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
This commit is contained in:
Math Ieu 2021-12-17 07:31:09 +02:00 committed by Konstantin Belousov
parent 8ea3921f93
commit caacda7a3e
2 changed files with 4 additions and 4 deletions

View File

@ -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));
}

View File

@ -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));
}