summaryrefslogtreecommitdiff
path: root/proc
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2019-10-31 16:57:43 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2019-10-31 16:59:24 +0100
commit4a1f2d3866defbdc9386b52051c1d8540a8db451 (patch)
tree34c488c1f9ca6499b7d4ab5b239242ec2fd3fc4b /proc
parent7719472e3410d009c89d775ea05dc7f305d9ebce (diff)
proc: do not set last_processor on thread_info() error
* proc/info.c (S_proc_getprocinfo): Only set last_processor field when err == 0.
Diffstat (limited to 'proc')
-rw-r--r--proc/info.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/proc/info.c b/proc/info.c
index 93a18d39e..6c2567d26 100644
--- a/proc/info.c
+++ b/proc/info.c
@@ -701,6 +701,15 @@ S_proc_getprocinfo (struct proc *callerp,
err = thread_info (thds[i], THREAD_SCHED_INFO,
(thread_info_t) &pi->threadinfos[i].pis_si,
&thcount);
+
+#ifdef HAVE_STRUCT_THREAD_SCHED_INFO_LAST_PROCESSOR
+ if (err == 0)
+ /* If the structure read doesn't include last_processor field, assume
+ CPU 0. */
+ if (thcount < 8)
+ pi->threadinfos[i].pis_si.last_processor = 0;
+#endif
+
if (err == MACH_SEND_INVALID_DEST)
{
pi->threadinfos[i].died = 1;
@@ -714,13 +723,6 @@ S_proc_getprocinfo (struct proc *callerp,
err = 0;
}
-#ifdef HAVE_STRUCT_THREAD_SCHED_INFO_LAST_PROCESSOR
- /* If the structure read doesn't include last_processor field, assume
- CPU 0. */
- if (thcount < 8)
- pi->threadinfos[i].pis_si.last_processor = 0;
-#endif
-
}
/* Note that there are thread wait entries only for those threads