X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=include%2Fwrapper%2Ffdtable.h;h=8b32c030cbb5b36eb42262a7b4228242756237be;hb=451e062751f0574bbb33390b072f5615d084e309;hp=9c11d02e9b853bae014ed9afa246541f04a45193;hpb=9f945e81a75cb152f0ecfca9c0b1d759fd15144b;p=lttng-modules.git diff --git a/include/wrapper/fdtable.h b/include/wrapper/fdtable.h index 9c11d02e..8b32c030 100644 --- a/include/wrapper/fdtable.h +++ b/include/wrapper/fdtable.h @@ -29,7 +29,7 @@ struct file *lttng_lookup_fdget_rcu(unsigned int fd) return NULL; return file; } -#else +#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,1,0)) static inline struct file *lttng_lookup_fdget_rcu(unsigned int fd) { @@ -39,6 +39,16 @@ struct file *lttng_lookup_fdget_rcu(unsigned int fd) return NULL; return file; } +#else +static inline +struct file *lttng_lookup_fdget_rcu(unsigned int fd) +{ + struct file* file = fcheck(fd); + + if (unlikely(!file || !atomic_long_inc_not_zero(&file->f_count))) + return NULL; + return file; +} #endif #if (LTTNG_LINUX_VERSION_CODE < LTTNG_KERNEL_VERSION(3,7,0))