From nobody Tue May 31 08:59:36 2022 X-Original-To: dev-commits-src-main@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 750281B57145; Tue, 31 May 2022 08:59:36 +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 4LC5nN2cT3z4l0h; Tue, 31 May 2022 08:59:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1653987576; 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=8ClyUuc5sukJDZPv1IRkRdNqoxDYRkHSgyElpkOtAWg=; b=qP7w0JRfb7pUAgFdUa9kDJoDmRTU1sU2u8NPxP2Yvk4K+ySbiD4+r9/nHHuAuCraWSebKX 3DP1SHchhPdROZGnCphdWLVPYHZnL14RqT/OTdwh4y02pIRQC+IH8DcK8C3pcWjiwohc7t XQC93VtZmiY1K3BSTH2TUwPUxRm2I7o6GKoUEI2QL0goGbbbJi/qndEqG33uiP+h07WEuw ZaFX6Q5CTix7oSvyPTFvEq+YXCPhxW0AmdH/ZRnV0VGuisFxMhJ/iCA8BEHztmG5bgWcnp wr2BMGY5RrIjK9SHC+nYf/Rd2NFpd87KTqsny70uyvEfz7JMtOsWW3wuEudn1Q== 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 2DDF888A; Tue, 31 May 2022 08:59:36 +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 24V8xalP047924; Tue, 31 May 2022 08:59:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 24V8xaDh047923; Tue, 31 May 2022 08:59:36 GMT (envelope-from git) Date: Tue, 31 May 2022 08:59:36 GMT Message-Id: <202205310859.24V8xaDh047923@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 452f4636c3ba - main - linux(4): Return ENOTSUP for unsupported clockid List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 452f4636c3ba1f51f2f549ccc31fd4177254fb6d Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1653987576; 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=8ClyUuc5sukJDZPv1IRkRdNqoxDYRkHSgyElpkOtAWg=; b=cwTyL/9U196XSpLcqbgXBK4qiAmIICnf/5ZAcL7fGBwrZ+KlG0fgCsAK1jE59Y7A7TacZo /YpbJFCGjKF2PCPw6pplikC5l//H7TzX04ieSuJhxR7N9S1gjwBW8f5/KubS25QWDU2bm5 EgWdWFzRD4vFqMypdGkGthco/lCheE2r1EQxEzBlH+IsaRUT7uz3Ybn50C0/fndh2Bb8CD 8gKeqBaPYY1GeES0QCQjdZBqNj4zNFyDvkROOIvy10S4D7EpZ+n0hedPsfBHi3923wl7Aa P17icnD70zDVDtERk+7EYREoUGOdg+rzdQFwE/OyiTVJ5IH+NXWa91uNeKJUuQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1653987576; a=rsa-sha256; cv=none; b=c7ha8IGmYLjXDvoP3Ci8Y05/yMF8sitLchvBpCT0rB/XUenRUo0/JlW1c5CBe7x41KUc0p IrLBDYXXqOmuAuk+TTopzAxfGWeLuVSMA7lSe3lJv+MIqfBFGr6+aEC88U6My0uYV9NFcO KzaTUyHqU8jgn5paHPmMZYhBFfUpluxNJXg6+D0YzeGwbe//kGTrRdIYT6Cg21tzkogQRp CpkN50Ksk7uO72gzOFdA24T4s0CuS5+j272t/3gYGODRKBX4zSRNDSCKpVeAzSQ0x+curK Vmii7EuE+3tzEZxCXRGcBfnkXnya83U9Ulan3af7JzpmXIz5IwlPYOKEvE7ECQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=452f4636c3ba1f51f2f549ccc31fd4177254fb6d commit 452f4636c3ba1f51f2f549ccc31fd4177254fb6d Author: Dmitry Chagin AuthorDate: 2022-05-31 08:43:00 +0000 Commit: Dmitry Chagin CommitDate: 2022-05-31 08:43:00 +0000 linux(4): Return ENOTSUP for unsupported clockid It's much better from the user perspective to get a sane error code. MFC after: 2 weeks --- sys/compat/linux/linux_time.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sys/compat/linux/linux_time.c b/sys/compat/linux/linux_time.c index 0be7025abe05..5d2269190931 100644 --- a/sys/compat/linux/linux_time.c +++ b/sys/compat/linux/linux_time.c @@ -278,8 +278,11 @@ linux_to_native_clockid(clockid_t *n, clockid_t l) if (l < 0) { /* cpu-clock */ - if ((l & LINUX_CLOCKFD_MASK) == LINUX_CLOCKFD) - return (EINVAL); + if (LINUX_CPUCLOCK_WHICH(l) == LINUX_CLOCKFD) { + LIN_SDT_PROBE1(time, linux_to_native_clockid, + unsupported_clockid, l); + return (ENOTSUP); + } if (LINUX_CPUCLOCK_WHICH(l) >= LINUX_CPUCLOCK_MAX) return (EINVAL); @@ -319,11 +322,11 @@ linux_to_native_clockid(clockid_t *n, clockid_t l) case LINUX_CLOCK_TAI: LIN_SDT_PROBE1(time, linux_to_native_clockid, unsupported_clockid, l); - return (EINVAL); + return (ENOTSUP); default: LIN_SDT_PROBE1(time, linux_to_native_clockid, unknown_clockid, l); - return (EINVAL); + return (ENOTSUP); } return (0);