1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef _LINUX_PID_FS_H 3 #define _LINUX_PID_FS_H 4 5 #include <linux/gfp_types.h> 6 #include <linux/pid.h> 7 8 struct coredump_params; 9 10 struct file *pidfs_alloc_file(struct pid *pid, unsigned int flags); 11 void __init pidfs_init(void); 12 void pidfs_prepare_pid(struct pid *pid); 13 int pidfs_add_pid(struct pid *pid); 14 void pidfs_remove_pid(struct pid *pid); 15 void pidfs_exit(struct task_struct *tsk); 16 #ifdef CONFIG_COREDUMP 17 void pidfs_coredump(const struct coredump_params *cprm); 18 #endif 19 extern const struct dentry_operations pidfs_dentry_operations; 20 int pidfs_register_pid_gfp(struct pid *pid, gfp_t gfp); 21 22 /** 23 * pidfs_register_pid - register a struct pid in pidfs 24 * @pid: pid to pin 25 * 26 * Register a struct pid in pidfs. 27 * 28 * Return: On success zero, on error a negative error code is returned. 29 */ pidfs_register_pid(struct pid * pid)30static inline int pidfs_register_pid(struct pid *pid) 31 { 32 return pidfs_register_pid_gfp(pid, GFP_KERNEL); 33 } 34 35 void pidfs_free_pid(struct pid *pid); 36 int __pidfs_register_pids(struct pid *const *pids, enum pid_type last); 37 38 /* Register the pids of an array declared with DECLARE_PIDS(). */ 39 #define pidfs_register_pids(pids) __pidfs_register_pids(pids, pids_last(pids)) 40 41 #endif /* _LINUX_PID_FS_H */ 42