P
Pioneer
I have found a problem in Perl 5.8.4 on Debian Linux where F_SETLKW is
showing up with value "14" when the kernel is expecting value "7".
Details below:
I have been struggling with getting fcntl locking working for 3 days.
Specifically with using fcntl to do exclusive byte range locking on a
file in Perl/Linux.
I had it working, however it seemed no matter what range I locked, the
entire file locked and I could not figure out why. Every piece of
example code or module I could find caused the same problem.
Finally I wrote test code in C that worked fine. I then started
comparing the values of all of the defined variables in C and perl.
This is what I found:
PERL v5.8.4:
F_WRLCK: 1
SEEK_SET: 0
F_SETLKW: 14
C:
F_WRLCK: 1
SEEK_SET: 0
F_SETLKW: 7
I forced F_SETLKW in Perl to be 7 and everything worked as it should.
I understand that the flock structures change from machine to machine,
etc. but I saw no comments anywhere on the web saying you had to make
sure these values were also proper. Is this due to installing a
predefined Debian package rather than compiling Perl from scratch, a
bug in the Perl install itself, me importing FCNTL data incorrectly, or
should I just not have expected this value to be correct?
(Details/Sample code shown below)
Thanks,
-John
Details: Debian, Sarge Distribution, Stable, Perl v5.8.4, Linux
Kernels, same issue on both v2.6.13 and v2.4.26
Code:
#!/usr/bin/perl
use Fcntl;
use POSIX qwunistd_h :errno_h);
use Fcntl qwDEFAULT :flock);
use strict;
print "F_SETLKW: ".F_SETLKW."\n";
I also tried removing different use statements above, all the same
results.
showing up with value "14" when the kernel is expecting value "7".
Details below:
I have been struggling with getting fcntl locking working for 3 days.
Specifically with using fcntl to do exclusive byte range locking on a
file in Perl/Linux.
I had it working, however it seemed no matter what range I locked, the
entire file locked and I could not figure out why. Every piece of
example code or module I could find caused the same problem.
Finally I wrote test code in C that worked fine. I then started
comparing the values of all of the defined variables in C and perl.
This is what I found:
PERL v5.8.4:
F_WRLCK: 1
SEEK_SET: 0
F_SETLKW: 14
C:
F_WRLCK: 1
SEEK_SET: 0
F_SETLKW: 7
I forced F_SETLKW in Perl to be 7 and everything worked as it should.
I understand that the flock structures change from machine to machine,
etc. but I saw no comments anywhere on the web saying you had to make
sure these values were also proper. Is this due to installing a
predefined Debian package rather than compiling Perl from scratch, a
bug in the Perl install itself, me importing FCNTL data incorrectly, or
should I just not have expected this value to be correct?
(Details/Sample code shown below)
Thanks,
-John
Details: Debian, Sarge Distribution, Stable, Perl v5.8.4, Linux
Kernels, same issue on both v2.6.13 and v2.4.26
Code:
#!/usr/bin/perl
use Fcntl;
use POSIX qwunistd_h :errno_h);
use Fcntl qwDEFAULT :flock);
use strict;
print "F_SETLKW: ".F_SETLKW."\n";
I also tried removing different use statements above, all the same
results.