From: Michael Jeanson Date: Mon, 24 Feb 2020 20:15:36 +0000 (-0500) Subject: fix: move lttng_close_on_exec to proper wrapper X-Git-Tag: before-upstreaming~30 X-Git-Url: http://git.lttng.org/?p=lttng-modules.git;a=commitdiff_plain;h=c07dca48244f57469b8965a2006a8671a8b39fc0 fix: move lttng_close_on_exec to proper wrapper Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers Change-Id: I330c6d63fc9c1af00c9a9471563d322d036b9a9c --- diff --git a/lttng-statedump-impl.c b/lttng-statedump-impl.c index 2ead9b6f..f3ae1937 100644 --- a/lttng-statedump-impl.c +++ b/lttng-statedump-impl.c @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include @@ -43,7 +42,7 @@ #include #include #include -#include +#include #ifdef CONFIG_LTTNG_HAS_LIST_IRQ #include diff --git a/wrapper/fdtable.h b/wrapper/fdtable.h index 72830a50..8f735597 100644 --- a/wrapper/fdtable.h +++ b/wrapper/fdtable.h @@ -28,4 +28,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 527615af..00000000 --- a/wrapper/time.h +++ /dev/null @@ -1,30 +0,0 @@ -/* SPDX-License-Identifier: (GPL-2.0 or LGPL-2.1) - * - * wrapper/time.h - * - * Copyright (C) 2015 Mathieu Desnoyers - */ - -#ifndef _LTTNG_WRAPPER_TIME_H -#define _LTTNG_WRAPPER_TIME_H - -#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 */