diff options
Diffstat (limited to 'fs/proc/array.c')
-rw-r--r-- | fs/proc/array.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/fs/proc/array.c b/fs/proc/array.c index b6c00ce0e29e..88c7de12197b 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c | |||
@@ -83,6 +83,7 @@ | |||
83 | #include <linux/tracehook.h> | 83 | #include <linux/tracehook.h> |
84 | #include <linux/string_helpers.h> | 84 | #include <linux/string_helpers.h> |
85 | #include <linux/user_namespace.h> | 85 | #include <linux/user_namespace.h> |
86 | #include <linux/fs_struct.h> | ||
86 | 87 | ||
87 | #include <asm/pgtable.h> | 88 | #include <asm/pgtable.h> |
88 | #include <asm/processor.h> | 89 | #include <asm/processor.h> |
@@ -139,12 +140,25 @@ static inline const char *get_task_state(struct task_struct *tsk) | |||
139 | return task_state_array[fls(state)]; | 140 | return task_state_array[fls(state)]; |
140 | } | 141 | } |
141 | 142 | ||
143 | static inline int get_task_umask(struct task_struct *tsk) | ||
144 | { | ||
145 | struct fs_struct *fs; | ||
146 | int umask = -ENOENT; | ||
147 | |||
148 | task_lock(tsk); | ||
149 | fs = tsk->fs; | ||
150 | if (fs) | ||
151 | umask = fs->umask; | ||
152 | task_unlock(tsk); | ||
153 | return umask; | ||
154 | } | ||
155 | |||
142 | static inline void task_state(struct seq_file *m, struct pid_namespace *ns, | 156 | static inline void task_state(struct seq_file *m, struct pid_namespace *ns, |
143 | struct pid *pid, struct task_struct *p) | 157 | struct pid *pid, struct task_struct *p) |
144 | { | 158 | { |
145 | struct user_namespace *user_ns = seq_user_ns(m); | 159 | struct user_namespace *user_ns = seq_user_ns(m); |
146 | struct group_info *group_info; | 160 | struct group_info *group_info; |
147 | int g; | 161 | int g, umask; |
148 | struct task_struct *tracer; | 162 | struct task_struct *tracer; |
149 | const struct cred *cred; | 163 | const struct cred *cred; |
150 | pid_t ppid, tpid = 0, tgid, ngid; | 164 | pid_t ppid, tpid = 0, tgid, ngid; |
@@ -162,6 +176,10 @@ static inline void task_state(struct seq_file *m, struct pid_namespace *ns, | |||
162 | ngid = task_numa_group_id(p); | 176 | ngid = task_numa_group_id(p); |
163 | cred = get_task_cred(p); | 177 | cred = get_task_cred(p); |
164 | 178 | ||
179 | umask = get_task_umask(p); | ||
180 | if (umask >= 0) | ||
181 | seq_printf(m, "Umask:\t%#04o\n", umask); | ||
182 | |||
165 | task_lock(p); | 183 | task_lock(p); |
166 | if (p->files) | 184 | if (p->files) |
167 | max_fds = files_fdtable(p->files)->max_fds; | 185 | max_fds = files_fdtable(p->files)->max_fds; |