[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] procfs: Fix process creation time in /proc/pid/stat
From: |
Sergey Bugaev |
Subject: |
[PATCH] procfs: Fix process creation time in /proc/pid/stat |
Date: |
Tue, 18 Apr 2023 13:49:02 +0300 |
This was always showing up as 0, because apparently we need to query
creation_time for the task, not a thread.
Here's a before vs after comparison:
$ cat /proc/self/stat ~/procfs/self/stat
11151 (cat) S 26571 11151 26571 0 0 0 0 0 0 0 1 0 0 0 20 0 2 0 0 154783744 251
0 134443008 134477480 0 0 0 0 0 0 0 21001 0 0 0 0 0 0 0
11151 (cat) S 26571 11151 26571 0 0 0 0 0 0 0 1 0 0 0 20 0 2 0 168174516295
154783744 260 0 134443008 134477480 0 0 0 0 0 0 0 21001 0 0 0 0 0 0 0
---
procfs/process.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/procfs/process.c b/procfs/process.c
index a9ba51ab..eaf5f45b 100644
--- a/procfs/process.c
+++ b/procfs/process.c
@@ -286,7 +286,7 @@ process_file_gc_stat (struct proc_stat *ps, char **contents)
MACH_PRIORITY_TO_NICE(thbi->base_priority) + 20,
MACH_PRIORITY_TO_NICE(thbi->base_priority),
pi->nthreads, 0L,
- timeval_jiffies (thbi->creation_time), /* FIXME: ... since boot */
+ timeval_jiffies (tbi->creation_time), /* FIXME: ... since boot */
(long unsigned) tbi->virtual_size,
(long unsigned) tbi->resident_size / PAGE_SIZE, 0L,
start_code,
--
2.39.2
- [PATCH] procfs: Fix process creation time in /proc/pid/stat,
Sergey Bugaev <=