diff options
author | Almudena Garcia <liberamenso10000@gmail.com> | 2019-10-27 23:14:15 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2019-10-27 23:14:15 +0100 |
commit | 75267dd103637d38fa95ecdee0eedb16ba0f662c (patch) | |
tree | 8727ccca1c9287459e55c938cb1824cf5d7b40d7 /kern | |
parent | d6bdc8ca5b08c4c155dc7c53a148937ba451351e (diff) | |
download | gnumach-75267dd103637d38fa95ecdee0eedb16ba0f662c.tar.gz gnumach-75267dd103637d38fa95ecdee0eedb16ba0f662c.tar.bz2 gnumach-75267dd103637d38fa95ecdee0eedb16ba0f662c.zip |
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.
Diffstat (limited to 'kern')
-rw-r--r-- | kern/thread.c | 13 |
1 files changed, 11 insertions, 2 deletions
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); |