X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fmain.c;h=4d700d1e54130fae8ae19369e8bdc8e3b7ca7771;hb=04135dbd279d3d0de6a6527b9b933e59de5cb495;hp=3a8a1b27cf5e403389ba0b962ac775ec1040e158;hpb=ef367a93d16bb6f1a32e50e3538a56d4f18fe715;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c index 3a8a1b27c..4d700d1e5 100644 --- a/src/bin/lttng-sessiond/main.c +++ b/src/bin/lttng-sessiond/main.c @@ -155,6 +155,7 @@ static const struct option long_options[] = { { "jul-tcp-port", 1, 0, 'J' }, { "config", 1, 0, 'f' }, { "load", 1, 0, 'l' }, + { "kmod-probes", 1, 0, 'P' }, { NULL, 0, 0, 0 } }; @@ -2821,6 +2822,38 @@ static int process_client_msg(struct command_ctx *cmd_ctx, int sock, break; } + /* + * Commands that need a valid session but should NOT create one if none + * exists. Instead of creating one and destroying it when the command is + * handled, process that right before so we save some round trip in useless + * code path. + */ + switch (cmd_ctx->lsm->cmd_type) { + case LTTNG_DISABLE_CHANNEL: + case LTTNG_DISABLE_EVENT: + case LTTNG_DISABLE_ALL_EVENT: + switch (cmd_ctx->lsm->domain.type) { + case LTTNG_DOMAIN_KERNEL: + if (!cmd_ctx->session->kernel_session) { + ret = LTTNG_ERR_NO_CHANNEL; + goto error; + } + break; + case LTTNG_DOMAIN_JUL: + case LTTNG_DOMAIN_UST: + if (!cmd_ctx->session->ust_session) { + ret = LTTNG_ERR_NO_CHANNEL; + goto error; + } + break; + default: + ret = LTTNG_ERR_UNKNOWN_DOMAIN; + goto error; + } + default: + break; + } + if (!need_domain) { goto skip_domain; } @@ -4132,6 +4165,7 @@ static void usage(void) fprintf(stderr, " --jul-tcp-port JUL application registration TCP port\n"); fprintf(stderr, " -f --config Load daemon configuration file\n"); fprintf(stderr, " -l --load PATH Load session configuration\n"); + fprintf(stderr, " --kmod-probes Specify kernel module probes to load\n"); } /* @@ -4204,7 +4238,10 @@ static int set_option(int opt, const char *arg, const char *optname) if (arg) { lttng_opt_verbose = config_parse_value(arg); } else { - lttng_opt_verbose += 1; + /* Only 3 level of verbosity (-vvv). */ + if (lttng_opt_verbose < 3) { + lttng_opt_verbose += 1; + } } break; case 'Z': @@ -4258,6 +4295,12 @@ static int set_option(int opt, const char *arg, const char *optname) ret = -ENOMEM; } break; + case 'P': /* probe modules list */ + kmod_probes_list = strdup(arg); + break; + case 'f': + /* This is handled in set_options() thus silent break. */ + break; default: /* Unknown option or other error. * Error is printed by getopt, just return */ @@ -5190,7 +5233,7 @@ int main(int argc, char **argv) ret = pthread_create(&apps_notify_thread, NULL, ust_thread_manage_notify, (void *) NULL); if (ret != 0) { - PERROR("pthread_create apps"); + PERROR("pthread_create notify"); goto exit_apps_notify; } @@ -5198,7 +5241,7 @@ int main(int argc, char **argv) ret = pthread_create(&jul_reg_thread, NULL, jul_thread_manage_registration, (void *) NULL); if (ret != 0) { - PERROR("pthread_create apps"); + PERROR("pthread_create JUL"); goto exit_jul_reg; }