Lines Matching +full:numbering +full:- +full:space
1 // SPDX-License-Identifier: GPL-2.0
27 * pidfd_show_fdinfo - print information about a pidfd
53 * - create two new pid namespaces ns1 and ns2 in the initial pid
56 * - create a process with a pidfd in ns1
57 * - send pidfd from ns1 to ns2
58 * - read /proc/self/fdinfo/<pidfd> and observe that both Pid and NSpid
65 pid_t nr = -1; in pidfd_show_fdinfo()
68 ns = proc_pid_ns(file_inode(m->file)->i_sb); in pidfd_show_fdinfo()
79 /* If nr is non-zero it means that 'pid' is valid and that in pidfd_show_fdinfo()
84 for (i = ns->level + 1; i <= pid->level; i++) in pidfd_show_fdinfo()
85 seq_put_decimal_ll(m, "\t", pid->numbers[i].nr); in pidfd_show_fdinfo()
98 bool thread = file->f_flags & PIDFD_THREAD; in pidfd_poll()
102 poll_wait(file, &pid->wait_pidfd, pts); in pidfd_poll()
105 * or the whole thread-group exits. in pidfd_poll()
111 else if (task->exit_state && (thread || thread_group_empty(task))) in pidfd_poll()
126 return -EINVAL; in pidfd_ioctl()
130 return -ESRCH; in pidfd_ioctl()
133 nsp = task->nsproxy; in pidfd_ioctl()
138 return -ESRCH; /* just pretend it didn't exist */ in pidfd_ioctl()
145 return -EACCES; in pidfd_ioctl()
151 get_cgroup_ns(nsp->cgroup_ns); in pidfd_ioctl()
152 ns_common = to_ns_common(nsp->cgroup_ns); in pidfd_ioctl()
157 get_ipc_ns(nsp->ipc_ns); in pidfd_ioctl()
158 ns_common = to_ns_common(nsp->ipc_ns); in pidfd_ioctl()
162 get_mnt_ns(nsp->mnt_ns); in pidfd_ioctl()
163 ns_common = to_ns_common(nsp->mnt_ns); in pidfd_ioctl()
167 ns_common = to_ns_common(nsp->net_ns); in pidfd_ioctl()
173 get_pid_ns(nsp->pid_ns_for_children); in pidfd_ioctl()
174 ns_common = to_ns_common(nsp->pid_ns_for_children); in pidfd_ioctl()
179 get_time_ns(nsp->time_ns); in pidfd_ioctl()
180 ns_common = to_ns_common(nsp->time_ns); in pidfd_ioctl()
185 get_time_ns(nsp->time_ns_for_children); in pidfd_ioctl()
186 ns_common = to_ns_common(nsp->time_ns_for_children); in pidfd_ioctl()
191 get_uts_ns(nsp->uts_ns); in pidfd_ioctl()
192 ns_common = to_ns_common(nsp->uts_ns); in pidfd_ioctl()
213 return -ENOIOCTLCMD; in pidfd_ioctl()
217 return -EOPNOTSUPP; in pidfd_ioctl()
234 if (file->f_op != &pidfs_file_operations) in pidfd_pid()
235 return ERR_PTR(-EBADF); in pidfd_pid()
236 return file_inode(file)->i_private; in pidfd_pid()
243 * Provide a fallback mechanism for 32-bit systems so processes remain
255 return -ENOSPC; in pidfs_inum()
269 *ino = pid->ino; in pidfs_inum()
276 * The vfs falls back to simple_setattr() if i_op->setattr() isn't
283 return -EOPNOTSUPP; in pidfs_setattr()
288 * User space expects pidfs inodes to have no file type in st_mode.
292 * type = s->st_mode & S_IFMT;
297 * Lf->ntype = Ntype = N_ANON_INODE;
308 struct inode *inode = d_inode(path->dentry); in pidfs_getattr()
311 stat->mode &= ~S_IFMT; in pidfs_getattr()
322 struct pid *pid = inode->i_private; in pidfs_evict_inode()
326 pidfs_free_inum(inode->i_ino); in pidfs_evict_inode()
352 inode->i_private = data; in pidfs_init_inode()
353 inode->i_flags |= S_PRIVATE; in pidfs_init_inode()
354 inode->i_mode |= S_IRWXU; in pidfs_init_inode()
355 inode->i_op = &pidfs_inode_operations; in pidfs_init_inode()
356 inode->i_fop = &pidfs_file_operations; in pidfs_init_inode()
358 * Inode numbering for pidfs start at RESERVED_PIDS + 1. This in pidfs_init_inode()
362 return pidfs_inum(data, &inode->i_ino); in pidfs_init_inode()
382 return -ENOMEM; in pidfs_init_fs_context()
384 ctx->ops = &pidfs_sops; in pidfs_init_fs_context()
385 ctx->dops = &pidfs_dentry_operations; in pidfs_init_fs_context()
386 fc->s_fs_info = (void *)&pidfs_stashed_ops; in pidfs_init_fs_context()
403 ret = path_from_stashed(&pid->stashed, pidfs_mnt, get_pid(pid), &path); in pidfs_alloc_file()