1Fcntl(3pm) Perl Programmers Reference Guide Fcntl(3pm)
2
3
4
6 Fcntl - load the C Fcntl.h defines
7
9 use Fcntl;
10 use Fcntl qw(:DEFAULT :flock);
11
13 This module is just a translation of the C fcntl.h file. Unlike the
14 old mechanism of requiring a translated fcntl.ph file, this uses the
15 h2xs program (see the Perl source distribution) and your native C
16 compiler. This means that it has a far more likely chance of getting
17 the numbers right.
18
20 Only "#define" symbols get translated; you must still correctly pack up
21 your own arguments to pass as args for locking functions, etc.
22
24 By default your system's F_* and O_* constants (eg, F_DUPFD and
25 O_CREAT) and the FD_CLOEXEC constant are exported into your namespace.
26
27 You can request that the flock() constants (LOCK_SH, LOCK_EX, LOCK_NB
28 and LOCK_UN) be provided by using the tag ":flock". See Exporter.
29
30 You can request that the old constants (FAPPEND, FASYNC, FCREAT,
31 FDEFER, FEXCL, FNDELAY, FNONBLOCK, FSYNC, FTRUNC) be provided for
32 compatibility reasons by using the tag ":Fcompat". For new
33 applications the newer versions of these constants are suggested
34 (O_APPEND, O_ASYNC, O_CREAT, O_DEFER, O_EXCL, O_NDELAY, O_NONBLOCK,
35 O_SYNC, O_TRUNC).
36
37 For ease of use also the SEEK_* constants (for seek() and sysseek(),
38 e.g. SEEK_END) and the S_I* constants (for chmod() and stat()) are
39 available for import. They can be imported either separately or using
40 the tags ":seek" and ":mode".
41
42 Please refer to your native fcntl(2), open(2), fseek(3), lseek(2)
43 (equal to Perl's seek() and sysseek(), respectively), and chmod(2)
44 documentation to see what constants are implemented in your system.
45
46 See perlopentut to learn about the uses of the O_* constants with
47 sysopen().
48
49 See "seek" in perlfunc and "sysseek" in perlfunc about the SEEK_*
50 constants.
51
52 See "stat" in perlfunc about the S_I* constants.
53
54
55
56perl v5.36.0 2022-08-30 Fcntl(3pm)