From nobody Thu Jun 13 18:30:24 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 4W0WDc2YHpz5P7mf; Thu, 13 Jun 2024 18:30:24 +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 4W0WDc22Vdz4l7h; Thu, 13 Jun 2024 18:30:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1718303424; 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=+kYPRC/kt4JIEjKOwuT4o9OZ8ObSiQCXgiprygxf5xQ=; b=yzhQBDGDAPF2UEow12f30qmjcc0xfYVfMOjzqpmw7bKcUqGesah6SRlKhkGM2qI029DMJz 7FG5qe4uuSwpcySYBei4PiUSkXk6DFMqQqPRTfAtGX2pca8gD1L4Y/1JqmRmTro53tg4bE uT+sImBUqFWGmgD4C708TmPh9G1bY5WUOS6BW5KhzgCwn+MqTI9Wat8G6fZxzFjJaWA+Os Tf3UqRVo5eRnw2tEaNWKMwm7WQUgOWt/ZvE+rWeP2n9WPiztSiPwR+w1ex6vDAXrnlaPfV CV0Y6q8HDXPFAN4eRfzrW6KWHB9KWaHwlJ+k13dCPNVQumZDubM5bi56PKRn5Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1718303424; a=rsa-sha256; cv=none; b=SAwBUViwuG2/D6Y/y1Q7Z11AfaVKrbib5L9bO50SPMvOVr3sDw0aSSxqFiIiymxTzcCFMI RIM1SJ5XrLof9PWk9p2Mg0uQ4yEEoxIIpZmTFlTV2XnZWNTmr+GldGRfmE5bjpcZ0y3/+n QDTJrB9ixct+ze/wVJMbOEtcTtvDFqdgKE7I93cFtIIU4sZNCL0ojxaSKKPhC+aiAigo+g u/laXHwVucrN2ZBvagUHL0HRLIdhkAY2HVAHnarsPq8Hj4unMlwSg0lVNijnXUaxxSTnKZ wrhpe9rr7rc64RKH7pNEE0KCK334lVDZBpr5Jh00maapUVihwoJqMQgRCNLaow== 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=1718303424; 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=+kYPRC/kt4JIEjKOwuT4o9OZ8ObSiQCXgiprygxf5xQ=; b=I0Nnpy1UCXPWJ5aQHJK9BOL7/iy0lDIuudUeVSThTSMcO8B2qoRfGZ5lADcBMKDl0MpWuR vlezXfj3pXQvcSYrFYlWdeJ+BRLdb3lnZnv/BNWXuwiINO0ihBh8lIW6lTsYvq1YPpxydH G++v+iIFp7F8gldSA+79aN2Y+UkxWFM3hJWorKwIWseRvx9qjs0hvODY938xSwhgOV9/As MDD3UElkgw58zgjIo/LrCi3g+PSRghmEC7PzCkzif08WQJzKPmzvo4cxsZ/462tFB34E8Q krnrWK/tbeGtV5lNH1qs5Ji2szON7y1IBQk1zSlcMSbibUoHwE9uG6TKKzXfCg== 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 4W0WDc1KR2znVk; Thu, 13 Jun 2024 18:30:24 +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 45DIUO43064021; Thu, 13 Jun 2024 18:30:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 45DIUO6R064018; Thu, 13 Jun 2024 18:30:24 GMT (envelope-from git) Date: Thu, 13 Jun 2024 18:30:24 GMT Message-Id: <202406131830.45DIUO6R064018@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: 20ac2dc15f03 - stable/13 - find: add SIGINFO handler 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 20ac2dc15f03c885a7d9b8f5bc1facd3074c40a8 Auto-Submitted: auto-generated The branch stable/13 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=20ac2dc15f03c885a7d9b8f5bc1facd3074c40a8 commit 20ac2dc15f03c885a7d9b8f5bc1facd3074c40a8 Author: Goran Mekić AuthorDate: 2024-01-11 22:35:25 +0000 Commit: Alan Somers CommitDate: 2024-06-13 18:29:45 +0000 find: add SIGINFO handler Print number of files processed and path currently being processed on SIGINFO. Reviewed by: des, asomers Sponsored by: Axcient Differential Revision: https://reviews.freebsd.org/D43380 (cherry picked from commit d06a00963b7f724b6fdd7d7cdcbed57c534196a9) --- usr.bin/find/extern.h | 1 + usr.bin/find/find.c | 9 +++++++++ usr.bin/find/main.c | 10 ++++++++++ 3 files changed, 20 insertions(+) diff --git a/usr.bin/find/extern.h b/usr.bin/find/extern.h index 3436f8cf07bf..323b9bfdfb93 100644 --- a/usr.bin/find/extern.h +++ b/usr.bin/find/extern.h @@ -126,3 +126,4 @@ extern int exitstatus; extern time_t now; extern int dotfd; extern FTS *tree; +extern volatile sig_atomic_t showinfo; diff --git a/usr.bin/find/find.c b/usr.bin/find/find.c index 3bff4982b4b6..57225e8fa23f 100644 --- a/usr.bin/find/find.c +++ b/usr.bin/find/find.c @@ -172,6 +172,7 @@ find_execute(PLAN *plan, char *paths[]) { FTSENT *entry; PLAN *p; + size_t counter = 0; int e; tree = fts_open(paths, ftsoptions, (issort ? find_compare : NULL)); @@ -213,6 +214,14 @@ find_execute(PLAN *plan, char *paths[]) continue; #endif /* FTS_W */ } + + if (showinfo) { + fprintf(stderr, "Scanning: %s/%s\n", entry->fts_path, entry->fts_name); + fprintf(stderr, "Scanned: %lu\n\n", counter); + showinfo = 0; + } + ++counter; + #define BADCH " \t\n\\'\"" if (isxargs && strpbrk(entry->fts_path, BADCH)) { (void)fflush(stdout); diff --git a/usr.bin/find/main.c b/usr.bin/find/main.c index 9ed1d1d4e29b..295e0f966362 100644 --- a/usr.bin/find/main.c +++ b/usr.bin/find/main.c @@ -68,8 +68,10 @@ int isxargs; /* don't permit xargs delimiting chars */ int mindepth = -1, maxdepth = -1; /* minimum and maximum depth */ int regexp_flags = REG_BASIC; /* use the "basic" regexp by default*/ int exitstatus; +volatile sig_atomic_t showinfo = 0; static void usage(void); +static void siginfo_handler(int sig __unused); int main(int argc, char *argv[]) @@ -81,6 +83,8 @@ main(int argc, char *argv[]) (void)time(&now); /* initialize the time-of-day */ + (void)signal(SIGINFO, siginfo_handler); + p = start = argv; Hflag = Lflag = 0; ftsoptions = FTS_NOSTAT | FTS_PHYSICAL; @@ -161,3 +165,9 @@ usage(void) " find [-H | -L | -P] [-EXdsx] -f path [path ...] [expression]"); exit(1); } + +static void +siginfo_handler(int sig __unused) +{ + showinfo = 1; +}