mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
perf tools: Introduce weak alternative to sched_getcpu()
Which is just a wrapper for sys_getcpu and is not present in at least musl libc. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Wang Nan <wangnan0@huawei.com> Link: http://lkml.kernel.org/n/tip-kblef7svmhr0g93kkx78envg@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
4998a12246
commit
c7007e9836
4 changed files with 20 additions and 4 deletions
|
@ -4,18 +4,24 @@
|
|||
#include "cloexec.h"
|
||||
#include "asm/bug.h"
|
||||
#include "debug.h"
|
||||
#include <unistd.h>
|
||||
#include <asm/unistd.h>
|
||||
#include <sys/syscall.h>
|
||||
|
||||
static unsigned long flag = PERF_FLAG_FD_CLOEXEC;
|
||||
|
||||
#ifdef __GLIBC_PREREQ
|
||||
#if !__GLIBC_PREREQ(2, 6)
|
||||
int __weak sched_getcpu(void)
|
||||
{
|
||||
#ifdef __NR_getcpu
|
||||
unsigned cpu;
|
||||
int err = syscall(__NR_getcpu, &cpu, NULL, NULL);
|
||||
if (!err)
|
||||
return cpu;
|
||||
#else
|
||||
errno = ENOSYS;
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static int perf_flag_probe(void)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue