Merge tag 'mac80211-for-davem-2016-06-01' of git://git.kernel.org/pub/scm/linux/kerne...
[linux-2.6-block.git] / fs / proc / array.c
index b6c00ce0e29e3563037c16fe7bbc754b396f606f..88c7de12197bd763c452b7770fcd19d15dcb3df1 100644 (file)
@@ -83,6 +83,7 @@
 #include <linux/tracehook.h>
 #include <linux/string_helpers.h>
 #include <linux/user_namespace.h>
+#include <linux/fs_struct.h>
 
 #include <asm/pgtable.h>
 #include <asm/processor.h>
@@ -139,12 +140,25 @@ static inline const char *get_task_state(struct task_struct *tsk)
        return task_state_array[fls(state)];
 }
 
+static inline int get_task_umask(struct task_struct *tsk)
+{
+       struct fs_struct *fs;
+       int umask = -ENOENT;
+
+       task_lock(tsk);
+       fs = tsk->fs;
+       if (fs)
+               umask = fs->umask;
+       task_unlock(tsk);
+       return umask;
+}
+
 static inline void task_state(struct seq_file *m, struct pid_namespace *ns,
                                struct pid *pid, struct task_struct *p)
 {
        struct user_namespace *user_ns = seq_user_ns(m);
        struct group_info *group_info;
-       int g;
+       int g, umask;
        struct task_struct *tracer;
        const struct cred *cred;
        pid_t ppid, tpid = 0, tgid, ngid;
@@ -162,6 +176,10 @@ static inline void task_state(struct seq_file *m, struct pid_namespace *ns,
        ngid = task_numa_group_id(p);
        cred = get_task_cred(p);
 
+       umask = get_task_umask(p);
+       if (umask >= 0)
+               seq_printf(m, "Umask:\t%#04o\n", umask);
+
        task_lock(p);
        if (p->files)
                max_fds = files_fdtable(p->files)->max_fds;