common: move utils_create_lock_file to its own file
[lttng-tools.git] / src / common / fd-tracker / utils.hpp
... / ...
CommitLineData
1/*
2 * Copyright (C) 2018 Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.1-only
5 *
6 */
7
8#ifndef FD_TRACKER_UTILS_H
9#define FD_TRACKER_UTILS_H
10
11#include <common/compat/directory-handle.hpp>
12#include <common/compat/poll.hpp>
13#include <common/fd-tracker/fd-tracker.hpp>
14#include <common/macros.hpp>
15
16/*
17 * Utility implementing a close_fd callback which receives one file descriptor
18 * and closes it, returning close()'s return value.
19 */
20int fd_tracker_util_close_fd(void *, int *fd);
21
22/*
23 * Create a pipe and track its underlying fds.
24 */
25int fd_tracker_util_pipe_open_cloexec(struct fd_tracker *tracker, const char *name, int *pipe);
26int fd_tracker_util_pipe_close(struct fd_tracker *tracker, int *pipe);
27
28/*
29 * Create a poll event and track its underlying fd, if applicable.
30 */
31int fd_tracker_util_poll_create(struct fd_tracker *tracker,
32 const char *name,
33 struct lttng_poll_event *events,
34 int size,
35 int flags);
36int fd_tracker_util_poll_clean(struct fd_tracker *tracker, struct lttng_poll_event *events);
37
38struct lttng_directory_handle *fd_tracker_create_directory_handle(struct fd_tracker *tracker,
39 const char *path);
40
41struct lttng_directory_handle *fd_tracker_create_directory_handle_from_handle(
42 struct fd_tracker *tracker, struct lttng_directory_handle *handle, const char *path);
43
44#endif /* FD_TRACKER_UTILS_H */
This page took 0.022935 seconds and 4 git commands to generate.