#include <assert.h>
#include <common/mi-lttng.h>
+#include <lttng/constant.h>
#include "../command.h"
static int opt_domain;
static int opt_fields;
static int opt_syscall;
-#if 0
-/* Not implemented yet */
-static char *opt_cmd_name;
-static pid_t opt_pid;
-#endif
const char *indent4 = " ";
const char *indent6 = " ";
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},
- {"jul", 'j', POPT_ARG_VAL, &opt_jul, 1, 0, 0},
- {"log4j", 'l', POPT_ARG_VAL, &opt_log4j, 1, 0, 0},
- {"python", 'p', POPT_ARG_VAL, &opt_python, 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
- {"channel", 'c', POPT_ARG_STRING, &opt_channel, 0, 0, 0},
- {"domain", 'd', POPT_ARG_VAL, &opt_domain, 1, 0, 0},
- {"fields", 'f', POPT_ARG_VAL, &opt_fields, 1, 0, 0},
- {"syscall", 'S', POPT_ARG_VAL, &opt_syscall, 1, 0, 0},
+ {"help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0},
+ {"kernel", 'k', POPT_ARG_VAL, &opt_kernel, 1, 0, 0},
+ {"jul", 'j', POPT_ARG_VAL, &opt_jul, 1, 0, 0},
+ {"log4j", 'l', POPT_ARG_VAL, &opt_log4j, 1, 0, 0},
+ {"python", 'p', POPT_ARG_VAL, &opt_python, 1, 0, 0},
+ {"userspace", 'u', POPT_ARG_NONE, 0, OPT_USERSPACE, 0, 0},
+ {"channel", 'c', POPT_ARG_STRING, &opt_channel, 0, 0, 0},
+ {"domain", 'd', POPT_ARG_VAL, &opt_domain, 1, 0, 0},
+ {"fields", 'f', POPT_ARG_VAL, &opt_fields, 1, 0, 0},
+ {"syscall", 'S', POPT_ARG_VAL, &opt_syscall, 1, 0, 0},
{"list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL},
{0, 0, 0, 0, 0, 0, 0}
};
fprintf(ofp, " -p, --python Apply for Python application using logging\n");
fprintf(ofp, " -f, --fields List event fields.\n");
fprintf(ofp, " --syscall List available system calls.\n");
-#if 0
- fprintf(ofp, " -p, --pid PID List user-space events by PID\n");
-#endif
fprintf(ofp, "\n");
fprintf(ofp, "Session Options:\n");
fprintf(ofp, " -c, --channel NAME List details of a channel\n");
int ret;
FILE *fp = NULL;
char *cmdline = NULL;
- char path[20]; /* Can't go bigger than /proc/65535/cmdline */
+ /* Can't go bigger than /proc/LTTNG_MAX_PID/cmdline */
+ char path[sizeof("/proc//cmdline") + sizeof(LTTNG_MAX_PID_STR) - 1];
snprintf(path, sizeof(path), "/proc/%d/cmdline", pid);
fp = fopen(path, "r");
{
int i, size, ret = CMD_SUCCESS;
struct lttng_domain domain;
- struct lttng_handle *handle;
- struct lttng_event *event_list;
+ struct lttng_handle *handle = NULL;
+ struct lttng_event *event_list = NULL;
pid_t cur_pid = 0;
char *cmdline = NULL;
const char *agent_domain_str;
domain.type = LTTNG_DOMAIN_LOG4J;
} else if (opt_python) {
domain.type = LTTNG_DOMAIN_PYTHON;
+ } else {
+ ERR("Invalid agent domain selected.");
+ ret = CMD_ERROR;
+ goto error;
}
agent_domain_str = get_domain_str(domain.type);
{
int enabled, ret;
int *pids = NULL;
- size_t nr_pids, i;
+ size_t nr_pids;
ret = lttng_list_tracker_pids(handle,
&enabled, &pids, &nr_pids);
if (ret) {
return ret;
}
- _MSG("PID tracker: [%s]", enabled ? "enabled" : "disabled");
if (enabled) {
- _MSG(", pids: [");
+ int i;
+ _MSG("PID tracker: [");
for (i = 0; i < nr_pids; i++) {
if (i) {
}
_MSG(" %d", pids[i]);
}
- _MSG(" ]");
+ _MSG(" ]\n\n");
}
- _MSG("\n\n");
free(pids);
return 0;
}
active_string(sessions[i].enabled),
snapshot_string(sessions[i].snapshot_mode));
MSG("%sTrace path: %s", indent4, sessions[i].path);
- MSG("%sLive timer interval (usec): %u\n", indent4,
- sessions[i].live_timer_interval);
+ if (sessions[i].live_timer_interval != 0) {
+ MSG("%sLive timer interval (usec): %u", indent4,
+ sessions[i].live_timer_interval);
+ }
+ MSG("");
}
}