/* * descriptor table is not shared, so files can't change or go away. */ static struct spu_context *coredump_next_context(int *fd) { struct file *file; int n = iterate_fd(current->files, *fd, match_context, NULL); if (!n) return NULL; *fd = n - 1; file = fcheck(*fd); return SPUFS_I(file->f_dentry->d_inode)->i_ctx; }
static void cgrp_attach(struct cgroup_taskset *tset) { struct cgroup_subsys_state *css; struct task_struct *p; cgroup_taskset_for_each(p, css, tset) { task_lock(p); iterate_fd(p->files, 0, update_classid_sock, (void *)(unsigned long)css_cls_state(css)->classid); task_unlock(p); }
static void cgrp_attach(struct cgroup *cgrp, struct cgroup_taskset *tset) { struct task_struct *p; void *v; cgroup_taskset_for_each(p, cgrp, tset) { task_lock(p); v = (void *)(unsigned long)task_cls_classid(p); iterate_fd(p->files, 0, update_classid, v); task_unlock(p); }
static void update_classid(struct cgroup_subsys_state *css, void *v) { struct css_task_iter it; struct task_struct *p; css_task_iter_start(css, &it); while ((p = css_task_iter_next(&it))) { task_lock(p); iterate_fd(p->files, 0, update_classid_sock, v); task_unlock(p); } css_task_iter_end(&it); }
/* * Check the fds open by this process and warn if something like the following * scenario is about to occur: * * fd1 = open("foo", O_RDONLY); * fd2 = open("foo", O_RDWR); */ static void ovl_do_check_copy_up(struct dentry *dentry) { if (ovl_check_copy_up) iterate_fd(current->files, 0, ovl_check_fd, dentry); }