From facc1162cc341da6eb82a6aef22e6ebf0e97c460 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Sun, 5 May 2019 18:47:26 -0400 Subject: [PATCH] Allow direct access to the dirfd of a directory handle MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Serialization functions need access to the dirfd of a directory handle in order to pass the fd and re-build the directory handle in another process. This function should not be used for other purposes. It is also only available in the 'enable-dirfd' configuration, which is assumed for the session daemon. Signed-off-by: Jérémie Galarneau --- src/common/compat/directory-handle.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/common/compat/directory-handle.h b/src/common/compat/directory-handle.h index fbdc19179..605c3dc81 100644 --- a/src/common/compat/directory-handle.h +++ b/src/common/compat/directory-handle.h @@ -32,6 +32,14 @@ struct lttng_directory_handle { int dirfd; }; + +static inline +int lttng_directory_handle_get_dirfd( + const struct lttng_directory_handle *handle) +{ + return handle->dirfd; +} + #else struct lttng_directory_handle { char *base_path; -- 2.34.1