9 static void *volatile vdso_func;
11 typedef long (*getcpu_f)(unsigned *, unsigned *, void *);
13 static long getcpu_init(unsigned *cpu, unsigned *node, void *unused)
15 void *p = __vdsosym(VDSO_GETCPU_VER, VDSO_GETCPU_SYM);
16 getcpu_f f = (getcpu_f)p;
17 a_cas_p(&vdso_func, (void *)getcpu_init, p);
18 return f ? f(cpu, node, unused) : -ENOSYS;
21 static void *volatile vdso_func = (void *)getcpu_init;
25 int sched_getcpu(void)
30 #ifdef VDSO_GETCPU_SYM
31 getcpu_f f = (getcpu_f)vdso_func;
35 if (r != -ENOSYS) return __syscall_ret(r);
39 r = __syscall(SYS_getcpu, &cpu, 0, 0);
41 return __syscall_ret(r);