Hi Folks,
I posted this awhile back, but then had problems with my mailer and saw no
responses.
I have also attempted to clarify the froblem.
When I run the following program under Linux ( Red Hat 7.1, Perl 5.6.0 ) it
works fine.
If I run the program under Solaris, it fails with "Bad File Number" (
EBADF). I have two
Solaris machines, a Sun 450 running Solaris 2.6 on which I have compiled
Perl 5.6.1 using
gcc 2.8.1, and a Compaq running Solaris 8i with the installed Perl
5.005003. In config.h
on both Solaris boxes HAVE_FLOCK is not defined, but HAVE_FCNTL is defined.
I thought that Solaris perl emulated flock() using fcntl(), but the
emulation appears not to work.
Do I need to define any special flags when I compile perl in order to get
the emulation?
Unfortunately I am not in a position to upgrade my gcc or my OS at the
present time.
Thanks,
Smiddy
P.S. As you can probably tell from the commented out line, I have also
tried:
flock( fileno( dataHandle ), LOCK_EX );
#!/usr/bin/perl -w
use strict;
use Fcntl qw( :DEFAULT :flock );
# Put your data file name here.
my $datafile = './test_file';
open( dataHandle, "< $datafile" ) or
die( "Cannot open data file $datafile: $!" );
# my $file_num = fileno( dataHandle );
flock( dataHandle, LOCK_EX ) or
die( "Cannot lock data file $datafile: $!" );
print "Ready to use file $datafile.\n";
close( dataHandle );
exit( 0 );
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]