flock() or lockf()

Ben Walton bdwalton-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Sun Apr 29 00:15:15 UTC 2012


Hi William,

On Sat, Apr 28, 2012 at 6:45 PM, William Park <opengeometry-FFYn/CNdgSA at public.gmane.org> wrote:
> For file locking in C program on Linux, which should I use?
>    flock() or lockf()

I'd generally say lockf() (it's a POSIX interface) is a better choice
than flock().  This is especially true if you will need to handle the
NFS case, although this also depends on the NFS server being
sufficiently capable.

HTH.
-Ben
-- 
---------------------------------------------------------------------------------------------------------------------------
Ben Walton <bdwalton-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org>

Take the risk of thinking for yourself.  Much more happiness,
truth, beauty and wisdom will come to you that way.

-Christopher Hitchens
---------------------------------------------------------------------------------------------------------------------------
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list