Debian Codegraph @

src/include/rt-get_cpu.h

raw symbols SCIP
1 // SPDX-License-Identifier: GPL-2.0-or-latercxx . . $ `<file>/src/include/rt-get_cpu.h`/
2 #ifndef __RT_GET_CPU_H
3 #define __RT_GET_CPU_Hcxx . . $ `src/include/rt-get_cpu.h:3:9`!
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <errno.h>
7 #include <unistd.h>
8 #include <sys/syscall.h> /* For SYS_xxx definitions */
9 #include <sched.h>
10 #include <dlfcn.h>
11 #ifdef __NR_getcpucxx . . $ `<external>/1941951872834623984/unistd_64.h:313:9`!
12 static inline int get_cpu_setupcxx . . $ get_cpu_setup(b126dc7c1de90089).(void) { return 0; }
13 static inline int get_cpucxx . . $ get_cpu(b126dc7c1de90089).(void)
14 {
15 int c,s;
16 /* Show the source of get_cpu */
17 #ifdef DEBUG
18 fprintf(stderr, "__NR_getcpu\n");
19 #endif
20 s = syscallcxx . . $ syscall(523f12be2d96faea).(__NR_getcpucxx . . $ `<external>/1941951872834623984/unistd_64.h:313:9`!, &c, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
21 return (s == -1) ? s : c;
22 }
23 #elif defined(__GLIBC__) && defined(__GLIBC_MINOR__) \
24 && __GLIBC__>=2 && __GLIBC_MINOR__>=6
25 #include <utmpx.h>
26 static inline int get_cpu_setup(void) { return 0; }
27 static inline int get_cpu(void) { return sched_getcpu(); }
28 #else
29 extern int get_cpu_setup(void);
30 extern int (*get_cpu)(void);
31 extern int (*get_cpu_vdsop)(unsigned int *, unsigned int *, void *);
32
33 static inline int getcpu_vdso(void)
34 {
35 unsigned int c,s;
36 /* Show the source of get_cpu */
37 #ifdef DEBUG
38 fprintf(stderr, "getcpu_vdso\n");
39 #endif
40 s = get_cpu_vdsop(&c, NULL, NULL);
41 return (s == -1) ? s : c;
42 }
43
44 #endif
45
46 #endif /* __RT_GET_CPU_H */
47