cancel global thread at exit
[lttng-ust.git] / libust / lttng-ust-comm.c
index ee187f8b9308f8d41dd50b9f76611a938506827b..13b3895e40127b7a57c9ff6b5081545dcb093d2b 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <sys/types.h>
 #include <sys/socket.h>
+#include <sys/prctl.h>
 #include <unistd.h>
 #include <errno.h>
 #include <pthread.h>
@@ -116,17 +117,28 @@ static
 int register_app_to_sessiond(int socket)
 {
        ssize_t ret;
+       int prctl_ret;
        struct {
                uint32_t major;
                uint32_t minor;
                pid_t pid;
+               pid_t ppid;
                uid_t uid;
+               gid_t gid;
+               char name[16];  /* process name */
        } reg_msg;
 
        reg_msg.major = LTTNG_UST_COMM_VERSION_MAJOR;
        reg_msg.minor = LTTNG_UST_COMM_VERSION_MINOR;
        reg_msg.pid = getpid();
+       reg_msg.ppid = getppid();
        reg_msg.uid = getuid();
+       reg_msg.gid = getgid();
+       prctl_ret = prctl(PR_GET_NAME, (unsigned long) reg_msg.name, 0, 0, 0);
+       if (prctl_ret) {
+               ERR("Error executing prctl");
+               return -errno;
+       }
 
        ret = lttcomm_send_unix_sock(socket, &reg_msg, sizeof(reg_msg));
        if (ret >= 0 && ret != sizeof(reg_msg))
@@ -165,9 +177,7 @@ int handle_register_done(struct sock_info *sock_info)
                return 0;
        sock_info->constructor_sem_posted = 1;
        ret = uatomic_add_return(&sem_count, -1);
-       fprintf(stderr, "DEC ret %d\n", ret);
        if (ret == 0) {
-               fprintf(stderr, "POST\n");
                ret = sem_post(&constructor_wait);
                assert(!ret);
        }
@@ -491,12 +501,10 @@ void __attribute__((destructor)) lttng_ust_exit(void)
        lttng_ust_comm_should_quit = 1;
        pthread_mutex_unlock(&lttng_ust_comm_mutex);
 
-#if 0
        ret = pthread_cancel(global_apps.ust_listener);
        if (ret) {
                ERR("Error cancelling global ust listener thread");
        }
-#endif //0
 
        cleanup_sock_info(&global_apps);
 
This page took 0.029598 seconds and 4 git commands to generate.