Debian Codegraph @

upstream/debian-unstable/man3/Fcntl.3perl

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45)
3 .\"
4 .\" Standard preamble:
5 .\" ========================================================================
6 .de Sp \" Vertical space (when we can't use .PP)
7 .if t .sp .5v
8 .if n .sp
9 ..
10 .de Vb \" Begin verbatim text
11 .ft CW
12 .nf
13 .ne \\$1
14 ..
15 .de Ve \" End verbatim text
16 .ft R
17 .fi
18 ..
19 .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
20 .ie n \{\
21 . ds C` ""
22 . ds C' ""
23 'br\}
24 .el\{\
25 . ds C`
26 . ds C'
27 'br\}
28 .\"
29 .\" Escape single quotes in literal strings from groff's Unicode transform.
30 .ie \n(.g .ds Aq \(aq
31 .el .ds Aq '
32 .\"
33 .\" If the F register is >0, we'll generate index entries on stderr for
34 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
35 .\" entries marked with X<> in POD. Of course, you'll have to process the
36 .\" output yourself in some meaningful fashion.
37 .\"
38 .\" Avoid warning from groff about undefined register 'F'.
39 .de IX
40 ..
41 .nr rF 0
42 .if \n(.g .if rF .nr rF 1
43 .if (\n(rF:(\n(.g==0)) \{\
44 . if \nF \{\
45 . de IX
46 . tm Index:\\$1\t\\n%\t"\\$2"
47 ..
48 . if !\nF==2 \{\
49 . nr % 0
50 . nr F 2
51 . \}
52 . \}
53 .\}
54 .rr rF
55 .\" ========================================================================
56 .\"
57 .IX Title "Fcntl 3perl"
58 .TH Fcntl 3perl 2025-11-16 "perl v5.40.1" "Perl Programmers Reference Guide"
59 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
60 .\" way too many mistakes in technical documents.
61 .if n .ad l
62 .nh
63 .SH NAME
64 Fcntl \- various flag constants and helper functions from C's fcntl.h
65 .SH SYNOPSIS
66 .IX Header "SYNOPSIS"
67 .Vb 3
68 \& use Fcntl;
69 \& use Fcntl qw(:DEFAULT :flock);
70 \& use Fcntl qw(F_GETFD F_SETFD FD_CLOEXEC);
71 .Ve
72 .SH DESCRIPTION
73 .IX Header "DESCRIPTION"
74 This module provides flags and helper functions for use with "chmod" in perlfunc
75 (S_*), "fcntl" in perlfunc (F_*), "flock" in perlfunc (LOCK_*), "seek" in perlfunc
76 (SEEK_*), "stat" in perlfunc (S_*), "sysopen" in perlfunc (O_*), and
77 "sysseek" in perlfunc (SEEK_*). They correspond to the C macros defined in
78 \&\fIfcntl.h\fR.
79 .PP
80 Not all symbols are available on all systems. Except where noted otherwise,
81 the constants and functions provided by this module will throw a runtime
82 exception if the corresponding C macro is not available. Consult your system
83 documentation to see the full description of each symbol and whether it is
84 available on your platform: \fBchmod\fR\|(2), \fBfcntl\fR\|(2), \fBflock\fR\|(2),
85 \&\fBlseek\fR\|(2), \fBopen\fR\|(2), \fBstat\fR\|(2).
86 .PP
87 (In particular, some of the F_* symbols are highly non-portable because they
88 only exist on a single platform or require system-specific C data structures to
89 be passed as the third argument to \f(CW\*(C`fcntl\*(C'\fR, which can't be portably
90 constructed in pure Perl.)
91 .SH "EXPORTED SYMBOLS"
92 .IX Header "EXPORTED SYMBOLS"
93 .SS "Default exports and export tags"
94 .IX Subsection "Default exports and export tags"
95 The full list of default exports can be found below in "APPENDIX A".
96 .PP
97 In addition, the following export tags are available (see Exporter for more
98 information on export tags):
99 .ie n .IP """:DEFAULT""" 4
100 .el .IP \f(CW:DEFAULT\fR 4
101 .IX Item ":DEFAULT"
102 Equivalent to the list of default export symbols (see "APPENDIX A").
103 .ie n .IP """:flock""" 4
104 .el .IP \f(CW:flock\fR 4
105 .IX Item ":flock"
106 Equivalent to all LOCK_* symbols listed below.
107 .ie n .IP """:mode""" 4
108 .el .IP \f(CW:mode\fR 4
109 .IX Item ":mode"
110 Equivalent to all S_* symbols listed below.
111 .ie n .IP """:seek""" 4
112 .el .IP \f(CW:seek\fR 4
113 .IX Item ":seek"
114 Equivalent to all SEEK_* symbols listed below.
115 .ie n .IP """:Fcompat""" 4
116 .el .IP \f(CW:Fcompat\fR 4
117 .IX Item ":Fcompat"
118 Equivalent to \f(CW\*(C`qw(FAPPEND FASYNC FCREAT FDEFER FDSYNC FEXCL FLARGEFILE FNDELAY
119 FNONBLOCK FRSYNC FSYNC FTRUNC)\*(C'\fR. These only exist for compatibility with old
120 code (if your platform defines them at all) and should not be used in new code.
121 .ie n .SS "Symbols for use with ""fcntl"""
122 .el .SS "Symbols for use with \f(CWfcntl\fP"
123 .IX Subsection "Symbols for use with fcntl"
124 .ie n .IP """F_ALLOCSP""" 4
125 .el .IP \f(CWF_ALLOCSP\fR 4
126 .IX Item "F_ALLOCSP"
127 File storage manipulation.
128 .ie n .IP """F_ALLOCSP64""" 4
129 .el .IP \f(CWF_ALLOCSP64\fR 4
130 .IX Item "F_ALLOCSP64"
131 File storage manipulation.
132 .ie n .IP """F_DUP2FD""" 4
133 .el .IP \f(CWF_DUP2FD\fR 4
134 .IX Item "F_DUP2FD"
135 Duplicate a file descriptor to the number specified in the third argument to
136 \&\f(CW\*(C`fcntl\*(C'\fR (if it refers to an open file, it is automatically closed first).
137 .ie n .IP """F_DUPFD""" 4
138 .el .IP \f(CWF_DUPFD\fR 4
139 .IX Item "F_DUPFD"
140 Duplicate a file descriptor to the lowest unused number greater than or equal
141 to the third argument of \f(CW\*(C`fcntl\*(C'\fR.
142 .ie n .IP """F_FREESP""" 4
143 .el .IP \f(CWF_FREESP\fR 4
144 .IX Item "F_FREESP"
145 File storage manipulation.
146 .ie n .IP """F_FREESP64""" 4
147 .el .IP \f(CWF_FREESP64\fR 4
148 .IX Item "F_FREESP64"
149 File storage manipulation.
150 .ie n .IP """F_FSYNC""" 4
151 .el .IP \f(CWF_FSYNC\fR 4
152 .IX Item "F_FSYNC"
153 Synchronize file data to disk.
154 .ie n .IP """F_FSYNC64""" 4
155 .el .IP \f(CWF_FSYNC64\fR 4
156 .IX Item "F_FSYNC64"
157 Synchronize file data to disk.
158 .ie n .IP """F_GETFD""" 4
159 .el .IP \f(CWF_GETFD\fR 4
160 .IX Item "F_GETFD"
161 Return (as a number) the set of file descriptor flags, in which the following
162 bits may be set:
163 .RS 4
164 .ie n .IP """FD_CLOEXEC""" 4
165 .el .IP \f(CWFD_CLOEXEC\fR 4
166 .IX Item "FD_CLOEXEC"
167 During a successful \f(CW\*(C`exec\*(C'\fR call, the file descriptor will be closed
168 automatically.
169 .RE
170 .RS 4
171 .RE
172 .ie n .IP """F_GETFL""" 4
173 .el .IP \f(CWF_GETFL\fR 4
174 .IX Item "F_GETFL"
175 Return (as a number) the set of file description status flags (O_*) as set by
176 \&\f(CW\*(C`open\*(C'\fR and \f(CW\*(C`fcntl\*(C'\fR. To determine the file access mode, perform a bitwise AND
177 with "\f(CW\*(C`O_ACCMODE\*(C'\fR" and see whether the result is equal to \f(CW\*(C`O_RDONLY\*(C'\fR,
178 \&\f(CW\*(C`O_WRONLY\*(C'\fR, or \f(CW\*(C`O_RDWR\*(C'\fR.
179 .ie n .IP """F_GETLEASE""" 4
180 .el .IP \f(CWF_GETLEASE\fR 4
181 .IX Item "F_GETLEASE"
182 Indicate the type of lease associated with the filehandle (if any) by returning
183 one of the following flags:
184 .RS 4
185 .ie n .IP """F_RDLCK""" 4
186 .el .IP \f(CWF_RDLCK\fR 4
187 .IX Item "F_RDLCK"
188 A read lease.
189 .ie n .IP """F_WRLCK""" 4
190 .el .IP \f(CWF_WRLCK\fR 4
191 .IX Item "F_WRLCK"
192 A write lease.
193 .ie n .IP """F_UNLCK""" 4
194 .el .IP \f(CWF_UNLCK\fR 4
195 .IX Item "F_UNLCK"
196 No lease.
197 .RE
198 .RS 4
199 .RE
200 .ie n .IP """F_GETLK""" 4
201 .el .IP \f(CWF_GETLK\fR 4
202 .IX Item "F_GETLK"
203 Test for the existence of record locks on the file.
204 .ie n .IP """F_GETLK64""" 4
205 .el .IP \f(CWF_GETLK64\fR 4
206 .IX Item "F_GETLK64"
207 Test for the existence of record locks on the file.
208 .ie n .IP """F_GETOWN""" 4
209 .el .IP \f(CWF_GETOWN\fR 4
210 .IX Item "F_GETOWN"
211 Return the ID of the process (as a positive number) or group (as a negative
212 number) that is currently receiving signals for events on the file descriptor.
213 .ie n .IP """F_GETPIPE_SZ""" 4
214 .el .IP \f(CWF_GETPIPE_SZ\fR 4
215 .IX Item "F_GETPIPE_SZ"
216 Return the capacity of the pipe associated with the filehandle.
217 .ie n .IP """F_GETSIG""" 4
218 .el .IP \f(CWF_GETSIG\fR 4
219 .IX Item "F_GETSIG"
220 Return the number of the signal sent when input or output becomes possible on
221 the filehandle. A return value of \f(CW0\fR means \f(CW\*(C`SIGIO\*(C'\fR.
222 .ie n .IP """F_NOTIFY""" 4
223 .el .IP \f(CWF_NOTIFY\fR 4
224 .IX Item "F_NOTIFY"
225 File and directory change notification with signals.
226 .RS 4
227 .ie n .IP """DN_ACCESS""" 4
228 .el .IP \f(CWDN_ACCESS\fR 4
229 .IX Item "DN_ACCESS"
230 .PD 0
231 .ie n .IP """DN_ATTRIB""" 4
232 .el .IP \f(CWDN_ATTRIB\fR 4
233 .IX Item "DN_ATTRIB"
234 .ie n .IP """DN_CREATE""" 4
235 .el .IP \f(CWDN_CREATE\fR 4
236 .IX Item "DN_CREATE"
237 .ie n .IP """DN_DELETE""" 4
238 .el .IP \f(CWDN_DELETE\fR 4
239 .IX Item "DN_DELETE"
240 .ie n .IP """DN_MODIFY""" 4
241 .el .IP \f(CWDN_MODIFY\fR 4
242 .IX Item "DN_MODIFY"
243 .ie n .IP """DN_MULTISHOT""" 4
244 .el .IP \f(CWDN_MULTISHOT\fR 4
245 .IX Item "DN_MULTISHOT"
246 .ie n .IP """DN_RENAME""" 4
247 .el .IP \f(CWDN_RENAME\fR 4
248 .IX Item "DN_RENAME"
249 .RE
250 .RS 4
251 .PD
252 .Sp
253
254 .RE
255 .ie n .IP """F_SETFD""" 4
256 .el .IP \f(CWF_SETFD\fR 4
257 .IX Item "F_SETFD"
258 Set the file descriptor flags. See "\f(CW\*(C`F_GETFD\*(C'\fR" for the list of available
259 flags.
260 .ie n .IP """F_SETFL""" 4
261 .el .IP \f(CWF_SETFL\fR 4
262 .IX Item "F_SETFL"
263 Set the file description status flags (O_*). Only some flags can be changed
264 this way.
265 .ie n .IP """F_SETLEASE""" 4
266 .el .IP \f(CWF_SETLEASE\fR 4
267 .IX Item "F_SETLEASE"
268 Set a file lease as specified by the third \f(CW\*(C`fnctl\*(C'\fR argument, which must be one
269 of the following:
270 .RS 4
271 .ie n .IP """F_RDLCK""" 4
272 .el .IP \f(CWF_RDLCK\fR 4
273 .IX Item "F_RDLCK"
274 Set a read lease.
275 .ie n .IP """F_WRLCK""" 4
276 .el .IP \f(CWF_WRLCK\fR 4
277 .IX Item "F_WRLCK"
278 Set a write lease.
279 .ie n .IP """F_UNLCK""" 4
280 .el .IP \f(CWF_UNLCK\fR 4
281 .IX Item "F_UNLCK"
282 Remove a lease.
283 .RE
284 .RS 4
285 .RE
286 .ie n .IP """F_SETLK""" 4
287 .el .IP \f(CWF_SETLK\fR 4
288 .IX Item "F_SETLK"
289 Acquire a record lock.
290 .ie n .IP """F_SETLK64""" 4
291 .el .IP \f(CWF_SETLK64\fR 4
292 .IX Item "F_SETLK64"
293 Acquire a record lock.
294 .ie n .IP """F_SETLKW""" 4
295 .el .IP \f(CWF_SETLKW\fR 4
296 .IX Item "F_SETLKW"
297 Acquire a record lock and wait for conflicting locks to be released.
298 .ie n .IP """F_SETLKW64""" 4
299 .el .IP \f(CWF_SETLKW64\fR 4
300 .IX Item "F_SETLKW64"
301 Acquire a record lock and wait for conflicting locks to be released.
302 .ie n .IP """F_SETOWN""" 4
303 .el .IP \f(CWF_SETOWN\fR 4
304 .IX Item "F_SETOWN"
305 Set the ID of the process (as a positive number) or group (as a negative
306 number) that will receive signals for events on the file descriptor.
307 .ie n .IP """F_SETPIPE_SZ""" 4
308 .el .IP \f(CWF_SETPIPE_SZ\fR 4
309 .IX Item "F_SETPIPE_SZ"
310 Set the capacity of the pipe associated with the filehandle. Return the actual
311 capacity reserved for the pipe, which may be higher than requested.
312 .ie n .IP """F_SETSIG""" 4
313 .el .IP \f(CWF_SETSIG\fR 4
314 .IX Item "F_SETSIG"
315 Set the number of the signal sent when input or output becomes possible on the
316 filehandle. An argument of \f(CW0\fR means \f(CW\*(C`SIGIO\*(C'\fR.
317 .ie n .IP """F_SHARE""" 4
318 .el .IP \f(CWF_SHARE\fR 4
319 .IX Item "F_SHARE"
320 Set share reservation.
321 .ie n .IP """F_UNSHARE""" 4
322 .el .IP \f(CWF_UNSHARE\fR 4
323 .IX Item "F_UNSHARE"
324 Remove share reservation.
325 .ie n .IP """F_COMPAT""" 4
326 .el .IP \f(CWF_COMPAT\fR 4
327 .IX Item "F_COMPAT"
328 .PD 0
329 .ie n .IP """F_EXLCK""" 4
330 .el .IP \f(CWF_EXLCK\fR 4
331 .IX Item "F_EXLCK"
332 .ie n .IP """F_NODNY""" 4
333 .el .IP \f(CWF_NODNY\fR 4
334 .IX Item "F_NODNY"
335 .ie n .IP """F_POSIX""" 4
336 .el .IP \f(CWF_POSIX\fR 4
337 .IX Item "F_POSIX"
338 .ie n .IP """F_RDACC""" 4
339 .el .IP \f(CWF_RDACC\fR 4
340 .IX Item "F_RDACC"
341 .ie n .IP """F_RDDNY""" 4
342 .el .IP \f(CWF_RDDNY\fR 4
343 .IX Item "F_RDDNY"
344 .ie n .IP """F_RWACC""" 4
345 .el .IP \f(CWF_RWACC\fR 4
346 .IX Item "F_RWACC"
347 .ie n .IP """F_RWDNY""" 4
348 .el .IP \f(CWF_RWDNY\fR 4
349 .IX Item "F_RWDNY"
350 .ie n .IP """F_SHLCK""" 4
351 .el .IP \f(CWF_SHLCK\fR 4
352 .IX Item "F_SHLCK"
353 .ie n .IP """F_WRACC""" 4
354 .el .IP \f(CWF_WRACC\fR 4
355 .IX Item "F_WRACC"
356 .ie n .IP """F_WRDNY""" 4
357 .el .IP \f(CWF_WRDNY\fR 4
358 .IX Item "F_WRDNY"
359 .PD
360 .ie n .SS "Symbols for use with ""flock"""
361 .el .SS "Symbols for use with \f(CWflock\fP"
362 .IX Subsection "Symbols for use with flock"
363 .ie n .IP """LOCK_EX""" 4
364 .el .IP \f(CWLOCK_EX\fR 4
365 .IX Item "LOCK_EX"
366 Request an exclusive lock.
367 .ie n .IP """LOCK_MAND""" 4
368 .el .IP \f(CWLOCK_MAND\fR 4
369 .IX Item "LOCK_MAND"
370 Request a mandatory lock.
371 .ie n .IP """LOCK_NB""" 4
372 .el .IP \f(CWLOCK_NB\fR 4
373 .IX Item "LOCK_NB"
374 Make lock request non-blocking (can be combined with other LOCK_* flags using bitwise OR).
375 .ie n .IP """LOCK_READ""" 4
376 .el .IP \f(CWLOCK_READ\fR 4
377 .IX Item "LOCK_READ"
378 With \f(CW\*(C`LOCK_MAND\*(C'\fR: Allow concurrent reads.
379 .ie n .IP """LOCK_RW""" 4
380 .el .IP \f(CWLOCK_RW\fR 4
381 .IX Item "LOCK_RW"
382 With \f(CW\*(C`LOCK_MAND\*(C'\fR: Allow concurrent reads and writes.
383 .ie n .IP """LOCK_SH""" 4
384 .el .IP \f(CWLOCK_SH\fR 4
385 .IX Item "LOCK_SH"
386 Request a shared lock.
387 .ie n .IP """LOCK_UN""" 4
388 .el .IP \f(CWLOCK_UN\fR 4
389 .IX Item "LOCK_UN"
390 Release a held lock.
391 .ie n .IP """LOCK_WRITE""" 4
392 .el .IP \f(CWLOCK_WRITE\fR 4
393 .IX Item "LOCK_WRITE"
394 With \f(CW\*(C`LOCK_MAND\*(C'\fR: Allow concurrent writes.
395 .ie n .SS "Symbols for use with ""sysopen"""
396 .el .SS "Symbols for use with \f(CWsysopen\fP"
397 .IX Subsection "Symbols for use with sysopen"
398 .ie n .IP """O_ACCMODE""" 4
399 .el .IP \f(CWO_ACCMODE\fR 4
400 .IX Item "O_ACCMODE"
401 Bit mask for extracting the file access mode (read-only, write-only, or
402 read/write) from the other flags. This is mainly useful in combination with
403 "\f(CW\*(C`F_GETFL\*(C'\fR".
404 .ie n .IP """O_ALIAS""" 4
405 .el .IP \f(CWO_ALIAS\fR 4
406 .IX Item "O_ALIAS"
407 (Mac OS) Open alias file (instead of the file that the alias refers to).
408 .ie n .IP """O_ALT_IO""" 4
409 .el .IP \f(CWO_ALT_IO\fR 4
410 .IX Item "O_ALT_IO"
411 (NetBSD) Use alternative I/O semantics.
412 .ie n .IP """O_APPEND""" 4
413 .el .IP \f(CWO_APPEND\fR 4
414 .IX Item "O_APPEND"
415 Open the file in append mode. Writes always go to the end of the file.
416 .ie n .IP """O_ASYNC""" 4
417 .el .IP \f(CWO_ASYNC\fR 4
418 .IX Item "O_ASYNC"
419 Enable signal-based I/O. When the file becomes readable or writable, a signal
420 is sent.
421 .ie n .IP """O_BINARY""" 4
422 .el .IP \f(CWO_BINARY\fR 4
423 .IX Item "O_BINARY"
424 (Windows) Open the file in binary mode.
425 .ie n .IP """O_CREAT""" 4
426 .el .IP \f(CWO_CREAT\fR 4
427 .IX Item "O_CREAT"
428 If the file to be opened does not exist yet, create it.
429 .ie n .IP """O_DEFER""" 4
430 .el .IP \f(CWO_DEFER\fR 4
431 .IX Item "O_DEFER"
432 (AIX) Changes to the file are kept in memory and not written to disk until the
433 program performs an explicit \f(CW\*(C`$fh\->sync()\*(C'\fR.
434 .ie n .IP """O_DIRECT""" 4
435 .el .IP \f(CWO_DIRECT\fR 4
436 .IX Item "O_DIRECT"
437 Perform direct I/O to/from user-space buffers; avoid caching at the OS level.
438 .ie n .IP """O_DIRECTORY""" 4
439 .el .IP \f(CWO_DIRECTORY\fR 4
440 .IX Item "O_DIRECTORY"
441 Fail if the filename to be opened does not refer to a directory.
442 .ie n .IP """O_DSYNC""" 4
443 .el .IP \f(CWO_DSYNC\fR 4
444 .IX Item "O_DSYNC"
445 Synchronize file data immediately, like calling \fBfdatasync\fR\|(2) after each
446 write.
447 .ie n .IP """O_EVTONLY""" 4
448 .el .IP \f(CWO_EVTONLY\fR 4
449 .IX Item "O_EVTONLY"
450 (Mac OS) Open the file for event notifications, not reading or writing.
451 .ie n .IP """O_EXCL""" 4
452 .el .IP \f(CWO_EXCL\fR 4
453 .IX Item "O_EXCL"
454 If the file already exists, fail and set \f(CW$!\fR to \f(CW\*(C`EEXIST\*(C'\fR (this only
455 makes sense in combination with \f(CW\*(C`O_CREAT\*(C'\fR).
456 .ie n .IP """O_EXLOCK""" 4
457 .el .IP \f(CWO_EXLOCK\fR 4
458 .IX Item "O_EXLOCK"
459 When the file is opened, atomically obtain an exclusive lock.
460 .ie n .IP """O_IGNORE_CTTY""" 4
461 .el .IP \f(CWO_IGNORE_CTTY\fR 4
462 .IX Item "O_IGNORE_CTTY"
463 (Hurd) If the file to be opened is the controlling terminal for this process,
464 don't recognize it as such. Operations on this filehandle won't trigger job
465 control signals.
466 .ie n .IP """O_LARGEFILE""" 4
467 .el .IP \f(CWO_LARGEFILE\fR 4
468 .IX Item "O_LARGEFILE"
469 On 32\-bit platforms, allow opening files whose size exceeds 2 GiB
470 (2,147,483,647 bytes).
471 .ie n .IP """O_NDELAY""" 4
472 .el .IP \f(CWO_NDELAY\fR 4
473 .IX Item "O_NDELAY"
474 Compatibility symbol. Use \f(CW\*(C`O_NONBLOCK\*(C'\fR instead.
475 .ie n .IP """O_NOATIME""" 4
476 .el .IP \f(CWO_NOATIME\fR 4
477 .IX Item "O_NOATIME"
478 Don't update the access time of the file when reading from it.
479 .ie n .IP """O_NOCTTY""" 4
480 .el .IP \f(CWO_NOCTTY\fR 4
481 .IX Item "O_NOCTTY"
482 If the process does not have a controlling terminal and the file to be opened
483 is a terminal device, don't make it the controlling terminal of the process.
484 .ie n .IP """O_NOFOLLOW""" 4
485 .el .IP \f(CWO_NOFOLLOW\fR 4
486 .IX Item "O_NOFOLLOW"
487 If the final component of the filename is a symbolic link, fail and set \f(CW$!\fR
488 to \f(CW\*(C`ELOOP\*(C'\fR.
489 .ie n .IP """O_NOINHERIT""" 4
490 .el .IP \f(CWO_NOINHERIT\fR 4
491 .IX Item "O_NOINHERIT"
492 (Windows) Don't let child processes inherit the opened file descriptor.
493 .ie n .IP """O_NOLINK""" 4
494 .el .IP \f(CWO_NOLINK\fR 4
495 .IX Item "O_NOLINK"
496 (Hurd) If the file to be opened is a symbolic link, don't follow it; open the
497 link itself.
498 .ie n .IP """O_NONBLOCK""" 4
499 .el .IP \f(CWO_NONBLOCK\fR 4
500 .IX Item "O_NONBLOCK"
501 Open the file in non-blocking mode. Neither the open itself nor any read/write
502 operations on the filehandle will block. (This is mainly useful for pipes and
503 sockets. It has no effect on regular files.)
504 .ie n .IP """O_NOSIGPIPE""" 4
505 .el .IP \f(CWO_NOSIGPIPE\fR 4
506 .IX Item "O_NOSIGPIPE"
507 If the file to be opened is a pipe, then don't raise \f(CW\*(C`SIGPIPE\*(C'\fR for write
508 operations when the read end of the pipe is closed; make the write fail with
509 \&\f(CW\*(C`EPIPE\*(C'\fR instead.
510 .ie n .IP """O_NOTRANS""" 4
511 .el .IP \f(CWO_NOTRANS\fR 4
512 .IX Item "O_NOTRANS"
513 (Hurd) If the file to be opened is specially translated, don't invoke the
514 translator; open the bare file itself.
515 .ie n .IP """O_RANDOM""" 4
516 .el .IP \f(CWO_RANDOM\fR 4
517 .IX Item "O_RANDOM"
518 (Windows) Indicate that the program intends to access the file contents
519 randomly (without a predictable pattern). This is an optimization hint for the
520 file cache (but may cause excessive memory use on large files).
521 .ie n .IP """O_RAW""" 4
522 .el .IP \f(CWO_RAW\fR 4
523 .IX Item "O_RAW"
524 (Windows) Same as \f(CW\*(C`O_BINARY\*(C'\fR.
525 .ie n .IP """O_RDONLY""" 4
526 .el .IP \f(CWO_RDONLY\fR 4
527 .IX Item "O_RDONLY"
528 Open the file for reading (only).
529 .ie n .IP """O_RDWR""" 4
530 .el .IP \f(CWO_RDWR\fR 4
531 .IX Item "O_RDWR"
532 Open the file for reading and writing.
533 .ie n .IP """O_RSRC""" 4
534 .el .IP \f(CWO_RSRC\fR 4
535 .IX Item "O_RSRC"
536 (Mac OS) Open the resource fork of the file.
537 .ie n .IP """O_RSYNC""" 4
538 .el .IP \f(CWO_RSYNC\fR 4
539 .IX Item "O_RSYNC"
540 Extend the effects of \f(CW\*(C`O_SYNC\*(C'\fR and \f(CW\*(C`O_DSYNC\*(C'\fR to read operations. In
541 particular, reading from a filehandle opened with \f(CW\*(C`O_SYNC | O_RSYNC\*(C'\fR will wait
542 until the access time of the file has been modified on disk.
543 .ie n .IP """O_SEQUENTIAL""" 4
544 .el .IP \f(CWO_SEQUENTIAL\fR 4
545 .IX Item "O_SEQUENTIAL"
546 (Windows) Indicate that the program intends to access the file contents
547 sequentially. This is an optimization hint for the file cache.
548 .ie n .IP """O_SHLOCK""" 4
549 .el .IP \f(CWO_SHLOCK\fR 4
550 .IX Item "O_SHLOCK"
551 When the file is opened, atomically obtain a shared lock.
552 .ie n .IP """O_SYMLINK""" 4
553 .el .IP \f(CWO_SYMLINK\fR 4
554 .IX Item "O_SYMLINK"
555 If the file to be opened is a symbolic link, don't follow it; open the link
556 itself.
557 .ie n .IP """O_SYNC""" 4
558 .el .IP \f(CWO_SYNC\fR 4
559 .IX Item "O_SYNC"
560 Synchronize file data and metadata immediately, like calling \fBfsync\fR\|(2) after
561 each write.
562 .ie n .IP """O_TEMPORARY""" 4
563 .el .IP \f(CWO_TEMPORARY\fR 4
564 .IX Item "O_TEMPORARY"
565 (Windows) Delete the file when its last open file descriptor is closed.
566 .ie n .IP """O_TEXT""" 4
567 .el .IP \f(CWO_TEXT\fR 4
568 .IX Item "O_TEXT"
569 (Windows) Open the file in text mode.
570 .ie n .IP """O_TMPFILE""" 4
571 .el .IP \f(CWO_TMPFILE\fR 4
572 .IX Item "O_TMPFILE"
573 Create an unnamed temporary file. The filename argument specifies the directory
574 the unnamed file should be placed in.
575 .ie n .IP """O_TRUNC""" 4
576 .el .IP \f(CWO_TRUNC\fR 4
577 .IX Item "O_TRUNC"
578 If the file already exists, truncate its contents to length 0.
579 .ie n .IP """O_TTY_INIT""" 4
580 .el .IP \f(CWO_TTY_INIT\fR 4
581 .IX Item "O_TTY_INIT"
582 If the file to be opened is a terminal that is not already open in any process,
583 initialize its termios parameters.
584 .ie n .IP """O_WRONLY""" 4
585 .el .IP \f(CWO_WRONLY\fR 4
586 .IX Item "O_WRONLY"
587 Open the file for writing (only).
588 .ie n .IP """FAPPEND""" 4
589 .el .IP \f(CWFAPPEND\fR 4
590 .IX Item "FAPPEND"
591 Compatibility symbol. Use \f(CW\*(C`O_APPEND\*(C'\fR instead.
592 .ie n .IP """FASYNC""" 4
593 .el .IP \f(CWFASYNC\fR 4
594 .IX Item "FASYNC"
595 Compatibility symbol. Use \f(CW\*(C`O_ASYNC\*(C'\fR instead.
596 .ie n .IP """FCREAT""" 4
597 .el .IP \f(CWFCREAT\fR 4
598 .IX Item "FCREAT"
599 Compatibility symbol. Use \f(CW\*(C`O_CREAT\*(C'\fR instead.
600 .ie n .IP """FDEFER""" 4
601 .el .IP \f(CWFDEFER\fR 4
602 .IX Item "FDEFER"
603 Compatibility symbol. Use \f(CW\*(C`O_DEFER\*(C'\fR instead.
604 .ie n .IP """FDSYNC""" 4
605 .el .IP \f(CWFDSYNC\fR 4
606 .IX Item "FDSYNC"
607 Compatibility symbol. Use \f(CW\*(C`O_DSYNC\*(C'\fR instead.
608 .ie n .IP """FEXCL""" 4
609 .el .IP \f(CWFEXCL\fR 4
610 .IX Item "FEXCL"
611 Compatibility symbol. Use \f(CW\*(C`O_EXCL\*(C'\fR instead.
612 .ie n .IP """FLARGEFILE""" 4
613 .el .IP \f(CWFLARGEFILE\fR 4
614 .IX Item "FLARGEFILE"
615 Compatibility symbol. Use \f(CW\*(C`O_LARGEFILE\*(C'\fR instead.
616 .ie n .IP """FNDELAY""" 4
617 .el .IP \f(CWFNDELAY\fR 4
618 .IX Item "FNDELAY"
619 Compatibility symbol. Use \f(CW\*(C`O_NDELAY\*(C'\fR instead.
620 .ie n .IP """FNONBLOCK""" 4
621 .el .IP \f(CWFNONBLOCK\fR 4
622 .IX Item "FNONBLOCK"
623 Compatibility symbol. Use \f(CW\*(C`O_NONBLOCK\*(C'\fR instead.
624 .ie n .IP """FRSYNC""" 4
625 .el .IP \f(CWFRSYNC\fR 4
626 .IX Item "FRSYNC"
627 Compatibility symbol. Use \f(CW\*(C`O_RSYNC\*(C'\fR instead.
628 .ie n .IP """FSYNC""" 4
629 .el .IP \f(CWFSYNC\fR 4
630 .IX Item "FSYNC"
631 Compatibility symbol. Use \f(CW\*(C`O_SYNC\*(C'\fR instead.
632 .ie n .IP """FTRUNC""" 4
633 .el .IP \f(CWFTRUNC\fR 4
634 .IX Item "FTRUNC"
635 Compatibility symbol. Use \f(CW\*(C`O_TRUNC\*(C'\fR instead.
636 .ie n .SS "Symbols for use with ""seek"" and ""sysseek"""
637 .el .SS "Symbols for use with \f(CWseek\fP and \f(CWsysseek\fP"
638 .IX Subsection "Symbols for use with seek and sysseek"
639 .ie n .IP """SEEK_CUR""" 4
640 .el .IP \f(CWSEEK_CUR\fR 4
641 .IX Item "SEEK_CUR"
642 File offsets are relative to the current position in the file.
643 .ie n .IP """SEEK_END""" 4
644 .el .IP \f(CWSEEK_END\fR 4
645 .IX Item "SEEK_END"
646 File offsets are relative to the end of the file (i.e. mostly negative).
647 .ie n .IP """SEEK_SET""" 4
648 .el .IP \f(CWSEEK_SET\fR 4
649 .IX Item "SEEK_SET"
650 File offsets are absolute (i.e. relative to the beginning of the file).
651 .ie n .SS "Symbols for use with ""stat"" and ""chmod"""
652 .el .SS "Symbols for use with \f(CWstat\fP and \f(CWchmod\fP"
653 .IX Subsection "Symbols for use with stat and chmod"
654 .ie n .IP """S_ENFMT""" 4
655 .el .IP \f(CWS_ENFMT\fR 4
656 .IX Item "S_ENFMT"
657 Enforce mandatory file locks. (This symbol typically shares its value with
658 \&\f(CW\*(C`S_ISGID\*(C'\fR.)
659 .ie n .IP """S_IEXEC""" 4
660 .el .IP \f(CWS_IEXEC\fR 4
661 .IX Item "S_IEXEC"
662 Compatibility symbol. Use \f(CW\*(C`S_IXUSR\*(C'\fR instead.
663 .ie n .IP """S_IFBLK""" 4
664 .el .IP \f(CWS_IFBLK\fR 4
665 .IX Item "S_IFBLK"
666 File type: Block device.
667 .ie n .IP """S_IFCHR""" 4
668 .el .IP \f(CWS_IFCHR\fR 4
669 .IX Item "S_IFCHR"
670 File type: Character device.
671 .ie n .IP """S_IFDIR""" 4
672 .el .IP \f(CWS_IFDIR\fR 4
673 .IX Item "S_IFDIR"
674 File type: Directory.
675 .ie n .IP """S_IFIFO""" 4
676 .el .IP \f(CWS_IFIFO\fR 4
677 .IX Item "S_IFIFO"
678 File type: Fifo/pipe.
679 .ie n .IP """S_IFLNK""" 4
680 .el .IP \f(CWS_IFLNK\fR 4
681 .IX Item "S_IFLNK"
682 File type: Symbolic link.
683 .ie n .IP """S_IFMT""" 4
684 .el .IP \f(CWS_IFMT\fR 4
685 .IX Item "S_IFMT"
686 Bit mask for extracting the file type bits. This symbol can also be used as a
687 function: \f(CWS_IFMT($mode)\fR acts like \f(CW\*(C`$mode & S_IFMT\*(C'\fR. The result will be
688 equal to one of the other S_IF* constants.
689 .ie n .IP """_S_IFMT""" 4
690 .el .IP \f(CW_S_IFMT\fR 4
691 .IX Item "_S_IFMT"
692 Bit mask for extracting the file type bits. This symbol is an actual constant
693 and cannot be used as a function; otherwise it is identical to \f(CW\*(C`S_IFMT\*(C'\fR.
694 .ie n .IP """S_IFREG""" 4
695 .el .IP \f(CWS_IFREG\fR 4
696 .IX Item "S_IFREG"
697 File type: Regular file.
698 .ie n .IP """S_IFSOCK""" 4
699 .el .IP \f(CWS_IFSOCK\fR 4
700 .IX Item "S_IFSOCK"
701 File type: Socket.
702 .ie n .IP """S_IFWHT""" 4
703 .el .IP \f(CWS_IFWHT\fR 4
704 .IX Item "S_IFWHT"
705 File type: Whiteout file (used to mark the absence/deletion of a file in overlays).
706 .ie n .IP """S_IMODE""" 4
707 .el .IP \f(CWS_IMODE\fR 4
708 .IX Item "S_IMODE"
709 Function for extracting the permission bits from a file mode.
710 .ie n .IP """S_IREAD""" 4
711 .el .IP \f(CWS_IREAD\fR 4
712 .IX Item "S_IREAD"
713 Compatibility symbol. Use \f(CW\*(C`S_IRUSR\*(C'\fR instead.
714 .ie n .IP """S_IRGRP""" 4
715 .el .IP \f(CWS_IRGRP\fR 4
716 .IX Item "S_IRGRP"
717 Permissions: Readable by group.
718 .ie n .IP """S_IROTH""" 4
719 .el .IP \f(CWS_IROTH\fR 4
720 .IX Item "S_IROTH"
721 Permissions: Readable by others.
722 .ie n .IP """S_IRUSR""" 4
723 .el .IP \f(CWS_IRUSR\fR 4
724 .IX Item "S_IRUSR"
725 Permissions: Readable by owner.
726 .ie n .IP """S_IRWXG""" 4
727 .el .IP \f(CWS_IRWXG\fR 4
728 .IX Item "S_IRWXG"
729 Bit mask for extracting group permissions.
730 .ie n .IP """S_IRWXO""" 4
731 .el .IP \f(CWS_IRWXO\fR 4
732 .IX Item "S_IRWXO"
733 Bit mask for extracting other permissions.
734 .ie n .IP """S_IRWXU""" 4
735 .el .IP \f(CWS_IRWXU\fR 4
736 .IX Item "S_IRWXU"
737 Bit mask for extracting owner ("user") permissions.
738 .ie n .IP """S_ISBLK""" 4
739 .el .IP \f(CWS_ISBLK\fR 4
740 .IX Item "S_ISBLK"
741 Convenience function to check for block devices: \f(CWS_ISBLK($mode)\fR is
742 equivalent to \f(CW\*(C`S_IFMT($mode) == S_IFBLK\*(C'\fR.
743 .ie n .IP """S_ISCHR""" 4
744 .el .IP \f(CWS_ISCHR\fR 4
745 .IX Item "S_ISCHR"
746 Convenience function to check for character devices: \f(CWS_ISCHR($mode)\fR is
747 equivalent to \f(CW\*(C`S_IFMT($mode) == S_IFCHR\*(C'\fR.
748 .ie n .IP """S_ISDIR""" 4
749 .el .IP \f(CWS_ISDIR\fR 4
750 .IX Item "S_ISDIR"
751 Convenience function to check for directories: \f(CWS_ISDIR($mode)\fR is
752 equivalent to \f(CW\*(C`S_IFMT($mode) == S_IFDIR\*(C'\fR.
753 .ie n .IP """S_ISENFMT""" 4
754 .el .IP \f(CWS_ISENFMT\fR 4
755 .IX Item "S_ISENFMT"
756 Broken function; do not use. (\f(CWS_ISENFMT($mode)\fR should always return false,
757 anyway.)
758 .ie n .IP """S_ISFIFO""" 4
759 .el .IP \f(CWS_ISFIFO\fR 4
760 .IX Item "S_ISFIFO"
761 Convenience function to check for fifos: \f(CWS_ISFIFO($mode)\fR is
762 equivalent to \f(CW\*(C`S_IFMT($mode) == S_IFIFO\*(C'\fR.
763 .ie n .IP """S_ISGID""" 4
764 .el .IP \f(CWS_ISGID\fR 4
765 .IX Item "S_ISGID"
766 Permissions: Set effective group ID from file (when running executables);
767 mandatory locking (on non-group-executable files); new files inherit their
768 group from the directory (on directories).
769 .ie n .IP """S_ISLNK""" 4
770 .el .IP \f(CWS_ISLNK\fR 4
771 .IX Item "S_ISLNK"
772 Convenience function to check for symbolic links: \f(CWS_ISLNK($mode)\fR is
773 equivalent to \f(CW\*(C`S_IFMT($mode) == S_IFLNK\*(C'\fR.
774 .ie n .IP """S_ISREG""" 4
775 .el .IP \f(CWS_ISREG\fR 4
776 .IX Item "S_ISREG"
777 Convenience function to check for regular files: \f(CWS_ISREG($mode)\fR is
778 equivalent to \f(CW\*(C`S_IFMT($mode) == S_IFREG\*(C'\fR.
779 .ie n .IP """S_ISSOCK""" 4
780 .el .IP \f(CWS_ISSOCK\fR 4
781 .IX Item "S_ISSOCK"
782 Convenience function to check for sockets: \f(CWS_ISSOCK($mode)\fR is
783 equivalent to \f(CW\*(C`S_IFMT($mode) == S_IFSOCK\*(C'\fR.
784 .ie n .IP """S_ISTXT""" 4
785 .el .IP \f(CWS_ISTXT\fR 4
786 .IX Item "S_ISTXT"
787 Compatibility symbol. Use \f(CW\*(C`S_ISVTX\*(C'\fR instead.
788 .ie n .IP """S_ISUID""" 4
789 .el .IP \f(CWS_ISUID\fR 4
790 .IX Item "S_ISUID"
791 Permissions: Set effective user ID from file (when running executables).
792 .ie n .IP """S_ISVTX""" 4
793 .el .IP \f(CWS_ISVTX\fR 4
794 .IX Item "S_ISVTX"
795 Permissions: Files in this directory can only be deleted/renamed by their owner
796 (or the directory's owner), even if other users have write permissions to the
797 directory ("sticky bit").
798 .ie n .IP """S_ISWHT""" 4
799 .el .IP \f(CWS_ISWHT\fR 4
800 .IX Item "S_ISWHT"
801 Convenience function to check for whiteout files: \f(CWS_ISWHT($mode)\fR is
802 equivalent to \f(CW\*(C`S_IFMT($mode) == S_IFWHT\*(C'\fR.
803 .ie n .IP """S_IWGRP""" 4
804 .el .IP \f(CWS_IWGRP\fR 4
805 .IX Item "S_IWGRP"
806 Permissions: Writable by group.
807 .ie n .IP """S_IWOTH""" 4
808 .el .IP \f(CWS_IWOTH\fR 4
809 .IX Item "S_IWOTH"
810 Permissions: Writable by others.
811 .ie n .IP """S_IWRITE""" 4
812 .el .IP \f(CWS_IWRITE\fR 4
813 .IX Item "S_IWRITE"
814 Compatibility symbol. Use \f(CW\*(C`S_IWUSR\*(C'\fR instead.
815 .ie n .IP """S_IWUSR""" 4
816 .el .IP \f(CWS_IWUSR\fR 4
817 .IX Item "S_IWUSR"
818 Permissions: Writable by owner.
819 .ie n .IP """S_IXGRP""" 4
820 .el .IP \f(CWS_IXGRP\fR 4
821 .IX Item "S_IXGRP"
822 Permissions: Executable/searchable by group.
823 .ie n .IP """S_IXOTH""" 4
824 .el .IP \f(CWS_IXOTH\fR 4
825 .IX Item "S_IXOTH"
826 Permissions: Executable/searchable by others.
827 .ie n .IP """S_IXUSR""" 4
828 .el .IP \f(CWS_IXUSR\fR 4
829 .IX Item "S_IXUSR"
830 Permissions: Executable/searchable by owner.
831 .SH "SEE ALSO"
832 .IX Header "SEE ALSO"
833 "chmod" in perlfunc, \fBchmod\fR\|(2),
834 "fcntl" in perlfunc, \fBfcntl\fR\|(2),
835 "flock" in perlfunc, \fBflock\fR\|(2),
836 "seek" in perlfunc, \fBfseek\fR\|(3),
837 "stat" in perlfunc, \fBstat\fR\|(2),
838 "sysopen" in perlfunc, \fBopen\fR\|(2),
839 "sysseek" in perlfunc, \fBlseek\fR\|(2)
840 .SH "APPENDIX A"
841 .IX Header "APPENDIX A"
842 By default, if you say \f(CW\*(C`use Fcntl;\*(C'\fR, the following symbols are exported:
843 .PP
844 .Vb 10
845 \& FD_CLOEXEC
846 \& F_ALLOCSP
847 \& F_ALLOCSP64
848 \& F_COMPAT
849 \& F_DUP2FD
850 \& F_DUPFD
851 \& F_EXLCK
852 \& F_FREESP
853 \& F_FREESP64
854 \& F_FSYNC
855 \& F_FSYNC64
856 \& F_GETFD
857 \& F_GETFL
858 \& F_GETLK
859 \& F_GETLK64
860 \& F_GETOWN
861 \& F_NODNY
862 \& F_POSIX
863 \& F_RDACC
864 \& F_RDDNY
865 \& F_RDLCK
866 \& F_RWACC
867 \& F_RWDNY
868 \& F_SETFD
869 \& F_SETFL
870 \& F_SETLK
871 \& F_SETLK64
872 \& F_SETLKW
873 \& F_SETLKW64
874 \& F_SETOWN
875 \& F_SHARE
876 \& F_SHLCK
877 \& F_UNLCK
878 \& F_UNSHARE
879 \& F_WRACC
880 \& F_WRDNY
881 \& F_WRLCK
882 \& O_ACCMODE
883 \& O_ALIAS
884 \& O_APPEND
885 \& O_ASYNC
886 \& O_BINARY
887 \& O_CREAT
888 \& O_DEFER
889 \& O_DIRECT
890 \& O_DIRECTORY
891 \& O_DSYNC
892 \& O_EXCL
893 \& O_EXLOCK
894 \& O_LARGEFILE
895 \& O_NDELAY
896 \& O_NOCTTY
897 \& O_NOFOLLOW
898 \& O_NOINHERIT
899 \& O_NONBLOCK
900 \& O_RANDOM
901 \& O_RAW
902 \& O_RDONLY
903 \& O_RDWR
904 \& O_RSRC
905 \& O_RSYNC
906 \& O_SEQUENTIAL
907 \& O_SHLOCK
908 \& O_SYNC
909 \& O_TEMPORARY
910 \& O_TEXT
911 \& O_TRUNC
912 \& O_WRONLY
913 .Ve