mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-26 11:41:35 +01:00
more getcpu
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
/* man getcpu says this exists since glibc 2.29, but I can't find it in Ubuntu 20.04 glibc 2.31 not even with locate
|
||||
* (there is a hit under /usr/src/linux-headers-5.4.0-29/include/linux/getcpu.h but it only defines `struct getcpu_cache`
|
||||
* and nothing else:
|
||||
* https://stackoverflow.com/questions/23224607/how-do-i-include-linux-header-files-like-linux-getcpu-h
|
||||
* https://stackoverflow.com/questions/23224607/how-do-i-include-linux-header-files-like-linux-getcpu-h/61774312#61774312
|
||||
* Furthermore, there is already a prototype in sched.h, so we can't define our own either. */
|
||||
#if 0
|
||||
#include <linux/getcpu.h>
|
||||
@@ -23,7 +23,7 @@
|
||||
void* main_thread(void *arg) {
|
||||
(void)arg;
|
||||
unsigned cpu, numa;
|
||||
getcpu(&cpu, &numa);
|
||||
assert(!getcpu(&cpu, &numa));
|
||||
printf("%u %u\n", cpu, numa);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user