diff options
Diffstat (limited to 'fs/proc/array.c')
| -rw-r--r-- | fs/proc/array.c | 44 |
1 files changed, 11 insertions, 33 deletions
diff --git a/fs/proc/array.c b/fs/proc/array.c index bd117d065b82..1295a00ca316 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c | |||
| @@ -81,6 +81,7 @@ | |||
| 81 | #include <linux/pid_namespace.h> | 81 | #include <linux/pid_namespace.h> |
| 82 | #include <linux/ptrace.h> | 82 | #include <linux/ptrace.h> |
| 83 | #include <linux/tracehook.h> | 83 | #include <linux/tracehook.h> |
| 84 | #include <linux/string_helpers.h> | ||
| 84 | #include <linux/user_namespace.h> | 85 | #include <linux/user_namespace.h> |
| 85 | 86 | ||
| 86 | #include <asm/pgtable.h> | 87 | #include <asm/pgtable.h> |
| @@ -89,39 +90,18 @@ | |||
| 89 | 90 | ||
| 90 | static inline void task_name(struct seq_file *m, struct task_struct *p) | 91 | static inline void task_name(struct seq_file *m, struct task_struct *p) |
| 91 | { | 92 | { |
| 92 | int i; | 93 | char *buf; |
| 93 | char *buf, *end; | ||
| 94 | char *name; | ||
| 95 | char tcomm[sizeof(p->comm)]; | 94 | char tcomm[sizeof(p->comm)]; |
| 96 | 95 | ||
| 97 | get_task_comm(tcomm, p); | 96 | get_task_comm(tcomm, p); |
| 98 | 97 | ||
| 99 | seq_puts(m, "Name:\t"); | 98 | seq_puts(m, "Name:\t"); |
| 100 | end = m->buf + m->size; | ||
| 101 | buf = m->buf + m->count; | 99 | buf = m->buf + m->count; |
| 102 | name = tcomm; | 100 | |
| 103 | i = sizeof(tcomm); | 101 | /* Ignore error for now */ |
| 104 | while (i && (buf < end)) { | 102 | string_escape_str(tcomm, &buf, m->size - m->count, |
| 105 | unsigned char c = *name; | 103 | ESCAPE_SPACE | ESCAPE_SPECIAL, "\n\\"); |
| 106 | name++; | 104 | |
| 107 | i--; | ||
| 108 | *buf = c; | ||
| 109 | if (!c) | ||
| 110 | break; | ||
| 111 | if (c == '\\') { | ||
| 112 | buf++; | ||
| 113 | if (buf < end) | ||
| 114 | *buf++ = c; | ||
| 115 | continue; | ||
| 116 | } | ||
| 117 | if (c == '\n') { | ||
| 118 | *buf++ = '\\'; | ||
| 119 | if (buf < end) | ||
| 120 | *buf++ = 'n'; | ||
| 121 | continue; | ||
| 122 | } | ||
| 123 | buf++; | ||
| 124 | } | ||
| 125 | m->count = buf - m->buf; | 105 | m->count = buf - m->buf; |
| 126 | seq_putc(m, '\n'); | 106 | seq_putc(m, '\n'); |
| 127 | } | 107 | } |
| @@ -336,12 +316,10 @@ static inline void task_context_switch_counts(struct seq_file *m, | |||
| 336 | 316 | ||
| 337 | static void task_cpus_allowed(struct seq_file *m, struct task_struct *task) | 317 | static void task_cpus_allowed(struct seq_file *m, struct task_struct *task) |
| 338 | { | 318 | { |
| 339 | seq_puts(m, "Cpus_allowed:\t"); | 319 | seq_printf(m, "Cpus_allowed:\t%*pb\n", |
| 340 | seq_cpumask(m, &task->cpus_allowed); | 320 | cpumask_pr_args(&task->cpus_allowed)); |
| 341 | seq_putc(m, '\n'); | 321 | seq_printf(m, "Cpus_allowed_list:\t%*pbl\n", |
| 342 | seq_puts(m, "Cpus_allowed_list:\t"); | 322 | cpumask_pr_args(&task->cpus_allowed)); |
| 343 | seq_cpumask_list(m, &task->cpus_allowed); | ||
| 344 | seq_putc(m, '\n'); | ||
| 345 | } | 323 | } |
| 346 | 324 | ||
| 347 | int proc_pid_status(struct seq_file *m, struct pid_namespace *ns, | 325 | int proc_pid_status(struct seq_file *m, struct pid_namespace *ns, |
