From 35e7d72e5f643bb342aff114b9bf5d7e03f6d5e2 Mon Sep 17 00:00:00 2001 From: Sergey Bugaev Date: Tue, 18 Apr 2023 13:49:02 +0300 Subject: procfs: Fix process creation time in /proc/pid/stat 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 Message-Id: <20230418104902.12263-1-bugaevc@gmail.com> --- procfs/process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'procfs') 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, -- cgit v1.2.3