diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2014-08-08 17:21:35 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-08-08 18:57:22 -0400 |
commit | f9ea536ef80d7b3ce531943e2c6aae7c0fedd9bd (patch) | |
tree | aedd1005f8b4ac16cfa167a223c76b28aa56ad6d /fs | |
parent | cedbccab8bb104a1e2d6b40e3db2159b30c6cd76 (diff) |
proc: convert /proc/$PID/auxv to seq_file interface
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/proc/base.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c index 0e76895f47f5..154bbd353b10 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -205,22 +205,20 @@ static int proc_pid_cmdline(struct task_struct *task, char *buffer) | |||
205 | return get_cmdline(task, buffer, PAGE_SIZE); | 205 | return get_cmdline(task, buffer, PAGE_SIZE); |
206 | } | 206 | } |
207 | 207 | ||
208 | static int proc_pid_auxv(struct task_struct *task, char *buffer) | 208 | static int proc_pid_auxv(struct seq_file *m, struct pid_namespace *ns, |
209 | struct pid *pid, struct task_struct *task) | ||
209 | { | 210 | { |
210 | struct mm_struct *mm = mm_access(task, PTRACE_MODE_READ); | 211 | struct mm_struct *mm = mm_access(task, PTRACE_MODE_READ); |
211 | int res = PTR_ERR(mm); | ||
212 | if (mm && !IS_ERR(mm)) { | 212 | if (mm && !IS_ERR(mm)) { |
213 | unsigned int nwords = 0; | 213 | unsigned int nwords = 0; |
214 | do { | 214 | do { |
215 | nwords += 2; | 215 | nwords += 2; |
216 | } while (mm->saved_auxv[nwords - 2] != 0); /* AT_NULL */ | 216 | } while (mm->saved_auxv[nwords - 2] != 0); /* AT_NULL */ |
217 | res = nwords * sizeof(mm->saved_auxv[0]); | 217 | seq_write(m, mm->saved_auxv, nwords * sizeof(mm->saved_auxv[0])); |
218 | if (res > PAGE_SIZE) | ||
219 | res = PAGE_SIZE; | ||
220 | memcpy(buffer, mm->saved_auxv, res); | ||
221 | mmput(mm); | 218 | mmput(mm); |
222 | } | 219 | return 0; |
223 | return res; | 220 | } else |
221 | return PTR_ERR(mm); | ||
224 | } | 222 | } |
225 | 223 | ||
226 | 224 | ||
@@ -2557,7 +2555,7 @@ static const struct pid_entry tgid_base_stuff[] = { | |||
2557 | DIR("net", S_IRUGO|S_IXUGO, proc_net_inode_operations, proc_net_operations), | 2555 | DIR("net", S_IRUGO|S_IXUGO, proc_net_inode_operations, proc_net_operations), |
2558 | #endif | 2556 | #endif |
2559 | REG("environ", S_IRUSR, proc_environ_operations), | 2557 | REG("environ", S_IRUSR, proc_environ_operations), |
2560 | INF("auxv", S_IRUSR, proc_pid_auxv), | 2558 | ONE("auxv", S_IRUSR, proc_pid_auxv), |
2561 | ONE("status", S_IRUGO, proc_pid_status), | 2559 | ONE("status", S_IRUGO, proc_pid_status), |
2562 | ONE("personality", S_IRUSR, proc_pid_personality), | 2560 | ONE("personality", S_IRUSR, proc_pid_personality), |
2563 | INF("limits", S_IRUGO, proc_pid_limits), | 2561 | INF("limits", S_IRUGO, proc_pid_limits), |
@@ -2896,7 +2894,7 @@ static const struct pid_entry tid_base_stuff[] = { | |||
2896 | DIR("fdinfo", S_IRUSR|S_IXUSR, proc_fdinfo_inode_operations, proc_fdinfo_operations), | 2894 | DIR("fdinfo", S_IRUSR|S_IXUSR, proc_fdinfo_inode_operations, proc_fdinfo_operations), |
2897 | DIR("ns", S_IRUSR|S_IXUGO, proc_ns_dir_inode_operations, proc_ns_dir_operations), | 2895 | DIR("ns", S_IRUSR|S_IXUGO, proc_ns_dir_inode_operations, proc_ns_dir_operations), |
2898 | REG("environ", S_IRUSR, proc_environ_operations), | 2896 | REG("environ", S_IRUSR, proc_environ_operations), |
2899 | INF("auxv", S_IRUSR, proc_pid_auxv), | 2897 | ONE("auxv", S_IRUSR, proc_pid_auxv), |
2900 | ONE("status", S_IRUGO, proc_pid_status), | 2898 | ONE("status", S_IRUGO, proc_pid_status), |
2901 | ONE("personality", S_IRUSR, proc_pid_personality), | 2899 | ONE("personality", S_IRUSR, proc_pid_personality), |
2902 | INF("limits", S_IRUGO, proc_pid_limits), | 2900 | INF("limits", S_IRUGO, proc_pid_limits), |