[lttng-dev] [PATCH lttng-tools] Fix: kernel track/untrack error handling
Jérémie Galarneau
jeremie.galarneau at efficios.com
Sat Sep 5 12:18:36 EDT 2015
Merged, thanks!
While testing/reviewing this fix, I noticed that untracking a user
space PID before enabling one (leaving the ust session pid_tracker
uninitialized) would result in an "Invalid parameter" error being
returned to the client (see bug #931).
The following commit addresses the problem:
commit b894343d659df2f6aa9ed50532fd4d8c0757e089
Author: Jérémie Galarneau <jeremie.galarneau at efficios.com>
Date: Fri Sep 4 17:34:44 2015 -0400
Fix: Invalid parameter error reported when untracking PID
The LTTng client reports an "Invalid parameter" error if a PID is
untracked from the userspace domain before any PID is tracked in that
domain.
Fixes #931
Signed-off-by: Jérémie Galarneau <jeremie.galarneau at efficios.com>
Jérémie
On Wed, Sep 2, 2015 at 10:45 AM, Mathieu Desnoyers
<mathieu.desnoyers at efficios.com> wrote:
> Fixes: #918
>
> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
> ---
> src/bin/lttng-sessiond/kernel.c | 34 ++++++++++++++++++++++++++++++++--
> 1 file changed, 32 insertions(+), 2 deletions(-)
>
> diff --git a/src/bin/lttng-sessiond/kernel.c b/src/bin/lttng-sessiond/kernel.c
> index 570747f..381b83e 100644
> --- a/src/bin/lttng-sessiond/kernel.c
> +++ b/src/bin/lttng-sessiond/kernel.c
> @@ -379,16 +379,46 @@ error:
>
> int kernel_track_pid(struct ltt_kernel_session *session, int pid)
> {
> + int ret;
> +
> DBG("Kernel track PID %d for session id %" PRIu64 ".",
> pid, session->id);
> - return kernctl_track_pid(session->fd, pid);
> + ret = kernctl_track_pid(session->fd, pid);
> + if (!ret) {
> + return LTTNG_OK;
> + }
> + switch (errno) {
> + case EINVAL:
> + return LTTNG_ERR_INVALID;
> + case ENOMEM:
> + return LTTNG_ERR_NOMEM;
> + case EEXIST:
> + return LTTNG_ERR_PID_TRACKED;
> + default:
> + return LTTNG_ERR_UNK;
> + }
> }
>
> int kernel_untrack_pid(struct ltt_kernel_session *session, int pid)
> {
> + int ret;
> +
> DBG("Kernel untrack PID %d for session id %" PRIu64 ".",
> pid, session->id);
> - return kernctl_untrack_pid(session->fd, pid);
> + ret = kernctl_untrack_pid(session->fd, pid);
> + if (!ret) {
> + return LTTNG_OK;
> + }
> + switch (errno) {
> + case EINVAL:
> + return LTTNG_ERR_INVALID;
> + case ENOMEM:
> + return LTTNG_ERR_NOMEM;
> + case ENOENT:
> + return LTTNG_ERR_PID_NOT_TRACKED;
> + default:
> + return LTTNG_ERR_UNK;
> + }
> }
>
> ssize_t kernel_list_tracker_pids(struct ltt_kernel_session *session,
> --
> 2.1.4
>
--
Jérémie Galarneau
EfficiOS Inc.
http://www.efficios.com
More information about the lttng-dev
mailing list