Something as this?

El lun., 28 oct. 2019 a las 19:24, Samuel Thibault (<samuel.thiba...@gnu.org>)
escribió:

> Almudena Garcia, le lun. 28 oct. 2019 19:16:28 +0100, a ecrit:
> > > As I said, look for the thread_info() calls, to fill the field if the
> > > returned count doesn't include it.
> >
> > process_file_gc_stat(), the function which write the stat structure,
> doesn't
> > calls to thread_info().
>
> Indeed, it gets it from proc_stat_thread_basic_info, which gets
> it from the ps parameter, which is created by _proc_stat_create
> and filled by proc_stat_set_flags, which calls set_procinfo_flags,
> which calls merge_procinfo, which calls fetch_procinfo, which calls
> proc_getprocinfo, i.e. proc's S_proc_getprocinfo() RPC.
>
> But we didn't need to see that route anyway: we add information returned
> by thread_info(), so it's simply the callers of thread_info() which need
> to be fixed. The rest will follow.
>
> Samuel
>
--- hurd/procfs/process.c	2019-10-26 23:12:40.495359917 +0200
+++ hurd~/procfs/process.c	2019-10-28 19:41:14.751636209 +0100
@@ -286,7 +288,7 @@
       (long unsigned) proc_stat_thread_rpc (ps), /* close enough */
       0L, 0L,
       0,
-      0,
+      (long unsigned) thsi->last_processor,
       0, 0,
       0LL);
 }
--- hurd/proc/info.c	2019-10-26 23:12:40.495359917 +0200
+++ hurd~/proc/info.c	2019-10-28 19:43:11.898787596 +0100
@@ -713,6 +713,12 @@
 	      *flags &= ~PI_FETCH_THREAD_SCHED;
 	      err = 0;
 	    }
+
+	  /* 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;
+	  }
+
 	}
 
       /* Note that there are thread wait entries only for those threads

Reply via email to