| 1 | /* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only) |
| 2 | * |
| 3 | * wrapper/fdtable.h |
| 4 | * |
| 5 | * Copyright (C) 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| 6 | */ |
| 7 | |
| 8 | #ifndef _LTTNG_WRAPPER_FDTABLE_H |
| 9 | #define _LTTNG_WRAPPER_FDTABLE_H |
| 10 | |
| 11 | #include <lttng/kernel-version.h> |
| 12 | #include <linux/fdtable.h> |
| 13 | #include <linux/sched.h> |
| 14 | |
| 15 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,11,0)) |
| 16 | static inline |
| 17 | struct file *lttng_lookup_fd_rcu(unsigned int fd) |
| 18 | { |
| 19 | return lookup_fd_rcu(fd); |
| 20 | } |
| 21 | #else |
| 22 | static inline |
| 23 | struct file *lttng_lookup_fd_rcu(unsigned int fd) |
| 24 | { |
| 25 | return fcheck(fd); |
| 26 | } |
| 27 | #endif |
| 28 | |
| 29 | #endif /* _LTTNG_WRAPPER_FDTABLE_H */ |