aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/lockf
Commit message (Collapse)AuthorAgeFilesLines
* Remove whitespace which accidentaly snuck into r364831.Colin Percival2020-08-261-1/+1
| | | | Notes: svn path=/head/; revision=364832
* Add -w option to lockf(1).Colin Percival2020-08-262-6/+17
| | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=364831
* lockf(1): Add EXAMPLES sectionFernando ApesteguĂ­a2020-06-181-2/+22
| | | | | | | | | | | * 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 Notes: svn path=/head/; revision=362299
* lockf(1): return EX_UNAVAILABLE if -n is used and the lock file does notAndriy Voskoboinyk2019-03-201-0/+2
| | | | | | | | | | | | | | | exist Apply EX_UNAVAILABLE patch part from PR 170775 to match the documentation. Checked with a command from PR 210770: lockf -n /tmp/doesnotexist echo; echo $? PR: 210770 MFC after: 1 week Notes: svn path=/head/; revision=345318
* various: general adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-271-1/+3
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. No functional change intended. Notes: svn path=/head/; revision=326276
* DIRDEPS_BUILD: Update dependencies.Bryan Drewery2017-10-311-1/+0
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=325188
* Add META_MODE support.Simon J. Gerraty2015-06-131-0/+17
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Off by default, build behaves normally. WITH_META_MODE we get auto objdir creation, the ability to start build from anywhere in the tree. Still need to add real targets under targets/ to build packages. Differential Revision: D2796 Reviewed by: brooks imp Notes: svn path=/head/; revision=284345
| * dirdeps.mk now sets DEP_RELDIRSimon J. Gerraty2015-06-081-2/+0
| | | | | | | | Notes: svn path=/projects/bmake/; revision=284172
| * Merge sync of headSimon J. Gerraty2015-05-272-1/+2
| |\ | |/ |/| | | Notes: svn path=/projects/bmake/; revision=283595
| * Merge head from 7/28Simon J. Gerraty2014-08-191-1/+1
| |\ | | | | | | | | | Notes: svn path=/projects/bmake/; revision=270164
| * | Updated dependenciesSimon J. Gerraty2014-05-161-1/+0
| | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=266219
| * | Updated dependenciesSimon J. Gerraty2014-05-101-0/+2
| | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=265802
| * | Merge from headSimon J. Gerraty2013-09-052-8/+28
| |\ \ | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=255263
| * | | Updated dependenciesSimon J. Gerraty2013-03-111-0/+1
| | | | | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=248169
| * | | Updated dependenciesSimon J. Gerraty2013-02-161-2/+0
| | | | | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=246868
| * | | Sync FreeBSD's bmake branch with Juniper's internal bmake branch.Marcel Moolenaar2012-08-221-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Requested by: Simon Gerraty <sjg@juniper.net> Notes: svn path=/projects/bmake/; revision=239572
* | | | Remove extra flags from r250462.Bryan Drewery2015-04-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=281582
* | | | lockf(1): add a reference to lockf(3).Mark Johnston2015-04-061-0/+1
| |_|/ |/| | | | | | | | | | | | | | | | | | | | Submitted by: Conrad Meyer MFC after: 1 week Notes: svn path=/head/; revision=281175
* | | use .Mt to mark up email addresses consistently (part3)Baptiste Daroussin2014-06-231-1/+1
| |/ |/| | | | | | | | | | | | | PR: 191174 Submitted by: Franco Fichtner <franco at lastsummer.de> Notes: svn path=/head/; revision=267773
* | Add option to lockf to avoid creating a file if it does not exist.Eitan Adler2013-05-102-8/+28
|/ | | | | | | | | | PR: bin/170775 Submitted by: Matthew Story <matthewstory@gmail.com> Reviewed by: scottl MFC after: 1 week Notes: svn path=/head/; revision=250462
* Remove trailing whitespace per mdoc lint warningEitan Adler2012-03-291-1/+1
| | | | | | | | | | Disussed with: gavin No objection from: doc Approved by: joel MFC after: 3 days Notes: svn path=/head/; revision=233648
* mdoc: order prologue macros consistently by Dd/Dt/OsUlrich Spörlein2010-04-141-1/+1
| | | | | | | | | | | 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) Notes: svn path=/head/; revision=206622
* Lockf was exiting with status 1 if the command did not exit normally.David Malone2008-08-212-1/+6
| | | | | | | | | | 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 Notes: svn path=/head/; revision=181960
* Also fix a "blank line" issue that sneaked in from rev. 1.19.Ruslan Ermilov2007-10-311-1/+1
| | | | | | | Submitted by: John Hein Notes: svn path=/head/; revision=173241
* Remove newly acquired hard sentence breaks.Ruslan Ermilov2007-10-301-2/+4
| | | | Notes: svn path=/head/; revision=173202
* Revision 1.12 of lockf.c fixed a "thundering herd" scenario when theChristian S.J. Peron2007-10-122-11/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=172580
* Markup cosmetics.Ruslan Ermilov2006-12-201-4/+6
| | | | Notes: svn path=/head/; revision=165392
* Finish off style(9) fixes which I started two revisions ago. This basicallyChristian S.J. Peron2005-10-091-20/+24
| | | | | | | | changes the indentation style from 4 spaces to 8 spaces which we expect to see in other FreeBSD source files. Notes: svn path=/head/; revision=151158
* Do not ignore ENOENTChristian S.J. Peron2005-10-071-88/+68
| | | | | | | Pointed out by: Amir Shalem Notes: svn path=/head/; revision=151056
* Un-break handling of -t 0 which was broken in my previous commit.Christian S.J. Peron2005-10-051-5/+6
| | | | | | | | | | | 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) Notes: svn path=/head/; revision=150984
* Fix long standing race condition associated with how lockf uses open(2)Christian S.J. Peron2005-10-051-30/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=150977
* Fix all the spelling mistakes I could find in the man pages for wordsGiorgos Keramidas2005-07-311-1/+1
| | | | | | | | | | | that have at least 3 characters. MFC after: 1 week Thanks to: Music band ``Chingon'' for keeping me company while searching for these. Notes: svn path=/head/; revision=148580
* Markup and wording fixes.Ruslan Ermilov2005-06-141-1/+3
| | | | | | | Approved by: re (blanket) Notes: svn path=/head/; revision=147370
* Document a couple of gotchas.Eivind Eklund2005-05-261-1/+7
| | | | Notes: svn path=/head/; revision=146657
* Added the EXIT STATUS section where appropriate.Ruslan Ermilov2005-01-171-1/+1
| | | | Notes: svn path=/head/; revision=140368
* Use warn() instead of perror().Tim J. Robbins2004-07-151-1/+1
| | | | Notes: svn path=/head/; revision=132180
* Mechanically kill hard sentence breaks.Ruslan Ermilov2004-07-021-2/+4
| | | | Notes: svn path=/head/; revision=131491
* Consistently use FBSDIDDavid E. O'Brien2002-06-301-2/+3
| | | | Notes: svn path=/head/; revision=99112
* Use `The .Nm utility'Philippe Charnier2002-04-201-1/+4
| | | | Notes: svn path=/head/; revision=95124
* Remove leaf node WARNS?=2 (that mainly I added). This shouldMark Murray2002-02-081-1/+0
| | | | | | | help the GCC3 transition and CURRENT in general. Notes: svn path=/head/; revision=90415
* Warns cleanups.David Malone2001-12-032-2/+2
| | | | Notes: svn path=/head/; revision=87290
* mdoc(7) police: s/BSD/.Bx/ where appropriate.Ruslan Ermilov2001-08-141-1/+3
| | | | Notes: svn path=/head/; revision=81622
* Remove whitespace at EOL.Dima Dorfman2001-07-151-1/+1
| | | | Notes: svn path=/head/; revision=79755
* mdoc(7) police: removed HISTORY info from the .Os call.Ruslan Ermilov2001-07-101-1/+1
| | | | Notes: svn path=/head/; revision=79535
* Add history.David E. O'Brien2000-12-101-0/+4
| | | | Notes: svn path=/head/; revision=69809
* $Id$ -> $FreeBSD$Peter Wemm1999-08-283-3/+3
| | | | Notes: svn path=/head/; revision=50477
* Add a "-k" option, to specify that the lock file should be keptJohn Polstra1998-07-082-13/+27
| | | | | | | | | rather than removed. Submitted by: Nick Barnes <Nick.Barnes@pobox.com> Notes: svn path=/head/; revision=37493
* .Sh AUTHOR -> .Sh AUTHORS. Use .An/.Aq.Philippe Charnier1998-03-231-4/+3
| | | | Notes: svn path=/head/; revision=34801
* lockf: usage : lockf -> usage: lockf by using fprintf instead of errx.Philippe Charnier1997-07-221-2/+4
| | | | Notes: svn path=/head/; revision=27603
* compare return value from getopt against -1 rather than EOF, per the finalWarner Losh1997-03-291-2/+2
| | | | | | | posix standard on the topic. Notes: svn path=/head/; revision=24360