busybox: lock: implement -n "Fail rather than wait"
authornbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Wed, 9 Sep 2015 20:36:10 +0000 (20:36 +0000)
committernbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Wed, 9 Sep 2015 20:36:10 +0000 (20:36 +0000)
commit55d39f5bfeaded48dabf2c2ae6b611b4504cbe29
tree7c5368c9d79993f208eda78d8f55f360ae45e0ba
parentbc9c81b3957dfc4580286a28a41dfeacd4bbac2f
busybox: lock: implement -n "Fail rather than wait"

lock -n is similiar to flock -n. If the lock was already taken,
fail with exit code = 1 and write error message to stderr.

example:
if ! lock -n /tmp/foo ; then
echo lock exits.
else
echo lock was free. But is locked now.
fi
> lock was free. But is locked now.
> lock exists.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@46836 3c298f89-4303-0410-b956-a3cf2f4a3e73
package/utils/busybox/patches/220-add_lock_util.patch