X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fcmd.c;h=139133210406882cf8e3359287a892bb228c9c5b;hb=aecf2da5ff4c92398b58af71ec10a3c2a311076e;hp=f152c1c2ed191269a19aace219679916a88e0cfb;hpb=55c9e7cac24318259d4f2549c97f7577b7b52db4;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index f152c1c2e..139133210 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -1,19 +1,9 @@ /* - * Copyright (C) 2012 - David Goulet - * Copyright (C) 2016 - Jérémie Galarneau + * Copyright (C) 2012 David Goulet + * Copyright (C) 2016 Jérémie Galarneau * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License, version 2 only, as - * published by the Free Software Foundation. + * SPDX-License-Identifier: GPL-2.0-only * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #define _LGPL_SOURCE @@ -2581,13 +2571,12 @@ ssize_t cmd_list_syscalls(struct lttng_event **events) * * Called with session lock held. */ -ssize_t cmd_list_tracker_ids(enum lttng_tracker_type tracker_type, +int cmd_list_tracker_ids(enum lttng_tracker_type tracker_type, struct ltt_session *session, enum lttng_domain_type domain, - struct lttng_tracker_id **ids) + struct lttng_tracker_ids **ids) { - int ret; - ssize_t nr_pids = 0; + int ret = LTTNG_OK; switch (domain) { case LTTNG_DOMAIN_KERNEL: @@ -2595,9 +2584,9 @@ ssize_t cmd_list_tracker_ids(enum lttng_tracker_type tracker_type, struct ltt_kernel_session *ksess; ksess = session->kernel_session; - nr_pids = kernel_list_tracker_ids(tracker_type, ksess, ids); - if (nr_pids < 0) { - ret = LTTNG_ERR_KERN_LIST_FAIL; + ret = kernel_list_tracker_ids(tracker_type, ksess, ids); + if (ret != LTTNG_OK) { + ret = -LTTNG_ERR_KERN_LIST_FAIL; goto error; } break; @@ -2607,9 +2596,9 @@ ssize_t cmd_list_tracker_ids(enum lttng_tracker_type tracker_type, struct ltt_ust_session *usess; usess = session->ust_session; - nr_pids = trace_ust_list_tracker_ids(tracker_type, usess, ids); - if (nr_pids < 0) { - ret = LTTNG_ERR_UST_LIST_FAIL; + ret = trace_ust_list_tracker_ids(tracker_type, usess, ids); + if (ret != LTTNG_OK) { + ret = -LTTNG_ERR_UST_LIST_FAIL; goto error; } break; @@ -2618,15 +2607,13 @@ ssize_t cmd_list_tracker_ids(enum lttng_tracker_type tracker_type, case LTTNG_DOMAIN_JUL: case LTTNG_DOMAIN_PYTHON: default: - ret = LTTNG_ERR_UND; + ret = -LTTNG_ERR_UND; goto error; } - return nr_pids; - error: /* Return negative value to differentiate return code */ - return -ret; + return ret; } /* @@ -2654,7 +2641,8 @@ int cmd_start_trace(struct ltt_session *session) /* Is the session already started? */ if (session->active) { ret = LTTNG_ERR_TRACE_ALREADY_STARTED; - goto error; + /* Perform nothing */ + goto end; } if (session->rotation_state == LTTNG_ROTATION_STATE_ONGOING && @@ -2782,6 +2770,7 @@ error: session->cleared_after_last_stop = session_cleared_after_last_stop; } +end: return ret; } @@ -4585,7 +4574,7 @@ int64_t get_session_nb_packets_per_stream(const struct ltt_session *session, } cur_nb_packets++; } - if (!cur_nb_packets) { + if (!cur_nb_packets && size_left != max_size) { /* Not enough room to grab one packet of each stream, error. */ return -1; }