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]>
---
 libc/pthread.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libc/pthread.cc b/libc/pthread.cc
index d59fa37..308b220 100644
--- 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;
     }
-- 
2.5.0

-- 
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.

Reply via email to