2 * Copyright (C) 2019 Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 * Copyright (C) 2019 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 * SPDX-License-Identifier: LGPL-2.1-only
9 #ifndef LTTNG_CLEAR_HANDLE_H
10 #define LTTNG_CLEAR_HANDLE_H
12 #include <lttng/lttng-error.h>
13 #include <lttng/lttng-export.h>
20 @addtogroup api_session_clear
25 @struct lttng_clear_handle
28 \lt_obj_c_session clearing handle (opaque type).
30 struct lttng_clear_handle
;
34 Return type of \lt_obj_session clearing handle functions.
36 Error status enumerators have a negative value.
38 enum lttng_clear_handle_status
{
40 LTTNG_CLEAR_HANDLE_STATUS_OK
= 0,
42 /// Recording session clearing operation completed.
43 LTTNG_CLEAR_HANDLE_STATUS_COMPLETED
= 1,
46 LTTNG_CLEAR_HANDLE_STATUS_TIMEOUT
= 2,
48 /// Unsatisfied precondition.
49 LTTNG_CLEAR_HANDLE_STATUS_INVALID
= -1,
52 LTTNG_CLEAR_HANDLE_STATUS_ERROR
= -2,
57 Destroys the \lt_obj_session clearing handle \lt_p{handle}.
61 Recording session clearing handle to destroy.
66 LTTNG_EXPORT
extern void lttng_clear_handle_destroy(struct lttng_clear_handle
*handle
);
70 Waits for the \lt_obj_session clearing operation identified by
71 \lt_p{handle} to complete.
73 If this function returns #LTTNG_CLEAR_HANDLE_STATUS_COMPLETED, then the
74 recording session clearing operation identified by \lt_p{handle}
75 completed. This doesn't mean, however, that the clearing operation
76 itself succeeded; use lttng_clear_handle_get_result() to know this.
79 Recording session clearing handle which identifies the clearing
80 operation of which to wait for completion.
82 Maximum time (milliseconds) to wait for the completion of the
83 recording session clearing operation identified by \lt_p{handle}
84 before returning #LTTNG_CLEAR_HANDLE_STATUS_TIMEOUT, or
85 <code>-1</code> to wait indefinitely.
87 @retval #LTTNG_CLEAR_HANDLE_STATUS_COMPLETED
88 The recording session clearing operation identified by \lt_p{handle}
89 completed (with or without success).
90 @retval #LTTNG_CLEAR_HANDLE_STATUS_INVALID
91 Unsatisfied precondition.
92 @retval #LTTNG_CLEAR_HANDLE_STATUS_TIMEOUT
93 The function waited for the completion of the recording session
94 clearing operation for more than \lt_p{timeout_ms} ms.
95 @retval #LTTNG_CLEAR_HANDLE_STATUS_ERROR
98 @lt_pre_not_null{handle}
100 @sa lttng_clear_handle_get_result() --
101 Returns whether or not a recording session clearing operation
104 LTTNG_EXPORT
extern enum lttng_clear_handle_status
105 lttng_clear_handle_wait_for_completion(struct lttng_clear_handle
*handle
, int timeout_ms
);
109 Sets \lt_p{*result} to the result of the \lt_obj_session clearing
110 operation identified by \lt_p{handle}.
112 You must successfully wait for the completion of the recording session
113 clearing operation identified by \lt_p{handle} with
114 lttng_clear_handle_wait_for_completion() before you call this function.
116 On success, \lt_p{*result} is #LTTNG_OK if the clearing operation was
120 Handle of the recording session clearing operation of which to get
124 <strong>On success</strong>, this function sets \lt_p{*result} to
125 the result of the recording session clearing operation identified by
128 \lt_p{*result} is #LTTNG_OK if the clearing operation was
132 @retval #LTTNG_CLEAR_HANDLE_STATUS_OK
133 Success: \lt_p{*result} is the result of the recording session
134 clearing operation identified by \lt_p{handle}.
135 @retval #LTTNG_CLEAR_HANDLE_STATUS_INVALID
136 Unsatisfied precondition.
137 @retval #LTTNG_CLEAR_HANDLE_STATUS_ERROR
140 @lt_pre_not_null{handle}
142 You successfully waited for the completion of the recording session
143 clearing operation identified by \lt_p{handle} with
144 lttng_clear_handle_wait_for_completion().
145 @lt_pre_not_null{result}
147 @sa lttng_clear_handle_wait_for_completion() --
148 Waits for a recording session clearing operation to complete.
150 LTTNG_EXPORT
extern enum lttng_clear_handle_status
151 lttng_clear_handle_get_result(const struct lttng_clear_handle
*handle
,
152 enum lttng_error_code
*result
);
160 #endif /* LTTNG_CLEAR_HANDLE_H */