Lines Matching full:fd
3 * Wrapper functions for accessing the file_struct fd array.
44 struct fd { struct
51 static inline bool fd_empty(struct fd f) in fd_empty() argument
56 #define EMPTY_FD (struct fd){0}
57 static inline struct fd BORROWED_FD(struct file *f) in BORROWED_FD()
59 return (struct fd){(unsigned long)f}; in BORROWED_FD()
61 static inline struct fd CLONED_FD(struct file *f) in CLONED_FD()
63 return (struct fd){(unsigned long)f | FDPUT_FPUT}; in CLONED_FD()
66 static inline void fdput(struct fd fd) in fdput() argument
68 if (fd.word & FDPUT_FPUT) in fdput()
69 fput(fd_file(fd)); in fdput()
72 extern struct file *fget(unsigned int fd);
73 extern struct file *fget_raw(unsigned int fd);
74 extern struct file *fget_task(struct task_struct *task, unsigned int fd);
77 struct fd fdget(unsigned int fd);
78 struct fd fdget_raw(unsigned int fd);
79 struct fd fdget_pos(unsigned int fd);
81 static inline void fdput_pos(struct fd f) in fdput_pos()
88 DEFINE_CLASS(fd, struct fd, fdput(_T), fdget(fd), int fd)
89 DEFINE_CLASS(fd_raw, struct fd, fdput(_T), fdget_raw(fd), int fd)
92 extern int replace_fd(unsigned fd, struct file *file, unsigned flags);
93 extern void set_close_on_exec(unsigned int fd, int flag);
94 extern bool get_close_on_exec(unsigned int fd);
97 extern void put_unused_fd(unsigned int fd);
104 * take_fd() will take care to set @fd to -EBADF ensuring that
110 * CLASS(get_unused_fd, fd)(O_CLOEXEC);
111 * if (fd < 0)
112 * return fd;
118 * fd_install(fd, f);
119 * return take_fd(fd);
121 #define take_fd(fd) __get_and_null(fd, -EBADF) argument
123 extern void fd_install(unsigned int fd, struct file *file);