Hi,
Can anyone direct me how fcntl call works in locking a region of a file ?
I tried locking a file with this call,
fcntl(fd,F_SETLK,&lk);
where lk is a struct of type flock (defined in fcntl.h). The structures
elements were set to ,
lk.l_type = F_WRLCK; lk.l_whence = SEEK_SET; lk.l_start = 0;
lk.l_len = 0;
After locking the file opened by fd, I had a sleep call so that I can
invoke an another process to open the same file and write some junk
data.
The write from the other process (on the same file) SUCCEEDED !!
- Any help how locking needs to be done !!
-Thanks Bye