From nobody Fri Feb 23 17:57:58 2024 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 4ThHmQ5dm9z5BCMl; Fri, 23 Feb 2024 17:57:58 +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 4ThHmQ3hlhz4pD7; Fri, 23 Feb 2024 17:57:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708711078; 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=ppOMLu93omniTqSvJjTuEKy8JMa0NRyVCJxxL0FqHwQ=; b=HX7BtQ3koaDNA6KLT3f4RhfIDC3k6lxm5xXzK+i/L0q4xZnuC6rXv2tDGchNmnn8lmfA1y WfiByDLIAESjm0V67d+QKqRVFPNn6m72nUCUbdlIG7A8ztWwuphYoHTZdpGFKHo/RLTqTJ /q0CcjcR2TnVmSIsSMRUt1gX1QNNRFFt25fT/KbDnn2u25nw/uFRpH4yzWrFfW6NZ1C9U9 +TdPosREntRmvqMd3cFVGXFqT8IxgC+YwlXkClRVHBSL96L1/2pb+7JKOnaNVWtqo7gAFi o3BHFXUkH9EzoOmexr/1bydUzQOY3RSVKWm2QP7SdtiS+8/ZcPcINd7pglLa8g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1708711078; a=rsa-sha256; cv=none; b=JanWIvTKM7gSdZ6Fs0E/M51B58PiIzwP9CPjSh+xGrjgVx3DQauiP069Pe9IWvkrcdLM2+ 2sSSexS+zpuvW7EGFK+Bf8nQ2sZ+K2ezPjPhgZ9W+Tq2xjfi960urJ+PoNYBEPg00v2rja xVWOyShFFtQ+J+m0TrY5Iwumge5h8BaUNKFtLdlrJ/tCiIh2fG4HEZsAUa5e4G9XnWurgR aqS0/A7NtCuZDsaUFQDtSusia5rUrkuE9YoATJg/9ACQC32FO4D4oNs2cDGWTqqNoaAZvf eGJFUKYhtyVU4em252sG68KCmZqgBq+mENGtNnSo2v80AinoZUVSShITGWhu2w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708711078; 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=ppOMLu93omniTqSvJjTuEKy8JMa0NRyVCJxxL0FqHwQ=; b=Xc3DDRcV4THydEo9SfFIKeFifG+E1dxOJas1UtKnVRIMspVxYn3ZgF1g5ys0FastA9c/Th UuJ1Ih4Yj9eF/C4q3VV0KPI3tjnkfMdkI2ZE8N3bFRSqMF0BO79b/NZUXaQw4/xs2+mmNo 6pdmEaSG7jbO/CzVwh5aKADF2o/aMgzWx9F/iu4NBOSpaHgPge05EI2Ssxx2+QIVT7qdu2 fffWHLY3nCMJ94tAY7pBbcgStCul9qTCRE6CYRxg9uTU/T15nQDj4CU23jcfEtAGLfHz7R NLiaxAA+wxhUcPaabhbvOXM34AZyvhJ6DTDkVr+dzWQ3dt3hj2IN6RmSqT+9xg== 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 4ThHmQ2SktzQmT; Fri, 23 Feb 2024 17:57:58 +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 41NHvwfx018265; Fri, 23 Feb 2024 17:57:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41NHvw1Y018262; Fri, 23 Feb 2024 17:57:58 GMT (envelope-from git) Date: Fri, 23 Feb 2024 17:57:58 GMT Message-Id: <202402231757.41NHvw1Y018262@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: 7d233b2220cd - main - libsys: fix sleep(3)/usleep(3) cancel behavior 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: 7d233b2220cd3d23c028bdac7eb3b6b7b2025125 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=7d233b2220cd3d23c028bdac7eb3b6b7b2025125 commit 7d233b2220cd3d23c028bdac7eb3b6b7b2025125 Author: Konstantin Belousov AuthorDate: 2024-02-23 14:53:10 +0000 Commit: Konstantin Belousov CommitDate: 2024-02-23 17:39:44 +0000 libsys: fix sleep(3)/usleep(3) cancel behavior Move functions back to libc/gen sources; they are only versioned from libc and not libsys. Access libsys interposing slots using __libsys_interposing_slot() instead of direct __libsys_interposing array dereference, which cannot work from libc. Reported by: glebius Reviewed by: brooks Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D44042 --- lib/libc/gen/Makefile.inc | 2 ++ lib/{libsys => libc/gen}/sleep.c | 2 +- lib/{libsys => libc/gen}/usleep.c | 3 ++- lib/libsys/Makefile.sys | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/libc/gen/Makefile.inc b/lib/libc/gen/Makefile.inc index 648ddc76e056..3a8b4e57420a 100644 --- a/lib/libc/gen/Makefile.inc +++ b/lib/libc/gen/Makefile.inc @@ -137,6 +137,7 @@ SRCS+= \ siglist.c \ signal.c \ sigsetops.c \ + sleep.c \ srand48.c \ statvfs.c \ stringlist.c \ @@ -160,6 +161,7 @@ SRCS+= \ ulimit.c \ uname.c \ unvis-compat.c \ + usleep.c \ utime.c \ utxdb.c \ valloc.c \ diff --git a/lib/libsys/sleep.c b/lib/libc/gen/sleep.c similarity index 97% rename from lib/libsys/sleep.c rename to lib/libc/gen/sleep.c index 7d0fa5332ecc..46a7dcc4dbca 100644 --- a/lib/libsys/sleep.c +++ b/lib/libc/gen/sleep.c @@ -56,7 +56,7 @@ __sleep(unsigned int seconds) time_to_sleep.tv_sec = seconds; time_to_sleep.tv_nsec = 0; if (((int (*)(const struct timespec *, struct timespec *)) - __libsys_interposing[INTERPOS_nanosleep])( + (*__libsys_interposing_slot(INTERPOS_nanosleep)))( &time_to_sleep, &time_remaining) != -1) return (0); if (errno != EINTR) diff --git a/lib/libsys/usleep.c b/lib/libc/gen/usleep.c similarity index 96% rename from lib/libsys/usleep.c rename to lib/libc/gen/usleep.c index efd5ee0d1667..e312e55c6541 100644 --- a/lib/libsys/usleep.c +++ b/lib/libc/gen/usleep.c @@ -46,7 +46,8 @@ __usleep(useconds_t useconds) time_to_sleep.tv_nsec = (useconds % 1000000) * 1000; time_to_sleep.tv_sec = useconds / 1000000; return (((int (*)(const struct timespec *, struct timespec *)) - __libsys_interposing[INTERPOS_nanosleep])(&time_to_sleep, NULL)); + (*__libsys_interposing_slot(INTERPOS_nanosleep)))(&time_to_sleep, + NULL)); } __weak_reference(__usleep, usleep); diff --git a/lib/libsys/Makefile.sys b/lib/libsys/Makefile.sys index e33a11bacb57..6b83e5812f76 100644 --- a/lib/libsys/Makefile.sys +++ b/lib/libsys/Makefile.sys @@ -40,7 +40,7 @@ SRCS+= \ SRCS+= getdents.c lstat.c mknod.c stat.c SRCS+= creat.c -SRCS+= lockf.c sleep.c usleep.c wait.c wait3.c waitpid.c waitid.c +SRCS+= lockf.c wait.c wait3.c waitpid.c waitid.c SRCS+= recv.c recvmmsg.c send.c sendmmsg.c NOASM+= sched_getcpu.o