Date: Wed, 13 Apr 2011 16:23:01 +0300 From: Nikos Vassiliadis <nvass@gmx.com> To: Bastien Semene <bsemene@cyanide-studio.com> Cc: freebsd-questions@freebsd.org Subject: Re: lockf command Message-ID: <4DA5A3B5.4080302@gmx.com> In-Reply-To: <4DA56819.90503@cyanide-studio.com> References: <4DA56819.90503@cyanide-studio.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On 4/13/2011 12:08 PM, Bastien Semene wrote: > I wish that if command #2 can't acquire the lock, lockf exits (exit 0 > would be nice). > If I set -t 1, lockf is quite what I'm waiting for. But I like to do > this in a clear way : if it can't acquire the lock it exits, no timeout > wait. > > Am I misunderstanding something ? What should I change ? > You should use -t0, something like: > lab# lockf -t 0 /tmp/lock /bin/csh > You have mail. > lab# lockf -t 0 /tmp/lock /bin/csh > lockf: /tmp/lock: already locked > lab# echo $? > 75 > lab# HTH, Nikos
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4DA5A3B5.4080302>