aboutsummaryrefslogtreecommitdiff
path: root/fs/proc/array.c
diff options
context:
space:
mode:
authorChunguang Wu <[email protected]>2023-04-16 13:24:04 +0800
committerAndrew Morton <[email protected]>2023-04-21 14:54:34 -0700
commit522dc4e5f51e3d51c4ff55ad1c725d12176b71ea (patch)
tree2bc3e886ccd84eb1e580c88dd421c9dbf776b113 /fs/proc/array.c
parent3647ebcfbfca384840231fe13fae665453238a61 (diff)
fs/proc: add Kthread flag to /proc/$pid/status
The command `ps -ef ` and `top -c` mark kernel thread by '[' and ']', but sometimes the result is not correct. The task->flags in /proc/$pid/stat is good, but we need remember the value of PF_KTHREAD is 0x00200000 and convert dec to hex. If we have no binary program and shell script which read /proc/$pid/stat, we can know it directly by `cat /proc/$pid/status`. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Chunguang Wu <[email protected]> Reviewed-by: Randy Dunlap <[email protected]> Cc: Alexey Dobriyan <[email protected]> Cc: Jonathan Corbet <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'fs/proc/array.c')
-rw-r--r--fs/proc/array.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/proc/array.c b/fs/proc/array.c
index 9b0315d34c58..425824ad85e1 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -219,6 +219,8 @@ static inline void task_state(struct seq_file *m, struct pid_namespace *ns,
seq_put_decimal_ull(m, "\t", task_session_nr_ns(p, pid->numbers[g].ns));
#endif
seq_putc(m, '\n');
+
+ seq_printf(m, "Kthread:\t%c\n", p->flags & PF_KTHREAD ? '1' : '0');
}
void render_sigset_t(struct seq_file *m, const char *header,