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>
14 * Wrapper around a file descriptor providing reference counting semantics.
16 * An fd_handle will close() the underlying file descriptor when its reference
21 /* Create a file descriptor handle. */
23 struct fd_handle
*fd_handle_create(int fd
);
25 /* Acquire reference to a file descriptor handle. */
27 void fd_handle_get(struct fd_handle
*handle
);
29 /* Release reference to a file descriptor handle. */
31 void fd_handle_put(struct fd_handle
*handle
);
34 * Return the underlying file descriptor of a file descriptor handle.
36 * 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
50 struct fd_handle
*fd_handle_copy(const struct fd_handle
*handle
);
52 #endif /* FS_HANDLE_H */
This page took 0.029485 seconds and 4 git commands to generate.