#include <lttng/ust-libc-wrapper.h>
#include <lttng/ust-thread.h>
#include <lttng/ust-tracer.h>
+#include <lttng/ust-common.h>
#include <urcu/tls-compat.h>
#include "common/compat/futex.h"
#include "common/ustcomm.h"
static char *get_map_shm(struct sock_info *sock_info);
-ssize_t lttng_ust_read(int fd, void *buf, size_t len)
-{
- ssize_t ret;
- size_t copied = 0, to_copy = len;
-
- do {
- ret = read(fd, buf + copied, to_copy);
- if (ret > 0) {
- copied += ret;
- to_copy -= ret;
- }
- } while ((ret > 0 && to_copy > 0)
- || (ret < 0 && errno == EINTR));
- if (ret > 0) {
- ret = copied;
- }
- return ret;
-}
/*
* Returns the HOME directory path. Caller MUST NOT free(3) the returned
* pointer.
* Weak symbol to call when the ust malloc wrapper is not loaded.
*/
__attribute__((weak))
-void lttng_ust_libc_wrapper_malloc_init(void)
+void lttng_ust_libc_wrapper_malloc_ctor(void)
{
}
* sessiond by polling the application common named pipe.
*/
static
-void lttng_ust_init(void)
+void lttng_ust_ctor(void)
__attribute__((constructor));
static
-void lttng_ust_init(void)
+void lttng_ust_ctor(void)
{
struct timespec constructor_timeout;
sigset_t sig_all_blocked, orig_parent_mask;
lttng_ust_logging_init();
lttng_ust_getenv_init();
+ /* Call the liblttng-ust-common constructor. */
+ lttng_ust_common_ctor();
+
lttng_ust_tp_init();
- lttng_ust_init_fd_tracker();
lttng_ust_clock_init();
lttng_ust_getcpu_plugin_init();
lttng_ust_statedump_init();
/*
* Invoke ust malloc wrapper init before starting other threads.
*/
- lttng_ust_libc_wrapper_malloc_init();
+ lttng_ust_libc_wrapper_malloc_ctor();
timeout_mode = get_constructor_timeout(&constructor_timeout);
* After fork, in the child, we need to cleanup all the leftover state,
* except the worker thread which already magically disappeared thanks
* to the weird Linux fork semantics. After tyding up, we call
- * lttng_ust_init() again to start over as a new PID.
+ * lttng_ust_ctor() again to start over as a new PID.
*
* This is meant for forks() that have tracing in the child between the
* fork and following exec call (if there is any).
lttng_ust_cleanup(0);
/* Release mutexes and reenable signals */
ust_after_fork_common(restore_sigset);
- lttng_ust_init();
+ lttng_ust_ctor();
}
void lttng_ust_after_setns(void)