Unverified Commit fa2a6d7c authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

replace legacy preprocessor tests for linux with POSIX compliant ones

parent d5b99481
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);
+1 −1
Original line number Diff line number Diff line
@@ -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
+3 −3
Original line number Diff line number Diff line
@@ -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;
+2 −2
Original line number Diff line number Diff line
@@ -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",
+2 −2
Original line number Diff line number Diff line
@@ -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);