Commit | Line | Data |
---|---|---|
df038819 | 1 | /* |
ab5be9fa | 2 | * Copyright (C) 2018 Jérémie Galarneau <jeremie.galarneau@efficios.com> |
df038819 | 3 | * |
ab5be9fa | 4 | * SPDX-License-Identifier: GPL-2.0-only |
df038819 | 5 | * |
df038819 JG |
6 | */ |
7 | ||
8 | #ifndef FD_TRACKER_UTILS_H | |
9 | #define FD_TRACKER_UTILS_H | |
10 | ||
dd95933f | 11 | #include <common/compat/directory-handle.h> |
184597e3 | 12 | #include <common/fd-tracker/fd-tracker.h> |
dd95933f | 13 | #include <common/macros.h> |
184597e3 JG |
14 | |
15 | struct lttng_poll_event; | |
16 | ||
df038819 JG |
17 | /* |
18 | * Utility implementing a close_fd callback which receives one file descriptor | |
19 | * and closes it, returning close()'s return value. | |
20 | */ | |
21 | int fd_tracker_util_close_fd(void *, int *fd); | |
22 | ||
c3e9c4c6 JG |
23 | /* |
24 | * Create a pipe and track its underlying fds. | |
25 | */ | |
5c1f54d1 JG |
26 | int fd_tracker_util_pipe_open_cloexec( |
27 | struct fd_tracker *tracker, const char *name, int *pipe); | |
c3e9c4c6 JG |
28 | int fd_tracker_util_pipe_close(struct fd_tracker *tracker, int *pipe); |
29 | ||
184597e3 JG |
30 | /* |
31 | * Create a poll event and track its underlying fd, if applicable. | |
32 | */ | |
5c1f54d1 JG |
33 | int fd_tracker_util_poll_create(struct fd_tracker *tracker, |
34 | const char *name, | |
35 | struct lttng_poll_event *events, | |
36 | int size, | |
37 | int flags); | |
38 | int fd_tracker_util_poll_clean( | |
39 | struct fd_tracker *tracker, struct lttng_poll_event *events); | |
184597e3 | 40 | |
dd95933f JG |
41 | struct lttng_directory_handle *fd_tracker_create_directory_handle( |
42 | struct fd_tracker *tracker, const char *path); | |
43 | ||
dd95933f JG |
44 | struct lttng_directory_handle *fd_tracker_create_directory_handle_from_handle( |
45 | struct fd_tracker *tracker, | |
46 | struct lttng_directory_handle *handle, | |
47 | const char *path); | |
48 | ||
df038819 | 49 | #endif /* FD_TRACKER_UTILS_H */ |