From nobody Sun Apr 12 18:49:29 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 4fv02K3lGDz6YX25 for ; Sun, 12 Apr 2026 18:49: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 "R12" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4fv02K311dz3hhx for ; Sun, 12 Apr 2026 18:49:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1776019769; 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=2IkIEJauLCol6dieOkWIH16uGbfutbP/Y47suuMASNw=; b=P7y/J/3F8YVPmUC/x9TdE5RQ0Qw/MScqsAoELagNB/VwVHivYKCRG2bWDWqUuZDJuXaXJt AWBNGX2x1q6MA/B/tOiBZj5uz9VojMYBmMK+C06WDIaIXMVRhMSdsLGMYEaGSlZCo+xMIj 3LaE7ujN/pFH8DRo4cP/hPWNii2/+mKbFZ8cVBVqWwe38c1ks3GEE73Sh2rnI6jofHE+aM IpaLL/bUIqIvwTTFs82Johl68gMgYwoHWVxx0wxCl2BvFpvyZK1QNLyEk475pb3ZBXQtu/ uJlHRcCglVOw8l7w8Om9lOAIgz37ZHxmPqX0l3sq5EIltSSHye8kvZeO15Zx9A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1776019769; a=rsa-sha256; cv=none; b=AOIHzv5RGOvCWX9zIWwT1QrTxWNEfYej0p+2NO9cXLwtsyx+mP+cTk6SRjh6jFLSq4ITVc jXK70BGensuTGEd87zmYADxKg3iABgIncIxhBCYgUhqGTIjJyYWkueL+tK2ZuubDmEkrwN nfAb03ZT5kv/WzBbrk+n2QXrlCPtWSdw59oBIcQilIw564E0z423Cr6sJB0RAu1PnT1O/c 8o+496XuFywScFegl44WUAV+h5xoYl/ZrC1TcwV2Co2HjHNOAGe//YxY51MQ2LS5XWzz73 U2CsTwu3FbjDfrJNOYUWAC9zMLUTBlfYEub5oQM8G89amE5eeu11F9f+CFh46w== 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=1776019769; 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=2IkIEJauLCol6dieOkWIH16uGbfutbP/Y47suuMASNw=; b=h2iNmnpd1rjHdvmcnKsnp5wFlHxn5GgB3QZr3qkzNDgs8bbJmfO5D+G1jgTJUg4bq0OSyx QHeJKLK2D6MUGNvCk8A7xr31NtL+LeqFjWS/Ba/VdB7tA5/mpQIUsc44jFE7Pf0COTuBC7 XGatq76ArBT5j3oDdab96DP79J6TX4sV++5cQluOMj+W5A8DJWHg+EDdDfiODw54ZjvaUp TnOtGKdYNl4q2GmcU3oeZbjfIwVCdb6BVPqZ6UxM0UCydmt+fPpTDxgHzpSXbVdh+55/LM 9J/nUdZ8Q75OcrMqj4oXz85dahAMxMBLlOp62emSNOH7bROZT7C+zfLHQpz2wA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4fv02K2YsfzTmG for ; Sun, 12 Apr 2026 18:49:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3a122 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 12 Apr 2026 18:49:29 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Ziaee Subject: git: 1ed68542b1f7 - stable/15 - lockf.1: Organize and provide error numbers 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 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ziaee X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: 1ed68542b1f7fcf56caa820064bdfb61a6b14f36 Auto-Submitted: auto-generated Date: Sun, 12 Apr 2026 18:49:29 +0000 Message-Id: <69dbe939.3a122.ed15483@gitrepo.freebsd.org> The branch stable/15 has been updated by ziaee: URL: https://cgit.FreeBSD.org/src/commit/?id=1ed68542b1f7fcf56caa820064bdfb61a6b14f36 commit 1ed68542b1f7fcf56caa820064bdfb61a6b14f36 Author: Alexander Ziaee AuthorDate: 2026-04-08 20:08:43 +0000 Commit: Alexander Ziaee CommitDate: 2026-04-12 18:49:00 +0000 lockf.1: Organize and provide error numbers Add error numbers to the exit codes so that readers can decode them without having to use a separate utility. Organize exits by error code. Mark up the error constants with the error constant macro, even though this is really not very helpful because people will search for the error code, the macro is explicitly for the constants and not the codes. While where, align and alphabetize the options list as well, fix misaligned padding in an example, and a one-sentance-per-line error. MFC after: 3 days Reported by: Antranig Vartanian Differential Revision: https://reviews.freebsd.org/D48470 (cherry picked from commit dd201e407e48ba59bdfa1f71d41acfdac1a9c562) --- usr.bin/lockf/lockf.1 | 57 +++++++++++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 27 deletions(-) diff --git a/usr.bin/lockf/lockf.1 b/usr.bin/lockf/lockf.1 index 40b4497bc80c..406ccd4caa39 100644 --- a/usr.bin/lockf/lockf.1 +++ b/usr.bin/lockf/lockf.1 @@ -1,4 +1,6 @@ .\" +.\" SPDX-License-Identifier: BSD-2-Clause +.\" .\" Copyright (C) 1998 John D. Polstra. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -22,7 +24,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd June 24, 2025 +.Dd February 26, 2026 .Dt LOCKF 1 .Os .Sh NAME @@ -104,15 +106,10 @@ that if the option is not used, then no guarantees around lock ordering can be made. .Pp The following options are supported: -.Bl -tag -width ".Fl t Ar seconds" +.Bl -tag -width "-t seconds" .It Fl k Causes the lock file to be kept (not removed) after the command completes. -.It Fl s -Causes -.Nm -to operate silently. -Failure to acquire the lock is indicated only in the exit status. .It Fl n Causes .Nm @@ -136,6 +133,11 @@ This option will cause to open .Ar file for writing rather than reading. +.It Fl s +Causes +.Nm +to operate silently. +Failure to acquire the lock is indicated only in the exit status. .It Fl T Upon receipt of a .Dv SIGTERM , @@ -191,32 +193,32 @@ successfully acquires the lock, it returns the exit status produced by Otherwise, it returns one of the exit codes defined in .Xr sysexits 3 , as follows: -.Bl -tag -width ".Dv EX_CANTCREAT" -.It Dv EX_TEMPFAIL -The specified lock file was already locked by another process. -.It Dv EX_CANTCREAT -The +.Bl -tag -width "EX_UNAVAILABLE (69)" +.It Er EX_OSERR Pq 61 +A system call, e.g., +.Xr fork 2 , +failed unexpectedly. +.It Er EX_USAGE Pq 64 +There was an error on the .Nm -utility -was unable to create the lock file, e.g., because of insufficient access -privileges. -.It Dv EX_UNAVAILABLE +command line. +.It Er EX_UNAVAILABLE Pq 69 The .Fl n option is specified and the specified lock file does not exist. -.It Dv EX_USAGE -There was an error on the -.Nm -command line. -.It Dv EX_OSERR -A system call (e.g., -.Xr fork 2 ) -failed unexpectedly. -.It Dv EX_SOFTWARE +.It Er EX_SOFTWARE Pq 70 The .Ar command did not exit normally, but may have been signaled or stopped. +.It Er EX_CANTCREAT Pq 73 +The +.Nm +utility +was unable to create the lock file, e.g., because of insufficient access +privileges. +.It Er EX_TEMPFAIL Pq 75 +The specified lock file was already locked by another process. .El .Sh EXAMPLES The first job takes a lock and sleeps for 5 seconds in the background. @@ -237,9 +239,10 @@ $ lockf mylock sleep 1 & lockf -t 5 mylock echo "Success" Success [1]+ Done lockf mylock sleep 1 .Ed +.Pp Lock a file and run a script, return immediately if the lock is not -available. Do not delete the file afterward so lock order is -guaranteed. +available. +Do not delete the file afterward so lock order is guaranteed. .Pp .Dl $ lockf -t 0 -k /tmp/my.lock myscript .Pp