Back to index

glibc  2.9
smp.h File Reference
#include <errno.h>
#include <fcntl.h>
#include <string.h>
#include <sys/utsname.h>
#include <not-cancel.h>

Go to the source code of this file.


static int is_smp_system (void)

Function Documentation

static int is_smp_system ( void  ) [inline, static]

Definition at line 30 of file smp.h.

    struct utsname uts;
    char buf[512];
  } u;
  char *cp;

  /* Try reading the number using `sysctl' first.  */
  if (uname (&u.uts) == 0)
    cp = u.uts.version;
      /* This was not successful.  Now try reading the /proc filesystem.  */
      int fd = open_not_cancel_2 ("/proc/sys/kernel/version", O_RDONLY);
      if (__builtin_expect (fd, 0) == -1
         || read_not_cancel (fd, u.buf, sizeof (u.buf)) <= 0)
       /* This also didn't work.  We give up and say it's a UP machine.  */
       u.buf[0] = '\0';

      close_not_cancel_no_status (fd);
      cp = u.buf;

  return strstr (cp, "SMP") != NULL;

Here is the call graph for this function: