X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fcommon%2Fcompat%2Fdirectory-handle.c;h=f0139be29bced2a8f566d64dc0b77b49c93a3cca;hb=dd95933f8371a8c81ffc1dc5b306f2263f1ff808;hp=9548da216298ff23980e5e84dcf8cc24975c5608;hpb=57b1431829d660508840fc820a19ee27f5e1a711;p=lttng-tools.git diff --git a/src/common/compat/directory-handle.c b/src/common/compat/directory-handle.c index 9548da216..f0139be29 100644 --- a/src/common/compat/directory-handle.c +++ b/src/common/compat/directory-handle.c @@ -1,18 +1,8 @@ /* - * Copyright (C) 2019 - Jérémie Galarneau + * Copyright (C) 2019 Jérémie Galarneau * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License, version 2 only, - * as published by the Free Software Foundation. + * SPDX-License-Identifier: GPL-2.0-only * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include @@ -191,6 +181,10 @@ void lttng_directory_handle_release(struct urcu_ref *ref) struct lttng_directory_handle *handle = container_of(ref, struct lttng_directory_handle, ref); + if (handle->destroy_cb) { + handle->destroy_cb(handle, handle->destroy_cb_data); + } + if (handle->dirfd == AT_FDCWD || handle->dirfd == -1) { goto end; } @@ -248,6 +242,13 @@ int lttng_directory_handle_stat(const struct lttng_directory_handle *handle, return fstatat(handle->dirfd, path, st, 0); } +LTTNG_HIDDEN +bool lttng_directory_handle_uses_fd( + const struct lttng_directory_handle *handle) +{ + return handle->dirfd != AT_FDCWD; +} + static int lttng_directory_handle_mkdir( const struct lttng_directory_handle *handle, @@ -617,6 +618,13 @@ end: return ret; } +LTTNG_HIDDEN +bool lttng_directory_handle_uses_fd( + const struct lttng_directory_handle *handle) +{ + return false; +} + static int lttng_directory_handle_mkdir(const struct lttng_directory_handle *handle, const char *subdirectory, mode_t mode)