This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
This is my patch patch.1h for perl5.001.
[perl5.git] / ext / Fcntl / Fcntl.pm
CommitLineData
a0d0e21e
LW
1package Fcntl;
2
3b35bae3
AD
3=head1 NAME
4
5Fcntl - load the C Fcntl.h defines
6
7=head1 SYNOPSIS
8
9 use Fcntl;
10
11=head1 DESCRIPTION
12
13This module is just a translation of the C F<fnctl.h> file.
14Unlike the old mechanism of requiring a translated F<fnctl.ph>
15file, this uses the B<h2xs> program (see the Perl source distribution)
16and your native C compiler. This means that it has a
17far more likely chance of getting the numbers right.
18
19=head1 NOTE
20
21Only C<#define> symbols get translated; you must still correctly
22pack up your own arguments to pass as args for locking functions, etc.
23
24=cut
25
a0d0e21e 26require Exporter;
3b35bae3 27use AutoLoader;
a0d0e21e 28require DynaLoader;
fec02dd3 29@ISA = qw(Exporter DynaLoader);
a0d0e21e
LW
30# Items to export into callers namespace by default
31# (move infrequently used names to @EXPORT_OK below)
32@EXPORT =
33 qw(
34 F_DUPFD F_GETFD F_GETLK F_SETFD F_GETFL F_SETFL F_SETLK F_SETLKW
35 FD_CLOEXEC F_RDLCK F_UNLCK F_WRLCK
36 O_CREAT O_EXCL O_NOCTTY O_TRUNC
37 O_APPEND O_NONBLOCK
38 O_NDELAY
39 O_RDONLY O_RDWR O_WRONLY
40 );
41# Other items we are prepared to export if requested
42@EXPORT_OK = qw(
43);
44
45sub AUTOLOAD {
a0d0e21e
LW
46 local($constname);
47 ($constname = $AUTOLOAD) =~ s/.*:://;
48 $val = constant($constname, @_ ? $_[0] : 0);
49 if ($! != 0) {
50 if ($! =~ /Invalid/) {
51 $AutoLoader::AUTOLOAD = $AUTOLOAD;
52 goto &AutoLoader::AUTOLOAD;
53 }
54 else {
55 ($pack,$file,$line) = caller;
56 die "Your vendor has not defined Fcntl macro $constname, used at $file line $line.
57";
58 }
59 }
60 eval "sub $AUTOLOAD { $val }";
61 goto &$AUTOLOAD;
62}
63
64bootstrap Fcntl;
65
66# Preloaded methods go here. Autoload methods go after __END__, and are
67# processed by the autosplit program.
68package Fcntl; # return to package Fcntl so AutoSplit is happy
691;
70__END__