Hi Everyone,

I'm following this list for about a year, so i have checked previous
messages in order to find an answer. Probably I'm missing some concept...

1. What I'm interested in is this: I'd like to perform exclusive lock on a
local file for a short time (open,wait to lock file,read,update,close; or
whatever is the technique). This file will be used by different running
instances of the same program (therefore there is not a question about what
others use for locking (like mailproc etc..))

2. What I have found:
a. Suggestion 1: Getting liblockfile
b. Suggestion 2: Glynn's quoted code  (a part of it, as it appeared on the
list once)

        IOW:
        int lock_file(const char *name)
        {
                size_t n = strlen(name);
                char *buff1 = alloca(n + 6);
                char *buff2 = alloca(n + 6);
                int fd;
        etc etc..
 
Now,

I got liblockfile routines, compiled the library but did not find any
examples on how to use them, tried some mickey-mouse programs to see how to
use it with a bit strange results. 

Simmilar thing is with Glynn's code... How to use it? Also, Is it
applicable to the case I'm after?. 

Can you help me with giving me a clue how to use such functions. e.g. open
a file then to make a lock or create a lockfile and then ??? associate with
opened file??

Or maybe any other considerable simple way to perform exclusive locks on a
local file.

Rgds,
Ljubisa Gavrilovic <[EMAIL PROTECTED]>

Reply via email to