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 \
--- /dev/null
+/*
+ * SPDX-License-Identifier: MIT
+ *
+ * Copyright (C) 2011-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ */
+
+#ifndef _LTTNG_UST_FORK_H
+#define _LTTNG_UST_FORK_H
+
+#include <signal.h>
+
+#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 */
+++ /dev/null
-/*
- * SPDX-License-Identifier: MIT
- *
- * Copyright (C) 2011-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- */
-
-#ifndef _LTTNG_UST_H
-#define _LTTNG_UST_H
-
-#include <signal.h>
-
-#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 */
#include <stdarg.h>
#include <errno.h>
-#include <lttng/ust.h>
+#include <lttng/ust-fork.h>
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;
}
}
- 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;
retval = plibc_func(uid);
saved_errno = errno;
- ust_after_setuid();
+ lttng_ust_after_setuid();
errno = saved_errno;
return retval;
retval = plibc_func(gid);
saved_errno = errno;
- ust_after_setgid();
+ lttng_ust_after_setgid();
errno = saved_errno;
return retval;
retval = plibc_func(euid);
saved_errno = errno;
- ust_after_seteuid();
+ lttng_ust_after_seteuid();
errno = saved_errno;
return retval;
retval = plibc_func(egid);
saved_errno = errno;
- ust_after_setegid();
+ lttng_ust_after_setegid();
errno = saved_errno;
return retval;
retval = plibc_func(ruid, euid);
saved_errno = errno;
- ust_after_setreuid();
+ lttng_ust_after_setreuid();
errno = saved_errno;
return retval;
retval = plibc_func(rgid, egid);
saved_errno = errno;
- ust_after_setregid();
+ lttng_ust_after_setregid();
errno = saved_errno;
return retval;
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);
}
/* 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;
retval = plibc_func(fd, nstype);
saved_errno = errno;
- ust_after_setns();
+ lttng_ust_after_setns();
errno = saved_errno;
return retval;
retval = plibc_func(flags);
saved_errno = errno;
- ust_after_unshare();
+ lttng_ust_after_unshare();
errno = saved_errno;
return retval;
retval = plibc_func(ruid, euid, suid);
saved_errno = errno;
- ust_after_setresuid();
+ lttng_ust_after_setresuid();
errno = saved_errno;
return retval;
retval = plibc_func(rgid, egid, sgid);
saved_errno = errno;
- ust_after_setresgid();
+ lttng_ust_after_setresgid();
errno = saved_errno;
return retval;
}
}
- 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;
#include <lttng/ust-utils.h>
#include <lttng/ust-events.h>
#include <lttng/ust-abi.h>
-#include <lttng/ust.h>
+#include <lttng/ust-fork.h>
#include <lttng/ust-error.h>
#include <lttng/ust-ctl.h>
#include <lttng/ust-libc-wrapper.h>
* 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
}
}
-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;
* 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;
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();
}