From: Michael Jeanson Date: Tue, 23 Mar 2021 21:23:53 +0000 (-0400) Subject: Namespace ust-fork symbols X-Git-Tag: v2.13.0-rc1~194 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=d0c8f180cac01b888a81ce8abb47ce9e57925a53;p=lttng-ust.git Namespace ust-fork symbols Namespace the public symbols used by liblttng-ust-fork and move them a more appropriatly named header. The major SONAME bump to '1' gives us the opportunity to properly namespace some older parts of the API. Change-Id: Ic44998cbf77c3ae8cd7e73c9ad789d743cefdd05 Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers --- diff --git a/include/Makefile.am b/include/Makefile.am index 2b7547a4..4d4761d9 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -20,7 +20,7 @@ nobase_include_HEADERS = \ lttng/ringbuffer-abi.h \ lttng/ust-tracer.h \ lttng/ust-compiler.h \ - lttng/ust.h \ + lttng/ust-fork.h \ lttng/ust-endian.h \ lttng/ringbuffer-context.h \ lttng/ust-utils.h \ diff --git a/include/lttng/ust-fork.h b/include/lttng/ust-fork.h new file mode 100644 index 00000000..7210f17b --- /dev/null +++ b/include/lttng/ust-fork.h @@ -0,0 +1,34 @@ +/* + * SPDX-License-Identifier: MIT + * + * Copyright (C) 2011-2012 Mathieu Desnoyers + */ + +#ifndef _LTTNG_UST_FORK_H +#define _LTTNG_UST_FORK_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void lttng_ust_before_fork(sigset_t *save_sigset); +void lttng_ust_after_fork_parent(sigset_t *restore_sigset); +void lttng_ust_after_fork_child(sigset_t *restore_sigset); +void lttng_ust_after_setns(void); +void lttng_ust_after_unshare(void); +void lttng_ust_after_setuid(void); +void lttng_ust_after_setgid(void); +void lttng_ust_after_seteuid(void); +void lttng_ust_after_setegid(void); +void lttng_ust_after_setreuid(void); +void lttng_ust_after_setregid(void); +void lttng_ust_after_setresuid(void); +void lttng_ust_after_setresgid(void); + +#ifdef __cplusplus +} +#endif + +#endif /* _LTTNG_UST_FORK_H */ diff --git a/include/lttng/ust.h b/include/lttng/ust.h deleted file mode 100644 index b3ae582b..00000000 --- a/include/lttng/ust.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * SPDX-License-Identifier: MIT - * - * Copyright (C) 2011-2012 Mathieu Desnoyers - */ - -#ifndef _LTTNG_UST_H -#define _LTTNG_UST_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -extern void ust_before_fork(sigset_t *save_sigset); -extern void ust_after_fork_parent(sigset_t *restore_sigset); -extern void ust_after_fork_child(sigset_t *restore_sigset); -extern void ust_after_setns(void); -extern void ust_after_unshare(void); -extern void ust_after_setuid(void); -extern void ust_after_setgid(void); -extern void ust_after_seteuid(void); -extern void ust_after_setegid(void); -extern void ust_after_setreuid(void); -extern void ust_after_setregid(void); -extern void ust_after_setresuid(void); -extern void ust_after_setresgid(void); - -#ifdef __cplusplus -} -#endif - -#endif /* _LTTNG_UST_H */ diff --git a/liblttng-ust-fork/ustfork.c b/liblttng-ust-fork/ustfork.c index 8fb35280..b10f24d2 100644 --- a/liblttng-ust-fork/ustfork.c +++ b/liblttng-ust-fork/ustfork.c @@ -13,7 +13,7 @@ #include #include -#include +#include pid_t fork(void) { @@ -31,15 +31,15 @@ pid_t fork(void) } } - ust_before_fork(&sigset); + lttng_ust_before_fork(&sigset); /* Do the real fork */ retval = plibc_func(); saved_errno = errno; if (retval == 0) { /* child */ - ust_after_fork_child(&sigset); + lttng_ust_after_fork_child(&sigset); } else { - ust_after_fork_parent(&sigset); + lttng_ust_after_fork_parent(&sigset); } errno = saved_errno; return retval; @@ -61,16 +61,16 @@ int daemon(int nochdir, int noclose) } } - ust_before_fork(&sigset); + lttng_ust_before_fork(&sigset); /* Do the real daemon call */ retval = plibc_func(nochdir, noclose); saved_errno = errno; if (retval == 0) { /* child, parent called _exit() directly */ - ust_after_fork_child(&sigset); + lttng_ust_after_fork_child(&sigset); } else { /* on error in the parent */ - ust_after_fork_parent(&sigset); + lttng_ust_after_fork_parent(&sigset); } errno = saved_errno; return retval; @@ -95,7 +95,7 @@ int setuid(uid_t uid) retval = plibc_func(uid); saved_errno = errno; - ust_after_setuid(); + lttng_ust_after_setuid(); errno = saved_errno; return retval; @@ -120,7 +120,7 @@ int setgid(gid_t gid) retval = plibc_func(gid); saved_errno = errno; - ust_after_setgid(); + lttng_ust_after_setgid(); errno = saved_errno; return retval; @@ -145,7 +145,7 @@ int seteuid(uid_t euid) retval = plibc_func(euid); saved_errno = errno; - ust_after_seteuid(); + lttng_ust_after_seteuid(); errno = saved_errno; return retval; @@ -170,7 +170,7 @@ int setegid(gid_t egid) retval = plibc_func(egid); saved_errno = errno; - ust_after_setegid(); + lttng_ust_after_setegid(); errno = saved_errno; return retval; @@ -195,7 +195,7 @@ int setreuid(uid_t ruid, uid_t euid) retval = plibc_func(ruid, euid); saved_errno = errno; - ust_after_setreuid(); + lttng_ust_after_setreuid(); errno = saved_errno; return retval; @@ -220,7 +220,7 @@ int setregid(gid_t rgid, gid_t egid) retval = plibc_func(rgid, egid); saved_errno = errno; - ust_after_setregid(); + lttng_ust_after_setregid(); errno = saved_errno; return retval; @@ -241,7 +241,7 @@ static int clone_fn(void *arg) struct ustfork_clone_info *info = (struct ustfork_clone_info *) arg; /* clone is now done and we are in child */ - ust_after_fork_child(&info->sigset); + lttng_ust_after_fork_child(&info->sigset); return info->fn(info->arg); } @@ -286,12 +286,12 @@ int clone(int (*fn)(void *), void *child_stack, int flags, void *arg, ...) /* Creating a real process, we need to intervene. */ struct ustfork_clone_info info = { .fn = fn, .arg = arg }; - ust_before_fork(&info.sigset); + lttng_ust_before_fork(&info.sigset); retval = plibc_func(clone_fn, child_stack, flags, &info, ptid, tls, ctid); saved_errno = errno; /* The child doesn't get here. */ - ust_after_fork_parent(&info.sigset); + lttng_ust_after_fork_parent(&info.sigset); } errno = saved_errno; return retval; @@ -316,7 +316,7 @@ int setns(int fd, int nstype) retval = plibc_func(fd, nstype); saved_errno = errno; - ust_after_setns(); + lttng_ust_after_setns(); errno = saved_errno; return retval; @@ -341,7 +341,7 @@ int unshare(int flags) retval = plibc_func(flags); saved_errno = errno; - ust_after_unshare(); + lttng_ust_after_unshare(); errno = saved_errno; return retval; @@ -366,7 +366,7 @@ int setresuid(uid_t ruid, uid_t euid, uid_t suid) retval = plibc_func(ruid, euid, suid); saved_errno = errno; - ust_after_setresuid(); + lttng_ust_after_setresuid(); errno = saved_errno; return retval; @@ -391,7 +391,7 @@ int setresgid(gid_t rgid, gid_t egid, gid_t sgid) retval = plibc_func(rgid, egid, sgid); saved_errno = errno; - ust_after_setresgid(); + lttng_ust_after_setresgid(); errno = saved_errno; return retval; @@ -415,15 +415,15 @@ pid_t rfork(int flags) } } - ust_before_fork(&sigset); + lttng_ust_before_fork(&sigset); /* Do the real rfork */ retval = plibc_func(); saved_errno = errno; if (retval == 0) { /* child */ - ust_after_fork_child(&sigset); + lttng_ust_after_fork_child(&sigset); } else { - ust_after_fork_parent(&sigset); + lttng_ust_after_fork_parent(&sigset); } errno = saved_errno; return retval; diff --git a/liblttng-ust/lttng-ust-comm.c b/liblttng-ust/lttng-ust-comm.c index 5800d9d6..3ace61fc 100644 --- a/liblttng-ust/lttng-ust-comm.c +++ b/liblttng-ust/lttng-ust-comm.c @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include #include @@ -2371,7 +2371,7 @@ void ust_context_vgids_reset(void) * in the middle of an tracepoint or ust tracing state modification. * Holding this mutex protects these structures across fork and clone. */ -void ust_before_fork(sigset_t *save_sigset) +void lttng_ust_before_fork(sigset_t *save_sigset) { /* * Disable signals. This is to avoid that the child intervenes @@ -2420,7 +2420,7 @@ static void ust_after_fork_common(sigset_t *restore_sigset) } } -void ust_after_fork_parent(sigset_t *restore_sigset) +void lttng_ust_after_fork_parent(sigset_t *restore_sigset) { if (URCU_TLS(lttng_ust_nest_count)) return; @@ -2439,7 +2439,7 @@ void ust_after_fork_parent(sigset_t *restore_sigset) * This is meant for forks() that have tracing in the child between the * fork and following exec call (if there is any). */ -void ust_after_fork_child(sigset_t *restore_sigset) +void lttng_ust_after_fork_child(sigset_t *restore_sigset) { if (URCU_TLS(lttng_ust_nest_count)) return; @@ -2458,56 +2458,56 @@ void ust_after_fork_child(sigset_t *restore_sigset) lttng_ust_init(); } -void ust_after_setns(void) +void lttng_ust_after_setns(void) { ust_context_ns_reset(); ust_context_vuids_reset(); ust_context_vgids_reset(); } -void ust_after_unshare(void) +void lttng_ust_after_unshare(void) { ust_context_ns_reset(); ust_context_vuids_reset(); ust_context_vgids_reset(); } -void ust_after_setuid(void) +void lttng_ust_after_setuid(void) { ust_context_vuids_reset(); } -void ust_after_seteuid(void) +void lttng_ust_after_seteuid(void) { ust_context_vuids_reset(); } -void ust_after_setreuid(void) +void lttng_ust_after_setreuid(void) { ust_context_vuids_reset(); } -void ust_after_setresuid(void) +void lttng_ust_after_setresuid(void) { ust_context_vuids_reset(); } -void ust_after_setgid(void) +void lttng_ust_after_setgid(void) { ust_context_vgids_reset(); } -void ust_after_setegid(void) +void lttng_ust_after_setegid(void) { ust_context_vgids_reset(); } -void ust_after_setregid(void) +void lttng_ust_after_setregid(void) { ust_context_vgids_reset(); } -void ust_after_setresgid(void) +void lttng_ust_after_setresgid(void) { ust_context_vgids_reset(); }