From nobody Tue Jan 31 00:29:29 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 4P5Qsj5XtKz3brwd; Tue, 31 Jan 2023 00:29:29 +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 4P5Qsj3vtvz4THV; Tue, 31 Jan 2023 00:29:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675124969; 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=p/PDvPqFDy3WXTEEiH594ZrKhKAox37TA7clTscvHh8=; b=RFMuWXA6ErkSlP0+GCEFp4v9XYMxXnJKmELANwUpW2dOCTkupRhXSQGpR7Veehexx9YsvP vue6TFRV1O10cDwyqITMZLxcNru4QYCjgVosKsO8v7RaEfVgMH/kQqA30QZ4v8eNjhagQn YWJdxOMTJuuY0Nt0Ol33nvwJzCTbqXn2HTUNAEpfU/xQG/0YHJPcxX1l/Czd1vCIoRWH2X 7mrBfh2xuvTK/gscVKN5y/rZXdHaDME1jJgFPKPdROkcnN8XDhNHTSuiLKFrGO6+nt4FMk sTVjVINKiqCT4K+BjpRiKtTbRdDs2053gDzf/1YlmvsCoFCSMG3sZ0YPHab73A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675124969; 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=p/PDvPqFDy3WXTEEiH594ZrKhKAox37TA7clTscvHh8=; b=fNIL74I8s06oi6w7oX+nbRl1j6W2rWktrCELo9D1ylGFpwanJ3ijcPUUdMYSIpRReYPFUR LqifYha8HcxAv0ClTg/glinAPOPknv3usZUQD1gj/Eb7FM2NyDf3diNd+hcna44Lh40Eat Hn/ymhonKlL2RcrMl9mErnhQnihkIOAFAyrNEud37iRCw7RxsUzhFYXVFS4sYNSffoaqfq /f5tknq1e+WUK6zaqU75BR5U09XEVF2jWQnl/4/QMtLL9vfiwExYwx/+4Svp12nn9mSbnc j8QBz7IWm7446hEQtCB1ZYleA8/aqfriEB4uAyuky3EFns3rZMuPnPI10hqsxg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675124969; a=rsa-sha256; cv=none; b=jwyhnIxoa20ufQ8b0OpprongpGTz8vwKAkIOIriqs+okbRBfNppBtZsR7+Trd7lWycTba+ zrcEpErsH2Wt9/YBjZOFzy/TZxvPAVNniRNeKpTIGNQTSU7pMY/lXfLrE9tiEMh0YmJNS/ XpMhNlYYvXMcxu4l1sGFUf0BrrCutQE5kiUmzClx3fPqrEu9dRogDInQJuza3SjVFDGEP1 ROglXVI41Rj0zUwunIvMnMEOUWTvGRhgzC5wvPemKRB+KF+lzm7qUTcWJB++WNJpjuALjf /ZHODlFGZcOggop0jtbVKFgSBScF2veUKSa2MJbOaTqABqxCGO3AYnaa84VcNw== 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 4P5Qsj2wb9zTCm; Tue, 31 Jan 2023 00:29:29 +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 30V0TTOH045385; Tue, 31 Jan 2023 00:29:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30V0TTO2045384; Tue, 31 Jan 2023 00:29:29 GMT (envelope-from git) Date: Tue, 31 Jan 2023 00:29:29 GMT Message-Id: <202301310029.30V0TTO2045384@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Dag-Erling=20Sm=C3=B8rgrav?= Subject: git: 6673a5476d02 - main - cmp: Print a summary on SIGINFO. 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: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6673a5476d029cd5b47b2eed27032211a14f52bd Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=6673a5476d029cd5b47b2eed27032211a14f52bd commit 6673a5476d029cd5b47b2eed27032211a14f52bd Author: Dag-Erling Smørgrav AuthorDate: 2023-01-31 00:28:47 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2023-01-31 00:29:05 +0000 cmp: Print a summary on SIGINFO. MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D38280 --- usr.bin/cmp/cmp.c | 14 ++++++++++++++ usr.bin/cmp/extern.h | 4 ++++ usr.bin/cmp/regular.c | 7 +++++++ usr.bin/cmp/special.c | 7 +++++++ 4 files changed, 32 insertions(+) diff --git a/usr.bin/cmp/cmp.c b/usr.bin/cmp/cmp.c index 83ea7ae7eee0..82f34803fc22 100644 --- a/usr.bin/cmp/cmp.c +++ b/usr.bin/cmp/cmp.c @@ -75,6 +75,17 @@ static const struct option long_opts[] = {NULL, no_argument, NULL, 0} }; +#ifdef SIGINFO +volatile sig_atomic_t info; + +static void +siginfo(int signo) +{ + + info = signo; +} +#endif + static void usage(void); static bool @@ -240,6 +251,9 @@ main(int argc, char *argv[]) } } +#ifdef SIGINFO + (void)signal(SIGINFO, siginfo); +#endif if (special) c_special(fd1, file1, skip1, fd2, file2, skip2, limit); else { diff --git a/usr.bin/cmp/extern.h b/usr.bin/cmp/extern.h index d98daf424995..60fd15ba0939 100644 --- a/usr.bin/cmp/extern.h +++ b/usr.bin/cmp/extern.h @@ -46,3 +46,7 @@ void diffmsg(const char *, const char *, off_t, off_t, int, int); void eofmsg(const char *); extern bool bflag, lflag, sflag, xflag, zflag; + +#ifdef SIGINFO +extern volatile sig_atomic_t info; +#endif diff --git a/usr.bin/cmp/regular.c b/usr.bin/cmp/regular.c index d270aeeac396..182a303f70ed 100644 --- a/usr.bin/cmp/regular.c +++ b/usr.bin/cmp/regular.c @@ -120,6 +120,13 @@ c_regular(int fd1, const char *file1, off_t skip1, off_t len1, p2 = m2 + (skip2 - off2); for (byte = line = 1; length--; ++byte) { +#ifdef SIGINFO + if (info) { + (void)fprintf(stderr, "%s %s char %zu line %zu\n", + file1, file2, (size_t)byte, (size_t)line); + info = 0; + } +#endif if ((ch = *p1) != *p2) { if (xflag) { dfound = 1; diff --git a/usr.bin/cmp/special.c b/usr.bin/cmp/special.c index c206a317c0ef..7514c01bd59a 100644 --- a/usr.bin/cmp/special.c +++ b/usr.bin/cmp/special.c @@ -77,6 +77,13 @@ c_special(int fd1, const char *file1, off_t skip1, goto eof; for (byte = line = 1; limit == 0 || byte <= limit; ++byte) { +#ifdef SIGINFO + if (info) { + (void)fprintf(stderr, "%s %s char %zu line %zu\n", + file1, file2, (size_t)byte, (size_t)line); + info = 0; + } +#endif ch1 = getc(fp1); ch2 = getc(fp2); if (ch1 == EOF || ch2 == EOF)