Sent patch

El mar., 29 oct. 2019 a las 0:05, Almudena Garcia (<
liberamenso10...@gmail.com>) escribió:

> Fixed
>
> El lun., 28 oct. 2019 a las 23:54, Samuel Thibault (<
> samuel.thiba...@gnu.org>) escribió:
>
>> Almudena Garcia, le lun. 28 oct. 2019 20:16:33 +0100, a ecrit:
>> > +       /* if the structure read doesn't include last_processor field,
>> set It to 0 */
>> > +       if(thcount >= THREAD_SCHED_INFO_COUNT){
>> > +               thds[i]->last_processor = 0;
>> > +       }
>>
>> That'd rather be if(thcount < THREAD_SCHED_INFO_COUNT), and better make
>> it akin to other additions: if (thcount < 8).
>>
>> Samuel
>>
>

Attachment: CHANGELOG_hurd
Description: Binary data

--- hurd/procfs/process.c	2019-10-26 23:12:40.495359917 +0200
+++ hurd~/procfs/process.c	2019-10-31 01:03:33.551379548 +0100
@@ -221,6 +221,7 @@
   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 @@
   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 @@
       (long unsigned) proc_stat_thread_rpc (ps), /* close enough */
       0L, 0L,
       0,
-      0,
+      last_processor,
       0, 0,
       0LL);
 }
--- hurd/proc/info.c	2019-10-26 23:12:40.495359917 +0200
+++ hurd~/proc/info.c	2019-10-31 01:31:45.283311352 +0100
@@ -713,6 +713,15 @@
 	      *flags &= ~PI_FETCH_THREAD_SCHED;
 	      err = 0;
 	    }
+
+#ifdef HAVE_STRUCT_THREAD_SCHED_INFO_LAST_PROCESSOR
+	  /* if the structure read doesn't include last_processor field, set It to 0 */
+	  if (thcount < 8)
+	    {
+  	      thds[i]->last_processor = 0;
+	    }
+#endif
+
 	}
 
       /* Note that there are thread wait entries only for those threads
--- hurd/configure.ac	2019-10-26 23:12:40.403359794 +0200
+++ hurd~/configure.ac	2019-10-31 00:09:50.799509461 +0100
@@ -347,6 +347,10 @@
 AC_SUBST([libdaemon_LIBS])
 AC_SUBST([libdaemon_CFLAGS])
 
+
+AC_CHECK_MEMBERS([struct thread_sched_info.last_processor],,,
+ [#include<mach/thread_info.h])
+
 PKG_CHECK_MODULES([libblkid], [blkid],
   [AC_DEFINE([HAVE_BLKID], [1], [Use libblkid])],
   [true])

Reply via email to