base.c (631f9c1868b970197747c80fc5168ad7d9fd5d53) base.c (2ec220e27f5040aec1e88901c1b6ea3d135787ad)
1/*
2 * linux/fs/proc/base.c
3 *
4 * Copyright (C) 1991, 1992 Linus Torvalds
5 *
6 * proc base directory handling functions
7 *
8 * 1999, Al Viro. Rewritten. Now it covers the whole per-process part.

--- 51 unchanged lines hidden (view full) ---

60#include <linux/fdtable.h>
61#include <linux/string.h>
62#include <linux/seq_file.h>
63#include <linux/namei.h>
64#include <linux/mnt_namespace.h>
65#include <linux/mm.h>
66#include <linux/rcupdate.h>
67#include <linux/kallsyms.h>
1/*
2 * linux/fs/proc/base.c
3 *
4 * Copyright (C) 1991, 1992 Linus Torvalds
5 *
6 * proc base directory handling functions
7 *
8 * 1999, Al Viro. Rewritten. Now it covers the whole per-process part.

--- 51 unchanged lines hidden (view full) ---

60#include <linux/fdtable.h>
61#include <linux/string.h>
62#include <linux/seq_file.h>
63#include <linux/namei.h>
64#include <linux/mnt_namespace.h>
65#include <linux/mm.h>
66#include <linux/rcupdate.h>
67#include <linux/kallsyms.h>
68#include <linux/stacktrace.h>
68#include <linux/resource.h>
69#include <linux/module.h>
70#include <linux/mount.h>
71#include <linux/security.h>
72#include <linux/ptrace.h>
73#include <linux/tracehook.h>
74#include <linux/cgroup.h>
75#include <linux/cpuset.h>

--- 256 unchanged lines hidden (view full) ---

332
333 if (lookup_symbol_name(wchan, symname) < 0)
334 return sprintf(buffer, "%lu", wchan);
335 else
336 return sprintf(buffer, "%s", symname);
337}
338#endif /* CONFIG_KALLSYMS */
339
69#include <linux/resource.h>
70#include <linux/module.h>
71#include <linux/mount.h>
72#include <linux/security.h>
73#include <linux/ptrace.h>
74#include <linux/tracehook.h>
75#include <linux/cgroup.h>
76#include <linux/cpuset.h>

--- 256 unchanged lines hidden (view full) ---

