replace legacy preprocessor tests for linux with POSIX compliant ones
This commit is contained in:
@ -102,7 +102,7 @@ void VerletLRTIntel::setup(int flag)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(_LMP_INTEL_LRT_PTHREAD)
|
#if defined(_LMP_INTEL_LRT_PTHREAD)
|
||||||
#if defined(__linux)
|
#if defined(__linux__)
|
||||||
if (comm->me == 0) {
|
if (comm->me == 0) {
|
||||||
cpu_set_t cpuset;
|
cpu_set_t cpuset;
|
||||||
sched_getaffinity(0, sizeof(cpuset), &cpuset);
|
sched_getaffinity(0, sizeof(cpuset), &cpuset);
|
||||||
|
|||||||
@ -1237,7 +1237,7 @@ void *imdsock_accept(void * v) {
|
|||||||
#elif defined(SOCKLEN_T)
|
#elif defined(SOCKLEN_T)
|
||||||
SOCKLEN_T len;
|
SOCKLEN_T len;
|
||||||
#define _SOCKLEN_TYPE SOCKLEN_T
|
#define _SOCKLEN_TYPE SOCKLEN_T
|
||||||
#elif defined(_POSIX_SOURCE) || (defined(__APPLE__) && defined(__MACH__)) || defined(__linux) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__OpenBSD__) || defined(__NetBSD__)
|
#elif defined(_POSIX_SOURCE) || (defined(__APPLE__) && defined(__MACH__)) || defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__OpenBSD__) || defined(__NetBSD__)
|
||||||
socklen_t len;
|
socklen_t len;
|
||||||
#define _SOCKLEN_TYPE socklen_t
|
#define _SOCKLEN_TYPE socklen_t
|
||||||
#else
|
#else
|
||||||
|
|||||||
@ -306,12 +306,12 @@ double FixHalt::tlimit()
|
|||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
determine available disk space, if supported. Return -1 if not.
|
determine available disk space, if supported. Return -1 if not.
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
#if defined(__linux) || defined(__APPLE__)
|
#if defined(__linux__) || defined(__APPLE__)
|
||||||
#include <sys/statvfs.h>
|
#include <sys/statvfs.h>
|
||||||
#endif
|
#endif
|
||||||
double FixHalt::diskfree()
|
double FixHalt::diskfree()
|
||||||
{
|
{
|
||||||
#if defined(__linux) || defined(__APPLE__)
|
#if defined(__linux__) || defined(__APPLE__)
|
||||||
struct statvfs fs;
|
struct statvfs fs;
|
||||||
double disk_free = -1.0;
|
double disk_free = -1.0;
|
||||||
|
|
||||||
@ -319,7 +319,7 @@ double FixHalt::diskfree()
|
|||||||
disk_free = 1.0e100;
|
disk_free = 1.0e100;
|
||||||
int rv = statvfs(dlimit_path,&fs);
|
int rv = statvfs(dlimit_path,&fs);
|
||||||
if (rv == 0) {
|
if (rv == 0) {
|
||||||
#if defined(__linux)
|
#if defined(__linux__)
|
||||||
disk_free = fs.f_bavail*fs.f_bsize/1048576.0;
|
disk_free = fs.f_bavail*fs.f_bsize/1048576.0;
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
disk_free = fs.f_bavail*fs.f_frsize/1048576.0;
|
disk_free = fs.f_bavail*fs.f_frsize/1048576.0;
|
||||||
|
|||||||
@ -60,7 +60,7 @@
|
|||||||
#include <sys/utsname.h>
|
#include <sys/utsname.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__linux)
|
#if defined(__linux__)
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -345,7 +345,7 @@ void Info::command(int narg, char **arg)
|
|||||||
fprintf(out,"Maximum working set size: %.4g Mbyte\n",
|
fprintf(out,"Maximum working set size: %.4g Mbyte\n",
|
||||||
(double)pmc.PeakWorkingSetSize/1048576.0);
|
(double)pmc.PeakWorkingSetSize/1048576.0);
|
||||||
#else
|
#else
|
||||||
#if defined(__linux)
|
#if defined(__linux__)
|
||||||
struct mallinfo mi;
|
struct mallinfo mi;
|
||||||
mi = mallinfo();
|
mi = mallinfo();
|
||||||
fprintf(out,"Current reserved memory pool size: %.4g Mbyte\n",
|
fprintf(out,"Current reserved memory pool size: %.4g Mbyte\n",
|
||||||
|
|||||||
@ -17,7 +17,7 @@
|
|||||||
#include "lammps.h"
|
#include "lammps.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
|
||||||
#if defined(__linux)
|
#if defined(__linux__)
|
||||||
#include <unistd.h> // for readlink
|
#include <unistd.h> // for readlink
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ static const char *guesspath(char *buf, int len, FILE *fp)
|
|||||||
{
|
{
|
||||||
memset(buf,0,len);
|
memset(buf,0,len);
|
||||||
|
|
||||||
#if defined(__linux)
|
#if defined(__linux__)
|
||||||
char procpath[32];
|
char procpath[32];
|
||||||
int fd = fileno(fp);
|
int fd = fileno(fp);
|
||||||
snprintf(procpath,32,"/proc/self/fd/%d",fd);
|
snprintf(procpath,32,"/proc/self/fd/%d",fd);
|
||||||
|
|||||||
Reference in New Issue
Block a user