projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: missing test file in EXTRA dist
[lttng-tools.git]
/
src
/
bin
/
lttng-sessiond
/
cmd.c
diff --git
a/src/bin/lttng-sessiond/cmd.c
b/src/bin/lttng-sessiond/cmd.c
index 8dd3fcc60c914c9df4979ac46150aea1c518c147..5bec355486975a21d0417a9538728d4ea2f3822d 100644
(file)
--- a/
src/bin/lttng-sessiond/cmd.c
+++ b/
src/bin/lttng-sessiond/cmd.c
@@
-305,6
+305,9
@@
static int list_lttng_ust_global_events(char *channel_name,
if (uevent->filter) {
tmp[i].filter = 1;
}
if (uevent->filter) {
tmp[i].filter = 1;
}
+ if (uevent->exclusion) {
+ tmp[i].exclusion = 1;
+ }
i++;
}
i++;
}
@@
-455,6
+458,7
@@
static int add_uri_to_consumer(struct consumer_output *consumer,
* URI was the same in the consumer so we do not append the subdir
* again so to not duplicate output dir.
*/
* URI was the same in the consumer so we do not append the subdir
* again so to not duplicate output dir.
*/
+ ret = LTTNG_OK;
goto error;
}
goto error;
}
@@
-1306,7
+1310,10
@@
error:
*/
int cmd_enable_event(struct ltt_session *session, struct lttng_domain *domain,
char *channel_name, struct lttng_event *event,
*/
int cmd_enable_event(struct ltt_session *session, struct lttng_domain *domain,
char *channel_name, struct lttng_event *event,
- struct lttng_filter_bytecode *filter, int wpipe)
+ char *filter_expression,
+ struct lttng_filter_bytecode *filter,
+ struct lttng_event_exclusion *exclusion,
+ int wpipe)
{
int ret, channel_created = 0;
struct lttng_channel *attr;
{
int ret, channel_created = 0;
struct lttng_channel *attr;
@@
-1419,7
+1426,8
@@
int cmd_enable_event(struct ltt_session *session, struct lttng_domain *domain,
}
/* At this point, the session and channel exist on the tracer */
}
/* At this point, the session and channel exist on the tracer */
- ret = event_ust_enable_tracepoint(usess, uchan, event, filter);
+ ret = event_ust_enable_tracepoint(usess, uchan, event,
+ filter_expression, filter, exclusion);
if (ret != LTTNG_OK) {
goto error;
}
if (ret != LTTNG_OK) {
goto error;
}
@@
-1434,9
+1442,16
@@
int cmd_enable_event(struct ltt_session *session, struct lttng_domain *domain,
assert(usess);
/* Create the default JUL tracepoint. */
assert(usess);
/* Create the default JUL tracepoint. */
+ memset(&uevent, 0, sizeof(uevent));
uevent.type = LTTNG_EVENT_TRACEPOINT;
uevent.loglevel_type = LTTNG_EVENT_LOGLEVEL_ALL;
uevent.type = LTTNG_EVENT_TRACEPOINT;
uevent.loglevel_type = LTTNG_EVENT_LOGLEVEL_ALL;
- strncpy(uevent.name, DEFAULT_JUL_EVENT_NAME, sizeof(uevent.name));
+ if (is_root) {
+ strncpy(uevent.name, DEFAULT_SYS_JUL_EVENT_NAME,
+ sizeof(uevent.name));
+ } else {
+ strncpy(uevent.name, DEFAULT_USER_JUL_EVENT_NAME,
+ sizeof(uevent.name));
+ }
uevent.name[sizeof(uevent.name) - 1] = '\0';
/*
uevent.name[sizeof(uevent.name) - 1] = '\0';
/*
@@
-1448,14
+1463,14
@@
int cmd_enable_event(struct ltt_session *session, struct lttng_domain *domain,
tmp_dom.type = LTTNG_DOMAIN_UST;
ret = cmd_enable_event(session, &tmp_dom, DEFAULT_JUL_CHANNEL_NAME,
tmp_dom.type = LTTNG_DOMAIN_UST;
ret = cmd_enable_event(session, &tmp_dom, DEFAULT_JUL_CHANNEL_NAME,
-
&uevent
, NULL, wpipe);
+
&uevent, NULL, NULL
, NULL, wpipe);
if (ret != LTTNG_OK && ret != LTTNG_ERR_UST_EVENT_ENABLED) {
goto error;
}
/* The wild card * means that everything should be enabled. */
if (strncmp(event->name, "*", 1) == 0 && strlen(event->name) == 1) {
if (ret != LTTNG_OK && ret != LTTNG_ERR_UST_EVENT_ENABLED) {
goto error;
}
/* The wild card * means that everything should be enabled. */
if (strncmp(event->name, "*", 1) == 0 && strlen(event->name) == 1) {
- ret = event_jul_enable_all(usess);
+ ret = event_jul_enable_all(usess
, event
);
} else {
ret = event_jul_enable(usess, event);
}
} else {
ret = event_jul_enable(usess, event);
}
@@
-1487,6
+1502,7
@@
error:
*/
int cmd_enable_event_all(struct ltt_session *session,
struct lttng_domain *domain, char *channel_name, int event_type,
*/
int cmd_enable_event_all(struct ltt_session *session,
struct lttng_domain *domain, char *channel_name, int event_type,
+ char *filter_expression,
struct lttng_filter_bytecode *filter, int wpipe)
{
int ret;
struct lttng_filter_bytecode *filter, int wpipe)
{
int ret;
@@
-1620,7
+1636,8
@@
int cmd_enable_event_all(struct ltt_session *session,
switch (event_type) {
case LTTNG_EVENT_ALL:
case LTTNG_EVENT_TRACEPOINT:
switch (event_type) {
case LTTNG_EVENT_ALL:
case LTTNG_EVENT_TRACEPOINT:
- ret = event_ust_enable_all_tracepoints(usess, uchan, filter);
+ ret = event_ust_enable_all_tracepoints(usess, uchan,
+ filter_expression, filter);
if (ret != LTTNG_OK) {
goto error;
}
if (ret != LTTNG_OK) {
goto error;
}
@@
-1639,7
+1656,7
@@
int cmd_enable_event_all(struct ltt_session *session,
}
case LTTNG_DOMAIN_JUL:
{
}
case LTTNG_DOMAIN_JUL:
{
- struct lttng_event uevent;
+ struct lttng_event uevent
, event
;
struct lttng_domain tmp_dom;
struct ltt_ust_session *usess = session->ust_session;
struct lttng_domain tmp_dom;
struct ltt_ust_session *usess = session->ust_session;
@@
-1648,7
+1665,13
@@
int cmd_enable_event_all(struct ltt_session *session,
/* Create the default JUL tracepoint. */
uevent.type = LTTNG_EVENT_TRACEPOINT;
uevent.loglevel_type = LTTNG_EVENT_LOGLEVEL_ALL;
/* Create the default JUL tracepoint. */
uevent.type = LTTNG_EVENT_TRACEPOINT;
uevent.loglevel_type = LTTNG_EVENT_LOGLEVEL_ALL;
- strncpy(uevent.name, DEFAULT_JUL_EVENT_NAME, sizeof(uevent.name));
+ if (is_root) {
+ strncpy(uevent.name, DEFAULT_SYS_JUL_EVENT_NAME,
+ sizeof(uevent.name));
+ } else {
+ strncpy(uevent.name, DEFAULT_USER_JUL_EVENT_NAME,
+ sizeof(uevent.name));
+ }
uevent.name[sizeof(uevent.name) - 1] = '\0';
/*
uevent.name[sizeof(uevent.name) - 1] = '\0';
/*
@@
-1660,12
+1683,17
@@
int cmd_enable_event_all(struct ltt_session *session,
tmp_dom.type = LTTNG_DOMAIN_UST;
ret = cmd_enable_event(session, &tmp_dom, DEFAULT_JUL_CHANNEL_NAME,
tmp_dom.type = LTTNG_DOMAIN_UST;
ret = cmd_enable_event(session, &tmp_dom, DEFAULT_JUL_CHANNEL_NAME,
-
&uevent
, NULL, wpipe);
+
&uevent, NULL, NULL
, NULL, wpipe);
if (ret != LTTNG_OK && ret != LTTNG_ERR_UST_EVENT_ENABLED) {
goto error;
}
if (ret != LTTNG_OK && ret != LTTNG_ERR_UST_EVENT_ENABLED) {
goto error;
}
- ret = event_jul_enable_all(usess);
+ event.loglevel = LTTNG_LOGLEVEL_JUL_ALL;
+ event.loglevel_type = LTTNG_EVENT_LOGLEVEL_ALL;
+ strncpy(event.name, "*", sizeof(event.name));
+ event.name[sizeof(event.name) - 1] = '\0';
+
+ ret = event_jul_enable_all(usess, &event);
if (ret != LTTNG_OK) {
goto error;
}
if (ret != LTTNG_OK) {
goto error;
}
@@
-1768,6
+1796,7
@@
error:
int cmd_start_trace(struct ltt_session *session)
{
int ret;
int cmd_start_trace(struct ltt_session *session)
{
int ret;
+ unsigned long nb_chan = 0;
struct ltt_kernel_session *ksession;
struct ltt_ust_session *usess;
struct ltt_kernel_session *ksession;
struct ltt_ust_session *usess;
@@
-1783,6
+1812,21
@@
int cmd_start_trace(struct ltt_session *session)
goto error;
}
goto error;
}
+ /*
+ * Starting a session without channel is useless since after that it's not
+ * possible to enable channel thus inform the client.
+ */
+ if (usess && usess->domain_global.channels) {
+ nb_chan += lttng_ht_get_count(usess->domain_global.channels);
+ }
+ if (ksession) {
+ nb_chan += ksession->channel_count;
+ }
+ if (!nb_chan) {
+ ret = LTTNG_ERR_NO_CHANNEL;
+ goto error;
+ }
+
session->enabled = 1;
/* Kernel tracing */
session->enabled = 1;
/* Kernel tracing */
@@
-2142,7
+2186,14
@@
int cmd_calibrate(int domain, struct lttng_calibrate *calibrate)
{
struct lttng_kernel_calibrate kcalibrate;
{
struct lttng_kernel_calibrate kcalibrate;
- kcalibrate.type = calibrate->type;
+ switch (calibrate->type) {
+ case LTTNG_CALIBRATE_FUNCTION:
+ default:
+ /* Default and only possible calibrate option. */
+ kcalibrate.type = LTTNG_KERNEL_CALIBRATE_KRETPROBE;
+ break;
+ }
+
ret = kernel_calibrate(kernel_tracer_fd, &kcalibrate);
if (ret < 0) {
ret = LTTNG_ERR_KERN_ENABLE_FAIL;
ret = kernel_calibrate(kernel_tracer_fd, &kcalibrate);
if (ret < 0) {
ret = LTTNG_ERR_KERN_ENABLE_FAIL;
@@
-2154,7
+2205,14
@@
int cmd_calibrate(int domain, struct lttng_calibrate *calibrate)
{
struct lttng_ust_calibrate ucalibrate;
{
struct lttng_ust_calibrate ucalibrate;
- ucalibrate.type = calibrate->type;
+ switch (calibrate->type) {
+ case LTTNG_CALIBRATE_FUNCTION:
+ default:
+ /* Default and only possible calibrate option. */
+ ucalibrate.type = LTTNG_UST_CALIBRATE_TRACEPOINT;
+ break;
+ }
+
ret = ust_app_calibrate_glb(&ucalibrate);
if (ret < 0) {
ret = LTTNG_ERR_UST_CALIBRATE_FAIL;
ret = ust_app_calibrate_glb(&ucalibrate);
if (ret < 0) {
ret = LTTNG_ERR_UST_CALIBRATE_FAIL;
@@
-2453,6
+2511,7
@@
void cmd_list_lttng_sessions(struct lttng_session *sessions, uid_t uid,
sessions[i].name[NAME_MAX - 1] = '\0';
sessions[i].enabled = session->enabled;
sessions[i].snapshot_mode = session->snapshot_mode;
sessions[i].name[NAME_MAX - 1] = '\0';
sessions[i].enabled = session->enabled;
sessions[i].snapshot_mode = session->snapshot_mode;
+ sessions[i].live_timer_interval = session->live_timer;
i++;
}
}
i++;
}
}
@@
-2738,7
+2797,7
@@
error:
/*
* Record a kernel snapshot.
*
/*
* Record a kernel snapshot.
*
- * Return
0
on success or a LTTNG_ERR code.
+ * Return
LTTNG_OK
on success or a LTTNG_ERR code.
*/
static int record_kernel_snapshot(struct ltt_kernel_session *ksess,
struct snapshot_output *output, struct ltt_session *session,
*/
static int record_kernel_snapshot(struct ltt_kernel_session *ksess,
struct snapshot_output *output, struct ltt_session *session,
@@
-2827,12
+2886,17
@@
static int record_ust_snapshot(struct ltt_ust_session *usess,
ret = ust_app_snapshot_record(usess, output, wait, nb_streams);
if (ret < 0) {
ret = ust_app_snapshot_record(usess, output, wait, nb_streams);
if (ret < 0) {
- if (ret == -EINVAL) {
+ switch (-ret) {
+ case EINVAL:
ret = LTTNG_ERR_INVALID;
ret = LTTNG_ERR_INVALID;
- goto error_snapshot;
+ break;
+ case ENODATA:
+ ret = LTTNG_ERR_SNAPSHOT_NODATA;
+ break;
+ default:
+ ret = LTTNG_ERR_SNAPSHOT_FAIL;
+ break;
}
}
-
- ret = LTTNG_ERR_SNAPSHOT_FAIL;
goto error_snapshot;
}
goto error_snapshot;
}
This page took
0.027597 seconds
and
4
git commands to generate.