36a92473a0b6ec7c2c1162e779448f0885d3d4d7
2 * Copyright (C) 2020 Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 * SPDX-License-Identifier: LGPL-2.1-only
11 #include <common/macros.h>
18 * Wrapper around a file descriptor providing reference counting semantics.
20 * An fd_handle will close() the underlying file descriptor when its reference
25 /* Create a file descriptor handle. */
26 struct fd_handle
*fd_handle_create(int fd
);
28 /* Acquire reference to a file descriptor handle. */
29 void fd_handle_get(struct fd_handle
*handle
);
31 /* Release reference to a file descriptor handle. */
32 void fd_handle_put(struct fd_handle
*handle
);
35 * Return the underlying file descriptor of a file descriptor handle.
37 * This function can't fail.
39 int fd_handle_get_fd(struct fd_handle
*handle
);
42 * Obtain a copy of a file descriptor handle.
44 * On success, the caller becomes the sole owner of the returned file descriptor
45 * handle. The underlying file descriptor is duplicated using dup(). Refer to
46 * the system documentation for the semantics of dup() for this particular file
49 struct fd_handle
*fd_handle_copy(const struct fd_handle
*handle
);
55 #endif /* FS_HANDLE_H */
This page took 0.033284 seconds and 4 git commands to generate.