Fcntl(3p) Perl Programmers Reference Guide Fcntl(3p) #
Fcntl(3p) Perl Programmers Reference Guide Fcntl(3p)
NNAAMMEE #
Fcntl - load the C Fcntl.h defines
SSYYNNOOPPSSIISS #
use Fcntl;
use Fcntl qw(:DEFAULT :flock);
DDEESSCCRRIIPPTTIIOONN #
This module is just a translation of the C _f_c_n_t_l_._h file. Unlike the old
mechanism of requiring a translated _f_c_n_t_l_._p_h file, this uses the hh22xxss
program (see the Perl source distribution) and your native C compiler.
This means that it has a far more likely chance of getting the numbers
right.
NNOOTTEE #
Only "#define" symbols get translated; you must still correctly pack up
your own arguments to pass as args for locking functions, etc.
EEXXPPOORRTTEEDD SSYYMMBBOOLLSS #
By default your system's F_* and O_* constants (eg, F_DUPFD and O_CREAT)
and the FD_CLOEXEC constant are exported into your namespace.
You can request that the fflloocckk(()) constants (LOCK_SH, LOCK_EX, LOCK_NB and
LOCK_UN) be provided by using the tag ":flock". See Exporter.
You can request that the old constants (FAPPEND, FASYNC, FCREAT, FDEFER,
FEXCL, FNDELAY, FNONBLOCK, FSYNC, FTRUNC) be provided for compatibility
reasons by using the tag ":Fcompat". For new applications the newer
versions of these constants are suggested (O_APPEND, O_ASYNC, O_CREAT,
O_DEFER, O_EXCL, O_NDELAY, O_NONBLOCK, O_SYNC, O_TRUNC). #
For ease of use also the SEEK_* constants (for sseeeekk(()) and ssyysssseeeekk(()), e.g.
SEEK_END) and the S_I* constants (for cchhmmoodd(()) and ssttaatt(())) are available
for import. They can be imported either separately or using the tags
":seek" and ":mode".
Please refer to your native ffccnnttll(2), ooppeenn(2), ffsseeeekk(3), llsseeeekk(2) (equal
to Perl's sseeeekk(()) and ssyysssseeeekk(()), respectively), and cchhmmoodd(2) documentation
to see what constants are implemented in your system.
See perlopentut to learn about the uses of the O_* constants with
ssyyssooppeenn(()).
See "seek" in perlfunc and "sysseek" in perlfunc about the SEEK_*
constants.
See "stat" in perlfunc about the S_I* constants.
perl v5.36.3 2023-02-15 Fcntl(3p)