From nobody Mon May 02 18:09:54 2022 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 5DA4E1AB43F7; Mon, 2 May 2022 18:09:54 +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 4KsWMk26thz3l1M; Mon, 2 May 2022 18:09:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651514994; 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=VEsYpqR2WrxtrFQPyFEmjDqg1H9Z/YdA1GFfZwgU/wc=; b=GsiA6LIMuYBGVjy/1bdCDuUOAKnIYHDCzuWU72l2H8S/wkQYyaEhmo0q31Gr48voFuTceC ye2V/hkefuHnVjXBL1gPz2RjyUMeR1vvBi9jihkbxAce9TE4rDF9o3uKCec6FmBKu56aZe XcS9PeWpXVr1tnI8KJSv4xyuMrn9/h19RBMl5j26mD1eXg1I/VWx5llxUBEQzuM8+6AjjG XYHOvR5aSClZLIe9k625uGZb5lT2OUjI4DeyqN07PSE+ZPGGQTHU9NDG97uC0ZHZR7bcbt gNxe9plE5s1B7fiPSSSN4N/jLbH0z2yuQ3Ju1YCxS0jSWulaJiDtC1k7VjYdQQ== 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 24C9D6B1D; Mon, 2 May 2022 18:09:54 +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 242I9s5e060309; Mon, 2 May 2022 18:09:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 242I9s2H060308; Mon, 2 May 2022 18:09:54 GMT (envelope-from git) Date: Mon, 2 May 2022 18:09:54 GMT Message-Id: <202205021809.242I9s2H060308@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: aca70bd01e3f - stable/13 - sched_getaffinity(3): more compatibility with Linux 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/stable/13 X-Git-Reftype: branch X-Git-Commit: aca70bd01e3f0db30caf9e3a9a0befe99a08f0d7 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651514994; 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=VEsYpqR2WrxtrFQPyFEmjDqg1H9Z/YdA1GFfZwgU/wc=; b=YD4jP8J1Aqr19aiBaOGa9aXE9dV4mdhQHjH9whbelw/gB+QIE9ReqqBEG/TiAYguI1DMjE 271NrIT2BFRxLVGsIZoJvDKaPmvq5tykV70GQocaylMqCPFmCJCS5P68GiW7dLHn75ukKw jyMyYQew6D+ZeYVcX+Zelg6goBvhGe4BCa2YT3g61YEoReMQS6+itVfl60i4SkO84tnao2 SLPkUBX6XaZXZSDPxJ2Je6bGUOQEG77berSC9Cdhfc5V87WyOC55PI14MbyIwGwNDqTNJv G3HwuhSvYDD0YiuV+WhxfNRsFNlBefTcSOi90Ac0xp++PmiWuRbNCGIibfNIow== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1651514994; a=rsa-sha256; cv=none; b=FiCFGvMSJfiBDUUYJa8wGVu3ujRupwOL1PDOjKSD2s+eG6HR/Otz+hJTtl/41RE+cMctt/ NiPeMdfRhm9mQykbafTQmQ1iTmY2PUp1c4B4/iCMGLBQMfPRIRgMs3fFw99E4pSWAquQpd yjdxlrvvoZysCesVx07PhYjPxEiq/ehJZy9jqgSPNUszbQlAEA9NgXujkSvs5xSIFPD8f7 WvnxDqHCLVnqVgyF2XtdhAXt3EOY5jqPqKZv9AUeX1yH7rBzUSjy3u2x4zRk4mRtnADq9w xRcbWnsG1uhKgIJnQhXGLjsbvFLgOTkZTYttXN8v1N4TYM75iqAtbowqHiNV0Q== 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=aca70bd01e3f0db30caf9e3a9a0befe99a08f0d7 commit aca70bd01e3f0db30caf9e3a9a0befe99a08f0d7 Author: Konstantin Belousov AuthorDate: 2022-04-24 22:10:18 +0000 Commit: Konstantin Belousov CommitDate: 2022-05-02 18:08:44 +0000 sched_getaffinity(3): more compatibility with Linux (cherry picked from commit 67fc95025ccfc696ea5eaea0ecb1fff295760723) --- lib/libc/gen/sched_setaffinity.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/libc/gen/sched_setaffinity.c b/lib/libc/gen/sched_setaffinity.c index 91ab2a401bda..09e2b9097d5a 100644 --- a/lib/libc/gen/sched_setaffinity.c +++ b/lib/libc/gen/sched_setaffinity.c @@ -34,6 +34,7 @@ int sched_setaffinity(pid_t pid, size_t cpusetsz, const cpuset_t *cpuset) { cpuset_t c; + int error; if (cpusetsz > sizeof(cpuset_t)) { errno = EINVAL; @@ -42,6 +43,10 @@ sched_setaffinity(pid_t pid, size_t cpusetsz, const cpuset_t *cpuset) memset(&c, 0, sizeof(c)); memcpy(&c, cpuset, cpusetsz); } - return (cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, - pid == 0 ? -1 : pid, sizeof(cpuset_t), &c)); + error = cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, + pid == 0 ? -1 : pid, sizeof(cpuset_t), &c); + if (error == -1 && errno == EDEADLK) + errno = EINVAL; + + return (error); }