2 * Copyright (C) 2019 - Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 * Copyright (C) 2019 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 * This library is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU Lesser General Public License, version 2.1 only,
7 * as published by the Free Software Foundation.
9 * This library is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this library; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 #ifndef LTTNG_CLEAR_HANDLE_H
20 #define LTTNG_CLEAR_HANDLE_H
22 #include <lttng/lttng-error.h>
29 * Handle used to represent a specific instance of session clear
32 struct lttng_clear_handle
;
35 * Negative values indicate errors. Values >= 0 indicate success.
37 enum lttng_clear_handle_status
{
38 LTTNG_CLEAR_HANDLE_STATUS_ERROR
= -2,
39 LTTNG_CLEAR_HANDLE_STATUS_INVALID
= -1,
40 LTTNG_CLEAR_HANDLE_STATUS_OK
= 0,
41 LTTNG_CLEAR_HANDLE_STATUS_COMPLETED
= 1,
42 LTTNG_CLEAR_HANDLE_STATUS_TIMEOUT
= 2,
46 * Destroy an lttng_clear_handle.
47 * The handle should be discarded after this call.
49 extern void lttng_clear_handle_destroy(struct lttng_clear_handle
*handle
);
52 * Wait for a session clear operation to complete.
54 * A negative timeout_ms value can be used to wait indefinitely.
56 * Returns LTTNG_CLEAR_HANDLE_STATUS_COMPLETED if the session clear
57 * operation was completed. LTTNG_CLEAR_HANDLE_STATUS_TIMEOUT is returned
58 * to indicate that the wait timed out.
59 * On error, one of the negative lttng_clear_handle_status is returned.
61 * Note: This function returning a success status does not mean that
62 * the clear operation itself succeeded; it indicates that the _wait_
63 * operation completed successfully.
65 extern enum lttng_clear_handle_status
66 lttng_clear_handle_wait_for_completion(
67 struct lttng_clear_handle
*handle
, int timeout_ms
);
70 * Get the result of a session clear operation.
72 * This function must be used on a clear handle which was successfully waited
75 * Returns LTTNG_CLEAR_HANDLE_STATUS_OK if the result of the session
76 * clear operation could be obtained. Check the value of 'result' to
77 * determine if the session clear operation completed successfully or not.
79 * On error, one of the negative lttng_clear_handle_status is returned.
80 * Returns LTTNG_CLEAR_HANDLE_STATUS_INVALID if the clear operation
81 * was not waited-on using the handle or if the arguments of the function are
82 * invalid (e.g. NULL).
84 extern enum lttng_clear_handle_status
85 lttng_clear_handle_get_result(
86 const struct lttng_clear_handle
*handle
,
87 enum lttng_error_code
*result
);
89 #endif /* LTTNG_CLEAR_HANDLE_H */