Lines Matching defs:file
29 * about physical memory size (rss) for each mapped file, i.e.,
60 #include <linux/file.h>
113 * The classic example of a problem is opening file descriptors
335 * pos is 0, and set a flag in the 'struct file'.
393 static ssize_t proc_pid_cmdline_read(struct file *file, char __user *buf,
401 tsk = get_proc_task(file_inode(file));
418 * Provides a wchan file via kallsyms in a proper one-value-per-file format.
480 if (!file_ns_capable(m->file, &init_user_ns, CAP_SYS_ADMIN))
557 static int lstats_open(struct inode *inode, struct file *file)
559 return single_open(file, lstats_show_proc, inode);
562 static ssize_t lstats_write(struct file *file, const char __user *buf,
565 struct task_struct *task = get_proc_task(file_inode(file));
613 [RLIMIT_FSIZE] = {"Max file size", "bytes"},
616 [RLIMIT_CORE] = {"Max core file size", "bytes"},
622 [RLIMIT_LOCKS] = {"Max file locks", "locks"},
645 * print the file header
712 /* Allow access to a task's file descriptors if it is us or we
783 * may not stat() a file, it shouldn't be seen
818 static int proc_single_open(struct inode *inode, struct file *filp)
859 static int __mem_open(struct inode *inode, struct file *file, unsigned int mode)
866 file->private_data = mm;
870 static int mem_open(struct inode *inode, struct file *file)
872 if (WARN_ON_ONCE(!(file->f_op->fop_flags & FOP_UNSIGNED_OFFSET)))
874 return __mem_open(inode, file, PTRACE_MODE_ATTACH);
877 static bool proc_mem_foll_force(struct file *file, struct mm_struct *mm)
886 task = get_proc_task(file_inode(file));
899 static ssize_t mem_rw(struct file *file, char __user *buf,
902 struct mm_struct *mm = file->private_data;
920 if (proc_mem_foll_force(file, mm))
956 static ssize_t mem_read(struct file *file, char __user *buf,
959 return mem_rw(file, buf, count, ppos, 0);
962 static ssize_t mem_write(struct file *file, const char __user *buf,
965 return mem_rw(file, (char __user*)buf, count, ppos, 1);
968 loff_t mem_lseek(struct file *file, loff_t offset, int orig)
972 file->f_pos = offset;
975 file->f_pos += offset;
981 return file->f_pos;
984 static int mem_release(struct inode *inode, struct file *file)
986 struct mm_struct *mm = file->private_data;
1001 static int environ_open(struct inode *inode, struct file *file)
1003 return __mem_open(inode, file, PTRACE_MODE_READ);
1006 static ssize_t environ_read(struct file *file, char __user *buf,
1012 struct mm_struct *mm = file->private_data;
1076 static int auxv_open(struct inode *inode, struct file *file)
1078 return __mem_open(inode, file, PTRACE_MODE_READ_FSCREDS);
1081 static ssize_t auxv_read(struct file *file, char __user *buf,
1084 struct mm_struct *mm = file->private_data;
1103 static ssize_t oom_adj_read(struct file *file, char __user *buf, size_t count,
1106 struct task_struct *task = get_proc_task(file_inode(file));
1125 static int __set_oom_adj(struct file *file, int oom_adj, bool legacy)
1131 task = get_proc_task(file_inode(file));
1218 static ssize_t oom_adj_write(struct file *file, const char __user *buf,
1250 err = __set_oom_adj(file, oom_adj, true);
1261 static ssize_t oom_score_adj_read(struct file *file, char __user *buf,
1264 struct task_struct *task = get_proc_task(file_inode(file));
1277 static ssize_t oom_score_adj_write(struct file *file, const char __user *buf,
1300 err = __set_oom_adj(file, oom_score_adj, false);
1313 static ssize_t proc_loginuid_read(struct file * file, char __user * buf,
1316 struct inode * inode = file_inode(file);
1324 from_kuid(file->f_cred->user_ns,
1330 static ssize_t proc_loginuid_write(struct file * file, const char __user * buf,
1333 struct inode * inode = file_inode(file);
1362 kloginuid = make_kuid(file->f_cred->user_ns, loginuid);
1379 static ssize_t proc_sessionid_read(struct file * file, char __user * buf,
1382 struct inode * inode = file_inode(file);
1402 static ssize_t proc_fault_inject_read(struct file * file, char __user * buf,
1405 struct task_struct *task = get_proc_task(file_inode(file));
1420 static ssize_t proc_fault_inject_write(struct file * file,
1441 task = get_proc_task(file_inode(file));
1456 static ssize_t proc_fail_nth_write(struct file *file, const char __user *buf,
1467 task = get_proc_task(file_inode(file));
1476 static ssize_t proc_fail_nth_read(struct file *file, char __user *buf,
1483 task = get_proc_task(file_inode(file));
1518 sched_write(struct file *file, const char __user *buf,
1521 struct inode *inode = file_inode(file);
1534 static int sched_open(struct inode *inode, struct file *filp)
1567 sched_autogroup_write(struct file *file, const char __user *buf,
1570 struct inode *inode = file_inode(file);
1598 static int sched_autogroup_open(struct inode *inode, struct file *filp)
1626 p = get_proc_task(file_inode(m->file));
1636 static ssize_t timens_offsets_write(struct file *file, const char __user *buf,
1639 struct inode *inode = file_inode(file);
1645 /* Only allow < page size writes at the beginning of the file */
1698 ret = proc_timens_set_offset(file, p, offsets, noffsets);
1709 static int timens_offsets_open(struct inode *inode, struct file *filp)
1723 static ssize_t comm_write(struct file *file, const char __user *buf,
1726 struct inode *inode = file_inode(file);
1767 static int comm_open(struct inode *inode, struct file *filp)
1783 struct file *exe_file;
1809 /* Are we allowed to snoop on the tasks file descriptors? */
1852 /* Are we allowed to snoop on the tasks file descriptors? */
1879 * proc file for a task.
1899 * Before the /proc/pid/status file was created the only way to read
2112 * file type from dcache entry.
2120 bool proc_fill_cache(struct file *file, struct dir_context *ctx,
2124 struct dentry *child, *dir = file->f_path.dentry;
2300 * ancestor directories in the path to the file in question.
2402 proc_map_files_readdir(struct file *file, struct dir_context *ctx)
2416 task = get_proc_task(file_inode(file));
2425 if (!dir_emit_dots(file, ctx))
2479 if (!proc_fill_cache(file, ctx,
2572 static int proc_timers_open(struct inode *inode, struct file *file)
2576 tp = __seq_open_private(file, &proc_timers_seq_ops,
2594 static ssize_t timerslack_ns_write(struct file *file, const char __user *buf,
2597 struct inode *inode = file_inode(file);
2674 static int timerslack_ns_open(struct inode *inode, struct file *filp)
2738 static int proc_pident_readdir(struct file *file, struct dir_context *ctx,
2741 struct task_struct *task = get_proc_task(file_inode(file));
2747 if (!dir_emit_dots(file, ctx))
2754 if (!proc_fill_cache(file, ctx, p->name, p->len,
2765 static int proc_pid_attr_open(struct inode *inode, struct file *file)
2767 file->private_data = NULL;
2768 __mem_open(inode, file, PTRACE_MODE_READ_FSCREDS);
2772 static ssize_t proc_pid_attr_read(struct file * file, char __user * buf,
2775 struct inode * inode = file_inode(file);
2784 file->f_path.dentry->d_name.name,
2793 static ssize_t proc_pid_attr_write(struct file * file, const char __user * buf,
2796 struct inode * inode = file_inode(file);
2802 if (file->private_data != current->mm)
2842 file->f_path.dentry->d_name.name, page,
2860 static int proc_##LSM##_attr_dir_iterate(struct file *filp, \
2921 static int proc_attr_dir_readdir(struct file *file, struct dir_context *ctx)
2923 return proc_pident_readdir(file, ctx,
2950 static ssize_t proc_coredump_filter_read(struct file *file, char __user *buf,
2953 struct task_struct *task = get_proc_task(file_inode(file));
2977 static ssize_t proc_coredump_filter_write(struct file *file,
2994 task = get_proc_task(file_inode(file));
3099 static int proc_id_map_open(struct inode *inode, struct file *file,
3117 ret = seq_open(file, seq_ops);
3121 seq = file->private_data;
3131 static int proc_id_map_release(struct inode *inode, struct file *file)
3133 struct seq_file *seq = file->private_data;
3136 return seq_release(inode, file);
3139 static int proc_uid_map_open(struct inode *inode, struct file *file)
3141 return proc_id_map_open(inode, file, &proc_uid_seq_operations);
3144 static int proc_gid_map_open(struct inode *inode, struct file *file)
3146 return proc_id_map_open(inode, file, &proc_gid_seq_operations);
3149 static int proc_projid_map_open(struct inode *inode, struct file *file)
3151 return proc_id_map_open(inode, file, &proc_projid_seq_operations);
3178 static int proc_setgroups_open(struct inode *inode, struct file *file)
3195 if (file->f_mode & FMODE_WRITE) {
3201 ret = single_open(file, &proc_setgroups_show, ns);
3212 static int proc_setgroups_release(struct inode *inode, struct file *file)
3214 struct seq_file *seq = file->private_data;
3216 int ret = single_release(inode, file);
3428 static int proc_tgid_base_readdir(struct file *file, struct dir_context *ctx)
3430 return proc_pident_readdir(file, ctx,
3440 struct pid *tgid_pidfd_to_pid(const struct file *file)
3442 if (file->f_op != &proc_tgid_base_operations)
3445 return proc_pid(file_inode(file));
3575 int proc_pid_readdir(struct file *file, struct dir_context *ctx)
3578 struct proc_fs_info *fs_info = proc_sb_info(file_inode(file)->i_sb);
3579 struct pid_namespace *ns = proc_pid_ns(file_inode(file)->i_sb);
3611 if (!proc_fill_cache(file, ctx, name, len,
3646 /* This file (/proc/<pid>/task/<tid>/comm) can always be
3764 static int proc_tid_base_readdir(struct file *file, struct dir_context *ctx)
3766 return proc_pident_readdir(file, ctx,
3920 static int proc_task_readdir(struct file *file, struct dir_context *ctx)
3922 struct inode *inode = file_inode(file);
3930 if (!dir_emit_dots(file, ctx))
3937 tid = (int)(intptr_t)file->private_data;
3938 file->private_data = NULL;
3949 if (!proc_fill_cache(file, ctx, name, len,
3953 file->private_data = (void *)(intptr_t)tid;
3979 * proc_task_readdir() set @file->private_data to a positive integer
3985 static loff_t proc_dir_llseek(struct file *file, loff_t offset, int whence)
3987 u64 cookie = (u64)(intptr_t)file->private_data;
3990 off = generic_llseek_cookie(file, offset, whence, &cookie);
3992 file->private_data = (void *)(intptr_t)cookie; /* serialized by f_pos_lock */