From nobody Fri Dec 17 05:35:05 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D2E5B18F1259; Fri, 17 Dec 2021 05:35:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JFd3Y4FpRz4pnJ; Fri, 17 Dec 2021 05:35:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6D25115EE5; Fri, 17 Dec 2021 05:35:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1BH5Z5ft088818; Fri, 17 Dec 2021 05:35:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BH5Z5kh088817; Fri, 17 Dec 2021 05:35:05 GMT (envelope-from git) Date: Fri, 17 Dec 2021 05:35:05 GMT Message-Id: <202112170535.1BH5Z5kh088817@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: caacda7a3e89 - main - sched_get/setaffinity(3): pid 0 should designate current process List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: caacda7a3e898a8b142d27732a9f13a525b08ea7 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1639719305; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gLIeHtsor6D1X1yAVhP+EWT7WXSBCoSyHBbg8AWMgzs=; b=nUpKeracgBPHKjF6y1TMOpSK2JP6RczSxqQzFWkGO2pNKyd1ujW/Z9Vc24Y4/LhsLXXkmT HVxFuksPCNm7aAwqga7YrcRvHNuoS2AOKfjJUAovYdxw1A006el7lca8su88R1j7xc/Y/a ZscHQsuyY6c/p/DDYPa5x11a5Gw8VeT11VCze3uVHfrzx+28XW7LLu2uhIVHxUGFNUz1X4 5Q/COwY982Tlixuf4VM1J+HwdRodkOoesFSjA1q/g2IZ+sTE7bMkxEW5grS18kNnM+sa49 ToY75V/W866fFYgbybxn+XCQM55OwlnPiIoU+OSHfQJp/qtSxS+RBKgtvCLwmQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1639719305; a=rsa-sha256; cv=none; b=oDfD1V3yF6E+u9GbFotqngw594W+fI0+qcQYtk43508fgnEQ67K8SdGapc1ngmnu99NvAb oIkLV5tKG6mDIXFeNPrWKWBMD3bcXpFulWNKLzgRxOsI8MM6NY5D+3hNODFyiY48ON/MAV mzOgX6Q0GwAcfEiF5IEsawn0dULpky4FffJ0slzf7qOA9L80oxqVf80x+8Z0M9zcbdNi4O wuO0Gl7PH9d4ss0GHy97HXVc7KSEA1R7uiqHH+ZwtskUF0XQjw0SprXQhsZ/7y25eqfHy7 VX20LDTZw5deMfGr0FPs0NmiJUoJzMAh5B+G9QcvWVAh7W9NqVsI9bF7vjwZsg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=caacda7a3e898a8b142d27732a9f13a525b08ea7 commit caacda7a3e898a8b142d27732a9f13a525b08ea7 Author: Math Ieu AuthorDate: 2021-12-17 05:31:09 +0000 Commit: Konstantin Belousov CommitDate: 2021-12-17 05:31:09 +0000 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 --- lib/libc/gen/sched_getaffinity.c | 4 ++-- lib/libc/gen/sched_setaffinity.c | 4 ++-- 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)); }