123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- #include <sys/sysctl.h>
- static __inline__ int
- is_smp_system (void)
- {
- static const int sysctl_args[] = { CTL_KERN, KERN_VERSION };
- char buf[512];
- size_t reslen = sizeof (buf);
-
- if (__sysctl ((int *) sysctl_args,
- sizeof (sysctl_args) / sizeof (sysctl_args[0]),
- buf, &reslen, NULL, 0) < 0)
- {
-
- int fd = __open ("/proc/sys/kernel/version", O_RDONLY);
- if (__builtin_expect (fd, 0) == -1
- || (reslen = __read (fd, buf, sizeof (buf))) <= 0)
-
- buf[0] = '\0';
- __close (fd);
- }
- return strstr (buf, "SMP") != NULL;
- }
|