X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=liblttng-ust%2Flttng-ust-comm.c;h=af7928c3eda10fb0ea13ab01d99f5e01539b436c;hb=1abcee5dc89230e8f9dca4b961e978fe6ac44954;hp=51eb75b55ab873795356fef5543839c5f44e755f;hpb=c0872615e30522e1245316d3892e64dc280345d5;p=lttng-ust.git diff --git a/liblttng-ust/lttng-ust-comm.c b/liblttng-ust/lttng-ust-comm.c index 51eb75b5..af7928c3 100644 --- a/liblttng-ust/lttng-ust-comm.c +++ b/liblttng-ust/lttng-ust-comm.c @@ -22,7 +22,6 @@ #define _LGPL_SOURCE #include #include -#include #include #include #include @@ -46,6 +45,7 @@ #include #include "tracepoint-internal.h" #include "ltt-tracer-core.h" +#include "compat.h" #include "../libringbuffer/tlsfixup.h" /* @@ -156,14 +156,16 @@ int setup_local_apps(void) * Disallow per-user tracing for setuid binaries. */ if (uid != geteuid()) { - local_apps.allowed = 0; + assert(local_apps.allowed == 0); return 0; - } else { - local_apps.allowed = 1; } home_dir = (const char *) getenv("HOME"); - if (!home_dir) + if (!home_dir) { + WARN("HOME environment variable not set. Disabling LTTng-UST per-user tracing."); + assert(local_apps.allowed == 0); return -ENOENT; + } + local_apps.allowed = 1; snprintf(local_apps.sock_path, PATH_MAX, DEFAULT_HOME_APPS_UNIX_SOCK, home_dir); snprintf(local_apps.wait_shm_path, PATH_MAX, @@ -175,7 +177,6 @@ static int register_app_to_sessiond(int socket) { ssize_t ret; - int prctl_ret; struct { uint32_t major; uint32_t minor; @@ -194,11 +195,7 @@ int register_app_to_sessiond(int socket) reg_msg.uid = getuid(); reg_msg.gid = getgid(); reg_msg.bits_per_long = CAA_BITS_PER_LONG; - prctl_ret = prctl(PR_GET_NAME, (unsigned long) reg_msg.name, 0, 0, 0); - if (prctl_ret) { - ERR("Error executing prctl"); - return -errno; - } + lttng_ust_getprocname(reg_msg.name); ret = ustcomm_send_unix_sock(socket, ®_msg, sizeof(reg_msg)); if (ret >= 0 && ret != sizeof(reg_msg)) @@ -549,13 +546,13 @@ int get_wait_shm(struct sock_info *sock_info, size_t mmap_size) */ if (!sock_info->global && errno != EACCES) { ERR("Error opening shm %s", sock_info->wait_shm_path); - exit(EXIT_FAILURE); + _exit(EXIT_FAILURE); } /* * The shm exists, but we cannot open it RW. Report * success. */ - exit(EXIT_SUCCESS); + _exit(EXIT_SUCCESS); } else { return -1; } @@ -891,7 +888,7 @@ void __attribute__((constructor)) lttng_ust_init(void) ret = setup_local_apps(); if (ret) { - ERR("Error setting up to local apps"); + DBG("local apps setup returned %d", ret); } /* A new thread created by pthread_create inherits the signal mask