X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=ltt-sessiond%2Fmain.c;h=97db535d142b16f802e9e80c77a19ef094097d5a;hp=e65e8198b756add9dc21ce96922300dd2170147e;hb=c49dc785799508e445e3e386c87f8151eef3c34c;hpb=2ef84c95c5158ce40e77229fb5705524ff22be7b diff --git a/ltt-sessiond/main.c b/ltt-sessiond/main.c index e65e8198b..97db535d1 100644 --- a/ltt-sessiond/main.c +++ b/ltt-sessiond/main.c @@ -486,12 +486,14 @@ static pid_t spawn_kconsumerd(void) int ret; pid_t pid; + DBG("Spawning kconsumerd"); + pid = fork(); if (pid == 0) { /* * Exec kconsumerd. */ - execlp("kconsumerd", "kconsumerd", "--daemonize", NULL); + execlp("kconsumerd", "kconsumerd", "--quiet", NULL); if (errno != 0) { perror("kernel start consumer exec"); } @@ -518,21 +520,21 @@ static int start_kconsumerd(void) { int ret; - DBG("Spawning kconsumerd"); - pthread_mutex_lock(&kconsumerd_pid_mutex); - if (kconsumerd_pid == 0) { - ret = spawn_kconsumerd(); - if (ret < 0) { - ERR("Spawning kconsumerd failed"); - ret = LTTCOMM_KERN_CONSUMER_FAIL; - pthread_mutex_unlock(&kconsumerd_pid_mutex); - goto error; - } + if (kconsumerd_pid != 0) { + goto end; + } - /* Setting up the global kconsumerd_pid */ - kconsumerd_pid = ret; + ret = spawn_kconsumerd(); + if (ret < 0) { + ERR("Spawning kconsumerd failed"); + ret = LTTCOMM_KERN_CONSUMER_FAIL; + pthread_mutex_unlock(&kconsumerd_pid_mutex); + goto error; } + + /* Setting up the global kconsumerd_pid */ + kconsumerd_pid = ret; pthread_mutex_unlock(&kconsumerd_pid_mutex); DBG("Kconsumerd pid %d", ret); @@ -544,6 +546,8 @@ static int start_kconsumerd(void) goto error; } +end: + pthread_mutex_unlock(&kconsumerd_pid_mutex); return 0; error: @@ -1411,8 +1415,12 @@ static int create_lttng_rundir(void) ret = mkdir(LTTNG_RUNDIR, S_IRWXU | S_IRWXG ); if (ret < 0) { - ERR("Unable to create " LTTNG_RUNDIR); - goto error; + if (errno != EEXIST) { + ERR("Unable to create " LTTNG_RUNDIR); + goto error; + } else { + ret = 0; + } } error: