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 com‐
16 piler. This means that it has a far more likely chance of getting the
17 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, FDE‐
31 FER, FEXCL, FNDELAY, FNONBLOCK, FSYNC, FTRUNC) be provided for compati‐
32 bility reasons by using the tag ":Fcompat". For new applications the
33 newer versions of these constants are suggested (O_APPEND, O_ASYNC,
34 O_CREAT, O_DEFER, O_EXCL, O_NDELAY, O_NONBLOCK, O_SYNC, O_TRUNC).
35
36 For ease of use also the SEEK_* constants (for seek() and sysseek(),
37 e.g. SEEK_END) and the S_I* constants (for chmod() and stat()) are
38 available for import. They can be imported either separately or using
39 the tags ":seek" and ":mode".
40
41 Please refer to your native fcntl(2), open(2), fseek(3), lseek(2)
42 (equal to Perl's seek() and sysseek(), respectively), and chmod(2) doc‐
43 umentation to see what constants are implemented in your system.
44
45 See perlopentut to learn about the uses of the O_* constants with
46 sysopen().
47
48 See "seek" in perlfunc and "sysseek" in perlfunc about the SEEK_* con‐
49 stants.
50
51 See "stat" in perlfunc about the S_I* constants.
52
53
54
55perl v5.8.8 2001-09-21 Fcntl(3pm)