Update version to 2.0-pre3
[lttng-tools.git] / liblttkconsumerd / liblttkconsumerd.h
CommitLineData
d4a1283e
JD
1/*
2 * Copyright (C) 2011 - Julien Desfossez <julien.desfossez@polymtl.ca>
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
82a3637f
DG
6 * as published by the Free Software Foundation; only version 2
7 * of the License.
d4a1283e
JD
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
1ce86c9a
JD
19#ifndef _LIBLTTKCONSUMERD_H
20#define _LIBLTTKCONSUMERD_H
d4a1283e 21
5dc18550 22#include "lttng-kconsumerd.h"
1ce86c9a 23#include "liblttsessiondcomm.h"
5dc18550 24
1ce86c9a
JD
25/*
26 * When the receiving thread dies, we need to have a way to make
27 * the polling thread exit eventually.
28 * If all FDs hang up (normal case when the ltt-sessiond stops),
29 * we can exit cleanly, but if there is a problem and for whatever
30 * reason some FDs remain open, the consumer should still exit eventually.
31 *
32 * If the timeout is reached, it means that during this period
33 * no events occurred on the FDs so we need to force an exit.
34 * This case should not happen but it is a safety to ensure we won't block
35 * the consumer indefinitely.
36 *
37 * The value of 2 seconds is an arbitrary choice.
38 */
39#define KCONSUMERD_POLL_GRACE_PERIOD 2000
40
41struct kconsumerd_fd_list {
d4a1283e
JD
42 struct cds_list_head head;
43};
44
45/*
46 * Internal representation of the FDs,
47 * sessiond_fd is used to identify uniquely a fd
48 */
1ce86c9a 49struct kconsumerd_fd {
d4a1283e
JD
50 struct cds_list_head list;
51 int sessiond_fd; /* used to identify uniquely a fd with sessiond */
52 int consumerd_fd; /* fd to consume */
53 int out_fd; /* output file to write the data */
54 off_t out_fd_offset; /* write position in the output file descriptor */
55 char path_name[PATH_MAX]; /* tracefile name */
5dc18550 56 enum kconsumerd_fd_state state;
d4a1283e
JD
57 unsigned long max_sb_size; /* the subbuffer size for this channel */
58};
59
4de84ad9 60int kconsumerd_init(void);
1ce86c9a 61int kconsumerd_send_error(enum lttcomm_return_code cmd);
4de84ad9 62int kconsumerd_poll_socket(struct pollfd *kconsumerd_sockpoll);
1ce86c9a
JD
63void *kconsumerd_thread_poll_fds(void *data);
64void *kconsumerd_thread_receive_fds(void *data);
3dcd2721
MD
65void kconsumerd_should_exit(void);
66void kconsumerd_cleanup(void);
1ce86c9a
JD
67void kconsumerd_set_error_socket(int sock);
68void kconsumerd_set_command_socket_path(char *sock);
69
70#endif /* _LIBLTTKCONSUMERD_H */
This page took 0.03594 seconds and 4 git commands to generate.