2 * Copyright (C) 2019 - Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License, version 2 only,
6 * as published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 #ifndef _COMPAT_DIRECTORY_HANDLE_H
19 #define _COMPAT_DIRECTORY_HANDLE_H
21 #include <common/macros.h>
22 #include <common/credentials.h>
25 * Some platforms, such as Solaris 10, do not support directory file descriptors
26 * and their associated functions (*at(...)), which are defined in POSIX.2008.
28 * This wrapper provides a handle that is either a copy of a directory's path
29 * or a directory file descriptors, depending on the platform's capabilities.
32 struct lttng_directory_handle
{
36 struct lttng_directory_handle
{
42 * Initialize a directory handle to the provided path. Passing a NULL path
43 * returns a handle to the current working directory. The working directory
44 * is not sampled; it will be accessed at the time of use of the functions
47 * An initialized directory handle must be finalized using
48 * lttng_directory_handle_fini().
51 int lttng_directory_handle_init(struct lttng_directory_handle
*handle
,
55 int lttng_directory_handle_init_from_dirfd(
56 struct lttng_directory_handle
*handle
, int dirfd
);
59 * Release the resources of a directory handle.
62 void lttng_directory_handle_fini(struct lttng_directory_handle
*handle
);
65 * Create a subdirectory relative to a directory handle.
68 int lttng_directory_handle_create_subdirectory(
69 const struct lttng_directory_handle
*handle
,
70 const char *subdirectory
,
74 * Create a subdirectory relative to a directory handle
78 int lttng_directory_handle_create_subdirectory_as_user(
79 const struct lttng_directory_handle
*handle
,
80 const char *subdirectory
,
81 mode_t mode
, const struct lttng_credentials
*creds
);
84 * Recursively create a directory relative to a directory handle.
87 int lttng_directory_handle_create_subdirectory_recursive(
88 const struct lttng_directory_handle
*handle
,
89 const char *subdirectory_path
,
93 * Recursively create a directory relative to a directory handle
97 int lttng_directory_handle_create_subdirectory_recursive_as_user(
98 const struct lttng_directory_handle
*handle
,
99 const char *subdirectory_path
,
100 mode_t mode
, const struct lttng_credentials
*creds
);
102 #endif /* _COMPAT_PATH_HANDLE_H */
This page took 0.031689 seconds and 4 git commands to generate.