Debian Codegraph @

upstream/opensuse-tumbleweed/man3/Fcntl.3pm

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