aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMath Ieu <sigsys@gmail.com>2021-12-17 05:31:09 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2021-12-17 05:31:09 +0000
commitcaacda7a3e898a8b142d27732a9f13a525b08ea7 (patch)
tree5c9630edf95bd4c1f9f71c2f7b426ee2dfa56a86
parent8ea3921f932c43e2ece5c3f9033d4990a4d81375 (diff)
downloadsrc-caacda7a3e898a8b142d27732a9f13a525b08ea7.tar.gz
src-caacda7a3e898a8b142d27732a9f13a525b08ea7.zip
sched_get/setaffinity(3): pid 0 should designate current process
while FreeBSD' native sched_get/setaffinity use pid -1 for this. PR: 260487 MFC after: 1 week
-rw-r--r--lib/libc/gen/sched_getaffinity.c4
-rw-r--r--lib/libc/gen/sched_setaffinity.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/libc/gen/sched_getaffinity.c b/lib/libc/gen/sched_getaffinity.c
index 5557d3d93b47..7fca53e39b4b 100644
--- a/lib/libc/gen/sched_getaffinity.c
+++ b/lib/libc/gen/sched_getaffinity.c
@@ -32,6 +32,6 @@
int
sched_getaffinity(pid_t pid, size_t cpusetsz, cpuset_t *cpuset)
{
- return (cpuset_getaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, pid,
- cpusetsz, cpuset));
+ return (cpuset_getaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID,
+ pid == 0 ? -1 : pid, cpusetsz, cpuset));
}
diff --git a/lib/libc/gen/sched_setaffinity.c b/lib/libc/gen/sched_setaffinity.c
index ad775b5dbce5..1c083b4b108a 100644
--- a/lib/libc/gen/sched_setaffinity.c
+++ b/lib/libc/gen/sched_setaffinity.c
@@ -32,6 +32,6 @@
int
sched_setaffinity(pid_t pid, size_t cpusetsz, const cpuset_t *cpuset)
{
- return (cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, pid,
- cpusetsz, cpuset));
+ return (cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID,
+ pid == 0 ? -1 : pid, cpusetsz, cpuset));
}