summaryrefslogtreecommitdiffstats
path: root/include/linux/fdtable.h
diff options
context:
space:
mode:
authorAl Viro2012-08-22 04:32:06 +0200
committerAl Viro2012-09-27 03:09:59 +0200
commitc3c073f808b22dfae15ef8412b6f7b998644139a (patch)
tree3369bcbe414738d90e6ccfe257f6ce3e72f6a5ae /include/linux/fdtable.h
parentmake expand_files() and alloc_fd() static (diff)
downloadkernel-qcow2-linux-c3c073f808b22dfae15ef8412b6f7b998644139a.tar.gz
kernel-qcow2-linux-c3c073f808b22dfae15ef8412b6f7b998644139a.tar.xz
kernel-qcow2-linux-c3c073f808b22dfae15ef8412b6f7b998644139a.zip
new helper: iterate_fd()
iterates through the opened files in given descriptor table, calling a supplied function; we stop once non-zero is returned. Callback gets struct file *, descriptor number and const void * argument passed to iterator. It is called with files->file_lock held, so it is not allowed to block. tty_io, netprio_cgroup and selinux flush_unauthorized_files() converted to its use. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'include/linux/fdtable.h')
-rw-r--r--include/linux/fdtable.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/fdtable.h b/include/linux/fdtable.h
index de2b71caa0f0..fb7dacae0522 100644
--- a/include/linux/fdtable.h
+++ b/include/linux/fdtable.h
@@ -98,6 +98,9 @@ void reset_files_struct(struct files_struct *);
int unshare_files(struct files_struct **);
struct files_struct *dup_fd(struct files_struct *, int *);
void do_close_on_exec(struct files_struct *);
+int iterate_fd(struct files_struct *, unsigned,
+ int (*)(const void *, struct file *, unsigned),
+ const void *);
extern int __alloc_fd(struct files_struct *files,
unsigned start, unsigned end, unsigned flags);