333
334 if (lookup_symbol_name(wchan, symname) < 0)
335 return sprintf(buffer, "%lu", wchan);
336 else
337 return sprintf(buffer, "%s", symname);
338}
339#endif /* CONFIG_KALLSYMS */
340
341#ifdef CONFIG_STACKTRACE
342
343#define MAX_STACK_TRACE_DEPTH 64
344
345static int proc_pid_stack(struct seq_file *m, struct pid_namespace *ns,
346 struct pid *pid, struct task_struct *task)
347{
348 struct stack_trace trace;
349 unsigned long *entries;
350 int i;
351
352 entries = kmalloc(MAX_STACK_TRACE_DEPTH * sizeof(*entries), GFP_KERNEL);
353 if (!entries)
354 return -ENOMEM;
355
356 trace.nr_entries = 0;
357 trace.max_entries = MAX_STACK_TRACE_DEPTH;
358 trace.entries = entries;
359 trace.skip = 0;
360 save_stack_trace_tsk(task, &trace);
361
362 for (i = 0; i < trace.nr_entries; i++) {
363 seq_printf(m, "[<%p>] %pS\n",
364 (void *)entries[i], (void *)entries[i]);
365 }
366 kfree(entries);
367
368 return 0;
369}
370#endif
371
340#ifdef CONFIG_SCHEDSTATS
341/*
342 * Provides /proc/PID/schedstat
343 */
344static int proc_pid_schedstat(struct task_struct *task, char *buffer)
345{
346 return sprintf(buffer, "%llu %llu %lu\n",
347 (unsigned long long)task->se.sum_exec_runtime,

--- 2147 unchanged lines hidden (view full) ---

2495 REG("pagemap", S_IRUSR, proc_pagemap_operations),
2496#endif
2497#ifdef CONFIG_SECURITY
2498 DIR("attr", S_IRUGO|S_IXUGO, proc_attr_dir_inode_operations, proc_attr_dir_operations),
2499#endif
2500#ifdef CONFIG_KALLSYMS
2501 INF("wchan", S_IRUGO, proc_pid_wchan),
2502#endif
372#ifdef CONFIG_SCHEDSTATS
373/*
374 * Provides /proc/PID/schedstat
375 */
376static int proc_pid_schedstat(struct task_struct *task, char *buffer)
377{
378 return sprintf(buffer, "%llu %llu %lu\n",
379 (unsigned long long)task->se.sum_exec_runtime,

--- 2147 unchanged lines hidden (view full) ---

2527 REG("pagemap", S_IRUSR, proc_pagemap_operations),
2528#endif
2529#ifdef CONFIG_SECURITY
2530 DIR("attr", S_IRUGO|S_IXUGO, proc_attr_dir_inode_operations, proc_attr_dir_operations),
2531#endif
2532#ifdef CONFIG_KALLSYMS
2533 INF("wchan", S_IRUGO, proc_pid_wchan),
2534#endif
2535#ifdef CONFIG_STACKTRACE
2536 ONE("stack", S_IRUSR, proc_pid_stack),
2537#endif
2503#ifdef CONFIG_SCHEDSTATS
2504 INF("schedstat", S_IRUGO, proc_pid_schedstat),
2505#endif
2506#ifdef CONFIG_LATENCYTOP
2507 REG("latency", S_IRUGO, proc_lstats_operations),
2508#endif
2509#ifdef CONFIG_PROC_PID_CPUSET
2510 REG("cpuset", S_IRUGO, proc_cpuset_operations),

--- 319 unchanged lines hidden (view full) ---

2830 REG("pagemap", S_IRUSR, proc_pagemap_operations),
2831#endif
2832#ifdef CONFIG_SECURITY
2833 DIR("attr", S_IRUGO|S_IXUGO, proc_attr_dir_inode_operations, proc_attr_dir_operations),
2834#endif
2835#ifdef CONFIG_KALLSYMS
2836 INF("wchan", S_IRUGO, proc_pid_wchan),
2837#endif
2538#ifdef CONFIG_SCHEDSTATS
2539 INF("schedstat", S_IRUGO, proc_pid_schedstat),
2540#endif
2541#ifdef CONFIG_LATENCYTOP
2542 REG("latency", S_IRUGO, proc_lstats_operations),
2543#endif
2544#ifdef CONFIG_PROC_PID_CPUSET
2545 REG("cpuset", S_IRUGO, proc_cpuset_operations),

--- 319 unchanged lines hidden (view full) ---

2865 REG("pagemap", S_IRUSR, proc_pagemap_operations),
2866#endif
2867#ifdef CONFIG_SECURITY
2868 DIR("attr", S_IRUGO|S_IXUGO, proc_attr_dir_inode_operations, proc_attr_dir_operations),
2869#endif
2870#ifdef CONFIG_KALLSYMS
2871 INF("wchan", S_IRUGO, proc_pid_wchan),
2872#endif
2873#ifdef CONFIG_STACKTRACE
2874 ONE("stack", S_IRUSR, proc_pid_stack),
2875#endif
2838#ifdef CONFIG_SCHEDSTATS
2839 INF("schedstat", S_IRUGO, proc_pid_schedstat),
2840#endif
2841#ifdef CONFIG_LATENCYTOP
2842 REG("latency", S_IRUGO, proc_lstats_operations),
2843#endif
2844#ifdef CONFIG_PROC_PID_CPUSET
2845 REG("cpuset", S_IRUGO, proc_cpuset_operations),

--- 272 unchanged lines hidden ---
2876#ifdef CONFIG_SCHEDSTATS
2877 INF("schedstat", S_IRUGO, proc_pid_schedstat),
2878#endif
2879#ifdef CONFIG_LATENCYTOP
2880 REG("latency", S_IRUGO, proc_lstats_operations),
2881#endif
2882#ifdef CONFIG_PROC_PID_CPUSET
2883 REG("cpuset", S_IRUGO, proc_cpuset_operations),

--- 272 unchanged lines hidden ---