5 * Copyright (C) 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
8 * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
10 * Permission is hereby granted to use or copy this program
11 * for any purpose, provided the above notices are retained on all copies.
12 * Permission to modify the code and to distribute modified code is granted,
13 * provided the above notices are retained, and a notice that the code was
14 * modified is included with the above copyright notice.
23 #include <sys/syscall.h>
24 #define __getcpu(cpu, node, cache) syscall(__NR_getcpu, cpu, node, cache)
26 int sched_getcpu(void)
30 s
= __getcpu(&c
, NULL
, NULL
);
31 return (s
== -1) ? s
: c
;
33 #endif /* __UCLIBC__ */
36 #error "Please add support for your OS into liblttng-ust/compat.h."
40 * lttng_ust_getprocname.
44 #include <sys/prctl.h>
46 #define LTTNG_UST_PROCNAME_LEN 17
49 void lttng_ust_getprocname(char *name
)
51 (void) prctl(PR_GET_NAME
, (unsigned long) name
, 0, 0, 0);
54 #elif defined(__FreeBSD__)
59 * Limit imposed by Linux UST-sessiond ABI.
61 #define LTTNG_UST_PROCNAME_LEN 17
64 * Acts like linux prctl, the string is not necessarily 0-terminated if
68 void lttng_ust_getprocname(char *name
)
72 bsd_name
= getprogname();
75 memcpy(name
, bsd_name
, LTTNG_UST_PROCNAME_LEN
- 1);
80 #endif /* _UST_COMPAT_H */
This page took 0.03405 seconds and 6 git commands to generate.