From: David Goulet Date: Thu, 11 Apr 2013 18:19:55 +0000 (-0400) Subject: Fix: enable-channel accepts mismatched option X-Git-Tag: v2.2.0-rc2~53 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=88c5f0d8ee74f6c3a19299e9bb34091247d50d64;p=lttng-tools.git Fix: enable-channel accepts mismatched option Also fixes a small typo in an error message of enable-channel. This commit adds the buffer type for the UST domain with lttng list. Fixes #489 Signed-off-by: David Goulet --- diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index 687c06d42..9ef1fde36 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -1920,6 +1920,7 @@ ssize_t cmd_list_domains(struct ltt_session *session, if (session->ust_session != NULL) { (*domains)[index].type = LTTNG_DOMAIN_UST; + (*domains)[index].buf_type = session->ust_session->buffer_type; index++; } diff --git a/src/bin/lttng/commands/enable_channels.c b/src/bin/lttng/commands/enable_channels.c index d026af433..f53a941a2 100644 --- a/src/bin/lttng/commands/enable_channels.c +++ b/src/bin/lttng/commands/enable_channels.c @@ -179,11 +179,21 @@ static int enable_channel(char *session_name) if (opt_kernel) { dom.type = LTTNG_DOMAIN_KERNEL; dom.buf_type = LTTNG_BUFFER_GLOBAL; + if (opt_buffer_uid || opt_buffer_pid) { + ERR("Buffer type not supported for domain -k"); + ret = CMD_ERROR; + goto error; + } } else if (opt_userspace) { dom.type = LTTNG_DOMAIN_UST; if (opt_buffer_uid) { dom.buf_type = LTTNG_BUFFER_PER_UID; } else { + if (opt_buffer_global) { + ERR("Buffer type not supported for domain -u"); + ret = CMD_ERROR; + goto error; + } dom.buf_type = LTTNG_BUFFER_PER_PID; } } else { @@ -238,7 +248,7 @@ static int enable_channel(char *session_name) switch (-ret) { case LTTNG_ERR_KERN_CHAN_EXIST: case LTTNG_ERR_UST_CHAN_EXIST: - WARN("Channel %s: %s (session %s", channel_name, + WARN("Channel %s: %s (session %s)", channel_name, lttng_strerror(ret), session_name); goto error; default: diff --git a/src/bin/lttng/commands/list.c b/src/bin/lttng/commands/list.c index 0554732c0..db993df75 100644 --- a/src/bin/lttng/commands/list.c +++ b/src/bin/lttng/commands/list.c @@ -815,6 +815,9 @@ int cmd_list(int argc, const char **argv) break; case LTTNG_DOMAIN_UST: MSG("=== Domain: UST global ===\n"); + MSG("Buffer type: %s\n", + domains[i].buf_type == + LTTNG_BUFFER_PER_PID ? "per PID" : "per UID"); break; default: MSG("=== Domain: Unimplemented ===\n");