From: Jookia Date: Thu, 23 Jan 2020 04:55:35 +0000 (+0000) Subject: flock: Add new example using shell IO redirection X-Git-Tag: v2.36-rc1~259^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=966bcac37a95837011cf3bf5c588509b56994eda;p=thirdparty%2Futil-linux.git flock: Add new example using shell IO redirection --- diff --git a/sys-utils/flock.1 b/sys-utils/flock.1 index 0a4da9d468..6762ecb4ce 100644 --- a/sys-utils/flock.1 +++ b/sys-utils/flock.1 @@ -166,6 +166,14 @@ run. If the env var $FLOCKER is not set to the shell script that is being run, then execute flock and grab an exclusive non-blocking lock (using the script itself as the lock file) before re-execing itself with the right arguments. It also sets the FLOCKER env var to the right value so it doesn't run again. +.TP +.TQ +exec 4<>/var/lock/mylockfile +.TQ +flock -n 4 +This form is convenient for locking a file without spawning a subprocess. +The shell opens the lock file for reading and writing as file descriptor 4, +then flock is used to lock the descriptor. .SH "EXIT STATUS" The command uses .B sysexits.h