New sessiond comm error for kernel version
[lttng-tools.git] / src / bin / lttng-sessiond / main.c
index 82deb9b0e4cc2acff6942ffbfa38aa5d9374ddb8..77b10787598616d418ed6d8258fafcff24040c9e 100644 (file)
 #include <unistd.h>
 #include <config.h>
 
-#include <bin/lttng-consumerd/lttng-consumerd.h>
-#include <common/lttngerr.h>
+#include <common/common.h>
+#include <common/compat/poll.h>
+#include <common/defaults.h>
 #include <common/kernel-consumer/kernel-consumer.h>
 #include <common/ust-consumer/ust-consumer.h>
-#include <common/runas.h>
-#include <common/compat/poll.h>
 
 #include "lttng-sessiond.h"
 #include "channel.h"
@@ -98,18 +97,18 @@ static char *rundir;
 /* Consumer daemon specific control data */
 static struct consumer_data kconsumer_data = {
        .type = LTTNG_CONSUMER_KERNEL,
-       .err_unix_sock_path = KCONSUMERD_ERR_SOCK_PATH,
-       .cmd_unix_sock_path = KCONSUMERD_CMD_SOCK_PATH,
+       .err_unix_sock_path = DEFAULT_KCONSUMERD_ERR_SOCK_PATH,
+       .cmd_unix_sock_path = DEFAULT_KCONSUMERD_CMD_SOCK_PATH,
 };
 static struct consumer_data ustconsumer64_data = {
        .type = LTTNG_CONSUMER64_UST,
-       .err_unix_sock_path = USTCONSUMERD64_ERR_SOCK_PATH,
-       .cmd_unix_sock_path = USTCONSUMERD64_CMD_SOCK_PATH,
+       .err_unix_sock_path = DEFAULT_USTCONSUMERD64_ERR_SOCK_PATH,
+       .cmd_unix_sock_path = DEFAULT_USTCONSUMERD64_CMD_SOCK_PATH,
 };
 static struct consumer_data ustconsumer32_data = {
        .type = LTTNG_CONSUMER32_UST,
-       .err_unix_sock_path = USTCONSUMERD32_ERR_SOCK_PATH,
-       .cmd_unix_sock_path = USTCONSUMERD32_CMD_SOCK_PATH,
+       .err_unix_sock_path = DEFAULT_USTCONSUMERD32_ERR_SOCK_PATH,
+       .cmd_unix_sock_path = DEFAULT_USTCONSUMERD32_CMD_SOCK_PATH,
 };
 
 static int dispatch_thread_exit;
@@ -4112,13 +4111,13 @@ static int set_consumer_sockets(struct consumer_data *consumer_data,
 
     switch (consumer_data->type) {
        case LTTNG_CONSUMER_KERNEL:
-               snprintf(path, PATH_MAX, KCONSUMERD_PATH, rundir);
+               snprintf(path, PATH_MAX, DEFAULT_KCONSUMERD_PATH, rundir);
                break;
        case LTTNG_CONSUMER64_UST:
-               snprintf(path, PATH_MAX, USTCONSUMERD64_PATH, rundir);
+               snprintf(path, PATH_MAX, DEFAULT_USTCONSUMERD64_PATH, rundir);
                break;
        case LTTNG_CONSUMER32_UST:
-               snprintf(path, PATH_MAX, USTCONSUMERD32_PATH, rundir);
+               snprintf(path, PATH_MAX, DEFAULT_USTCONSUMERD32_PATH, rundir);
                break;
        default:
                ERR("Consumer type unknown");
@@ -4169,14 +4168,14 @@ static void sighandler(int sig)
 {
        switch (sig) {
        case SIGPIPE:
-               DBG("SIGPIPE catched");
+               DBG("SIGPIPE caugth");
                return;
        case SIGINT:
-               DBG("SIGINT catched");
+               DBG("SIGINT caugth");
                stop_threads();
                break;
        case SIGTERM:
-               DBG("SIGTERM catched");
+               DBG("SIGTERM caugth");
                stop_threads();
                break;
        default:
@@ -4278,7 +4277,7 @@ int main(int argc, char **argv)
        is_root = !getuid();
 
        if (is_root) {
-               rundir = strdup(LTTNG_RUNDIR);
+               rundir = strdup(DEFAULT_LTTNG_RUNDIR);
 
                /* Create global run dir with root access */
                ret = create_lttng_rundir(rundir);
@@ -4304,9 +4303,9 @@ int main(int argc, char **argv)
 
                /* Setup kernel consumerd path */
                snprintf(kconsumer_data.err_unix_sock_path, PATH_MAX,
-                               KCONSUMERD_ERR_SOCK_PATH, rundir);
+                               DEFAULT_KCONSUMERD_ERR_SOCK_PATH, rundir);
                snprintf(kconsumer_data.cmd_unix_sock_path, PATH_MAX,
-                               KCONSUMERD_CMD_SOCK_PATH, rundir);
+                               DEFAULT_KCONSUMERD_CMD_SOCK_PATH, rundir);
 
                DBG2("Kernel consumer err path: %s",
                                kconsumer_data.err_unix_sock_path);
@@ -4325,7 +4324,7 @@ int main(int argc, char **argv)
                 * Create rundir from home path. This will create something like
                 * $HOME/.lttng
                 */
-               ret = asprintf(&rundir, LTTNG_HOME_RUNDIR, home_path);
+               ret = asprintf(&rundir, DEFAULT_LTTNG_HOME_RUNDIR, home_path);
                if (ret < 0) {
                        ret = -ENOMEM;
                        goto error;
@@ -4360,9 +4359,9 @@ int main(int argc, char **argv)
 
        /* 32 bits consumerd path setup */
        snprintf(ustconsumer32_data.err_unix_sock_path, PATH_MAX,
-                       USTCONSUMERD32_ERR_SOCK_PATH, rundir);
+                       DEFAULT_USTCONSUMERD32_ERR_SOCK_PATH, rundir);
        snprintf(ustconsumer32_data.cmd_unix_sock_path, PATH_MAX,
-                       USTCONSUMERD32_CMD_SOCK_PATH, rundir);
+                       DEFAULT_USTCONSUMERD32_CMD_SOCK_PATH, rundir);
 
        DBG2("UST consumer 32 bits err path: %s",
                        ustconsumer32_data.err_unix_sock_path);
@@ -4371,9 +4370,9 @@ int main(int argc, char **argv)
 
        /* 64 bits consumerd path setup */
        snprintf(ustconsumer64_data.err_unix_sock_path, PATH_MAX,
-                       USTCONSUMERD64_ERR_SOCK_PATH, rundir);
+                       DEFAULT_USTCONSUMERD64_ERR_SOCK_PATH, rundir);
        snprintf(ustconsumer64_data.cmd_unix_sock_path, PATH_MAX,
-                       USTCONSUMERD64_CMD_SOCK_PATH, rundir);
+                       DEFAULT_USTCONSUMERD64_CMD_SOCK_PATH, rundir);
 
        DBG2("UST consumer 64 bits err path: %s",
                        ustconsumer64_data.err_unix_sock_path);
This page took 0.026457 seconds and 4 git commands to generate.