History log of /freebsd-10.0-release/usr.bin/lockf/
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
259065 07-Dec-2013 gjb

- Copy stable/10 (r259064) to releng/10.0 as part of the
10.0-RELEASE cycle.
- Update __FreeBSD_version [1]
- Set branch name to -RC1

[1] 10.0-CURRENT __FreeBSD_version value ended at '55', so
start releng/10.0 at '100' so the branch is started with
a value ending in zero.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


250462 10-May-2013 eadler

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


233648 29-Mar-2012 eadler

Remove trailing whitespace per mdoc lint warning

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


206622 14-Apr-2010 uqs

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)


181960 21-Aug-2008 dwmalone

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


173241 31-Oct-2007 ru

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

Submitted by: John Hein


173202 30-Oct-2007 ru

Remove newly acquired hard sentence breaks.


172580 12-Oct-2007 csjp

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


165392 20-Dec-2006 ru

Markup cosmetics.


151158 09-Oct-2005 csjp

Finish off style(9) fixes which I started two revisions ago. This basically
changes the indentation style from 4 spaces to 8 spaces which we expect to
see in other FreeBSD source files.


151056 07-Oct-2005 csjp

Do not ignore ENOENT

Pointed out by: Amir Shalem


150984 05-Oct-2005 csjp

Un-break handling of -t 0 which was broken in my previous commit.
Add a flags argument to wait_for_lock so that O_NONBLOCK can be
passed to open if a user doesn't want the open to sleep until the
lock becomes available.

Submitted by: Amir Shalem (partially modified)


150977 05-Oct-2005 csjp

Fix long standing race condition associated with how lockf uses open(2)
for mutual exclusion:

A brief description of the problem:

1) Proc A picks up non-blocking lock on file X
2) Proc B attempts to pickup lock, fails then waits
3) Proc C attempts to pickup lock, fails then waits
4) Proc A releases lock
5) Proc B acquires lock, release it to pickup a non-blocking version
6) Proc C acquires lock, release it to pickup a non-blocking version
7) Both process B and C race each other to pickup lock again

This occurs mainly because the processes do not keep the lock after they have
been waiting on it. They drop it, attempt to re-acquire it. (They use the wait
to notify when the lock has become available then race to pick it up). This
results in additional CPU utilization during the race, and can also result
in processes picking locks up out of order.

This change attempts to correct this problem by eliminating the test/acquire
race and having the operating system handle it.

Reported by: kris
Tested by: kris
MFC after: 1 week


148580 31-Jul-2005 keramida

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.


147370 14-Jun-2005 ru

Markup and wording fixes.

Approved by: re (blanket)


146657 26-May-2005 eivind

Document a couple of gotchas.


140368 17-Jan-2005 ru

Added the EXIT STATUS section where appropriate.


132180 15-Jul-2004 tjr

Use warn() instead of perror().


131491 02-Jul-2004 ru

Mechanically kill hard sentence breaks.


99112 30-Jun-2002 obrien

Consistently use FBSDID


95124 20-Apr-2002 charnier

Use `The .Nm utility'


90415 08-Feb-2002 markm

Remove leaf node WARNS?=2 (that mainly I added). This should
help the GCC3 transition and CURRENT in general.


87290 03-Dec-2001 dwmalone

Warns cleanups.


81622 14-Aug-2001 ru

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


79755 15-Jul-2001 dd

Remove whitespace at EOL.


79535 10-Jul-2001 ru

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


69809 10-Dec-2000 obrien

Add history.


50477 28-Aug-1999 peter

$Id$ -> $FreeBSD$


37493 08-Jul-1998 jdp

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

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


34801 23-Mar-1998 charnier

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


27603 22-Jul-1997 charnier

lockf: usage : lockf -> usage: lockf by using fprintf instead of errx.


24360 29-Mar-1997 imp

compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.


23012 22-Feb-1997 peter

Revert $FreeBSD$ to $Id$


21673 14-Jan-1997 jkh

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.


21462 09-Jan-1997 jdp

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.


21440 08-Jan-1997 jdp

This commit was generated by cvs2svn to compensate for changes in r21439,
which included commits to RCS files with non-trunk default branches.