aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc/base.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/proc/base.c')
-rw-r--r--fs/proc/base.c181
1 files changed, 74 insertions, 107 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 2d696b0c93bf..043c83cb51f9 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -105,7 +105,7 @@
105 */ 105 */
106 106
107struct pid_entry { 107struct pid_entry {
108 char *name; 108 const char *name;
109 int len; 109 int len;
110 umode_t mode; 110 umode_t mode;
111 const struct inode_operations *iop; 111 const struct inode_operations *iop;
@@ -130,10 +130,6 @@ struct pid_entry {
130 { .proc_get_link = get_link } ) 130 { .proc_get_link = get_link } )
131#define REG(NAME, MODE, fops) \ 131#define REG(NAME, MODE, fops) \
132 NOD(NAME, (S_IFREG|(MODE)), NULL, &fops, {}) 132 NOD(NAME, (S_IFREG|(MODE)), NULL, &fops, {})
133#define INF(NAME, MODE, read) \
134 NOD(NAME, (S_IFREG|(MODE)), \
135 NULL, &proc_info_file_operations, \
136 { .proc_read = read } )
137#define ONE(NAME, MODE, show) \ 133#define ONE(NAME, MODE, show) \
138 NOD(NAME, (S_IFREG|(MODE)), \ 134 NOD(NAME, (S_IFREG|(MODE)), \
139 NULL, &proc_single_file_operations, \ 135 NULL, &proc_single_file_operations, \
@@ -200,27 +196,32 @@ static int proc_root_link(struct dentry *dentry, struct path *path)
200 return result; 196 return result;
201} 197}
202 198
203static int proc_pid_cmdline(struct task_struct *task, char *buffer) 199static int proc_pid_cmdline(struct seq_file *m, struct pid_namespace *ns,
200 struct pid *pid, struct task_struct *task)
204{ 201{
205 return get_cmdline(task, buffer, PAGE_SIZE); 202 /*
203 * Rely on struct seq_operations::show() being called once
204 * per internal buffer allocation. See single_open(), traverse().
205 */
206 BUG_ON(m->size < PAGE_SIZE);
207 m->count += get_cmdline(task, m->buf, PAGE_SIZE);
208 return 0;
206} 209}
207 210
208static int proc_pid_auxv(struct task_struct *task, char *buffer) 211static int proc_pid_auxv(struct seq_file *m, struct pid_namespace *ns,
212 struct pid *pid, struct task_struct *task)
209{ 213{
210 struct mm_struct *mm = mm_access(task, PTRACE_MODE_READ); 214 struct mm_struct *mm = mm_access(task, PTRACE_MODE_READ);
211 int res = PTR_ERR(mm);
212 if (mm && !IS_ERR(mm)) { 215 if (mm && !IS_ERR(mm)) {
213 unsigned int nwords = 0; 216 unsigned int nwords = 0;
214 do { 217 do {
215 nwords += 2; 218 nwords += 2;
216 } while (mm->saved_auxv[nwords - 2] != 0); /* AT_NULL */ 219 } while (mm->saved_auxv[nwords - 2] != 0); /* AT_NULL */
217 res = nwords * sizeof(mm->saved_auxv[0]); 220 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); 221 mmput(mm);
222 } 222 return 0;
223 return res; 223 } else
224 return PTR_ERR(mm);
224} 225}
225 226
226 227
@@ -229,7 +230,8 @@ static int proc_pid_auxv(struct task_struct *task, char *buffer)
229 * Provides a wchan file via kallsyms in a proper one-value-per-file format. 230 * Provides a wchan file via kallsyms in a proper one-value-per-file format.
230 * Returns the resolved symbol. If that fails, simply return the address. 231 * Returns the resolved symbol. If that fails, simply return the address.
231 */ 232 */
232static int proc_pid_wchan(struct task_struct *task, char *buffer) 233static int proc_pid_wchan(struct seq_file *m, struct pid_namespace *ns,
234 struct pid *pid, struct task_struct *task)
233{ 235{
234 unsigned long wchan; 236 unsigned long wchan;
235 char symname[KSYM_NAME_LEN]; 237 char symname[KSYM_NAME_LEN];
@@ -240,9 +242,9 @@ static int proc_pid_wchan(struct task_struct *task, char *buffer)
240 if (!ptrace_may_access(task, PTRACE_MODE_READ)) 242 if (!ptrace_may_access(task, PTRACE_MODE_READ))
241 return 0; 243 return 0;
242 else 244 else
243 return sprintf(buffer, "%lu", wchan); 245 return seq_printf(m, "%lu", wchan);
244 else 246 else
245 return sprintf(buffer, "%s", symname); 247 return seq_printf(m, "%s", symname);
246} 248}
247#endif /* CONFIG_KALLSYMS */ 249#endif /* CONFIG_KALLSYMS */
248 250
@@ -304,9 +306,10 @@ static int proc_pid_stack(struct seq_file *m, struct pid_namespace *ns,
304/* 306/*
305 * Provides /proc/PID/schedstat 307 * Provides /proc/PID/schedstat
306 */ 308 */
307static int proc_pid_schedstat(struct task_struct *task, char *buffer) 309static int proc_pid_schedstat(struct seq_file *m, struct pid_namespace *ns,
310 struct pid *pid, struct task_struct *task)
308{ 311{
309 return sprintf(buffer, "%llu %llu %lu\n", 312 return seq_printf(m, "%llu %llu %lu\n",
310 (unsigned long long)task->se.sum_exec_runtime, 313 (unsigned long long)task->se.sum_exec_runtime,
311 (unsigned long long)task->sched_info.run_delay, 314 (unsigned long long)task->sched_info.run_delay,
312 task->sched_info.pcount); 315 task->sched_info.pcount);
@@ -404,7 +407,8 @@ static const struct file_operations proc_cpuset_operations = {
404}; 407};
405#endif 408#endif
406 409
407static int proc_oom_score(struct task_struct *task, char *buffer) 410static int proc_oom_score(struct seq_file *m, struct pid_namespace *ns,
411 struct pid *pid, struct task_struct *task)
408{ 412{
409 unsigned long totalpages = totalram_pages + total_swap_pages; 413 unsigned long totalpages = totalram_pages + total_swap_pages;
410 unsigned long points = 0; 414 unsigned long points = 0;
@@ -414,12 +418,12 @@ static int proc_oom_score(struct task_struct *task, char *buffer)
414 points = oom_badness(task, NULL, NULL, totalpages) * 418 points = oom_badness(task, NULL, NULL, totalpages) *
415 1000 / totalpages; 419 1000 / totalpages;
416 read_unlock(&tasklist_lock); 420 read_unlock(&tasklist_lock);
417 return sprintf(buffer, "%lu\n", points); 421 return seq_printf(m, "%lu\n", points);
418} 422}
419 423
420struct limit_names { 424struct limit_names {
421 char *name; 425 const char *name;
422 char *unit; 426 const char *unit;
423}; 427};
424 428
425static const struct limit_names lnames[RLIM_NLIMITS] = { 429static const struct limit_names lnames[RLIM_NLIMITS] = {
@@ -442,12 +446,11 @@ static const struct limit_names lnames[RLIM_NLIMITS] = {
442}; 446};
443 447
444/* Display limits for a process */ 448/* Display limits for a process */
445static int proc_pid_limits(struct task_struct *task, char *buffer) 449static int proc_pid_limits(struct seq_file *m, struct pid_namespace *ns,
450 struct pid *pid, struct task_struct *task)
446{ 451{
447 unsigned int i; 452 unsigned int i;
448 int count = 0;
449 unsigned long flags; 453 unsigned long flags;
450 char *bufptr = buffer;
451 454
452 struct rlimit rlim[RLIM_NLIMITS]; 455 struct rlimit rlim[RLIM_NLIMITS];
453 456
@@ -459,35 +462,34 @@ static int proc_pid_limits(struct task_struct *task, char *buffer)
459 /* 462 /*
460 * print the file header 463 * print the file header
461 */ 464 */
462 count += sprintf(&bufptr[count], "%-25s %-20s %-20s %-10s\n", 465 seq_printf(m, "%-25s %-20s %-20s %-10s\n",
463 "Limit", "Soft Limit", "Hard Limit", "Units"); 466 "Limit", "Soft Limit", "Hard Limit", "Units");
464 467
465 for (i = 0; i < RLIM_NLIMITS; i++) { 468 for (i = 0; i < RLIM_NLIMITS; i++) {
466 if (rlim[i].rlim_cur == RLIM_INFINITY) 469 if (rlim[i].rlim_cur == RLIM_INFINITY)
467 count += sprintf(&bufptr[count], "%-25s %-20s ", 470 seq_printf(m, "%-25s %-20s ",
468 lnames[i].name, "unlimited"); 471 lnames[i].name, "unlimited");
469 else 472 else
470 count += sprintf(&bufptr[count], "%-25s %-20lu ", 473 seq_printf(m, "%-25s %-20lu ",
471 lnames[i].name, rlim[i].rlim_cur); 474 lnames[i].name, rlim[i].rlim_cur);
472 475
473 if (rlim[i].rlim_max == RLIM_INFINITY) 476 if (rlim[i].rlim_max == RLIM_INFINITY)
474 count += sprintf(&bufptr[count], "%-20s ", "unlimited"); 477 seq_printf(m, "%-20s ", "unlimited");
475 else 478 else
476 count += sprintf(&bufptr[count], "%-20lu ", 479 seq_printf(m, "%-20lu ", rlim[i].rlim_max);
477 rlim[i].rlim_max);
478 480
479 if (lnames[i].unit) 481 if (lnames[i].unit)
480 count += sprintf(&bufptr[count], "%-10s\n", 482 seq_printf(m, "%-10s\n", lnames[i].unit);
481 lnames[i].unit);
482 else 483 else
483 count += sprintf(&bufptr[count], "\n"); 484 seq_putc(m, '\n');
484 } 485 }
485 486
486 return count; 487 return 0;
487} 488}
488 489
489#ifdef CONFIG_HAVE_ARCH_TRACEHOOK 490#ifdef CONFIG_HAVE_ARCH_TRACEHOOK
490static int proc_pid_syscall(struct task_struct *task, char *buffer) 491static int proc_pid_syscall(struct seq_file *m, struct pid_namespace *ns,
492 struct pid *pid, struct task_struct *task)
491{ 493{
492 long nr; 494 long nr;
493 unsigned long args[6], sp, pc; 495 unsigned long args[6], sp, pc;
@@ -496,11 +498,11 @@ static int proc_pid_syscall(struct task_struct *task, char *buffer)
496 return res; 498 return res;
497 499
498 if (task_current_syscall(task, &nr, args, 6, &sp, &pc)) 500 if (task_current_syscall(task, &nr, args, 6, &sp, &pc))
499 res = sprintf(buffer, "running\n"); 501 seq_puts(m, "running\n");
500 else if (nr < 0) 502 else if (nr < 0)
501 res = sprintf(buffer, "%ld 0x%lx 0x%lx\n", nr, sp, pc); 503 seq_printf(m, "%ld 0x%lx 0x%lx\n", nr, sp, pc);
502 else 504 else
503 res = sprintf(buffer, 505 seq_printf(m,
504 "%ld 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx\n", 506 "%ld 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx\n",
505 nr, 507 nr,
506 args[0], args[1], args[2], args[3], args[4], args[5], 508 args[0], args[1], args[2], args[3], args[4], args[5],
@@ -598,43 +600,6 @@ static const struct inode_operations proc_def_inode_operations = {
598 .setattr = proc_setattr, 600 .setattr = proc_setattr,
599}; 601};
600 602
601#define PROC_BLOCK_SIZE (3*1024) /* 4K page size but our output routines use some slack for overruns */
602
603static ssize_t proc_info_read(struct file * file, char __user * buf,
604 size_t count, loff_t *ppos)
605{
606 struct inode * inode = file_inode(file);
607 unsigned long page;
608 ssize_t length;
609 struct task_struct *task = get_proc_task(inode);
610
611 length = -ESRCH;
612 if (!task)
613 goto out_no_task;
614
615 if (count > PROC_BLOCK_SIZE)
616 count = PROC_BLOCK_SIZE;
617
618 length = -ENOMEM;
619 if (!(page = __get_free_page(GFP_TEMPORARY)))
620 goto out;
621
622 length = PROC_I(inode)->op.proc_read(task, (char*)page);
623
624 if (length >= 0)
625 length = simple_read_from_buffer(buf, count, ppos, (char *)page, length);
626 free_page(page);
627out:
628 put_task_struct(task);
629out_no_task:
630 return length;
631}
632
633static const struct file_operations proc_info_file_operations = {
634 .read = proc_info_read,
635 .llseek = generic_file_llseek,
636};
637
638static int proc_single_show(struct seq_file *m, void *v) 603static int proc_single_show(struct seq_file *m, void *v)
639{ 604{
640 struct inode *inode = m->private; 605 struct inode *inode = m->private;
@@ -2056,7 +2021,7 @@ static int show_timer(struct seq_file *m, void *v)
2056 struct k_itimer *timer; 2021 struct k_itimer *timer;
2057 struct timers_private *tp = m->private; 2022 struct timers_private *tp = m->private;
2058 int notify; 2023 int notify;
2059 static char *nstr[] = { 2024 static const char * const nstr[] = {
2060 [SIGEV_SIGNAL] = "signal", 2025 [SIGEV_SIGNAL] = "signal",
2061 [SIGEV_NONE] = "none", 2026 [SIGEV_NONE] = "none",
2062 [SIGEV_THREAD] = "thread", 2027 [SIGEV_THREAD] = "thread",
@@ -2392,7 +2357,7 @@ static const struct file_operations proc_coredump_filter_operations = {
2392#endif 2357#endif
2393 2358
2394#ifdef CONFIG_TASK_IO_ACCOUNTING 2359#ifdef CONFIG_TASK_IO_ACCOUNTING
2395static int do_io_accounting(struct task_struct *task, char *buffer, int whole) 2360static int do_io_accounting(struct task_struct *task, struct seq_file *m, int whole)
2396{ 2361{
2397 struct task_io_accounting acct = task->ioac; 2362 struct task_io_accounting acct = task->ioac;
2398 unsigned long flags; 2363 unsigned long flags;
@@ -2416,7 +2381,7 @@ static int do_io_accounting(struct task_struct *task, char *buffer, int whole)
2416 2381
2417 unlock_task_sighand(task, &flags); 2382 unlock_task_sighand(task, &flags);
2418 } 2383 }
2419 result = sprintf(buffer, 2384 result = seq_printf(m,
2420 "rchar: %llu\n" 2385 "rchar: %llu\n"
2421 "wchar: %llu\n" 2386 "wchar: %llu\n"
2422 "syscr: %llu\n" 2387 "syscr: %llu\n"
@@ -2436,20 +2401,22 @@ out_unlock:
2436 return result; 2401 return result;
2437} 2402}
2438 2403
2439static int proc_tid_io_accounting(struct task_struct *task, char *buffer) 2404static int proc_tid_io_accounting(struct seq_file *m, struct pid_namespace *ns,
2405 struct pid *pid, struct task_struct *task)
2440{ 2406{
2441 return do_io_accounting(task, buffer, 0); 2407 return do_io_accounting(task, m, 0);
2442} 2408}
2443 2409
2444static int proc_tgid_io_accounting(struct task_struct *task, char *buffer) 2410static int proc_tgid_io_accounting(struct seq_file *m, struct pid_namespace *ns,
2411 struct pid *pid, struct task_struct *task)
2445{ 2412{
2446 return do_io_accounting(task, buffer, 1); 2413 return do_io_accounting(task, m, 1);
2447} 2414}
2448#endif /* CONFIG_TASK_IO_ACCOUNTING */ 2415#endif /* CONFIG_TASK_IO_ACCOUNTING */
2449 2416
2450#ifdef CONFIG_USER_NS 2417#ifdef CONFIG_USER_NS
2451static int proc_id_map_open(struct inode *inode, struct file *file, 2418static int proc_id_map_open(struct inode *inode, struct file *file,
2452 struct seq_operations *seq_ops) 2419 const struct seq_operations *seq_ops)
2453{ 2420{
2454 struct user_namespace *ns = NULL; 2421 struct user_namespace *ns = NULL;
2455 struct task_struct *task; 2422 struct task_struct *task;
@@ -2557,10 +2524,10 @@ static const struct pid_entry tgid_base_stuff[] = {
2557 DIR("net", S_IRUGO|S_IXUGO, proc_net_inode_operations, proc_net_operations), 2524 DIR("net", S_IRUGO|S_IXUGO, proc_net_inode_operations, proc_net_operations),
2558#endif 2525#endif
2559 REG("environ", S_IRUSR, proc_environ_operations), 2526 REG("environ", S_IRUSR, proc_environ_operations),
2560 INF("auxv", S_IRUSR, proc_pid_auxv), 2527 ONE("auxv", S_IRUSR, proc_pid_auxv),
2561 ONE("status", S_IRUGO, proc_pid_status), 2528 ONE("status", S_IRUGO, proc_pid_status),
2562 ONE("personality", S_IRUSR, proc_pid_personality), 2529 ONE("personality", S_IRUSR, proc_pid_personality),
2563 INF("limits", S_IRUGO, proc_pid_limits), 2530 ONE("limits", S_IRUGO, proc_pid_limits),
2564#ifdef CONFIG_SCHED_DEBUG 2531#ifdef CONFIG_SCHED_DEBUG
2565 REG("sched", S_IRUGO|S_IWUSR, proc_pid_sched_operations), 2532 REG("sched", S_IRUGO|S_IWUSR, proc_pid_sched_operations),
2566#endif 2533#endif
@@ -2569,9 +2536,9 @@ static const struct pid_entry tgid_base_stuff[] = {
2569#endif 2536#endif
2570 REG("comm", S_IRUGO|S_IWUSR, proc_pid_set_comm_operations), 2537 REG("comm", S_IRUGO|S_IWUSR, proc_pid_set_comm_operations),
2571#ifdef CONFIG_HAVE_ARCH_TRACEHOOK 2538#ifdef CONFIG_HAVE_ARCH_TRACEHOOK
2572 INF("syscall", S_IRUSR, proc_pid_syscall), 2539 ONE("syscall", S_IRUSR, proc_pid_syscall),
2573#endif 2540#endif
2574 INF("cmdline", S_IRUGO, proc_pid_cmdline), 2541 ONE("cmdline", S_IRUGO, proc_pid_cmdline),
2575 ONE("stat", S_IRUGO, proc_tgid_stat), 2542 ONE("stat", S_IRUGO, proc_tgid_stat),
2576 ONE("statm", S_IRUGO, proc_pid_statm), 2543 ONE("statm", S_IRUGO, proc_pid_statm),
2577 REG("maps", S_IRUGO, proc_pid_maps_operations), 2544 REG("maps", S_IRUGO, proc_pid_maps_operations),
@@ -2594,13 +2561,13 @@ static const struct pid_entry tgid_base_stuff[] = {
2594 DIR("attr", S_IRUGO|S_IXUGO, proc_attr_dir_inode_operations, proc_attr_dir_operations), 2561 DIR("attr", S_IRUGO|S_IXUGO, proc_attr_dir_inode_operations, proc_attr_dir_operations),
2595#endif 2562#endif
2596#ifdef CONFIG_KALLSYMS 2563#ifdef CONFIG_KALLSYMS
2597 INF("wchan", S_IRUGO, proc_pid_wchan), 2564 ONE("wchan", S_IRUGO, proc_pid_wchan),
2598#endif 2565#endif
2599#ifdef CONFIG_STACKTRACE 2566#ifdef CONFIG_STACKTRACE
2600 ONE("stack", S_IRUSR, proc_pid_stack), 2567 ONE("stack", S_IRUSR, proc_pid_stack),
2601#endif 2568#endif
2602#ifdef CONFIG_SCHEDSTATS 2569#ifdef CONFIG_SCHEDSTATS
2603 INF("schedstat", S_IRUGO, proc_pid_schedstat), 2570 ONE("schedstat", S_IRUGO, proc_pid_schedstat),
2604#endif 2571#endif
2605#ifdef CONFIG_LATENCYTOP 2572#ifdef CONFIG_LATENCYTOP
2606 REG("latency", S_IRUGO, proc_lstats_operations), 2573 REG("latency", S_IRUGO, proc_lstats_operations),
@@ -2611,7 +2578,7 @@ static const struct pid_entry tgid_base_stuff[] = {
2611#ifdef CONFIG_CGROUPS 2578#ifdef CONFIG_CGROUPS
2612 REG("cgroup", S_IRUGO, proc_cgroup_operations), 2579 REG("cgroup", S_IRUGO, proc_cgroup_operations),
2613#endif 2580#endif
2614 INF("oom_score", S_IRUGO, proc_oom_score), 2581 ONE("oom_score", S_IRUGO, proc_oom_score),
2615 REG("oom_adj", S_IRUGO|S_IWUSR, proc_oom_adj_operations), 2582 REG("oom_adj", S_IRUGO|S_IWUSR, proc_oom_adj_operations),
2616 REG("oom_score_adj", S_IRUGO|S_IWUSR, proc_oom_score_adj_operations), 2583 REG("oom_score_adj", S_IRUGO|S_IWUSR, proc_oom_score_adj_operations),
2617#ifdef CONFIG_AUDITSYSCALL 2584#ifdef CONFIG_AUDITSYSCALL
@@ -2625,10 +2592,10 @@ static const struct pid_entry tgid_base_stuff[] = {
2625 REG("coredump_filter", S_IRUGO|S_IWUSR, proc_coredump_filter_operations), 2592 REG("coredump_filter", S_IRUGO|S_IWUSR, proc_coredump_filter_operations),
2626#endif 2593#endif
2627#ifdef CONFIG_TASK_IO_ACCOUNTING 2594#ifdef CONFIG_TASK_IO_ACCOUNTING
2628 INF("io", S_IRUSR, proc_tgid_io_accounting), 2595 ONE("io", S_IRUSR, proc_tgid_io_accounting),
2629#endif 2596#endif
2630#ifdef CONFIG_HARDWALL 2597#ifdef CONFIG_HARDWALL
2631 INF("hardwall", S_IRUGO, proc_pid_hardwall), 2598 ONE("hardwall", S_IRUGO, proc_pid_hardwall),
2632#endif 2599#endif
2633#ifdef CONFIG_USER_NS 2600#ifdef CONFIG_USER_NS
2634 REG("uid_map", S_IRUGO|S_IWUSR, proc_uid_map_operations), 2601 REG("uid_map", S_IRUGO|S_IWUSR, proc_uid_map_operations),
@@ -2780,12 +2747,12 @@ out:
2780 2747
2781struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, unsigned int flags) 2748struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, unsigned int flags)
2782{ 2749{
2783 int result = 0; 2750 int result = -ENOENT;
2784 struct task_struct *task; 2751 struct task_struct *task;
2785 unsigned tgid; 2752 unsigned tgid;
2786 struct pid_namespace *ns; 2753 struct pid_namespace *ns;
2787 2754
2788 tgid = name_to_int(dentry); 2755 tgid = name_to_int(&dentry->d_name);
2789 if (tgid == ~0U) 2756 if (tgid == ~0U)
2790 goto out; 2757 goto out;
2791 2758
@@ -2896,18 +2863,18 @@ static const struct pid_entry tid_base_stuff[] = {
2896 DIR("fdinfo", S_IRUSR|S_IXUSR, proc_fdinfo_inode_operations, proc_fdinfo_operations), 2863 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), 2864 DIR("ns", S_IRUSR|S_IXUGO, proc_ns_dir_inode_operations, proc_ns_dir_operations),
2898 REG("environ", S_IRUSR, proc_environ_operations), 2865 REG("environ", S_IRUSR, proc_environ_operations),
2899 INF("auxv", S_IRUSR, proc_pid_auxv), 2866 ONE("auxv", S_IRUSR, proc_pid_auxv),
2900 ONE("status", S_IRUGO, proc_pid_status), 2867 ONE("status", S_IRUGO, proc_pid_status),
2901 ONE("personality", S_IRUSR, proc_pid_personality), 2868 ONE("personality", S_IRUSR, proc_pid_personality),
2902 INF("limits", S_IRUGO, proc_pid_limits), 2869 ONE("limits", S_IRUGO, proc_pid_limits),
2903#ifdef CONFIG_SCHED_DEBUG 2870#ifdef CONFIG_SCHED_DEBUG
2904 REG("sched", S_IRUGO|S_IWUSR, proc_pid_sched_operations), 2871 REG("sched", S_IRUGO|S_IWUSR, proc_pid_sched_operations),
2905#endif 2872#endif
2906 REG("comm", S_IRUGO|S_IWUSR, proc_pid_set_comm_operations), 2873 REG("comm", S_IRUGO|S_IWUSR, proc_pid_set_comm_operations),
2907#ifdef CONFIG_HAVE_ARCH_TRACEHOOK 2874#ifdef CONFIG_HAVE_ARCH_TRACEHOOK
2908 INF("syscall", S_IRUSR, proc_pid_syscall), 2875 ONE("syscall", S_IRUSR, proc_pid_syscall),
2909#endif 2876#endif
2910 INF("cmdline", S_IRUGO, proc_pid_cmdline), 2877 ONE("cmdline", S_IRUGO, proc_pid_cmdline),
2911 ONE("stat", S_IRUGO, proc_tid_stat), 2878 ONE("stat", S_IRUGO, proc_tid_stat),
2912 ONE("statm", S_IRUGO, proc_pid_statm), 2879 ONE("statm", S_IRUGO, proc_pid_statm),
2913 REG("maps", S_IRUGO, proc_tid_maps_operations), 2880 REG("maps", S_IRUGO, proc_tid_maps_operations),
@@ -2932,13 +2899,13 @@ static const struct pid_entry tid_base_stuff[] = {
2932 DIR("attr", S_IRUGO|S_IXUGO, proc_attr_dir_inode_operations, proc_attr_dir_operations), 2899 DIR("attr", S_IRUGO|S_IXUGO, proc_attr_dir_inode_operations, proc_attr_dir_operations),
2933#endif 2900#endif
2934#ifdef CONFIG_KALLSYMS 2901#ifdef CONFIG_KALLSYMS
2935 INF("wchan", S_IRUGO, proc_pid_wchan), 2902 ONE("wchan", S_IRUGO, proc_pid_wchan),
2936#endif 2903#endif
2937#ifdef CONFIG_STACKTRACE 2904#ifdef CONFIG_STACKTRACE
2938 ONE("stack", S_IRUSR, proc_pid_stack), 2905 ONE("stack", S_IRUSR, proc_pid_stack),
2939#endif 2906#endif
2940#ifdef CONFIG_SCHEDSTATS 2907#ifdef CONFIG_SCHEDSTATS
2941 INF("schedstat", S_IRUGO, proc_pid_schedstat), 2908 ONE("schedstat", S_IRUGO, proc_pid_schedstat),
2942#endif 2909#endif
2943#ifdef CONFIG_LATENCYTOP 2910#ifdef CONFIG_LATENCYTOP
2944 REG("latency", S_IRUGO, proc_lstats_operations), 2911 REG("latency", S_IRUGO, proc_lstats_operations),
@@ -2949,7 +2916,7 @@ static const struct pid_entry tid_base_stuff[] = {
2949#ifdef CONFIG_CGROUPS 2916#ifdef CONFIG_CGROUPS
2950 REG("cgroup", S_IRUGO, proc_cgroup_operations), 2917 REG("cgroup", S_IRUGO, proc_cgroup_operations),
2951#endif 2918#endif
2952 INF("oom_score", S_IRUGO, proc_oom_score), 2919 ONE("oom_score", S_IRUGO, proc_oom_score),
2953 REG("oom_adj", S_IRUGO|S_IWUSR, proc_oom_adj_operations), 2920 REG("oom_adj", S_IRUGO|S_IWUSR, proc_oom_adj_operations),
2954 REG("oom_score_adj", S_IRUGO|S_IWUSR, proc_oom_score_adj_operations), 2921 REG("oom_score_adj", S_IRUGO|S_IWUSR, proc_oom_score_adj_operations),
2955#ifdef CONFIG_AUDITSYSCALL 2922#ifdef CONFIG_AUDITSYSCALL
@@ -2960,10 +2927,10 @@ static const struct pid_entry tid_base_stuff[] = {
2960 REG("make-it-fail", S_IRUGO|S_IWUSR, proc_fault_inject_operations), 2927 REG("make-it-fail", S_IRUGO|S_IWUSR, proc_fault_inject_operations),
2961#endif 2928#endif
2962#ifdef CONFIG_TASK_IO_ACCOUNTING 2929#ifdef CONFIG_TASK_IO_ACCOUNTING
2963 INF("io", S_IRUSR, proc_tid_io_accounting), 2930 ONE("io", S_IRUSR, proc_tid_io_accounting),
2964#endif 2931#endif
2965#ifdef CONFIG_HARDWALL 2932#ifdef CONFIG_HARDWALL
2966 INF("hardwall", S_IRUGO, proc_pid_hardwall), 2933 ONE("hardwall", S_IRUGO, proc_pid_hardwall),
2967#endif 2934#endif
2968#ifdef CONFIG_USER_NS 2935#ifdef CONFIG_USER_NS
2969 REG("uid_map", S_IRUGO|S_IWUSR, proc_uid_map_operations), 2936 REG("uid_map", S_IRUGO|S_IWUSR, proc_uid_map_operations),
@@ -3033,7 +3000,7 @@ static struct dentry *proc_task_lookup(struct inode *dir, struct dentry * dentry
3033 if (!leader) 3000 if (!leader)
3034 goto out_no_task; 3001 goto out_no_task;
3035 3002
3036 tid = name_to_int(dentry); 3003 tid = name_to_int(&dentry->d_name);
3037 if (tid == ~0U) 3004 if (tid == ~0U)
3038 goto out; 3005 goto out;
3039 3006