From nobody Fri Jan 14 18:10:23 2022 X-Original-To: dev-commits-src-branches@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 00F6F1942573; Fri, 14 Jan 2022 18:10:25 +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 4Jb8V917pbz4pDK; Fri, 14 Jan 2022 18:10:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642183825; 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=BRx3xUTwL1r2l2KsIaEsDL8UWI5HUDIvXf/xRmBsA68=; b=WuO9zRoUDYMqgfqsdEv2RX3hvAxiQ6FGxb6296qn1BEdGAJ0ZiQ2N9lERDY/BrWOZAo5DH kCi5fO+TsnD2vJk4ayKvBWrxpSOlgwYxh8UZZJR464u1FNxl2X5CC5YA5khGzCMUifs7lV ped4QVSc2R43QHpQal0X9UVYJ1h3SgZQ81Pk+7gngAmdYQa3JZp28txqq4PFJ8s6Lecthp 8Dklp82qpu5Ca6hXG8ti5FcJNUSj92zl53K3k8d2neKtIi/ShD7kJqw9Uvt41kIAr12V0x 8z7IgE+DSXG+V7aawxC3T8CAodejShQXgtC2wxs9dsVash3R59reTDEQruOSpA== 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 A1F5918433; Fri, 14 Jan 2022 18:10:23 +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 20EIANfv095407; Fri, 14 Jan 2022 18:10:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20EIANW4095406; Fri, 14 Jan 2022 18:10:23 GMT (envelope-from git) Date: Fri, 14 Jan 2022 18:10:23 GMT Message-Id: <202201141810.20EIANW4095406@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 3f8542d3968e - stable/13 - sched_get/setaffinity(3): pid 0 should designate current process List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 3f8542d3968e24222c66844833dfa5b8707dd807 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642183825; 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=BRx3xUTwL1r2l2KsIaEsDL8UWI5HUDIvXf/xRmBsA68=; b=sme71KHjEn3qjKVE4pfX8ZK2Pg2Y6KBsJs6BsJoj0CxSIDRmgHaNEor9lf+YuY0htaOWUZ YJ9h4mqDNEM4LWy59dJTh1wIQTmJdlpkqJPKpZjyklQF2SyPDDznXdRXftFn5UiSOHb7ay lrBu69WxxWzXmV2P3w8EGuBQRgznPY+iUTp6jUT7Ofcog3o1skte5veokalWAqnEn4BfA7 q6x5Xb5Mh0tiR17S0508y3MJ9n0fhN7sFEHhGVok4iAJn+Ze3l53H2RaEHFo8QUb2IRw4t XdmXvdf3UDZTRkjjCoaSEAPKHvlhpiXv6VmK+77B9z5um/NxuSGJq2K1iJ/zqw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1642183825; a=rsa-sha256; cv=none; b=L7bHlvhTR3UKhMGBM3TtTA2iPh2ah0Chdtfr97zl5xA1/iN/+OOCRWzYGT3QySmfQeAaru 4Fb88IcBtfep+VS8rl5yTz2jbrVVnqaBYCssh8PGUvafO0H8TPzD+IZdqxE9dk91JROtOs 5Nd5zeNtNzY2c7JugnHVs+NiqS8ib8/5xh8dROjsbzhuw5KxmpYKAgkJK8AyeMHO+DvZ9z eON+ie8fU8xywj/ZtXsIvyVaYQMKlc/hgsGoJCf/jlIgBx08ujpmMFv1h55d/XHCz9PhJ/ t3E3lJIuGMdBI1PkXuWKr53W8tYJJIsPzwnVF/4rB6vIY3d9jvN6xJ+M2l+V+A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=3f8542d3968e24222c66844833dfa5b8707dd807 commit 3f8542d3968e24222c66844833dfa5b8707dd807 Author: Math Ieu AuthorDate: 2021-12-17 05:31:09 +0000 Commit: Konstantin Belousov CommitDate: 2022-01-14 16:17:30 +0000 sched_get/setaffinity(3): pid 0 should designate current process PR: 260487 (cherry picked from commit caacda7a3e898a8b142d27732a9f13a525b08ea7) --- 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)); }