12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- #include <errno.h>
- #include <fcntl.h>
- #include <string.h>
- #include <sys/utsname.h>
- #include <not-cancel.h>
- static inline int
- is_smp_system (void)
- {
- union
- {
- struct utsname uts;
- char buf[512];
- } u;
- char *cp;
-
- if (uname (&u.uts) == 0)
- cp = u.uts.version;
- else
- {
-
- 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)
-
- u.buf[0] = '\0';
- close_not_cancel_no_status (fd);
- cp = u.buf;
- }
- return strstr (cp, "SMP") != NULL;
- }
|