From dd970ee8196b857ce89278a55b7ac471593dc95d Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Mon, 24 Feb 2020 15:15:36 -0500 Subject: [PATCH] fix: move lttng_close_on_exec to proper wrapper Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers Change-Id: I330c6d63fc9c1af00c9a9471563d322d036b9a9c --- lttng-statedump-impl.c | 3 +-- wrapper/fdtable.h | 17 +++++++++++++++++ wrapper/time.h | 43 ------------------------------------------ 3 files changed, 18 insertions(+), 45 deletions(-) delete mode 100644 wrapper/time.h diff --git a/lttng-statedump-impl.c b/lttng-statedump-impl.c index fb609e34..2828b190 100644 --- a/lttng-statedump-impl.c +++ b/lttng-statedump-impl.c @@ -41,7 +41,6 @@ #include #include #include -#include #include #include #include @@ -56,7 +55,7 @@ #include #include #include -#include +#include #ifdef CONFIG_LTTNG_HAS_LIST_IRQ #include diff --git a/wrapper/fdtable.h b/wrapper/fdtable.h index 7e74290e..69ff4aa3 100644 --- a/wrapper/fdtable.h +++ b/wrapper/fdtable.h @@ -41,4 +41,21 @@ int lttng_iterate_fd(struct files_struct *files, #define lttng_iterate_fd iterate_fd #endif + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) + +static inline bool lttng_close_on_exec(int fd, const struct fdtable *fdt) +{ + return close_on_exec(fd, fdt); +} + +#else + +static inline bool lttng_close_on_exec(int fd, const struct fdtable *fdt) +{ + return FD_ISSET(fd, fdt->close_on_exec); +} + +#endif + #endif /* _LTTNG_WRAPPER_FDTABLE_H */ diff --git a/wrapper/time.h b/wrapper/time.h deleted file mode 100644 index f33791f0..00000000 --- a/wrapper/time.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef _LTTNG_WRAPPER_TIME_H -#define _LTTNG_WRAPPER_TIME_H - -/* - * wrapper/time.h - * - * Copyright (C) 2015 Mathieu Desnoyers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; only - * version 2.1 of the License. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) - -static inline bool lttng_close_on_exec(int fd, const struct fdtable *fdt) -{ - return close_on_exec(fd, fdt); -} - -#else - -static inline bool lttng_close_on_exec(int fd, const struct fdtable *fdt) -{ - return FD_ISSET(fd, fdt->close_on_exec); -} - -#endif - -#endif /* _LTTNG_WRAPPER_TIME_H */ -- 2.34.1