2 * Copyright (C) 2018 Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 * SPDX-License-Identifier: LGPL-2.1-only
8 #ifndef FD_TRACKER_UTILS_H
9 #define FD_TRACKER_UTILS_H
11 #include <common/compat/directory-handle.hpp>
12 #include <common/fd-tracker/fd-tracker.hpp>
13 #include <common/macros.hpp>
15 struct lttng_poll_event;
18 * Utility implementing a close_fd callback which receives one file descriptor
19 * and closes it, returning close()'s return value.
21 int fd_tracker_util_close_fd(void *, int *fd);
24 * Create a pipe and track its underlying fds.
26 int fd_tracker_util_pipe_open_cloexec(
27 struct fd_tracker *tracker, const char *name, int *pipe);
28 int fd_tracker_util_pipe_close(struct fd_tracker *tracker, int *pipe);
31 * Create a poll event and track its underlying fd, if applicable.
33 int fd_tracker_util_poll_create(struct fd_tracker *tracker,
35 struct lttng_poll_event *events,
38 int fd_tracker_util_poll_clean(
39 struct fd_tracker *tracker, struct lttng_poll_event *events);
41 struct lttng_directory_handle *fd_tracker_create_directory_handle(
42 struct fd_tracker *tracker, const char *path);
44 struct lttng_directory_handle *fd_tracker_create_directory_handle_from_handle(
45 struct fd_tracker *tracker,
46 struct lttng_directory_handle *handle,
49 #endif /* FD_TRACKER_UTILS_H */