projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Update local copy of ust-abi.h to reflect addition of ns contexts
[lttng-tools.git]
/
src
/
bin
/
lttng-sessiond
/
trace-ust.c
diff --git
a/src/bin/lttng-sessiond/trace-ust.c
b/src/bin/lttng-sessiond/trace-ust.c
index 1c325fb259b24ca497618dbe1ba309052be8266b..cc166fd6f9413824e3a22f37016f73e704560dc8 100644
(file)
--- a/
src/bin/lttng-sessiond/trace-ust.c
+++ b/
src/bin/lttng-sessiond/trace-ust.c
@@
-25,6
+25,7
@@
#include <common/common.h>
#include <common/defaults.h>
#include <common/common.h>
#include <common/defaults.h>
+#include <common/trace-chunk.h>
#include "buffer-registry.h"
#include "trace-ust.h"
#include "buffer-registry.h"
#include "trace-ust.h"
@@
-170,7
+171,7
@@
no_match:
* lock MUST be acquired before calling this.
*/
struct ltt_ust_channel *trace_ust_find_channel_by_name(struct lttng_ht *ht,
* lock MUST be acquired before calling this.
*/
struct ltt_ust_channel *trace_ust_find_channel_by_name(struct lttng_ht *ht,
- char *name)
+ c
onst c
har *name)
{
struct lttng_ht_node_str *node;
struct lttng_ht_iter iter;
{
struct lttng_ht_node_str *node;
struct lttng_ht_iter iter;
@@
-356,6
+357,10
@@
struct ltt_ust_channel *trace_ust_create_channel(struct lttng_channel *chan,
luc->attr.switch_timer_interval = chan->attr.switch_timer_interval;
luc->attr.read_timer_interval = chan->attr.read_timer_interval;
luc->attr.output = (enum lttng_ust_output) chan->attr.output;
luc->attr.switch_timer_interval = chan->attr.switch_timer_interval;
luc->attr.read_timer_interval = chan->attr.read_timer_interval;
luc->attr.output = (enum lttng_ust_output) chan->attr.output;
+ luc->monitor_timer_interval = ((struct lttng_channel_extended *)
+ chan->attr.extended.ptr)->monitor_timer_interval;
+ luc->attr.u.s.blocking_timeout = ((struct lttng_channel_extended *)
+ chan->attr.extended.ptr)->blocking_timeout;
/* Translate to UST output enum */
switch (luc->attr.output) {
/* Translate to UST output enum */
switch (luc->attr.output) {
@@
-431,91
+436,99
@@
end:
* Allocate and initialize a ust event. Set name and event type.
* We own filter_expression, filter, and exclusion.
*
* Allocate and initialize a ust event. Set name and event type.
* We own filter_expression, filter, and exclusion.
*
- * Return
pointer to structure or NULL.
+ * Return
an lttng_error_code
*/
*/
-
struct ltt_ust_event *
trace_ust_create_event(struct lttng_event *ev,
+
enum lttng_error_code
trace_ust_create_event(struct lttng_event *ev,
char *filter_expression,
struct lttng_filter_bytecode *filter,
struct lttng_event_exclusion *exclusion,
char *filter_expression,
struct lttng_filter_bytecode *filter,
struct lttng_event_exclusion *exclusion,
- bool internal_event)
+ bool internal_event,
+ struct ltt_ust_event **ust_event)
{
{
- struct ltt_ust_event *lue;
+ struct ltt_ust_event *local_ust_event;
+ enum lttng_error_code ret = LTTNG_OK;
assert(ev);
if (exclusion && validate_exclusion(exclusion)) {
assert(ev);
if (exclusion && validate_exclusion(exclusion)) {
+ ret = LTTNG_ERR_INVALID;
goto error;
}
goto error;
}
- l
ue
= zmalloc(sizeof(struct ltt_ust_event));
- if (l
ue
== NULL) {
+ l
ocal_ust_event
= zmalloc(sizeof(struct ltt_ust_event));
+ if (l
ocal_ust_event
== NULL) {
PERROR("ust event zmalloc");
PERROR("ust event zmalloc");
+ ret = LTTNG_ERR_NOMEM;
goto error;
}
goto error;
}
- l
ue
->internal = internal_event;
+ l
ocal_ust_event
->internal = internal_event;
switch (ev->type) {
case LTTNG_EVENT_PROBE:
switch (ev->type) {
case LTTNG_EVENT_PROBE:
- l
ue
->attr.instrumentation = LTTNG_UST_PROBE;
+ l
ocal_ust_event
->attr.instrumentation = LTTNG_UST_PROBE;
break;
case LTTNG_EVENT_FUNCTION:
break;
case LTTNG_EVENT_FUNCTION:
- l
ue
->attr.instrumentation = LTTNG_UST_FUNCTION;
+ l
ocal_ust_event
->attr.instrumentation = LTTNG_UST_FUNCTION;
break;
case LTTNG_EVENT_FUNCTION_ENTRY:
break;
case LTTNG_EVENT_FUNCTION_ENTRY:
- l
ue
->attr.instrumentation = LTTNG_UST_FUNCTION;
+ l
ocal_ust_event
->attr.instrumentation = LTTNG_UST_FUNCTION;
break;
case LTTNG_EVENT_TRACEPOINT:
break;
case LTTNG_EVENT_TRACEPOINT:
- l
ue
->attr.instrumentation = LTTNG_UST_TRACEPOINT;
+ l
ocal_ust_event
->attr.instrumentation = LTTNG_UST_TRACEPOINT;
break;
default:
ERR("Unknown ust instrumentation type (%d)", ev->type);
break;
default:
ERR("Unknown ust instrumentation type (%d)", ev->type);
+ ret = LTTNG_ERR_INVALID;
goto error_free_event;
}
/* Copy event name */
goto error_free_event;
}
/* Copy event name */
- strncpy(l
ue
->attr.name, ev->name, LTTNG_UST_SYM_NAME_LEN);
- l
ue
->attr.name[LTTNG_UST_SYM_NAME_LEN - 1] = '\0';
+ strncpy(l
ocal_ust_event
->attr.name, ev->name, LTTNG_UST_SYM_NAME_LEN);
+ l
ocal_ust_event
->attr.name[LTTNG_UST_SYM_NAME_LEN - 1] = '\0';
switch (ev->loglevel_type) {
case LTTNG_EVENT_LOGLEVEL_ALL:
switch (ev->loglevel_type) {
case LTTNG_EVENT_LOGLEVEL_ALL:
- l
ue
->attr.loglevel_type = LTTNG_UST_LOGLEVEL_ALL;
- l
ue->attr.loglevel = -1;
/* Force to -1 */
+ l
ocal_ust_event
->attr.loglevel_type = LTTNG_UST_LOGLEVEL_ALL;
+ l
ocal_ust_event->attr.loglevel = -1;
/* Force to -1 */
break;
case LTTNG_EVENT_LOGLEVEL_RANGE:
break;
case LTTNG_EVENT_LOGLEVEL_RANGE:
- l
ue
->attr.loglevel_type = LTTNG_UST_LOGLEVEL_RANGE;
- l
ue
->attr.loglevel = ev->loglevel;
+ l
ocal_ust_event
->attr.loglevel_type = LTTNG_UST_LOGLEVEL_RANGE;
+ l
ocal_ust_event
->attr.loglevel = ev->loglevel;
break;
case LTTNG_EVENT_LOGLEVEL_SINGLE:
break;
case LTTNG_EVENT_LOGLEVEL_SINGLE:
- l
ue
->attr.loglevel_type = LTTNG_UST_LOGLEVEL_SINGLE;
- l
ue
->attr.loglevel = ev->loglevel;
+ l
ocal_ust_event
->attr.loglevel_type = LTTNG_UST_LOGLEVEL_SINGLE;
+ l
ocal_ust_event
->attr.loglevel = ev->loglevel;
break;
default:
ERR("Unknown ust loglevel type (%d)", ev->loglevel_type);
break;
default:
ERR("Unknown ust loglevel type (%d)", ev->loglevel_type);
+ ret = LTTNG_ERR_INVALID;
goto error_free_event;
}
/* Same layout. */
goto error_free_event;
}
/* Same layout. */
- l
ue
->filter_expression = filter_expression;
- l
ue
->filter = filter;
- l
ue
->exclusion = exclusion;
+ l
ocal_ust_event
->filter_expression = filter_expression;
+ l
ocal_ust_event
->filter = filter;
+ l
ocal_ust_event
->exclusion = exclusion;
/* Init node */
/* Init node */
- lttng_ht_node_init_str(&l
ue->node, lue
->attr.name);
+ lttng_ht_node_init_str(&l
ocal_ust_event->node, local_ust_event
->attr.name);
DBG2("Trace UST event %s, loglevel (%d,%d) created",
DBG2("Trace UST event %s, loglevel (%d,%d) created",
- lue->attr.name, lue->attr.loglevel_type,
- lue->attr.loglevel);
+ local_ust_event->attr.name, local_ust_event->attr.loglevel_type,
+ local_ust_event->attr.loglevel);
+
+ *ust_event = local_ust_event;
- return
lue
;
+ return
ret
;
error_free_event:
error_free_event:
- free(l
ue
);
+ free(l
ocal_ust_event
);
error:
free(filter_expression);
free(filter);
free(exclusion);
error:
free(filter_expression);
free(filter);
free(exclusion);
- return
NULL
;
+ return
ret
;
}
static
}
static
@@
-561,8
+574,8
@@
int trace_ust_context_type_event_to_ust(
/*
* Return 1 if contexts match, 0 otherwise.
*/
/*
* Return 1 if contexts match, 0 otherwise.
*/
-int trace_ust_match_context(struct ltt_ust_context *uctx,
- struct lttng_event_context *ctx)
+int trace_ust_match_context(
const
struct ltt_ust_context *uctx,
+
const
struct lttng_event_context *ctx)
{
int utype;
{
int utype;
@@
-611,7
+624,7
@@
int trace_ust_match_context(struct ltt_ust_context *uctx,
* Return pointer to structure or NULL.
*/
struct ltt_ust_context *trace_ust_create_context(
* Return pointer to structure or NULL.
*/
struct ltt_ust_context *trace_ust_create_context(
- struct lttng_event_context *ctx)
+
const
struct lttng_event_context *ctx)
{
struct ltt_ust_context *uctx = NULL;
int utype;
{
struct ltt_ust_context *uctx = NULL;
int utype;
@@
-815,13
+828,14
@@
int trace_ust_pid_tracker_lookup(struct ltt_ust_session *session, int pid)
int trace_ust_track_pid(struct ltt_ust_session *session, int pid)
{
int retval = LTTNG_OK;
int trace_ust_track_pid(struct ltt_ust_session *session, int pid)
{
int retval = LTTNG_OK;
+ bool should_update_apps = false;
if (pid == -1) {
/* Track all pids: destroy tracker if exists. */
if (session->pid_tracker.ht) {
fini_pid_tracker(&session->pid_tracker);
/* Ensure all apps have session. */
if (pid == -1) {
/* Track all pids: destroy tracker if exists. */
if (session->pid_tracker.ht) {
fini_pid_tracker(&session->pid_tracker);
/* Ensure all apps have session. */
-
ust_app_global_update_all(session)
;
+
should_update_apps = true
;
}
} else {
int ret;
}
} else {
int ret;
@@
-840,7
+854,7
@@
int trace_ust_track_pid(struct ltt_ust_session *session, int pid)
goto end;
}
/* Remove all apps from session except pid. */
goto end;
}
/* Remove all apps from session except pid. */
-
ust_app_global_update_all(session)
;
+
should_update_apps = true
;
} else {
struct ust_app *app;
} else {
struct ust_app *app;
@@
-852,10
+866,13
@@
int trace_ust_track_pid(struct ltt_ust_session *session, int pid)
/* Add session to application */
app = ust_app_find_by_pid(pid);
if (app) {
/* Add session to application */
app = ust_app_find_by_pid(pid);
if (app) {
-
ust_app_global_update(session, app)
;
+
should_update_apps = true
;
}
}
}
}
}
}
+ if (should_update_apps && session->active) {
+ ust_app_global_update_all(session);
+ }
end:
return retval;
}
end:
return retval;
}
@@
-1144,7
+1161,8
@@
static void destroy_domain_global(struct ltt_ust_domain_global *dom)
}
/*
}
/*
- * Cleanup ust session structure
+ * Cleanup ust session structure, keeping data required by
+ * destroy notifier.
*
* Should *NOT* be called with RCU read-side lock held.
*/
*
* Should *NOT* be called with RCU read-side lock held.
*/
@@
-1180,9
+1198,13
@@
void trace_ust_destroy_session(struct ltt_ust_session *session)
buffer_reg_uid_destroy(reg, session->consumer);
}
buffer_reg_uid_destroy(reg, session->consumer);
}
- consumer_output_put(session->consumer);
-
fini_pid_tracker(&session->pid_tracker);
fini_pid_tracker(&session->pid_tracker);
+ lttng_trace_chunk_put(session->current_trace_chunk);
+}
+/* Free elements needed by destroy notifiers. */
+void trace_ust_free_session(struct ltt_ust_session *session)
+{
+ consumer_output_put(session->consumer);
free(session);
}
free(session);
}
This page took
0.029646 seconds
and
5
git commands to generate.