Skip site navigation (1)Skip section navigation (2)

  
 
  

home | help
setlock(1)		     General Commands Manual		      setlock(1)

NAME
     setlock - run a program with a file locked

SYNTAX
     setlock [ -nNxX ] file program [ arg ...  ]

DESCRIPTION
     setlock  opens file for writing (creating it if it does not exist), obtains
     an exclusive lock on it, and runs program.

     Normally the lock disappears when program exits.

     (Here's the complete story: program is given  a  descriptor  for  a  locked
     ofile  pointing to file.  The lock disappears when this ofile is (1) closed
     by all the processes that have descriptors for it	or  (2)  explicitly  un-
     locked.)

OPTIONS
     -n     No delay.  If file is locked by another process, setlock gives up.

     -N     (Default.)	 Delay.   If  file is locked by another process, setlock
	    waits until it can obtain a new lock.

     -x     If file cannot be opened (or created) or locked, setlock exits zero.

     -X     (Default.)	If file cannot be opened (or created) or locked, setlock
	    prints an error message and exits nonzero.

SEE ALSO
     flock(2), lockf(3)

								      setlock(1)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=setlock&sektion=1&manpath=FreeBSD+Ports+15.1.quarterly>

home | help