From: Justin Cinkelj <[email protected]>
Committer: Nadav Har'El <[email protected]>
Branch: master
sched: sched_setaffinity/sched_getaffinity should accept pid == current tid
There is no need to reject non-zero pid/tid if it is equal to current tid.
The pid 0 means current tid anyway.
Signed-off-by: Justin Cinkelj <[email protected]>
Message-Id: <[email protected]>
Signed-off-by: Nadav Har'El <[email protected]>
---
diff --git a/libc/pthread.cc b/libc/pthread.cc
--- a/libc/pthread.cc
+++ b/libc/pthread.cc
@@ -971,7 +971,7 @@ int pthread_setaffinity_np(pthread_t thread, size_t
cpusetsize,
int sched_setaffinity(pid_t pid, size_t cpusetsize,
cpu_set_t *cpuset)
{
- if (pid != 0) {
+ if (pid != 0 && (unsigned int)pid != sched::thread::current()->id()) {
WARN_STUBBED();
return EINVAL;
}
@@ -1029,7 +1029,7 @@ int pthread_attr_getaffinity_np(const pthread_attr_t
*attr, size_t cpusetsize,
int sched_getaffinity(pid_t pid, size_t cpusetsize,
cpu_set_t *cpuset)
{
- if (pid != 0) {
+ if (pid != 0 && (unsigned int)pid != sched::thread::current()->id()) {
WARN_STUBBED();
return EINVAL;
}
--
You received this message because you are subscribed to the Google Groups "OSv
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.