Rename sessiond comm lib into ust comm
[lttng-ust.git] / libust / lttng-ust-comm.c
index 0d8fcdd07f923001a4da72ebfa96475c7604dcd0..c9cb777709dab0d84ffffebe26352fcfdfbde563 100644 (file)
@@ -23,7 +23,8 @@
 #include <sys/socket.h>
 #include <unistd.h>
 #include <errno.h>
-#include <lttng-sessiond-comm.h>
+#include <ust/lttng-ust-abi.h>
+#include <lttng-ust-comm.h>
 #include <ust/usterr-signal-safe.h>
 #include <pthread.h>
 
@@ -54,10 +55,14 @@ int register_app_to_sessiond(int socket)
 {
        ssize_t ret;
        struct {
+               uint32_t major;
+               uint32_t minor;
                pid_t pid;
                uid_t uid;
        } reg_msg;
 
+       reg_msg.major = LTTNG_UST_COMM_VERSION_MAJOR;
+       reg_msg.minor = LTTNG_UST_COMM_VERSION_MINOR;
        reg_msg.pid = getpid();
        reg_msg.uid = getuid();
 
@@ -69,19 +74,19 @@ int register_app_to_sessiond(int socket)
 
 
 static
-int handle_message(int sock, struct lttcomm_session_msg *lsm)
+int handle_message(int sock, struct lttcomm_ust_msg *lum)
 {
        ssize_t len;
        int ret;
 
-       switch (lsm->cmd_type) {
-       case LTTNG_CREATE_SESSION:
+       switch (lum->cmd_type) {
+       case UST_CREATE_SESSION:
        {
-               struct lttcomm_ust_msg lur;
+               struct lttcomm_ust_reply lur;
 
                DBG("Handling create session message");
                memset(&lur, 0, sizeof(lur));
-               lur.cmd_type = LTTNG_CREATE_SESSION;
+               lur.cmd_type = UST_CREATE_SESSION;
 
                /* ... */
                ret = 0;
@@ -90,7 +95,7 @@ int handle_message(int sock, struct lttcomm_session_msg *lsm)
                        lur.ret_code = LTTCOMM_OK;
                else
                        lur.ret_code = LTTCOMM_SESSION_FAIL;
-               lur.u.session.handle = 42;
+               lur.ret_val = 42;
                len = lttcomm_send_unix_sock(sock, &lur, sizeof(lur));
                switch (len) {
                case sizeof(lur):
@@ -109,7 +114,7 @@ int handle_message(int sock, struct lttcomm_session_msg *lsm)
                break;
        }
        default:
-               ERR("Unimplemented command %d", (int) lsm->cmd_type);
+               ERR("Unimplemented command %d", (int) lum->cmd_type);
                return -1;
        }
        return 0;
@@ -141,17 +146,17 @@ restart:
        }
        for (;;) {
                ssize_t len;
-               struct lttcomm_session_msg lsm;
+               struct lttcomm_ust_msg lum;
 
                /* Receive session handle */
-               len = lttcomm_recv_unix_sock(sock, &lsm, sizeof(lsm));
+               len = lttcomm_recv_unix_sock(sock, &lum, sizeof(lum));
                switch (len) {
                case 0: /* orderly shutdown */
                        DBG("ltt-sessiond has performed an orderly shutdown\n");
                        goto end;
-               case sizeof(lsm):
+               case sizeof(lum):
                        DBG("message received\n");
-                       ret = handle_message(sock, &lsm);
+                       ret = handle_message(sock, &lum);
                        if (ret) {
                                ERR("Error handling message\n");
                        }
@@ -220,4 +225,5 @@ void __attribute__((destructor)) lttng_ust_comm_exit(void)
        if (ret) {
                ERR("Error cancelling local ust listener thread");
        }
+       lttng_ust_abi_exit();
 }
This page took 0.027057 seconds and 4 git commands to generate.