Commit Graph

28 Commits

Author SHA1 Message Date
Ruslan Ermilov
c8c3587578 Markup cosmetics. 2006-12-20 16:57:13 +00:00
Christian S.J. Peron
cc2a9f52a7 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.
2005-10-09 04:45:41 +00:00
Christian S.J. Peron
45edbdccd7 Do not ignore ENOENT
Pointed out by:	Amir Shalem
2005-10-07 11:49:27 +00:00
Christian S.J. Peron
4ccbe0c50d 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)
2005-10-05 22:02:07 +00:00
Christian S.J. Peron
031469eb27 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
2005-10-05 17:39:15 +00:00
Giorgos Keramidas
6fb9b618f5 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.
2005-07-31 03:30:48 +00:00
Ruslan Ermilov
39c59153e9 Markup and wording fixes.
Approved by:	re (blanket)
2005-06-14 11:50:53 +00:00
Eivind Eklund
f2839e75f6 Document a couple of gotchas. 2005-05-26 22:30:12 +00:00
Ruslan Ermilov
a866e17077 Added the EXIT STATUS section where appropriate. 2005-01-17 07:44:44 +00:00
Tim J. Robbins
208f2fd1ed Use warn() instead of perror(). 2004-07-15 04:51:21 +00:00
Ruslan Ermilov
6a3e8b0adc Mechanically kill hard sentence breaks. 2004-07-02 22:22:35 +00:00
David E. O'Brien
e026a48c34 Consistently use FBSDID 2002-06-30 05:25:07 +00:00
Philippe Charnier
e8937ba009 Use `The .Nm utility' 2002-04-20 12:18:28 +00:00
Mark Murray
91bd71d206 Remove leaf node WARNS?=2 (that mainly I added). This should
help the GCC3 transition and CURRENT in general.
2002-02-08 22:31:43 +00:00
David Malone
9ff5e898db Warns cleanups. 2001-12-03 21:07:23 +00:00
Ruslan Ermilov
753d686d34 mdoc(7) police: s/BSD/.Bx/ where appropriate. 2001-08-14 10:01:54 +00:00
Dima Dorfman
f247324df7 Remove whitespace at EOL. 2001-07-15 08:06:20 +00:00
Ruslan Ermilov
625003720a mdoc(7) police: removed HISTORY info from the .Os call. 2001-07-10 14:16:33 +00:00
David E. O'Brien
9c8efe99eb Add history. 2000-12-10 01:10:54 +00:00
Peter Wemm
c3aac50f28 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
John Polstra
2f278eac1f Add a "-k" option, to specify that the lock file should be kept
rather than removed.

Submitted by:	Nick Barnes <Nick.Barnes@pobox.com>
1998-07-08 05:29:05 +00:00
Philippe Charnier
306005e78c .Sh AUTHOR -> .Sh AUTHORS. Use .An/.Aq. 1998-03-23 07:48:45 +00:00
Philippe Charnier
3ec665d482 lockf: usage : lockf -> usage: lockf by using fprintf instead of errx. 1997-07-22 07:32:23 +00:00
Warner Losh
1c8af87873 compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.
1997-03-29 04:34:07 +00:00
Peter Wemm
c115df18cd Revert $FreeBSD$ to $Id$ 1997-02-22 19:58:13 +00:00
Jordan K. Hubbard
1130b656e5 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.
1997-01-14 07:20:47 +00:00
John Polstra
ae06cb4d32 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.
1997-01-09 19:53:21 +00:00
John Polstra
c8929a4926 Initial import of the lockf utility. It executes an arbitrary command
while holding an exclusive lock on a file.
1997-01-08 20:12:59 +00:00