| 1 | /* SPDX-License-Identifier: (GPL-2.0 or LGPL-2.1) |
| 2 | * |
| 3 | * wrapper/file.h |
| 4 | * |
| 5 | * wrapper around linux/file.h. |
| 6 | * |
| 7 | * Copyright (C) 2014 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| 8 | */ |
| 9 | |
| 10 | #ifndef _LTTNG_WRAPPER_FILE_H |
| 11 | #define _LTTNG_WRAPPER_FILE_H |
| 12 | |
| 13 | #include <linux/version.h> |
| 14 | #include <linux/file.h> |
| 15 | |
| 16 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) |
| 17 | |
| 18 | static |
| 19 | inline int lttng_get_unused_fd(void) |
| 20 | { |
| 21 | return get_unused_fd_flags(0); |
| 22 | } |
| 23 | |
| 24 | #define lttng_f_dentry f_path.dentry |
| 25 | |
| 26 | #else /* #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) */ |
| 27 | |
| 28 | static |
| 29 | inline int lttng_get_unused_fd(void) |
| 30 | { |
| 31 | return get_unused_fd(); |
| 32 | } |
| 33 | |
| 34 | #define lttng_f_dentry f_dentry |
| 35 | |
| 36 | #endif /* #else #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) */ |
| 37 | |
| 38 | #endif /* _LTTNG_WRAPPER_FILE_H */ |