| 1 | /* SPDX-License-Identifier: (GPL-2.0 or LGPL-2.1) |
| 2 | * |
| 3 | * wrapper/time.h |
| 4 | * |
| 5 | * Copyright (C) 2015 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| 6 | */ |
| 7 | |
| 8 | #ifndef _LTTNG_WRAPPER_TIME_H |
| 9 | #define _LTTNG_WRAPPER_TIME_H |
| 10 | |
| 11 | #include <linux/version.h> |
| 12 | #include <linux/time.h> |
| 13 | |
| 14 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 15 | |
| 16 | static inline bool lttng_close_on_exec(int fd, const struct fdtable *fdt) |
| 17 | { |
| 18 | return close_on_exec(fd, fdt); |
| 19 | } |
| 20 | |
| 21 | #else |
| 22 | |
| 23 | static inline bool lttng_close_on_exec(int fd, const struct fdtable *fdt) |
| 24 | { |
| 25 | return FD_ISSET(fd, fdt->close_on_exec); |
| 26 | } |
| 27 | |
| 28 | #endif |
| 29 | |
| 30 | #endif /* _LTTNG_WRAPPER_TIME_H */ |