X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=liblttng-ust%2Fcompat.h;fp=liblttng-ust%2Fcompat.h;h=05b85a930615516da7175af84661ce144f7d5127;hb=e4486ebcdee39064492ed386b11008191fbbad17;hp=37480671052edcb872c58345958b7c543c2ddea4;hpb=c9e31458c3a4813f13c9d3339071d0f924f89347;p=lttng-ust.git diff --git a/liblttng-ust/compat.h b/liblttng-ust/compat.h index 37480671..05b85a93 100644 --- a/liblttng-ust/compat.h +++ b/liblttng-ust/compat.h @@ -14,6 +14,28 @@ * modified is included with the above copyright notice. */ +/* + * sched_getcpu. + */ +#ifdef __linux__ + +#ifdef __UCLIBC__ +#include +#define __getcpu(cpu, node, cache) syscall(__NR_getcpu, cpu, node, cache) +static inline +int sched_getcpu(void) +{ + int c, s; + + s = __getcpu(&c, NULL, NULL); + return (s == -1) ? s : c; +} +#endif /* __UCLIBC__ */ + +#else +#error "Please add support for your OS into liblttng-ust/compat.h." +#endif + /* * lttng_ust_getprocname. */