From d78d661021eb1c5761c631dbd525697769fe638b Mon Sep 17 00:00:00 2001 From: David Goulet Date: Mon, 23 Jan 2012 16:42:30 -0500 Subject: [PATCH] Disable lttng ust domain not implemented Keep them in lttng.h to retain values for future development. Also fix define alignment in lttng.h Note that at this commit, "Not implemented" error is still returned. This will be fix to "Unknown command" in next commit. Signed-off-by: David Goulet --- include/lttng/lttng.h | 33 ++++++++++++++--------- src/bin/lttng-sessiond/channel.c | 12 +++++++++ src/bin/lttng-sessiond/context.c | 2 ++ src/bin/lttng-sessiond/event.c | 8 ++++++ src/bin/lttng-sessiond/main.c | 18 ++++++++++--- src/bin/lttng/commands/add_context.c | 27 ++++++++++++------- src/bin/lttng/commands/calibrate.c | 25 ++++++++++------- src/bin/lttng/commands/disable_channels.c | 22 +++++++++------ src/bin/lttng/commands/disable_events.c | 28 +++++++++++-------- src/bin/lttng/commands/enable_channels.c | 25 ++++++++++------- src/bin/lttng/commands/enable_events.c | 27 ++++++++++++------- src/bin/lttng/commands/list.c | 22 +++++++++------ src/lib/lttng-ctl/lttng-ctl.c | 4 +++ 13 files changed, 169 insertions(+), 84 deletions(-) diff --git a/include/lttng/lttng.h b/include/lttng/lttng.h index f1c913b66..8bdfe121c 100644 --- a/include/lttng/lttng.h +++ b/include/lttng/lttng.h @@ -52,9 +52,16 @@ enum lttng_domain_type { LTTNG_DOMAIN_KERNEL = 1, LTTNG_DOMAIN_UST = 2, + + /* + * For now, the domains below are not implemented. However, we keep them + * here in order to retain their enum values for future development. Note + * that it is on the roadmap to implement them. + * LTTNG_DOMAIN_UST_EXEC_NAME = 3, LTTNG_DOMAIN_UST_PID = 4, LTTNG_DOMAIN_UST_PID_FOLLOW_CHILDREN = 5, + */ }; /* @@ -75,26 +82,26 @@ enum lttng_event_type { * LTTng consumer mode */ enum lttng_event_output { - LTTNG_EVENT_SPLICE = 0, - LTTNG_EVENT_MMAP = 1, + LTTNG_EVENT_SPLICE = 0, + LTTNG_EVENT_MMAP = 1, }; /* Event context possible type */ enum lttng_event_context_type { - LTTNG_EVENT_CONTEXT_PID = 0, - LTTNG_EVENT_CONTEXT_PERF_COUNTER = 1, - LTTNG_EVENT_CONTEXT_COMM = 2, - LTTNG_EVENT_CONTEXT_PRIO = 3, - LTTNG_EVENT_CONTEXT_NICE = 4, - LTTNG_EVENT_CONTEXT_VPID = 5, - LTTNG_EVENT_CONTEXT_TID = 6, - LTTNG_EVENT_CONTEXT_VTID = 7, - LTTNG_EVENT_CONTEXT_PPID = 8, - LTTNG_EVENT_CONTEXT_VPPID = 9, + LTTNG_EVENT_CONTEXT_PID = 0, + LTTNG_EVENT_CONTEXT_PERF_COUNTER = 1, + LTTNG_EVENT_CONTEXT_COMM = 2, + LTTNG_EVENT_CONTEXT_PRIO = 3, + LTTNG_EVENT_CONTEXT_NICE = 4, + LTTNG_EVENT_CONTEXT_VPID = 5, + LTTNG_EVENT_CONTEXT_TID = 6, + LTTNG_EVENT_CONTEXT_VTID = 7, + LTTNG_EVENT_CONTEXT_PPID = 8, + LTTNG_EVENT_CONTEXT_VPPID = 9, }; enum lttng_calibrate_type { - LTTNG_CALIBRATE_FUNCTION = 0, + LTTNG_CALIBRATE_FUNCTION = 0, }; struct lttng_domain { diff --git a/src/bin/lttng-sessiond/channel.c b/src/bin/lttng-sessiond/channel.c index b5202fe6a..23b3b1fee 100644 --- a/src/bin/lttng-sessiond/channel.c +++ b/src/bin/lttng-sessiond/channel.c @@ -59,7 +59,11 @@ struct lttng_channel *channel_new_default_attr(int dom) chan->attr.output = DEFAULT_KERNEL_CHANNEL_OUTPUT; break; case LTTNG_DOMAIN_UST: +#if 0 case LTTNG_DOMAIN_UST_PID: + case LTTNG_DOMAIN_UST_PID_FOLLOW_CHILDREN: + case LTTNG_DOMAIN_UST_EXEC_NAME: +#endif chan->attr.subbuf_size = DEFAULT_UST_CHANNEL_SUBBUF_SIZE; chan->attr.num_subbuf = DEFAULT_UST_CHANNEL_SUBBUF_NUM; chan->attr.output = DEFAULT_UST_CHANNEL_OUTPUT; @@ -184,9 +188,12 @@ int channel_ust_enable(struct ltt_ust_session *usess, int domain, /* Enable channel for global domain */ ret = ust_app_enable_channel_glb(usess, uchan); break; +#if 0 case LTTNG_DOMAIN_UST_PID: case LTTNG_DOMAIN_UST_PID_FOLLOW_CHILDREN: case LTTNG_DOMAIN_UST_EXEC_NAME: +#endif + default: ret = LTTCOMM_NOT_IMPLEMENTED; goto error; } @@ -243,9 +250,11 @@ int channel_ust_create(struct ltt_ust_session *usess, int domain, /* Enable channel for global domain */ ret = ust_app_create_channel_glb(usess, uchan); break; +#if 0 case LTTNG_DOMAIN_UST_PID: case LTTNG_DOMAIN_UST_PID_FOLLOW_CHILDREN: case LTTNG_DOMAIN_UST_EXEC_NAME: +#endif default: ret = LTTCOMM_NOT_IMPLEMENTED; goto error_free_chan; @@ -298,9 +307,12 @@ int channel_ust_disable(struct ltt_ust_session *usess, int domain, /* Disable channel for global domain */ ret = ust_app_disable_channel_glb(usess, uchan); break; +#if 0 case LTTNG_DOMAIN_UST_PID_FOLLOW_CHILDREN: case LTTNG_DOMAIN_UST_EXEC_NAME: case LTTNG_DOMAIN_UST_PID: +#endif + default: ret = LTTCOMM_NOT_IMPLEMENTED; goto error; } diff --git a/src/bin/lttng-sessiond/context.c b/src/bin/lttng-sessiond/context.c index 0144f7824..bbed1e767 100644 --- a/src/bin/lttng-sessiond/context.c +++ b/src/bin/lttng-sessiond/context.c @@ -292,9 +292,11 @@ int context_ust_add(struct ltt_ust_session *usess, int domain, case LTTNG_DOMAIN_UST: chan_ht = usess->domain_global.channels; break; +#if 0 case LTTNG_DOMAIN_UST_EXEC_NAME: case LTTNG_DOMAIN_UST_PID: case LTTNG_DOMAIN_UST_PID_FOLLOW_CHILDREN: +#endif default: ret = LTTCOMM_NOT_IMPLEMENTED; goto error; diff --git a/src/bin/lttng-sessiond/event.c b/src/bin/lttng-sessiond/event.c index 4a86c22cd..0a82372bd 100644 --- a/src/bin/lttng-sessiond/event.c +++ b/src/bin/lttng-sessiond/event.c @@ -334,9 +334,11 @@ int event_ust_enable_all_tracepoints(struct ltt_ust_session *usess, int domain, free(events); break; } +#if 0 case LTTNG_DOMAIN_UST_EXEC_NAME: case LTTNG_DOMAIN_UST_PID: case LTTNG_DOMAIN_UST_PID_FOLLOW_CHILDREN: +#endif default: ret = LTTCOMM_NOT_IMPLEMENTED; goto error; @@ -401,9 +403,11 @@ int event_ust_enable_tracepoint(struct ltt_ust_session *usess, int domain, } break; } +#if 0 case LTTNG_DOMAIN_UST_EXEC_NAME: case LTTNG_DOMAIN_UST_PID: case LTTNG_DOMAIN_UST_PID_FOLLOW_CHILDREN: +#endif default: ret = LTTCOMM_NOT_IMPLEMENTED; goto end; @@ -468,9 +472,11 @@ int event_ust_disable_tracepoint(struct ltt_ust_session *usess, int domain, goto error; } break; +#if 0 case LTTNG_DOMAIN_UST_EXEC_NAME: case LTTNG_DOMAIN_UST_PID: case LTTNG_DOMAIN_UST_PID_FOLLOW_CHILDREN: +#endif default: ret = LTTCOMM_NOT_IMPLEMENTED; goto error; @@ -539,9 +545,11 @@ int event_ust_disable_all_tracepoints(struct ltt_ust_session *usess, int domain, free(events); break; } +#if 0 case LTTNG_DOMAIN_UST_EXEC_NAME: case LTTNG_DOMAIN_UST_PID: case LTTNG_DOMAIN_UST_PID_FOLLOW_CHILDREN: +#endif default: ret = LTTCOMM_NOT_IMPLEMENTED; goto error; diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c index 7da0b7c68..1b837c1fc 100644 --- a/src/bin/lttng-sessiond/main.c +++ b/src/bin/lttng-sessiond/main.c @@ -2159,11 +2159,11 @@ static int cmd_disable_channel(struct ltt_session *session, } break; } +#if 0 case LTTNG_DOMAIN_UST_PID_FOLLOW_CHILDREN: case LTTNG_DOMAIN_UST_EXEC_NAME: case LTTNG_DOMAIN_UST_PID: - ret = LTTCOMM_NOT_IMPLEMENTED; - goto error; +#endif default: ret = LTTCOMM_UNKNOWN_DOMAIN; goto error; @@ -2222,11 +2222,11 @@ static int cmd_enable_channel(struct ltt_session *session, } break; } +#if 0 case LTTNG_DOMAIN_UST_PID_FOLLOW_CHILDREN: case LTTNG_DOMAIN_UST_EXEC_NAME: case LTTNG_DOMAIN_UST_PID: - ret = LTTCOMM_NOT_IMPLEMENTED; - goto error; +#endif default: ret = LTTCOMM_UNKNOWN_DOMAIN; goto error; @@ -2289,9 +2289,11 @@ static int cmd_disable_event(struct ltt_session *session, int domain, channel_name); break; } +#if 0 case LTTNG_DOMAIN_UST_EXEC_NAME: case LTTNG_DOMAIN_UST_PID: case LTTNG_DOMAIN_UST_PID_FOLLOW_CHILDREN: +#endif default: ret = LTTCOMM_NOT_IMPLEMENTED; goto error; @@ -2356,9 +2358,11 @@ static int cmd_disable_event_all(struct ltt_session *session, int domain, break; } +#if 0 case LTTNG_DOMAIN_UST_EXEC_NAME: case LTTNG_DOMAIN_UST_PID: case LTTNG_DOMAIN_UST_PID_FOLLOW_CHILDREN: +#endif default: ret = LTTCOMM_NOT_IMPLEMENTED; goto error; @@ -2397,9 +2401,11 @@ static int cmd_add_context(struct ltt_session *session, int domain, } break; } +#if 0 case LTTNG_DOMAIN_UST_EXEC_NAME: case LTTNG_DOMAIN_UST_PID: case LTTNG_DOMAIN_UST_PID_FOLLOW_CHILDREN: +#endif default: ret = LTTCOMM_NOT_IMPLEMENTED; goto error; @@ -2512,9 +2518,11 @@ static int cmd_enable_event(struct ltt_session *session, int domain, } break; } +#if 0 case LTTNG_DOMAIN_UST_EXEC_NAME: case LTTNG_DOMAIN_UST_PID: case LTTNG_DOMAIN_UST_PID_FOLLOW_CHILDREN: +#endif default: ret = LTTCOMM_NOT_IMPLEMENTED; goto error; @@ -2647,9 +2655,11 @@ static int cmd_enable_event_all(struct ltt_session *session, int domain, break; } +#if 0 case LTTNG_DOMAIN_UST_EXEC_NAME: case LTTNG_DOMAIN_UST_PID: case LTTNG_DOMAIN_UST_PID_FOLLOW_CHILDREN: +#endif default: ret = LTTCOMM_NOT_IMPLEMENTED; goto error; diff --git a/src/bin/lttng/commands/add_context.c b/src/bin/lttng/commands/add_context.c index 23ae8f2a8..95fefa50c 100644 --- a/src/bin/lttng/commands/add_context.c +++ b/src/bin/lttng/commands/add_context.c @@ -37,9 +37,12 @@ static char *opt_channel_name; static char *opt_session_name; static int opt_kernel; static int opt_userspace; +static char *opt_type; +#if 0 +/* Not implemented yet */ static char *opt_cmd_name; static pid_t opt_pid; -static char *opt_type; +#endif enum { OPT_HELP = 1, @@ -138,8 +141,13 @@ static struct poptOption long_options[] = { {"channel", 'c', POPT_ARG_STRING, &opt_channel_name, 0, 0, 0}, {"event", 'e', POPT_ARG_STRING, &opt_event_name, 0, 0, 0}, {"kernel", 'k', POPT_ARG_VAL, &opt_kernel, 1, 0, 0}, - {"userspace", 'u', POPT_ARG_STRING | POPT_ARGFLAG_OPTIONAL, &opt_cmd_name, OPT_USERSPACE, 0, 0}, +#if 0 + /* Not implemented yet */ {"pid", 'p', POPT_ARG_INT, &opt_pid, 0, 0, 0}, + {"userspace", 'u', POPT_ARG_STRING | POPT_ARGFLAG_OPTIONAL, &opt_cmd_name, OPT_USERSPACE, 0, 0}, +#else + {"userspace", 'u', POPT_ARG_NONE, 0, OPT_USERSPACE, 0, 0}, +#endif {"type", 't', POPT_ARG_STRING, &opt_type, OPT_TYPE, 0, 0}, {0, 0, 0, 0, 0, 0, 0} }; @@ -303,10 +311,14 @@ static void usage(FILE *ofp) fprintf(ofp, " -c, --channel NAME Apply on channel\n"); fprintf(ofp, " -e, --event NAME Apply on event\n"); fprintf(ofp, " -k, --kernel Apply for the kernel tracer\n"); +#if 0 fprintf(ofp, " -u, --userspace [CMD] Apply for the user-space tracer\n"); fprintf(ofp, " If no CMD, the domain used is UST global\n"); fprintf(ofp, " or else the domain is UST EXEC_NAME\n"); fprintf(ofp, " -p, --pid PID If -u, apply to specific PID (domain: UST PID)\n"); +#else + fprintf(ofp, " -u, --userspace Apply for the user-space tracer\n"); +#endif fprintf(ofp, " -t, --type TYPE Context type. You can repeat that option on\n"); fprintf(ofp, " the command line.\n"); fprintf(ofp, " TYPE can be one of the strings below:\n"); @@ -352,15 +364,8 @@ static int add_context(char *session_name) if (opt_kernel) { dom.type = LTTNG_DOMAIN_KERNEL; - } else if (opt_pid != 0) { - dom.type = LTTNG_DOMAIN_UST_PID; - dom.attr.pid = opt_pid; - DBG("PID %d set to lttng handle", opt_pid); - } else if (opt_userspace && opt_cmd_name == NULL) { + } else if (opt_userspace) { dom.type = LTTNG_DOMAIN_UST; - } else if (opt_userspace && opt_cmd_name != NULL) { - dom.type = LTTNG_DOMAIN_UST_EXEC_NAME; - strncpy(dom.attr.exec_name, opt_cmd_name, NAME_MAX); } else { ERR("Please specify a tracer (-k/--kernel or -u/--userspace)"); ret = CMD_NOT_IMPLEMENTED; @@ -454,7 +459,9 @@ int cmd_add_context(int argc, const char **argv) break; case OPT_USERSPACE: opt_userspace = 1; +#if 0 opt_cmd_name = poptGetOptArg(pc); +#endif break; default: usage(stderr); diff --git a/src/bin/lttng/commands/calibrate.c b/src/bin/lttng/commands/calibrate.c index ee2c76af1..023ea100e 100644 --- a/src/bin/lttng/commands/calibrate.c +++ b/src/bin/lttng/commands/calibrate.c @@ -32,10 +32,12 @@ static int opt_event_type; static char *opt_kernel; -static int opt_pid_all; static int opt_userspace; +#if 0 +/* Not implemented yet */ static char *opt_cmd_name; static pid_t opt_pid; +#endif enum { OPT_HELP = 1, @@ -54,9 +56,13 @@ static struct poptOption long_options[] = { /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */ {"help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0}, {"kernel", 'k', POPT_ARG_VAL, &opt_kernel, 1, 0, 0}, +#if 0 + /* Not implemented yet */ {"userspace", 'u', POPT_ARG_STRING | POPT_ARGFLAG_OPTIONAL, &opt_cmd_name, OPT_USERSPACE, 0, 0}, - {"all", 0, POPT_ARG_VAL, &opt_pid_all, 1, 0, 0}, {"pid", 'p', POPT_ARG_INT, &opt_pid, 0, 0, 0}, +#else + {"userspace", 'u', POPT_ARG_NONE, 0, OPT_USERSPACE, 0, 0}, +#endif {"tracepoint", 0, POPT_ARG_NONE, 0, OPT_TRACEPOINT, 0, 0}, {"marker", 0, POPT_ARG_NONE, 0, OPT_MARKER, 0, 0}, {"probe", 0, POPT_ARG_NONE, 0, OPT_PROBE, 0, 0}, @@ -81,9 +87,14 @@ static void usage(FILE *ofp) fprintf(ofp, "\n"); fprintf(ofp, " -h, --help Show this help\n"); fprintf(ofp, " -k, --kernel Apply for the kernel tracer\n"); +#if 0 fprintf(ofp, " -u, --userspace [CMD] Apply for the user-space tracer\n"); - fprintf(ofp, " --all If -u, apply on all traceable apps\n"); - fprintf(ofp, " -p, --pid PID If -u, apply on a specific PID\n"); + fprintf(ofp, " If no CMD, the domain used is UST global\n"); + fprintf(ofp, " or else the domain is UST EXEC_NAME\n"); + fprintf(ofp, " -p, --pid PID If -u, apply to specific PID (domain: UST PID)\n"); +#else + fprintf(ofp, " -u, --userspace Apply for the user-space tracer\n"); +#endif fprintf(ofp, "\n"); fprintf(ofp, "Calibrate options:\n"); fprintf(ofp, " --tracepoint Tracepoint event (default)\n"); @@ -147,12 +158,6 @@ static int calibrate_lttng(void) goto end; } } else if (opt_userspace) { /* User-space tracer action */ - /* - * TODO: Waiting on lttng UST 2.0 - */ - if (opt_pid_all) { - } else if (opt_pid != 0) { - } ret = CMD_NOT_IMPLEMENTED; goto end; } else { diff --git a/src/bin/lttng/commands/disable_channels.c b/src/bin/lttng/commands/disable_channels.c index f2e181971..cc81b74c9 100644 --- a/src/bin/lttng/commands/disable_channels.c +++ b/src/bin/lttng/commands/disable_channels.c @@ -31,8 +31,11 @@ static char *opt_channels; static int opt_kernel; static char *opt_session_name; static int opt_userspace; +#if 0 +/* Not implemented yet */ static char *opt_cmd_name; static pid_t opt_pid; +#endif enum { OPT_HELP = 1, @@ -46,8 +49,13 @@ static struct poptOption long_options[] = { {"help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0}, {"session", 's', POPT_ARG_STRING, &opt_session_name, 0, 0, 0}, {"kernel", 'k', POPT_ARG_VAL, &opt_kernel, 1, 0, 0}, +#if 0 + /* Not implemented yet */ {"userspace", 'u', POPT_ARG_STRING | POPT_ARGFLAG_OPTIONAL, &opt_cmd_name, OPT_USERSPACE, 0, 0}, {"pid", 'p', POPT_ARG_INT, &opt_pid, 0, 0, 0}, +#else + {"userspace", 'u', POPT_ARG_NONE, 0, OPT_USERSPACE, 0, 0}, +#endif {0, 0, 0, 0, 0, 0, 0} }; @@ -61,10 +69,14 @@ static void usage(FILE *ofp) fprintf(ofp, " -h, --help Show this help\n"); fprintf(ofp, " -s, --session Apply on session name\n"); fprintf(ofp, " -k, --kernel Apply for the kernel tracer\n"); +#if 0 fprintf(ofp, " -u, --userspace [CMD] Apply for the user-space tracer\n"); fprintf(ofp, " If no CMD, the domain used is UST global\n"); fprintf(ofp, " or else the domain is UST EXEC_NAME\n"); fprintf(ofp, " -p, --pid PID If -u, apply to specific PID (domain: UST PID)\n"); +#else + fprintf(ofp, " -u, --userspace Apply for the user-space tracer\n"); +#endif fprintf(ofp, "\n"); } @@ -77,17 +89,11 @@ static int disable_channels(char *session_name) char *channel_name; struct lttng_domain dom; + /* Create lttng domain */ if (opt_kernel) { dom.type = LTTNG_DOMAIN_KERNEL; - } else if (opt_pid != 0) { - dom.type = LTTNG_DOMAIN_UST_PID; - dom.attr.pid = opt_pid; - DBG("PID %d set to lttng handle", opt_pid); - } else if (opt_userspace && opt_cmd_name == NULL) { + } else if (opt_userspace) { dom.type = LTTNG_DOMAIN_UST; - } else if (opt_userspace && opt_cmd_name != NULL) { - dom.type = LTTNG_DOMAIN_UST_EXEC_NAME; - strncpy(dom.attr.exec_name, opt_cmd_name, NAME_MAX); } else { ERR("Please specify a tracer (-k/--kernel or -u/--userspace)"); ret = CMD_NOT_IMPLEMENTED; diff --git a/src/bin/lttng/commands/disable_events.c b/src/bin/lttng/commands/disable_events.c index 0e53b4228..e6c8b2d06 100644 --- a/src/bin/lttng/commands/disable_events.c +++ b/src/bin/lttng/commands/disable_events.c @@ -32,9 +32,12 @@ static int opt_kernel; static char *opt_channel_name; static char *opt_session_name; static int opt_userspace; -static char *opt_cmd_name; static int opt_disable_all; +#if 0 +/* Not implemented yet */ +static char *opt_cmd_name; static pid_t opt_pid; +#endif enum { OPT_HELP = 1, @@ -50,8 +53,13 @@ static struct poptOption long_options[] = { {"all-events", 'a', POPT_ARG_VAL, &opt_disable_all, 1, 0, 0}, {"channel", 'c', POPT_ARG_STRING, &opt_channel_name, 0, 0, 0}, {"kernel", 'k', POPT_ARG_VAL, &opt_kernel, 1, 0, 0}, +#if 0 + /* Not implemented yet */ {"userspace", 'u', POPT_ARG_STRING | POPT_ARGFLAG_OPTIONAL, &opt_cmd_name, OPT_USERSPACE, 0, 0}, {"pid", 'p', POPT_ARG_INT, &opt_pid, 0, 0, 0}, +#else + {"userspace", 'u', POPT_ARG_NONE, 0, OPT_USERSPACE, 0, 0}, +#endif {0, 0, 0, 0, 0, 0, 0} }; @@ -67,10 +75,14 @@ static void usage(FILE *ofp) fprintf(ofp, " -c, --channel Apply on this channel\n"); fprintf(ofp, " -a, --all-events Disable all tracepoints\n"); fprintf(ofp, " -k, --kernel Apply for the kernel tracer\n"); +#if 0 fprintf(ofp, " -u, --userspace [CMD] Apply for the user-space tracer\n"); fprintf(ofp, " If no CMD, the domain used is UST global\n"); fprintf(ofp, " or else the domain is UST EXEC_NAME\n"); fprintf(ofp, " -p, --pid PID If -u, apply to specific PID (domain: UST PID)\n"); +#else + fprintf(ofp, " -u, --userspace Apply for the user-space tracer\n"); +#endif fprintf(ofp, "\n"); } @@ -101,19 +113,11 @@ static int disable_events(char *session_name) goto error; } + /* Create lttng domain */ if (opt_kernel) { dom.type = LTTNG_DOMAIN_KERNEL; - } else if (opt_pid != 0) { - dom.type = LTTNG_DOMAIN_UST_PID; - dom.attr.pid = opt_pid; - DBG("PID %d set to lttng handle", opt_pid); - } else if (opt_userspace && opt_cmd_name == NULL) { + } else if (opt_userspace) { dom.type = LTTNG_DOMAIN_UST; - DBG("UST global domain selected"); - } else if (opt_userspace && opt_cmd_name != NULL) { - dom.type = LTTNG_DOMAIN_UST_EXEC_NAME; - strncpy(dom.attr.exec_name, opt_cmd_name, NAME_MAX); - dom.attr.exec_name[NAME_MAX - 1] = '\0'; } else { ERR("Please specify a tracer (-k/--kernel or -u/--userspace)"); ret = CMD_NOT_IMPLEMENTED; @@ -145,11 +149,13 @@ static int disable_events(char *session_name) DBG("Disabling kernel event %s in channel %s", event_name, channel_name); } else if (opt_userspace) { /* User-space tracer action */ +#if 0 if (opt_cmd_name != NULL || opt_pid) { MSG("Only supporting tracing all UST processes (-u) for now."); ret = CMD_NOT_IMPLEMENTED; goto error; } +#endif DBG("Disabling UST event %s in channel %s", event_name, channel_name); } else { diff --git a/src/bin/lttng/commands/enable_channels.c b/src/bin/lttng/commands/enable_channels.c index 3ec02ef41..2da06ad50 100644 --- a/src/bin/lttng/commands/enable_channels.c +++ b/src/bin/lttng/commands/enable_channels.c @@ -30,12 +30,14 @@ static char *opt_channels; static int opt_kernel; -static char *opt_cmd_name; static char *opt_session_name; static int opt_userspace; +static struct lttng_channel chan; +#if 0 +/* Not implemented yet */ static char *opt_cmd_name; static pid_t opt_pid; -static struct lttng_channel chan; +#endif enum { OPT_HELP = 1, @@ -55,8 +57,13 @@ static struct poptOption long_options[] = { {"help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0}, {"session", 's', POPT_ARG_STRING, &opt_session_name, 0, 0, 0}, {"kernel", 'k', POPT_ARG_VAL, &opt_kernel, 1, 0, 0}, +#if 0 + /* Not implemented yet */ {"userspace", 'u', POPT_ARG_STRING | POPT_ARGFLAG_OPTIONAL, &opt_cmd_name, OPT_USERSPACE, 0, 0}, {"pid", 'p', POPT_ARG_INT, &opt_pid, 0, 0, 0}, +#else + {"userspace", 'u', POPT_ARG_NONE, 0, OPT_USERSPACE, 0, 0}, +#endif {"discard", 0, POPT_ARG_NONE, 0, OPT_DISCARD, 0, 0}, {"overwrite", 0, POPT_ARG_NONE, 0, OPT_OVERWRITE, 0, 0}, {"subbuf-size", 0, POPT_ARG_DOUBLE, 0, OPT_SUBBUF_SIZE, 0, 0}, @@ -76,10 +83,14 @@ static void usage(FILE *ofp) fprintf(ofp, " -h, --help Show this help\n"); fprintf(ofp, " -s, --session Apply on session name\n"); fprintf(ofp, " -k, --kernel Apply on the kernel tracer\n"); +#if 0 fprintf(ofp, " -u, --userspace [CMD] Apply for the user-space tracer\n"); fprintf(ofp, " If no CMD, the domain used is UST global\n"); fprintf(ofp, " or else the domain is UST EXEC_NAME\n"); fprintf(ofp, " -p, --pid PID If -u, apply to specific PID (domain: UST PID)\n"); +#else + fprintf(ofp, " -u, --userspace Apply for the user-space tracer\n"); +#endif fprintf(ofp, "\n"); fprintf(ofp, "Channel options:\n"); fprintf(ofp, " --discard Discard event when buffers are full%s\n", @@ -141,17 +152,11 @@ static int enable_channel(char *session_name) char *channel_name; struct lttng_domain dom; + /* Create lttng domain */ if (opt_kernel) { dom.type = LTTNG_DOMAIN_KERNEL; - } else if (opt_pid != 0) { - dom.type = LTTNG_DOMAIN_UST_PID; - dom.attr.pid = opt_pid; - DBG("PID %d set to lttng handle", opt_pid); - } else if (opt_userspace && opt_cmd_name == NULL) { + } else if (opt_userspace) { dom.type = LTTNG_DOMAIN_UST; - } else if (opt_userspace && opt_cmd_name != NULL) { - dom.type = LTTNG_DOMAIN_UST_EXEC_NAME; - strncpy(dom.attr.exec_name, opt_cmd_name, NAME_MAX); } else { ERR("Please specify a tracer (-k/--kernel or -u/--userspace)"); ret = CMD_NOT_IMPLEMENTED; diff --git a/src/bin/lttng/commands/enable_events.c b/src/bin/lttng/commands/enable_events.c index ca18ccd48..8360821fb 100644 --- a/src/bin/lttng/commands/enable_events.c +++ b/src/bin/lttng/commands/enable_events.c @@ -34,13 +34,16 @@ static int opt_event_type; static int opt_kernel; static char *opt_session_name; static int opt_userspace; -static char *opt_cmd_name; static int opt_enable_all; -static pid_t opt_pid; static char *opt_probe; static char *opt_function; static char *opt_function_entry_symbol; static char *opt_channel_name; +#if 0 +/* Not implemented yet */ +static char *opt_cmd_name; +static pid_t opt_pid; +#endif enum { OPT_HELP = 1, @@ -62,8 +65,13 @@ static struct poptOption long_options[] = { {"all", 'a', POPT_ARG_VAL, &opt_enable_all, 1, 0, 0}, {"channel", 'c', POPT_ARG_STRING, &opt_channel_name, 0, 0, 0}, {"kernel", 'k', POPT_ARG_VAL, &opt_kernel, 1, 0, 0}, +#if 0 + /* Not implemented yet */ {"userspace", 'u', POPT_ARG_STRING | POPT_ARGFLAG_OPTIONAL, &opt_cmd_name, OPT_USERSPACE, 0, 0}, {"pid", 'p', POPT_ARG_INT, &opt_pid, 0, 0, 0}, +#else + {"userspace", 'u', POPT_ARG_NONE, 0, OPT_USERSPACE, 0, 0}, +#endif {"tracepoint", 0, POPT_ARG_NONE, 0, OPT_TRACEPOINT, 0, 0}, {"probe", 0, POPT_ARG_STRING, &opt_probe, OPT_PROBE, 0, 0}, {"function", 0, POPT_ARG_STRING, &opt_function, OPT_FUNCTION, 0, 0}, @@ -91,10 +99,14 @@ static void usage(FILE *ofp) fprintf(ofp, " -c, --channel Apply on this channel\n"); fprintf(ofp, " -a, --all Enable all tracepoints\n"); fprintf(ofp, " -k, --kernel Apply for the kernel tracer\n"); +#if 0 fprintf(ofp, " -u, --userspace [CMD] Apply for the user-space tracer\n"); fprintf(ofp, " If no CMD, the domain used is UST global\n"); fprintf(ofp, " or else the domain is UST EXEC_NAME\n"); fprintf(ofp, " -p, --pid PID If -u, apply to specific PID (domain: UST PID)\n"); +#else + fprintf(ofp, " -u, --userspace Apply for the user-space tracer\n"); +#endif fprintf(ofp, "\n"); fprintf(ofp, "Event options:\n"); fprintf(ofp, " --tracepoint Tracepoint event (default)\n"); @@ -216,15 +228,8 @@ static int enable_events(char *session_name) /* Create lttng domain */ if (opt_kernel) { dom.type = LTTNG_DOMAIN_KERNEL; - } else if (opt_pid != 0) { - dom.type = LTTNG_DOMAIN_UST_PID; - dom.attr.pid = opt_pid; - DBG("PID %d set to lttng handle", opt_pid); - } else if (opt_userspace && opt_cmd_name == NULL) { + } else if (opt_userspace) { dom.type = LTTNG_DOMAIN_UST; - } else if (opt_userspace && opt_cmd_name != NULL) { - dom.type = LTTNG_DOMAIN_UST_EXEC_NAME; - strncpy(dom.attr.exec_name, opt_cmd_name, NAME_MAX); } else { ERR("Please specify a tracer (-k/--kernel or -u/--userspace)"); ret = CMD_NOT_IMPLEMENTED; @@ -326,11 +331,13 @@ static int enable_events(char *session_name) goto error; } } else if (opt_userspace) { /* User-space tracer action */ +#if 0 if (opt_cmd_name != NULL || opt_pid) { MSG("Only supporting tracing all UST processes (-u) for now."); ret = CMD_NOT_IMPLEMENTED; goto error; } +#endif DBG("Enabling UST event %s for channel %s", event_name, channel_name); diff --git a/src/bin/lttng/commands/list.c b/src/bin/lttng/commands/list.c index 7698bb6ed..f09edaef4 100644 --- a/src/bin/lttng/commands/list.c +++ b/src/bin/lttng/commands/list.c @@ -26,12 +26,15 @@ #include "../command.h" -static int opt_pid; static int opt_userspace; -static char *opt_cmd_name; static int opt_kernel; static char *opt_channel; static int opt_domain; +#if 0 +/* Not implemented yet */ +static char *opt_cmd_name; +static pid_t opt_pid; +#endif const char *indent4 = " "; const char *indent6 = " "; @@ -48,8 +51,13 @@ static struct poptOption long_options[] = { /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */ {"help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0}, {"kernel", 'k', POPT_ARG_VAL, &opt_kernel, 1, 0, 0}, - {"userspace", 'u', POPT_ARG_STRING | POPT_ARGFLAG_OPTIONAL, &opt_cmd_name, OPT_USERSPACE, 0, 0}, - {"pid", 'p', POPT_ARG_INT, &opt_pid, 0, 0, 0}, +#if 0 + /* Not implemented yet */ + {"userspace", 'u', POPT_ARG_STRING | POPT_ARGFLAG_OPTIONAL, &opt_cmd_name, OPT_USERSPACE, 0, 0}, + {"pid", 'p', POPT_ARG_INT, &opt_pid, 0, 0, 0}, +#else + {"userspace", 'u', POPT_ARG_NONE, 0, OPT_USERSPACE, 0, 0}, +#endif {"channel", 'c', POPT_ARG_STRING, &opt_channel, 0, 0, 0}, {"domain", 'd', POPT_ARG_VAL, &opt_domain, 1, 0, 0}, {0, 0, 0, 0, 0, 0, 0} @@ -70,7 +78,9 @@ static void usage(FILE *ofp) fprintf(ofp, " -h, --help Show this help\n"); fprintf(ofp, " -k, --kernel Select kernel domain\n"); fprintf(ofp, " -u, --userspace Select user-space domain.\n"); +#if 0 fprintf(ofp, " -p, --pid PID List user-space events by PID\n"); +#endif fprintf(ofp, "\n"); fprintf(ofp, "Options:\n"); fprintf(ofp, " -c, --channel NAME List details of a channel\n"); @@ -553,10 +563,6 @@ int cmd_list(int argc, const char **argv) } } - if (opt_pid != 0) { - MSG("*** Userspace tracing not implemented for PID ***\n"); - } - /* Get session name (trailing argument) */ session_name = poptGetArg(pc); DBG2("Session name: %s", session_name); diff --git a/src/lib/lttng-ctl/lttng-ctl.c b/src/lib/lttng-ctl/lttng-ctl.c index 9fbc7358c..0858c1a74 100644 --- a/src/lib/lttng-ctl/lttng-ctl.c +++ b/src/lib/lttng-ctl/lttng-ctl.c @@ -66,9 +66,11 @@ static void copy_lttng_domain(struct lttng_domain *dst, struct lttng_domain *src switch (src->type) { case LTTNG_DOMAIN_KERNEL: case LTTNG_DOMAIN_UST: + /* case LTTNG_DOMAIN_UST_EXEC_NAME: case LTTNG_DOMAIN_UST_PID: case LTTNG_DOMAIN_UST_PID_FOLLOW_CHILDREN: + */ memcpy(dst, src, sizeof(struct lttng_domain)); break; default: @@ -847,9 +849,11 @@ void lttng_channel_set_default_attr(struct lttng_domain *domain, attr->output = DEFAULT_KERNEL_CHANNEL_OUTPUT; break; case LTTNG_DOMAIN_UST: +#if 0 case LTTNG_DOMAIN_UST_EXEC_NAME: case LTTNG_DOMAIN_UST_PID: case LTTNG_DOMAIN_UST_PID_FOLLOW_CHILDREN: +#endif attr->overwrite = DEFAULT_CHANNEL_OVERWRITE; attr->switch_timer_interval = DEFAULT_CHANNEL_SWITCH_TIMER; attr->read_timer_interval = DEFAULT_CHANNEL_READ_TIMER; -- 2.34.1