X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fkernel.c;h=4bb418949d3ea330b60397ed2352f5541c7fcbdc;hp=00bfbbc2be5400d460e2c7dd7c273335f7d444b4;hb=ccf10263bcd2ca4667b9e1fc4dab64a3c8d8c4d8;hpb=c052142c0fb4ce4cd13999218852ceb2d07ea51e diff --git a/src/bin/lttng-sessiond/kernel.c b/src/bin/lttng-sessiond/kernel.c index 00bfbbc2b..4bb418949 100644 --- a/src/bin/lttng-sessiond/kernel.c +++ b/src/bin/lttng-sessiond/kernel.c @@ -16,6 +16,7 @@ */ #define _GNU_SOURCE +#define _LGPL_SOURCE #include #include #include @@ -173,6 +174,7 @@ error: /* * Create a kernel event, enable it to the kernel tracer and add it to the * channel event list of the kernel session. + * We own filter_expression and filter. */ int kernel_create_event(struct lttng_event *ev, struct ltt_kernel_channel *channel) @@ -365,6 +367,20 @@ int kernel_disable_syscall(const char *syscall_name, return kernctl_disable_syscall(channel->fd, syscall_name); } +int kernel_track_pid(struct ltt_kernel_session *session, int pid) +{ + DBG("Kernel track PID %d for session id %" PRIu64 ".", + pid, session->id); + return kernctl_track_pid(session->fd, pid); +} + +int kernel_untrack_pid(struct ltt_kernel_session *session, int pid) +{ + DBG("Kernel untrack PID %d for session id %" PRIu64 ".", + pid, session->id); + return kernctl_untrack_pid(session->fd, pid); +} + /* * Create kernel metadata, open from the kernel tracer and add it to the * kernel session. @@ -792,6 +808,7 @@ void kernel_destroy_session(struct ltt_kernel_session *ksess) struct lttng_ht_iter iter; /* For each consumer socket. */ + rcu_read_lock(); cds_lfht_for_each_entry(ksess->consumer->socks->ht, &iter.iter, socket, node.node) { struct ltt_kernel_channel *chan; @@ -805,6 +822,7 @@ void kernel_destroy_session(struct ltt_kernel_session *ksess) } } } + rcu_read_unlock(); } /* Close any relayd session */ @@ -849,7 +867,8 @@ void kernel_destroy_channel(struct ltt_kernel_channel *kchan) * Return 0 on success or else return a LTTNG_ERR code. */ int kernel_snapshot_record(struct ltt_kernel_session *ksess, - struct snapshot_output *output, int wait, uint64_t max_size_per_stream) + struct snapshot_output *output, int wait, + uint64_t nb_packets_per_stream) { int err, ret, saved_metadata_fd; struct consumer_socket *socket; @@ -910,7 +929,7 @@ int kernel_snapshot_record(struct ltt_kernel_session *ksess, ret = consumer_snapshot_channel(socket, chan->fd, output, 0, ksess->uid, ksess->gid, DEFAULT_KERNEL_TRACE_DIR, wait, - max_size_per_stream); + nb_packets_per_stream); pthread_mutex_unlock(socket->lock); if (ret < 0) { ret = LTTNG_ERR_KERN_CONSUMER_FAIL; @@ -924,7 +943,7 @@ int kernel_snapshot_record(struct ltt_kernel_session *ksess, pthread_mutex_lock(socket->lock); ret = consumer_snapshot_channel(socket, ksess->metadata->fd, output, 1, ksess->uid, ksess->gid, - DEFAULT_KERNEL_TRACE_DIR, wait, max_size_per_stream); + DEFAULT_KERNEL_TRACE_DIR, wait, 0); pthread_mutex_unlock(socket->lock); if (ret < 0) { ret = LTTNG_ERR_KERN_CONSUMER_FAIL;