Change API to support exporting loglevel in event listing
[lttng-ust.git] / liblttng-ust / lttng-ust-comm.c
index 2f9729420e17b3db79f2ab713c84c0be7c94b073..6830d86d100ac4ad4e49b5458f2518b463d609cc 100644 (file)
@@ -37,6 +37,7 @@
 #include <signal.h>
 #include <urcu/uatomic.h>
 #include <urcu/futex.h>
+#include <urcu/compiler.h>
 
 #include <lttng/ust-events.h>
 #include <lttng/ust-abi.h>
@@ -166,6 +167,7 @@ int register_app_to_sessiond(int socket)
                pid_t ppid;
                uid_t uid;
                gid_t gid;
+               uint32_t bits_per_long;
                char name[16];  /* process name */
        } reg_msg;
 
@@ -175,6 +177,7 @@ int register_app_to_sessiond(int socket)
        reg_msg.ppid = getppid();
        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");
@@ -304,9 +307,7 @@ end:
                lur.u.version = lum->u.version;
                break;
        case LTTNG_UST_TRACEPOINT_LIST_GET:
-               memcpy(lur.u.tracepoint_list_entry,
-                       lum->u.tracepoint_list_entry,
-                       LTTNG_UST_SYM_NAME_LEN);
+               memcpy(&lur.u.tracepoint, &lum->u.tracepoint, sizeof(lur.u.tracepoint));
                break;
        }
        ret = send_reply(sock, &lur);
@@ -680,6 +681,20 @@ restart:
                switch (len) {
                case 0: /* orderly shutdown */
                        DBG("%s ltt-sessiond has performed an orderly shutdown\n", sock_info->name);
+                       ust_lock();
+                       /*
+                        * Either sessiond has shutdown or refused us by closing the socket.
+                        * In either case, we don't want to delay construction execution,
+                        * and we need to wait before retry.
+                        */
+                       prev_connect_failed = 1;
+                       /*
+                        * If we cannot register to the sessiond daemon, don't
+                        * delay constructor execution.
+                        */
+                       ret = handle_register_done(sock_info);
+                       assert(!ret);
+                       ust_unlock();
                        goto end;
                case sizeof(lum):
                        DBG("message received\n");
@@ -689,6 +704,7 @@ restart:
                        }
                        continue;
                case -1:
+                       DBG("Receive failed from lttng-sessiond with errno %d", errno);
                        if (errno == ECONNRESET) {
                                ERR("%s remote end closed connection\n", sock_info->name);
                                goto end;
This page took 0.025072 seconds and 4 git commands to generate.