|Perl: the Markov chain saw|
Re: File::lockf and the lock() return valueby count0 (Friar)
|on Jan 12, 2002 at 00:43 UTC||Need Help??|
First off, i'd highly suggest using flock() if at all possible.
The big limitation here is that File::lockf is a Perl binding to the SYSV lockf(3) call. Since lockf(3) will never return a 9, my guess is that the Perl binding (File::lockf) is returning the value that errno is set to.
Now the next hurdle; how do you figure out what an errno value corresponds to? ... with the strerror(3) (POSIX/SYSV/BSD/ISO 9899, etc) call. OOOoooh loook, it conforms to POSIX! =) That means that we're in luck (*this* time), since Perl has a fairly complete POSIX module.
The short answer (this is barebones, no strict or anything... and *just* a snippet):
The real answer: flock
Update: I forgot to mention, in this case, with a status of '9', the error is "Bad file descriptor". This means that something was wrong with your filehandle.