History log of /freebsd-current/usr.bin/lockf/lockf.1
Revision Date Author Comments
# 09a7fe0a 22-Nov-2023 Kyle Evans <kevans@FreeBSD.org>

lockf: allow locking file descriptors

This is most useful inside a shell script, allowing one to lock just
portions of a script rather than having to wrap the entire script in a
lock.

PR: 262738
Reviewed by: 0mp, allanjude (both previous versions)
Co-authored-by: Daniel O'Connor <darius@dons.net.au>
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D42718


# fa9896e0 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: two-line nroff pattern

Remove /^\.\\"\n\.\\"\s*\$FreeBSD\$$\n/


# bd4fcf75 26-Aug-2020 Colin Percival <cperciva@FreeBSD.org>

Remove whitespace which accidentaly snuck into r364831.


# 437bab48 26-Aug-2020 Colin Percival <cperciva@FreeBSD.org>

Add -w option to lockf(1).

By default, lockf(1) opens its lock file O_RDONLY|O_EXLOCK. On NFS, if the
file already exists, this is split into opening the file read-only and then
requesting an exclusive lock -- and the second step fails because NFS does
not permit exclusive locking on files which are opened read-only.

The new -w option changes the open flags to O_WRONLY|O_EXLOCK, allowing it
to work on NFS -- at the cost of not working if the file cannot be opened
for writing.

(Whether the traditional BSD behaviour of allowing exclusive locks to be
obtained on a file which cannot be opened for writing is a good idea is
perhaps questionable since it may allow less-privileged users to perform
a local denial of service; however this behaviour has been present for a
long time and changing it now seems like it would cause problems.)

Reviewed by: rmacklem
Differential Revision: https://reviews.freebsd.org/D26005


# 15597d5d 18-Jun-2020 Fernando ApesteguĂ­a <fernape@FreeBSD.org>

lockf(1): Add EXAMPLES section

* Add pretty small EXAMPLES section
* While here, fix a warning in line 98 (new sentence in new line)

Approved by: bcr@
Differential Revision: https://reviews.freebsd.org/D25205


# bef6922b 06-Apr-2015 Mark Johnston <markj@FreeBSD.org>

lockf(1): add a reference to lockf(3).

Submitted by: Conrad Meyer
MFC after: 1 week


# 2b7af31c 23-Jun-2014 Baptiste Daroussin <bapt@FreeBSD.org>

use .Mt to mark up email addresses consistently (part3)

PR: 191174
Submitted by: Franco Fichtner <franco at lastsummer.de>


# b5be420a 10-May-2013 Eitan Adler <eadler@FreeBSD.org>

Add option to lockf to avoid creating a file if it does not exist.

PR: bin/170775
Submitted by: Matthew Story <matthewstory@gmail.com>
Reviewed by: scottl
MFC after: 1 week


# 50d675f7 28-Mar-2012 Eitan Adler <eadler@FreeBSD.org>

Remove trailing whitespace per mdoc lint warning

Disussed with: gavin
No objection from: doc
Approved by: joel
MFC after: 3 days


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# aa12cea2 14-Apr-2010 Ulrich Spörlein <uqs@FreeBSD.org>

mdoc: order prologue macros consistently by Dd/Dt/Os

Although groff_mdoc(7) gives another impression, this is the ordering
most widely used and also required by mdocml/mandoc.

Reviewed by: ru
Approved by: philip, ed (mentors)


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 7f15c32d 21-Aug-2008 David Malone <dwmalone@FreeBSD.org>

Lockf was exiting with status 1 if the command did not exit normally.
This is easy to confuse with the actual exit status of the program.
Instead exit with EX_SOFTWARE if the command doesn't exit normally.

MFC after: 1 month


# 8931e1d5 31-Oct-2007 Ruslan Ermilov <ru@FreeBSD.org>

Also fix a "blank line" issue that sneaked in from rev. 1.19.

Submitted by: John Hein


# de8f7dcb 30-Oct-2007 Ruslan Ermilov <ru@FreeBSD.org>

Remove newly acquired hard sentence breaks.


# 6a53f0a5 12-Oct-2007 Christian S.J. Peron <csjp@FreeBSD.org>

