Keep It Simple, Stupid | |
PerlMonks |
Shared flocks on Solaris?by BazB (Priest) |
on May 06, 2003 at 19:57 UTC ( [id://256020]=perlquestion: print w/replies, xml ) | Need Help?? |
BazB has asked for the wisdom of the Perl Monks concerning the following question: Greetings, follow Monks.
I've been tinkering with some code which flock()s a semaphore file. Note that the emulation built with lockf(3) doesn't provide shared locks, and it requires that FILEHANDLE be open with write intent. These are the semantics that lockf(3) implements. Most if not all systems implement lockf(3) in terms of fcntl(2) locking, though, so the differing semantics shouldn’t bite too many people.Unfortunately, I seem to have been bitten. I need both exclusive (LOCK_EX) and shared locks (LOCK_SH). Changing the permissions on the open statement also causes exclusive locks to fail, as foretold by the perldoc. I tried recompiling my Perl binary with sh Configure -Ud_flock, but the problem persists.
The test code is shown below. It works as expected on Linux, but not Solaris. I have tried both 5.6.1 and 5.8.0.
My questions are as follows:
Cheers in advance, If the information in this post is inaccurate, or just plain wrong, don't just downvote - please post explaining what's wrong.
Back to
Seekers of Perl Wisdom
|
|