X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fsessiond-timer.h;fp=src%2Fbin%2Flttng-sessiond%2Fsessiond-timer.h;h=e1b8a7eaded2d0a23ac34dad435611d319d90f19;hb=d086f507d02078aed618ab291a0bc4a634958fa3;hp=0000000000000000000000000000000000000000;hpb=4f5fb4c3d8752aae822ed0066784cc77e6f0f508;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/sessiond-timer.h b/src/bin/lttng-sessiond/sessiond-timer.h new file mode 100644 index 000000000..e1b8a7ead --- /dev/null +++ b/src/bin/lttng-sessiond/sessiond-timer.h @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2017 - Julien Desfossez + * + * 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. + * + * 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. + */ + +#ifndef SESSIOND_TIMER_H +#define SESSIOND_TIMER_H + +#include + +#include "session.h" + +#define LTTNG_SESSIOND_SIG_TEARDOWN SIGRTMIN + 10 +#define LTTNG_SESSIOND_SIG_EXIT SIGRTMIN + 11 + +#define CLOCKID CLOCK_MONOTONIC + +/* + * Handle timer teardown race wrt memory free of private data by sessiond + * signals are handled by a single thread, which permits a synchronization + * point between handling of each signal. Internal lock ensures mutual + * exclusion. + */ +struct timer_signal_data { + /* Thread managing signals. */ + pthread_t tid; + int qs_done; + pthread_mutex_t lock; +}; + +struct timer_thread_parameters { + struct rotation_thread_timer_queue *rotation_timer_queue; +}; + +struct sessiond_rotation_timer { + uint64_t session_id; + unsigned int signal; + /* List member in struct rotation_thread_timer_queue. */ + struct cds_list_head head; +}; + +void *sessiond_timer_thread(void *data); +int sessiond_timer_signal_init(void); + +#endif /* SESSIOND_TIMER_H */