From nobody Sat Aug 12 22:34:15 2023 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 4RNb7D031xz4TtvW; Sat, 12 Aug 2023 22:34:16 +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 4RNb7C6Pg6z4YY3; Sat, 12 Aug 2023 22:34:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1691879655; 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=Q18/nDlJte+93jptWgNPgpmAzi08XC29udHclJgtKVA=; b=ixf3wHLjst4H9QArrmekWoEsHCtQouFN0hFrhTSF77dHI3oeTZP8a4zgxu+UKG3BrRxWh0 3aGGUFqnmIIaRe31HIHZP3cnk3HyzF59BiRckUVZ8J6GmgW0HelvEctBQCIWfzFwjSCCHv mFp867kJ6n1P+5itxLmu9yYhS1H8BtzLMnufJ4Muv1ge0xs72JPYzrbGDJhv62umFIUyes /bOZ2JMrzAt4+nsVV8dkHDCSLpyycW7N/MQZVxmKLItAdyminftacejZSYJH85M/7D5/FA fN4tiBP9Fc32mhDEuxAnFa+lyBZtciimSfStkGFRQoMmrh8E+JAn4X0gPqV8Ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1691879655; 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=Q18/nDlJte+93jptWgNPgpmAzi08XC29udHclJgtKVA=; b=Bn2TsybwyIzD1QzeC3nj3cLvawEGpJHfv/OcsMbzVa9S6GnaXR+tbMQMlY3vWO5W+Ob4tZ TCp+a4kL0zNPw6S2hkXAHBRWgN7myhSQFtwCKM32AgmC5JFUylfgeBXMwKxBag0aH+ufU/ sxXbBa9rlNpkFmP/AH2STq6ZLSmClwB/YzmPyT/3y1/VDUseHbwHomceLQNsb61Df2vVkT Wrh57XzjbFoxlDgRwSOizwHU9Nrp1UQShlVwtCgni411+y2Yb0say52k6TB3PH2KeQNCGK b8cJO5LyqloLGNayOQ5gTbTf/eu9GyGxzynJpfmJC2FY1IDnG7ou56c+n9MhKQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1691879655; a=rsa-sha256; cv=none; b=ZO+eaZQswXO7DPRwk5ALunCTyvX0I2EKKvt8e0s5BRZIDjFJrgKXJlNOB2JcaEiyt71bLH uh9S/byLExFthgV1cmgiQLxIixykKRcC2E8EWkWx/mkF+YIc1hoepgeUupSAuJHkVGOnK3 ouVK8uzOt6T/QA4+nmF+mtsN/zmIM94PKlDW+9gPrR9rMyn6t0BCBC+EnguttdxdEtAfe5 cdgUwjZVjzMzkbl3HtvFo/eMU+z2WMLHpICa7ruHt0sQS+j5eAvRR0l0yMiDXa4Tn+VCkW 5bLPPXXfovanfoDguSGLvd6E2tFokxt3ICf+sVqphcqfub5NPkrUDbAEVo+Xwg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4RNb7C5T40zdh1; Sat, 12 Aug 2023 22:34:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 37CMYFoC037100; Sat, 12 Aug 2023 22:34:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 37CMYFgQ037097; Sat, 12 Aug 2023 22:34:15 GMT (envelope-from git) Date: Sat, 12 Aug 2023 22:34:15 GMT Message-Id: <202308122234.37CMYFgQ037097@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: 41acfee690da - main - libc vdso time functions: correctly convert errors into errnos 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: 41acfee690da6289d570338e6365c1d7ef61dad5 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=41acfee690da6289d570338e6365c1d7ef61dad5 commit 41acfee690da6289d570338e6365c1d7ef61dad5 Author: Konstantin Belousov AuthorDate: 2023-08-12 15:45:43 +0000 Commit: Konstantin Belousov CommitDate: 2023-08-12 22:34:08 +0000 libc vdso time functions: correctly convert errors into errnos Sponsored by: The FreeBSD Foundation MFC after: 1 week --- lib/libc/sys/clock_gettime.c | 6 +++++- lib/libc/sys/gettimeofday.c | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/libc/sys/clock_gettime.c b/lib/libc/sys/clock_gettime.c index ec8ec13a754d..b2a414455245 100644 --- a/lib/libc/sys/clock_gettime.c +++ b/lib/libc/sys/clock_gettime.c @@ -48,7 +48,11 @@ __clock_gettime(clockid_t clock_id, struct timespec *ts) error = __vdso_clock_gettime(clock_id, ts); else error = ENOSYS; - if (error == ENOSYS) + if (error == ENOSYS) { error = __sys_clock_gettime(clock_id, ts); + } else if (error != 0) { + errno = error; + error = -1; + } return (error); } diff --git a/lib/libc/sys/gettimeofday.c b/lib/libc/sys/gettimeofday.c index 22177b15a5c7..d955aaa907e2 100644 --- a/lib/libc/sys/gettimeofday.c +++ b/lib/libc/sys/gettimeofday.c @@ -44,7 +44,11 @@ __gettimeofday(struct timeval *tv, struct timezone *tz) int error; error = __vdso_gettimeofday(tv, tz); - if (error == ENOSYS) + if (error == ENOSYS) { error = __sys_gettimeofday(tv, tz); + } else if (error != 0) { + errno = error; + error = -1; + } return (error); }