5 * Copyright (C) 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; only
10 * version 2.1 of the License.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
28 #include <sys/syscall.h>
29 #define __getcpu(cpu, node, cache) syscall(__NR_getcpu, cpu, node, cache)
31 int sched_getcpu(void)
35 s
= __getcpu(&c
, NULL
, NULL
);
36 return (s
== -1) ? s
: c
;
38 #endif /* __UCLIBC__ */
41 #error "Please add support for your OS into liblttng-ust/compat.h."
45 * lttng_ust_getprocname.
49 #include <sys/prctl.h>
51 #define LTTNG_UST_PROCNAME_LEN 17
54 void lttng_ust_getprocname(char *name
)
56 (void) prctl(PR_GET_NAME
, (unsigned long) name
, 0, 0, 0);
59 #elif defined(__FreeBSD__)
64 * Limit imposed by Linux UST-sessiond ABI.
66 #define LTTNG_UST_PROCNAME_LEN 17
69 * Acts like linux prctl, the string is not necessarily 0-terminated if
73 void lttng_ust_getprocname(char *name
)
77 bsd_name
= getprogname();
80 memcpy(name
, bsd_name
, LTTNG_UST_PROCNAME_LEN
- 1);
85 #endif /* _UST_COMPAT_H */
This page took 0.031794 seconds and 4 git commands to generate.