replace legacy preprocessor tests for linux with POSIX compliant ones

This commit is contained in:
Axel Kohlmeyer 2020-05-03 01:04:52 -04:00
parent d5b9948129
commit fa2a6d7c6b
No known key found for this signature in database
GPG Key ID: D9B44E93BF0C375A
5 changed files with 9 additions and 9 deletions

View File

@ -102,7 +102,7 @@ void VerletLRTIntel::setup(int flag)
}
#if defined(_LMP_INTEL_LRT_PTHREAD)
#if defined(__linux)
#if defined(__linux__)
if (comm->me == 0) {
cpu_set_t cpuset;
sched_getaffinity(0, sizeof(cpuset), &cpuset);

View File

@ -1237,7 +1237,7 @@ void *imdsock_accept(void * v) {
#elif defined(SOCKLEN_T)
SOCKLEN_T len;
#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;
#define _SOCKLEN_TYPE socklen_t
#else

View File

@ -306,12 +306,12 @@ double FixHalt::tlimit()
/* ----------------------------------------------------------------------
determine available disk space, if supported. Return -1 if not.
------------------------------------------------------------------------- */
#if defined(__linux) || defined(__APPLE__)
#if defined(__linux__) || defined(__APPLE__)
#include <sys/statvfs.h>
#endif
double FixHalt::diskfree()
{
#if defined(__linux) || defined(__APPLE__)
#if defined(__linux__) || defined(__APPLE__)
struct statvfs fs;
double disk_free = -1.0;
@ -319,7 +319,7 @@ double FixHalt::diskfree()
disk_free = 1.0e100;
int rv = statvfs(dlimit_path,&fs);
if (rv == 0) {
#if defined(__linux)
#if defined(__linux__)
disk_free = fs.f_bavail*fs.f_bsize/1048576.0;
#elif defined(__APPLE__)
disk_free = fs.f_bavail*fs.f_frsize/1048576.0;

View File

@ -60,7 +60,7 @@
#include <sys/utsname.h>
#endif
#if defined(__linux)
#if defined(__linux__)
#include <malloc.h>
#endif
@ -345,7 +345,7 @@ void Info::command(int narg, char **arg)
fprintf(out,"Maximum working set size: %.4g Mbyte\n",
(double)pmc.PeakWorkingSetSize/1048576.0);
#else
#if defined(__linux)
#if defined(__linux__)
struct mallinfo mi;
mi = mallinfo();
fprintf(out,"Current reserved memory pool size: %.4g Mbyte\n",

View File

@ -17,7 +17,7 @@
#include "lammps.h"
#include "error.h"
#if defined(__linux)
#if defined(__linux__)
#include <unistd.h> // for readlink
#endif
@ -95,7 +95,7 @@ static const char *guesspath(char *buf, int len, FILE *fp)
{
memset(buf,0,len);
#if defined(__linux)
#if defined(__linux__)
char procpath[32];
int fd = fileno(fp);
snprintf(procpath,32,"/proc/self/fd/%d",fd);