X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Flib%2Flttng-ctl%2Frotate.c;h=daba7afa2318ab3b504632192502b589475732b1;hp=d9871dc9d3e9f6c651126f917d765321adc116f2;hb=ab5be9fa2eb5ba9600a82cd18fd3cfcbac69169a;hpb=ed9f1fb24a21b222c23684cdf8e77b4d21c21895 diff --git a/src/lib/lttng-ctl/rotate.c b/src/lib/lttng-ctl/rotate.c index d9871dc9d..daba7afa2 100644 --- a/src/lib/lttng-ctl/rotate.c +++ b/src/lib/lttng-ctl/rotate.c @@ -1,18 +1,8 @@ /* - * Copyright (C) 2017 - Julien Desfossez + * Copyright (C) 2017 Julien Desfossez * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License, version 2.1 only, - * as published by the Free Software Foundation. + * SPDX-License-Identifier: LGPL-2.1-only * - * This library 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #define _LGPL_SOURCE @@ -233,7 +223,7 @@ int lttng_rotate_session(const char *session_name, sizeof(lsm.session.name)); ret = lttng_ctl_ask_sessiond(&lsm, (void **) &rotate_return); - if (ret < 0) { + if (ret <= 0) { *rotation_handle = NULL; goto end; } @@ -299,29 +289,33 @@ enum lttng_rotation_status lttng_rotation_update_schedule( switch (schedule->type) { case LTTNG_ROTATION_SCHEDULE_TYPE_SIZE_THRESHOLD: { + uint64_t threshold; + status = lttng_rotation_schedule_size_threshold_get_threshold( - schedule, &lsm.u.rotation_set_schedule.value); + schedule, &threshold); if (status != LTTNG_ROTATION_STATUS_OK) { if (status == LTTNG_ROTATION_STATUS_UNAVAILABLE) { status = LTTNG_ROTATION_STATUS_INVALID; } goto end; } - + lsm.u.rotation_set_schedule.value = threshold; lsm.u.rotation_set_schedule.set = !!add; break; } case LTTNG_ROTATION_SCHEDULE_TYPE_PERIODIC: { + uint64_t period; + status = lttng_rotation_schedule_periodic_get_period( - schedule, &lsm.u.rotation_set_schedule.value); + schedule, &period); if (status != LTTNG_ROTATION_STATUS_OK) { if (status == LTTNG_ROTATION_STATUS_UNAVAILABLE) { status = LTTNG_ROTATION_STATUS_INVALID; } goto end; } - + lsm.u.rotation_set_schedule.value = period; lsm.u.rotation_set_schedule.set = !!add; break; }