From 3e11d3f61ae2b2b8a8ffeff4ef32067d95c065a1 Mon Sep 17 00:00:00 2001 From: Dmitry Chagin Date: Thu, 12 May 2022 20:06:13 +0300 Subject: [PATCH] Fixed the value returned by sched_getaffinity(). On success gnu libc sched_getaffinity() should return 0, unlike underlying Linux syscall which returns the size of CPU mask copied to user. PR: 263939 MFC after: 2 weeks --- lib/libc/gen/sched_getaffinity.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/libc/gen/sched_getaffinity.c b/lib/libc/gen/sched_getaffinity.c index 92135109156..ed304c11198 100644 --- a/lib/libc/gen/sched_getaffinity.c +++ b/lib/libc/gen/sched_getaffinity.c @@ -39,9 +39,5 @@ sched_getaffinity(pid_t pid, size_t cpusetsz, cpuset_t *cpuset) pid == 0 ? -1 : pid, cpusetsz, cpuset); if (error == -1 && errno == ERANGE) errno = EINVAL; - if (error == 0) - return (cpusetsz < sizeof(cpuset_t) ? cpusetsz : - sizeof(cpuset_t)); - return (error); }