Fix: destroy called twice on quit pipe
[lttng-tools.git] / include / lttng / save.h
1 /*
2 * Copyright (C) 2013 - Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 *
4 * This library is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License, version 2.1 only,
6 * as published by the Free Software Foundation.
7 *
8 * This library is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
11 * for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this library; if not, write to the Free Software Foundation,
15 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17
18 #ifndef LTTNG_SAVE_H
19 #define LTTNG_SAVE_H
20
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24
25 /*
26 * The lttng_save_session_attr object is opaque to the user. Use the helper
27 * functions below to use them.
28 */
29 struct lttng_save_session_attr;
30
31 /*
32 * Return a newly allocated save session attribute object or NULL on error.
33 */
34 struct lttng_save_session_attr *lttng_save_session_attr_create(void);
35
36 /*
37 * Free a given save session attribute object.
38 */
39 void lttng_save_session_attr_destroy(struct lttng_save_session_attr *output);
40
41
42 /*
43 * Save session attribute getter family functions.
44 */
45
46 /* Return session name. NULL indicated all sessions must be saved. */
47 const char *lttng_save_session_attr_get_session_name(
48 struct lttng_save_session_attr *attr);
49 /*
50 * Return destination URL. A NULL value indicates the default session
51 * configuration location. The URL format used is documented in lttng(1).
52 * NULL indicates that the default session configuration path is used.
53 */
54 const char *lttng_save_session_attr_get_output_url(
55 struct lttng_save_session_attr *attr);
56 /*
57 * Return the configuration overwrite attribute. This attribute indicates
58 * whether or not existing configuration files must be overwritten.
59 */
60 int lttng_save_session_attr_get_overwrite(
61 struct lttng_save_session_attr *attr);
62 /*
63 * Return the omit name configuration attribute. This attribute indicates
64 * whether or not the saved sessions' names should be omitted.
65 */
66 int lttng_save_session_attr_get_omit_name(
67 struct lttng_save_session_attr *attr);
68 /*
69 * Return the omit output configuration attribute. This attribute indicates
70 * whether or not the saved sessions' output configuration should be omitted.
71 */
72 int lttng_save_session_attr_get_omit_output(
73 struct lttng_save_session_attr *attr);
74
75 /*
76 * Save session attribute setter family functions.
77 *
78 * For every set* call, 0 is returned on success or else -LTTNG_ERR_INVALID is
79 * returned indicating that at least one given parameter is invalid.
80 */
81
82 /*
83 * Set the name of the session to save. A NULL name means all sessions
84 * known to the session daemon will be saved.
85 */
86 int lttng_save_session_attr_set_session_name(
87 struct lttng_save_session_attr *attr, const char *session_name);
88 /*
89 * Set the URL of the session configuration to save. A NULL value indicates the
90 * use of the default location being the session one. The URL's format is is
91 * documented in lttng(1).
92 */
93 int lttng_save_session_attr_set_output_url(
94 struct lttng_save_session_attr *attr, const char *url);
95 /*
96 * Set the overwrite attribute. If set to true, files of the same name as the
97 * current session configuration URL will be overwritten.
98 */
99 int lttng_save_session_attr_set_overwrite(
100 struct lttng_save_session_attr *attr, int overwrite);
101 /*
102 * Set the omit name attribute. If set to true, the sessions' names are omitted
103 * from the resulting session configuration file.
104 */
105 int lttng_save_session_attr_set_omit_name(
106 struct lttng_save_session_attr *attr, int omit_name);
107 /*
108 * Set the omit output attribute. If set to true, the sessions' output
109 * configurations are omitted from the resulting session configuration file.
110 */
111 int lttng_save_session_attr_set_omit_output(
112 struct lttng_save_session_attr *attr, int omit_output);
113
114 /*
115 * Save session configuration(s).
116 *
117 * The lttng_save_session_attr object must not be NULL. No ownership of the
118 * object is kept by the function; it must be released by the caller.
119 *
120 * Returns 0 on success or a negative LTTNG_ERR value on error.
121 */
122 int lttng_save_session(struct lttng_save_session_attr *attr);
123
124 #ifdef __cplusplus
125 }
126 #endif
127
128 #endif /* LTTNG_SAVE_H */
This page took 0.031571 seconds and 4 git commands to generate.