Attached new patch
El dom., 27 oct. 2019 a las 19:17, Samuel Thibault (<[email protected]>)
escribió:
> Almudena Garcia, le dim. 27 oct. 2019 19:09:17 +0100, a ecrit:
> > --- gnumach/kern/thread.c 2019-09-03 01:22:10.932747830 +0200
> > +++ GNUMach_SMP/kern/thread.c 2019-10-27 19:00:17.577010318 +0100
> > @@ -1530,6 +1530,16 @@
> > read_time_stamp(&thread->creation_time,
> > &basic_info->creation_time);
> >
> > + #if THREAD_BASIC_INFO_COUNT > 10
>
> That will be always true. What you want to check is *thread_info_count.
>
> Samuel
>
--- gnumach/kern/thread.c 2019-09-03 01:22:10.932747830 +0200
+++ GNUMach_SMP/kern/thread.c 2019-10-27 19:42:15.360761959 +0100
@@ -1500,11 +1500,11 @@
if (flavor == THREAD_BASIC_INFO) {
thread_basic_info_t basic_info;
- /* Allow *thread_info_count to be one smaller than the
- usual amount, because creation_time is a new member
- that some callers might not know about. */
+ /* Allow *thread_info_count to be two smaller than the
+ usual amount, because creation_time and last_processor
+ are new members that some callers might not know about. */
- if (*thread_info_count < THREAD_BASIC_INFO_COUNT - 1) {
+ if (*thread_info_count < THREAD_BASIC_INFO_COUNT - 2) {
return KERN_INVALID_ARGUMENT;
}
@@ -1530,6 +1530,17 @@
read_time_stamp(&thread->creation_time,
&basic_info->creation_time);
+ /* Check if the basic_info includes all new members (including last_processor) */
+ if (*thread_info_count == THREAD_BASIC_INFO_COUNT) {
+
+ #if NCPUS > 1
+ basic_info->last_processor = thread->last_processor;
+ #else
+ basic_info->last_processor = 0;
+ #endif
+
+ }
+
/*
* To calculate cpu_usage, first correct for timer rate,
* then for 5/8 ageing. The correction factor [3/5] is