summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlmudena Garcia <liberamenso10000@gmail.com>2019-10-27 23:14:15 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2019-10-27 23:14:15 +0100
commit75267dd103637d38fa95ecdee0eedb16ba0f662c (patch)
tree8727ccca1c9287459e55c938cb1824cf5d7b40d7
parentd6bdc8ca5b08c4c155dc7c53a148937ba451351e (diff)
patch: add last_processor to thread info structures
* include/mach/thread_info.h (thread info structures): Add new member "last_processor" in thread_sched_info. * kern/thread.c (thread management): Fill new member "last_processor" in thread_info() function.
-rw-r--r--include/mach/thread_info.h1
-rw-r--r--kern/thread.c13
-rw-r--r--version.m42
3 files changed, 13 insertions, 3 deletions
diff --git a/include/mach/thread_info.h b/include/mach/thread_info.h
index 60e8ba7f..569c8c84 100644
--- a/include/mach/thread_info.h
+++ b/include/mach/thread_info.h
@@ -107,6 +107,7 @@ struct thread_sched_info {
integer_t cur_priority; /* current priority */
/*boolean_t*/integer_t depressed; /* depressed ? */
integer_t depress_priority; /* priority depressed from */
+ integer_t last_processor; /* last processor used by the thread */
};
typedef struct thread_sched_info thread_sched_info_data_t;
diff --git a/kern/thread.c b/kern/thread.c
index 73d9b5a4..680e72c2 100644
--- a/kern/thread.c
+++ b/kern/thread.c
@@ -1580,8 +1580,11 @@ kern_return_t thread_info(
else if (flavor == THREAD_SCHED_INFO) {
thread_sched_info_t sched_info;
- if (*thread_info_count < THREAD_SCHED_INFO_COUNT) {
- return KERN_INVALID_ARGUMENT;
+ /* Allow *thread_info_count to be one smaller than the
+ usual amount, because last_processor is a
+ new member that some callers might not know about. */
+ if (*thread_info_count < THREAD_SCHED_INFO_COUNT -1) {
+ return KERN_INVALID_ARGUMENT;
}
sched_info = (thread_sched_info_t) thread_info_out;
@@ -1609,6 +1612,12 @@ kern_return_t thread_info(
sched_info->depressed = (thread->depress_priority >= 0);
sched_info->depress_priority = thread->depress_priority;
+#if NCPUS > 1
+ sched_info->last_processor = thread->last_processor;
+#else
+ sched_info->last_processor = 0;
+#endif
+
thread_unlock(thread);
splx(s);
diff --git a/version.m4 b/version.m4
index d6696d62..1de75037 100644
--- a/version.m4
+++ b/version.m4
@@ -1,4 +1,4 @@
m4_define([AC_PACKAGE_NAME],[GNU Mach])
-m4_define([AC_PACKAGE_VERSION],[1.8])
+m4_define([AC_PACKAGE_VERSION],[1.8+git20190109])
m4_define([AC_PACKAGE_BUGREPORT],[bug-hurd@gnu.org])
m4_define([AC_PACKAGE_TARNAME],[gnumach])