87 |
use strict; |
use strict; |
88 |
use vars qw($VERSION @EXPORT @EXPORT_OK $AUTOLOAD @ISA); |
use vars qw($VERSION @EXPORT @EXPORT_OK $AUTOLOAD @ISA); |
89 |
use Carp; |
use Carp; |
90 |
|
use Errno; |
91 |
use IO::File; |
use IO::File; |
92 |
use File::Basename; |
use File::Basename; |
93 |
use Autom4te::ChannelDefs; |
use Autom4te::ChannelDefs; |
217 |
{ |
{ |
218 |
my ($fh, $mode) = @_; |
my ($fh, $mode) = @_; |
219 |
# Cannot use @_ here. |
# Cannot use @_ here. |
220 |
if (!flock ($fh, $mode)) |
|
221 |
|
# On some systems (e.g. GNU/Linux with NFSv2), flock(2) does not work over |
222 |
|
# NFS, but Perl prefers that over fcntl(2) if it exists and if |
223 |
|
# perl was not built with -Ud_flock. Normally, this problem is harmless, |
224 |
|
# so ignore the ENOLCK errors that are reported in that situation, |
225 |
|
# However, if the invoker is using "make -j", the problem is not harmless, |
226 |
|
# so report it in that case. Admittedly this is a bit of a hack. |
227 |
|
if (!flock ($fh, $mode) |
228 |
|
&& (!$!{ENOLCK} || " $ENV{'MAKEFLAGS'} " =~ / -j /)) |
229 |
{ |
{ |
230 |
my $file = $fh->name; |
my $file = $fh->name; |
231 |
fatal "cannot lock $file with mode $mode: $!"; |
fatal "cannot lock $file with mode $mode: $!"; |