Changeset View
Changeset View
Standalone View
Standalone View
sys/compat/linuxkpi/common/include/linux/file.h
Show First 20 Lines • Show All 180 Lines • ▼ Show 20 Lines | |||||
static inline struct fd fdget(unsigned int fd) | static inline struct fd fdget(unsigned int fd) | ||||
{ | { | ||||
struct linux_file *f = linux_fget(fd); | struct linux_file *f = linux_fget(fd); | ||||
return (struct fd){f}; | return (struct fd){f}; | ||||
} | } | ||||
#define file linux_file | #define file linux_file | ||||
#define fget(...) linux_fget(__VA_ARGS__) | #define fget(...) linux_fget(__VA_ARGS__) | ||||
#define fcheck(...) linux_fget(__VA_ARGS__) | |||||
hselasky: This function cannot be safely implemented under FreeBSD, because Linux use RCU to protect FD's… | |||||
#endif /* _LINUX_FILE_H_ */ | #endif /* _LINUX_FILE_H_ */ |
This function cannot be safely implemented under FreeBSD, because Linux use RCU to protect FD's while in FreeBSD we have a refcount. You need to use the existing fget() and don't forget to add a fput() call to release the refcount!
Please remove this #define