Revision 1.12 of lockf.c fixed a "thundering herd" scenario when the
lock experienced contention a number of processes would race to acquire
lock when it was released. This problem resulted in a lot of CPU
load as well as locks being picked up out of order.

Unfortunately, a regression snuck in which allowed multiple threads
to pickup the same lock when -k was not used. This could occur when
multiple processes open a file descriptor to inode X (one process
will be blocked) and the file is unlinked on unlock (thereby removing
the directory entry allow another process to create a new directory
entry for the same file name and lock it).

This changes restores the old algorithm of: wait for the lock, then
acquire lock when we want to unlink the file on exit (specifically
when -k is not used) and keeps the new algorithm for when -k is used,
which yields fairness and improved performance.

Also, update the man page to inform users that if lockf(1) is being
used to facilitate concurrency between a number of processes, it
is recommended that -k be used to reduce CPU load and yeld
fairness with regard to lock ordering.

Collaborated with: jdp
PR: bin/114341
PR: bin/116543
PR: bin/111101
MFC after: 1 week


# c8c35875 20-Dec-2006 Ruslan Ermilov <ru@FreeBSD.org>

Markup cosmetics.


# 6fb9b618 30-Jul-2005 Giorgos Keramidas <keramida@FreeBSD.org>

Fix all the spelling mistakes I could find in the man pages for words
that have at least 3 characters.

MFC after: 1 week
Thanks to: Music band ``Chingon''
for keeping me company while searching for these.


# 39c59153 14-Jun-2005 Ruslan Ermilov <ru@FreeBSD.org>

Markup and wording fixes.

Approved by: re (blanket)


# f2839e75 26-May-2005 Eivind Eklund <eivind@FreeBSD.org>

Document a couple of gotchas.


# a866e170 17-Jan-2005 Ruslan Ermilov <ru@FreeBSD.org>

Added the EXIT STATUS section where appropriate.


# 6a3e8b0a 02-Jul-2004 Ruslan Ermilov <ru@FreeBSD.org>

Mechanically kill hard sentence breaks.


# e8937ba0 19-Apr-2002 Philippe Charnier <charnier@FreeBSD.org>

Use `The .Nm utility'


# 753d686d 14-Aug-2001 Ruslan Ermilov <ru@FreeBSD.org>

mdoc(7) police: s/BSD/.Bx/ where appropriate.


# f247324d 15-Jul-2001 Dima Dorfman <dd@FreeBSD.org>

Remove whitespace at EOL.


# 62500372 10-Jul-2001 Ruslan Ermilov <ru@FreeBSD.org>

mdoc(7) police: removed HISTORY info from the .Os call.


# 9c8efe99 09-Dec-2000 David E. O'Brien <obrien@FreeBSD.org>

Add history.


# c3aac50f 27-Aug-1999 Peter Wemm <peter@FreeBSD.org>

$Id$ -> $FreeBSD$


# 2f278eac 07-Jul-1998 John Polstra <jdp@FreeBSD.org>

Add a "-k" option, to specify that the lock file should be kept
rather than removed.

Submitted by: Nick Barnes <Nick.Barnes@pobox.com>


# 306005e7 23-Mar-1998 Philippe Charnier <charnier@FreeBSD.org>

.Sh AUTHOR -> .Sh AUTHORS. Use .An/.Aq.


# c115df18 22-Feb-1997 Peter Wemm <peter@FreeBSD.org>

Revert $FreeBSD$ to $Id$


# 1130b656 14-Jan-1997 Jordan K. Hubbard <jkh@FreeBSD.org>

Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.


# ae06cb4d 09-Jan-1997 John Polstra <jdp@FreeBSD.org>

On failure, return various exit codes from <sysexits.h>. In particular,
return EX_TEMPFAIL if the file was already locked. This makes it easier
to distinguish between lock collisions and failures within the command
being executed.

Also, don't complain if the unlink() fails in the cleanup handler. It
doesn't matter anyway, and it obscured the exit status returned from
the command that was executed.


# c8929a49 08-Jan-1997 John Polstra <jdp@FreeBSD.org>

Initial import of the lockf utility. It executes an arbitrary command
while holding an exclusive lock on a file.