summaryrefslogtreecommitdiff
path: root/procfs
diff options
context:
space:
mode:
authorAlmudena Garcia <liberamenso10000@gmail.com>2019-10-31 01:53:52 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2019-10-31 01:59:00 +0100
commitd8671bc2a0fead7655b9e80736db33d84f14025c (patch)
tree11bc9379bf6946619b42789370a43dfe131fb068 /procfs
parent40ab805df48b2f65d5028ba59063e2a36f19f452 (diff)
proc: add support for last_processor
Read last_processor (new member) from thread_info structures, and fill stat structure with this. * configure.ac: Check whether thread_sched_info structure includes `last_processor' member. * proc/info.c (S_proc_getprocinfo) [HAVE_STRUCT_THREAD_SCHED_INFO_LAST_PROCESSOR]: Set `last_processor' field. * procfs/process.c (process_file_gc_stat) [HAVE_STRUCT_THREAD_SCHED_INFO_LAST_PROCESSOR]: Set last processor proc field to `thsi->last_processor'. [!HAVE_STRUCT_THREAD_SCHED_INFO_LAST_PROCESSOR]: Set last processor proc field to 0.
Diffstat (limited to 'procfs')
-rw-r--r--procfs/process.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/procfs/process.c b/procfs/process.c
index 59653b24..f6d3a730 100644
--- a/procfs/process.c
+++ b/procfs/process.c
@@ -221,6 +221,7 @@ process_file_gc_stat (struct proc_stat *ps, char **contents)
struct procinfo *pi = proc_stat_proc_info (ps);
task_basic_info_t tbi = proc_stat_task_basic_info (ps);
thread_basic_info_t thbi = proc_stat_thread_basic_info (ps);
+ thread_sched_info_t thsi = proc_stat_thread_sched_info (ps);
const char *fn = args_filename (proc_stat_args (ps));
vm_address_t start_code = 1; /* 0 would make killall5.c consider it
@@ -229,6 +230,15 @@ process_file_gc_stat (struct proc_stat *ps, char **contents)
vm_address_t end_code = 1;
process_t p;
error_t err = proc_pid2proc (ps->context->server, ps->pid, &p);
+
+ long unsigned last_processor;
+
+#ifdef HAVE_STRUCT_THREAD_SCHED_INFO_LAST_PROCESSOR
+ last_processor = thsi->last_processor;
+#else
+ last_processor = 0;
+#endif
+
if (! err)
{
boolean_t essential = 0;
@@ -286,7 +296,7 @@ process_file_gc_stat (struct proc_stat *ps, char **contents)
(long unsigned) proc_stat_thread_rpc (ps), /* close enough */
0L, 0L,
0,
- 0,
+ last_processor,
0, 0,
0LL);
}