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 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libc/pthread.cc b/libc/pthread.cc index d59fa37..ad094fc 100644 --- a/libc/pthread.cc +++ b/libc/pthread.cc @@ -971,7 +971,10 @@ 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) { + int self_tid; + sched::thread &t = pthread::from_libc(pthread_self())->_thread; + self_tid = t.id(); + if (pid != 0 && pid != self_tid) { WARN_STUBBED(); return EINVAL; } @@ -1029,7 +1032,10 @@ 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) { + int self_tid; + sched::thread &t = pthread::from_libc(pthread_self())->_thread; + self_tid = t.id(); + if (pid != 0 && pid != self_tid) { 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.
