Hi ,
Here is some information for you ....
there is a function in unistd.h
int lockf(int fildes, int function, off_t size);
fildes is the open file descriptor opened in the 
function can be any one of the following..
 0  ---Unlock a locked a region
 1  ---Lock a unlocked region
 2  ---test and unlock a region    returns 0 if it is acessible and -1 if it
is not
 3  ---test a region
size is number of bytes of the file to be locked

the differnce between fn 1 and fn 2 is that 1 will sleep until lock is
obtained

Bye,
Sudhir Shenoy .P.
IT Solutions (India ) Pvt Ltd
-----Original Message-----
From: G A Abhay [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 01, 2000 6:26 PM
To: [EMAIL PROTECTED]
Subject: [LI] lock function in unix


>Is there any lock function (in C) to lock files on a >linux machine
>Does the kernel provide such system calls at all?
>This should prevent other processes from accessing the >same file.

abhay



--------------------------------------------------------------------------
LI is all for free speech, but this list was created for a purpose --
to help popularise Linux in India. If your messages are counterproductive
to that purpose, your privileges to submit messages can and will be revoked.

--------------------------------------------------------------------------
LI is all for free speech, but this list was created for a purpose --
to help popularise Linux in India. If your messages are counterproductive
to that purpose, your privileges to submit messages can and will be revoked.

Reply via email to