Has anyone used Fcntl to handle file locking? 
Author Message
 Has anyone used Fcntl to handle file locking?

I've been trying to handle file locking using fcntl (instead of flock),
but whenever I call the function, I get an error.
When I do a F_GETLK, the $! variable says "Invalid Argument".
When I do a F_SETLK, the $! variable says "Bad file number".
I think the first error might have something to do with packing the
argument structure, but I'm not sure.

Here's my code:

$filehandle = "datfile";
$fcntl_arg = pack("ssll*", F_WRLCK, 0, 0, 0, 0);

$fcntl_arg = pack("ssll*", F_WRLCK, 0, 0, 0);


Any ideas?
Stuart Lee

Wed, 26 Nov 1997 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Req for example: file lock using fcntl

2. Help with using fcntl file locking

3. File locking using Fcntl

4. Nee file lock example using fcntl

5. Need example of file locking using fcntl

6. Trouble using fcntl to lock file

7. Using fcntl for locking

8. File locking with fcntl()

9. problem locking file with fcntl (HP-UX)

10. File locking via 'fcntl()'

11. File Locking: why not use fcntl?

12. fcntl to lock a file?


Powered by phpBB® Forum Software