9 void *__vdsosym(const char *, const char *);
11 static void *volatile vdso_func
;
13 typedef long (*getcpu_f
)(unsigned *, unsigned *, void *);
15 static long getcpu_init(unsigned *cpu
, unsigned *node
, void *unused
)
17 void *p
= __vdsosym(VDSO_GETCPU_VER
, VDSO_GETCPU_SYM
);
18 getcpu_f f
= (getcpu_f
)p
;
19 a_cas_p(&vdso_func
, (void *)getcpu_init
, p
);
20 return f
? f(cpu
, node
, unused
) : -ENOSYS
;
23 static void *volatile vdso_func
= (void *)getcpu_init
;
27 int sched_getcpu(void)
32 #ifdef VDSO_GETCPU_SYM
33 getcpu_f f
= (getcpu_f
)vdso_func
;
37 if (r
!= -ENOSYS
) return __syscall_ret(r
);
41 r
= __syscall(SYS_getcpu
, &cpu
, 0, 0);
43 return __syscall_ret(r
);