From nobody Mon Jun 15 18:01:47 2026 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 4gfHxl4wd8z6hhYD for ; Mon, 15 Jun 2026 18:01:47 +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 "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gfHxl1fmGz4F6x for ; Mon, 15 Jun 2026 18:01:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1781546507; 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=MPDx+PVYxJupTJn+omwA4PryzHxKVw2BVOT1u0wB3XE=; b=V+LXbbZRDPzQFNNcw1wsqIo8n/YvpBmtKnUqyW/KAbqZc+FYvYvYeC4nx/9Xhg6KnkGYnG zrP45WoYzd9Nqasibd2yvDl6A9irKxDf3zRGMEnqnmlxk819z/ZY85qu9gJ+itVQ9IDr4T oqSJKvT2dfEzNykcJjIDhEeqmuniw9wXO5b/YwyKvHqyUwjFIg3ywkz9V1rBzvPSEn2Apo iZ4SYMN7fqbnI4YyTe6UuZ9UJJ2OEi7HKpfm2PUx9Zw1dFNu2r04/zx0icmQqQ0nBe1++S USYPj81lmjC7i25UPLnBMxOaIJyiDXe5eSZUbO6vUaw7tRv71TxxYUia0WclDw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1781546507; a=rsa-sha256; cv=none; b=TMfeijotyrFoFhMc8w/iEe3LRva5+SZzkopf8lYsTnaspoUq5jWdjkK/SVcAwOJTmK1ssy kdyuhzdEf17Jdg5IETEMafPzWCiskEwjd0P58DZTd8Bo0R6K9GbnoXgao8gwXbF758qqkF WU6yitLYWiALajx+XFg6mqXUgNttcwxg0Z9mX8SUr+b+uY3ebUyk+JXImsxoFPd5fykQ3e ESP3q/WXAWK7w7MHOBF1/9GMTw+YEwrNsURVgEylw1ECxTOv9oxVXbXZgO+Mz2kcdesRcA 3zVhba1agd9Qub/CGl4L0pyEntDbGJr0A9I+uFhgbor7GsYfaJQSZ/A2TKVyWg== 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=1781546507; 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=MPDx+PVYxJupTJn+omwA4PryzHxKVw2BVOT1u0wB3XE=; b=tZqI0xadzzRkwX82X2qbKROLwuUGPDnb5rIvUUc0UInUoI01f1SkcSq5hpN/Cv9uRe6v2S RuISByszE+hD8CvYl+VMixRLAwtvj311/r/JKYeFAU02CKoyerV4pjWTCk07jTLXC/AEOE 7UEOGZqArzTIQxo7NXRUn0I7Be7Ew+tjmC0pDSd513IzMrbuDKjmWxa9F5CHhsZbHbtqIs V1Sp1613hPxGVgOuWjPR34us8LzVNknpLghlbm69BtOWc32jrWBoW9EsWWPEo6xjpTPkkf V11F4AZJa1WpNVhAi+uBhCe9pUilIjHEglZS8N5PqbyKIUyrFy7iLiZ3tICADg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gfHxl0r31z15Zd for ; Mon, 15 Jun 2026 18:01:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1e8e9 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 15 Jun 2026 18:01:47 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: cb64a09ec905 - stable/15 - tests/procdesc: Use a more efficient mechanism to block 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: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: cb64a09ec9052b3219132ccc4c5388e2f6e6969d Auto-Submitted: auto-generated Date: Mon, 15 Jun 2026 18:01:47 +0000 Message-Id: <6a303e0b.1e8e9.630b68ed@gitrepo.freebsd.org> The branch stable/15 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=cb64a09ec9052b3219132ccc4c5388e2f6e6969d commit cb64a09ec9052b3219132ccc4c5388e2f6e6969d Author: Mark Johnston AuthorDate: 2026-05-22 14:56:47 +0000 Commit: Mark Johnston CommitDate: 2026-06-15 16:00:04 +0000 tests/procdesc: Use a more efficient mechanism to block Reviewed by: kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D57149 (cherry picked from commit c9546bb61910d40f4cb0dfb9716ba6eba44d1a0d) --- tests/sys/kern/Makefile | 2 +- tests/sys/kern/procdesc.c | 41 +++++++++++++++++++++++++++++++++++++---- 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/tests/sys/kern/Makefile b/tests/sys/kern/Makefile index b85e7ec53196..972e0aa0fb9d 100644 --- a/tests/sys/kern/Makefile +++ b/tests/sys/kern/Makefile @@ -107,7 +107,7 @@ LIBADD.kcov+= pthread CFLAGS.ktls_test+= -DOPENSSL_API_COMPAT=0x10100000L LIBADD.ktls_test+= crypto util LIBADD.listener_wakeup+= pthread -LIBADD.procdesc+= pthread +LIBADD.procdesc+= kvm pthread LIBADD.shutdown_dgram+= pthread LIBADD.socket_msg_waitall+= pthread LIBADD.socket_splice+= pthread diff --git a/tests/sys/kern/procdesc.c b/tests/sys/kern/procdesc.c index 2d710ef057f2..2fe50be45bf7 100644 --- a/tests/sys/kern/procdesc.c +++ b/tests/sys/kern/procdesc.c @@ -33,15 +33,50 @@ #include #include +#include #include #include #include #include #include +#include /* Tests for procdesc(4) that aren't specific to any one syscall */ +/* + * Block until a thread in the specified process is sleeping in the specified + * wait message. + */ +static void +wait_for_naptime(pid_t pid, const char *wmesg) +{ + kvm_t *kd; + int count; + + kd = kvm_openfiles(NULL, "/dev/null", NULL, O_RDONLY, NULL); + ATF_REQUIRE(kd != NULL); + for (;;) { + struct kinfo_proc *kip; + int i; + + usleep(1000); + kip = kvm_getprocs(kd, KERN_PROC_PID | KERN_PROC_INC_THREAD, + pid, &count); + ATF_REQUIRE(kip != NULL); + for (i = 0; i < count; i++) { + ATF_REQUIRE(kip[i].ki_stat != SZOMB); + if (kip[i].ki_stat == SSLEEP && + strcmp(kip[i].ki_wmesg, wmesg) == 0) + break; + } + if (i < count) + break; + } + + kvm_close(kd); +} + /* * Even after waiting on a process descriptor with waitpid(2), the kernel will * not recycle the pid until after the process descriptor is closed. That is @@ -128,8 +163,7 @@ ATF_TC_BODY(poll_close_race, tc) error = pthread_create(&thr, NULL, poll_procdesc, &pd); ATF_REQUIRE_MSG(error == 0, "pthread_create: %s", strerror(error)); - /* Wait for the thread to block in poll(2). */ - usleep(250000); + wait_for_naptime(getpid(), "select"); ATF_REQUIRE_MSG(close(pd) == 0, "close: %s", strerror(errno)); @@ -159,8 +193,7 @@ ATF_TC_BODY(poll_exit_wakeup, tc) error = pthread_create(&thr, NULL, poll_procdesc, &pd); ATF_REQUIRE_MSG(error == 0, "pthread_create: %s", strerror(error)); - /* Wait for the thread to block in poll(2). */ - usleep(250000); + wait_for_naptime(getpid(), "select"); ATF_REQUIRE_MSG(pdkill(pd, SIGKILL) == 0, "pdkill: %s", strerror(errno));