hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/include/linux/file.h
....@@ -9,6 +9,7 @@
99 #include <linux/compiler.h>
1010 #include <linux/types.h>
1111 #include <linux/posix_types.h>
12
+#include <linux/errno.h>
1213
1314 struct file;
1415
....@@ -16,6 +17,7 @@
1617 extern void fput_many(struct file *, unsigned int);
1718
1819 struct file_operations;
20
+struct task_struct;
1921 struct vfsmount;
2022 struct dentry;
2123 struct inode;
....@@ -47,6 +49,7 @@
4749 extern struct file *fget(unsigned int fd);
4850 extern struct file *fget_many(unsigned int fd, unsigned int refs);
4951 extern struct file *fget_raw(unsigned int fd);
52
+extern struct file *fget_task(struct task_struct *task, unsigned int fd);
5053 extern unsigned long __fdget(unsigned int fd);
5154 extern unsigned long __fdget_raw(unsigned int fd);
5255 extern unsigned long __fdget_pos(unsigned int fd);
....@@ -83,12 +86,33 @@
8386 extern int replace_fd(unsigned fd, struct file *file, unsigned flags);
8487 extern void set_close_on_exec(unsigned int fd, int flag);
8588 extern bool get_close_on_exec(unsigned int fd);
89
+extern int __get_unused_fd_flags(unsigned flags, unsigned long nofile);
8690 extern int get_unused_fd_flags(unsigned flags);
8791 extern void put_unused_fd(unsigned int fd);
8892
8993 extern void fd_install(unsigned int fd, struct file *file);
9094
95
+extern int __receive_fd(int fd, struct file *file, int __user *ufd,
96
+ unsigned int o_flags);
97
+static inline int receive_fd_user(struct file *file, int __user *ufd,
98
+ unsigned int o_flags)
99
+{
100
+ if (ufd == NULL)
101
+ return -EFAULT;
102
+ return __receive_fd(-1, file, ufd, o_flags);
103
+}
104
+static inline int receive_fd(struct file *file, unsigned int o_flags)
105
+{
106
+ return __receive_fd(-1, file, NULL, o_flags);
107
+}
108
+static inline int receive_fd_replace(int fd, struct file *file, unsigned int o_flags)
109
+{
110
+ return __receive_fd(fd, file, NULL, o_flags);
111
+}
112
+
91113 extern void flush_delayed_fput(void);
92114 extern void __fput_sync(struct file *);
93115
116
+extern unsigned int sysctl_nr_open_min, sysctl_nr_open_max;
117
+
94118 #endif /* __LINUX_FILE_H */