OSDN Git Service

LDP: Update original to LDP v3.79
[linuxjm/LDP_man-pages.git] / original / man2 / open.2
1 .\" This manpage is Copyright (C) 1992 Drew Eckhardt;
2 .\" and Copyright (C) 1993 Michael Haardt, Ian Jackson.
3 .\" and Copyright (C) 2008 Greg Banks
4 .\" and Copyright (C) 2006, 2008, 2013, 2014 Michael Kerrisk <mtk.manpages@gmail.com>
5 .\"
6 .\" %%%LICENSE_START(VERBATIM)
7 .\" Permission is granted to make and distribute verbatim copies of this
8 .\" manual provided the copyright notice and this permission notice are
9 .\" preserved on all copies.
10 .\"
11 .\" Permission is granted to copy and distribute modified versions of this
12 .\" manual under the conditions for verbatim copying, provided that the
13 .\" entire resulting derived work is distributed under the terms of a
14 .\" permission notice identical to this one.
15 .\"
16 .\" Since the Linux kernel and libraries are constantly changing, this
17 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
18 .\" responsibility for errors or omissions, or for damages resulting from
19 .\" the use of the information contained herein.  The author(s) may not
20 .\" have taken the same level of care in the production of this manual,
21 .\" which is licensed free of charge, as they might when working
22 .\" professionally.
23 .\"
24 .\" Formatted or processed versions of this manual, if unaccompanied by
25 .\" the source, must acknowledge the copyright and authors of this work.
26 .\" %%%LICENSE_END
27 .\"
28 .\" Modified 1993-07-21 by Rik Faith <faith@cs.unc.edu>
29 .\" Modified 1994-08-21 by Michael Haardt
30 .\" Modified 1996-04-13 by Andries Brouwer <aeb@cwi.nl>
31 .\" Modified 1996-05-13 by Thomas Koenig
32 .\" Modified 1996-12-20 by Michael Haardt
33 .\" Modified 1999-02-19 by Andries Brouwer <aeb@cwi.nl>
34 .\" Modified 1998-11-28 by Joseph S. Myers <jsm28@hermes.cam.ac.uk>
35 .\" Modified 1999-06-03 by Michael Haardt
36 .\" Modified 2002-05-07 by Michael Kerrisk <mtk.manpages@gmail.com>
37 .\" Modified 2004-06-23 by Michael Kerrisk <mtk.manpages@gmail.com>
38 .\" 2004-12-08, mtk, reordered flags list alphabetically
39 .\" 2004-12-08, Martin Pool <mbp@sourcefrog.net> (& mtk), added O_NOATIME
40 .\" 2007-09-18, mtk, Added description of O_CLOEXEC + other minor edits
41 .\" 2008-01-03, mtk, with input from Trond Myklebust
42 .\"     <trond.myklebust@fys.uio.no> and Timo Sirainen <tss@iki.fi>
43 .\"     Rewrite description of O_EXCL.
44 .\" 2008-01-11, Greg Banks <gnb@melbourne.sgi.com>: add more detail
45 .\"     on O_DIRECT.
46 .\" 2008-02-26, Michael Haardt: Reorganized text for O_CREAT and mode
47 .\"
48 .\" FIXME . Apr 08: The next POSIX revision has O_EXEC, O_SEARCH, and
49 .\" O_TTYINIT.  Eventually these may need to be documented.  --mtk
50 .\"
51 .TH OPEN 2 2015-01-22 "Linux" "Linux Programmer's Manual"
52 .SH NAME
53 open, openat, creat \- open and possibly create a file
54 .SH SYNOPSIS
55 .nf
56 .B #include <sys/types.h>
57 .B #include <sys/stat.h>
58 .B #include <fcntl.h>
59 .sp
60 .BI "int open(const char *" pathname ", int " flags );
61 .BI "int open(const char *" pathname ", int " flags ", mode_t " mode );
62
63 .BI "int creat(const char *" pathname ", mode_t " mode );
64 .sp
65 .BI "int openat(int " dirfd ", const char *" pathname ", int " flags );
66 .BI "int openat(int " dirfd ", const char *" pathname ", int " flags \
67 ", mode_t " mode );
68 .fi
69 .sp
70 .in -4n
71 Feature Test Macro Requirements for glibc (see
72 .BR feature_test_macros (7)):
73 .in
74 .sp
75 .BR openat ():
76 .PD 0
77 .ad l
78 .RS 4
79 .TP 4
80 Since glibc 2.10:
81 _XOPEN_SOURCE\ >=\ 700 || _POSIX_C_SOURCE\ >=\ 200809L
82 .TP
83 Before glibc 2.10:
84 _ATFILE_SOURCE
85 .RE
86 .ad
87 .PD
88 .SH DESCRIPTION
89 Given a
90 .I pathname
91 for a file,
92 .BR open ()
93 returns a file descriptor, a small, nonnegative integer
94 for use in subsequent system calls
95 .RB ( read "(2), " write "(2), " lseek "(2), " fcntl "(2), etc.)."
96 The file descriptor returned by a successful call will be
97 the lowest-numbered file descriptor not currently open for the process.
98 .PP
99 By default, the new file descriptor is set to remain open across an
100 .BR execve (2)
101 (i.e., the
102 .B FD_CLOEXEC
103 file descriptor flag described in
104 .BR fcntl (2)
105 is initially disabled); the
106 .B O_CLOEXEC
107 flag, described below, can be used to change this default.
108 The file offset is set to the beginning of the file (see
109 .BR lseek (2)).
110 .PP
111 A call to
112 .BR open ()
113 creates a new
114 .IR "open file description" ,
115 an entry in the system-wide table of open files.
116 The open file description records the file offset and the file status flags
117 (see below).
118 A file descriptor is a reference to an open file description;
119 this reference is unaffected if
120 .I pathname
121 is subsequently removed or modified to refer to a different file.
122 For further details on open file descriptions, see NOTES.
123 .PP
124 The argument
125 .I flags
126 must include one of the following
127 .IR "access modes" :
128 .BR O_RDONLY ", " O_WRONLY ", or " O_RDWR .
129 These request opening the file read-only, write-only, or read/write,
130 respectively.
131
132 In addition, zero or more file creation flags and file status flags
133 can be
134 .RI bitwise- or 'd
135 in
136 .IR flags .
137 The
138 .I file creation flags
139 are
140 .BR O_CLOEXEC ,
141 .BR O_CREAT ,
142 .BR O_DIRECTORY ,
143 .BR O_EXCL ,
144 .BR O_NOCTTY ,
145 .BR O_NOFOLLOW ,
146 .BR O_TMPFILE ,
147 .BR O_TRUNC ,
148 and
149 .BR O_TTY_INIT .
150 The
151 .I file status flags
152 are all of the remaining flags listed below.
153 .\" SUSv4 divides the flags into:
154 .\" * Access mode
155 .\" * File creation
156 .\" * File status
157 .\" * Other (O_CLOEXEC, O_DIRECTORY, O_NOFOLLOW)
158 .\" though it's not clear what the difference between "other" and
159 .\" "File creation" flags is.  I raised an Aardvark to see if this
160 .\" can be clarified in SUSv4; 10 Oct 2008.
161 .\" http://thread.gmane.org/gmane.comp.standards.posix.austin.general/64/focus=67
162 .\" TC1 (balloted in 2013), resolved this, so that those three constants
163 .\" are also categorized" as file status flags.
164 .\"
165 The distinction between these two groups of flags is that
166 the file status flags can be retrieved and (in some cases)
167 modified; see
168 .BR fcntl (2)
169 for details.
170
171 The full list of file creation flags and file status flags is as follows:
172 .TP
173 .B O_APPEND
174 The file is opened in append mode.
175 Before each
176 .BR write (2),
177 the file offset is positioned at the end of the file,
178 as if with
179 .BR lseek (2).
180 .B O_APPEND
181 may lead to corrupted files on NFS filesystems if more than one process
182 appends data to a file at once.
183 .\" For more background, see
184 .\" http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=453946
185 .\" http://nfs.sourceforge.net/
186 This is because NFS does not support
187 appending to a file, so the client kernel has to simulate it, which
188 can't be done without a race condition.
189 .TP
190 .B O_ASYNC
191 Enable signal-driven I/O:
192 generate a signal
193 .RB ( SIGIO
194 by default, but this can be changed via
195 .BR fcntl (2))
196 when input or output becomes possible on this file descriptor.
197 This feature is available only for terminals, pseudoterminals,
198 sockets, and (since Linux 2.6) pipes and FIFOs.
199 See
200 .BR fcntl (2)
201 for further details.
202 See also BUGS, below.
203 .TP
204 .BR O_CLOEXEC " (since Linux 2.6.23)"
205 .\" NOTE! several other man pages refer to this text
206 Enable the close-on-exec flag for the new file descriptor.
207 Specifying this flag permits a program to avoid additional
208 .BR fcntl (2)
209 .B F_SETFD
210 operations to set the
211 .B FD_CLOEXEC
212 flag.
213
214 Note that the use of this flag is essential in some multithreaded programs,
215 because using a separate
216 .BR fcntl (2)
217 .B F_SETFD
218 operation to set the
219 .B FD_CLOEXEC
220 flag does not suffice to avoid race conditions
221 where one thread opens a file descriptor and
222 attempts to set its close-on-exec flag using
223 .BR fcntl (2)
224 at the same time as another thread does a
225 .BR fork (2)
226 plus
227 .BR execve (2).
228 Depending on the order of execution,
229 the race may lead to the file descriptor returned by
230 .BR open ()
231 being unintentionally leaked to the program executed by the child process
232 created by
233 .BR fork (2).
234 (This kind of race is in principle possible for any system call
235 that creates a file descriptor whose close-on-exec flag should be set,
236 and various other Linux system calls provide an equivalent of the
237 .BR O_CLOEXEC
238 flag to deal with this problem.)
239 .\" This flag fixes only one form of the race condition;
240 .\" The race can also occur with, for example, descriptors
241 .\" returned by accept(), pipe(), etc.
242 .TP
243 .B O_CREAT
244 If the file does not exist, it will be created.
245 The owner (user ID) of the file is set to the effective user ID
246 of the process.
247 The group ownership (group ID) is set either to
248 the effective group ID of the process or to the group ID of the
249 parent directory (depending on filesystem type and mount options,
250 and the mode of the parent directory; see the mount options
251 .I bsdgroups
252 and
253 .I sysvgroups
254 described in
255 .BR mount (8)).
256 .\" As at 2.6.25, bsdgroups is supported by ext2, ext3, ext4, and
257 .\" XFS (since 2.6.14).
258 .RS
259 .PP
260 .I mode
261 specifies the permissions to use in case a new file is created.
262 This argument must be supplied when
263 .B O_CREAT
264 or
265 .B O_TMPFILE
266 is specified in
267 .IR flags ;
268 if neither
269 .B O_CREAT
270 nor
271 .B O_TMPFILE
272 is specified, then
273 .I mode
274 is ignored.
275 The effective permissions are modified by
276 the process's
277 .I umask
278 in the usual way: The permissions of the created file are
279 .IR "(mode\ &\ ~umask)" .
280 Note that this mode applies only to future accesses of the
281 newly created file; the
282 .BR open ()
283 call that creates a read-only file may well return a read/write
284 file descriptor.
285 .PP
286 The following symbolic constants are provided for
287 .IR mode :
288 .TP 9
289 .B S_IRWXU
290 00700 user (file owner) has read, write and execute permission
291 .TP
292 .B S_IRUSR
293 00400 user has read permission
294 .TP
295 .B S_IWUSR
296 00200 user has write permission
297 .TP
298 .B S_IXUSR
299 00100 user has execute permission
300 .TP
301 .B S_IRWXG
302 00070 group has read, write and execute permission
303 .TP
304 .B S_IRGRP
305 00040 group has read permission
306 .TP
307 .B S_IWGRP
308 00020 group has write permission
309 .TP
310 .B S_IXGRP
311 00010 group has execute permission
312 .TP
313 .B S_IRWXO
314 00007 others have read, write and execute permission
315 .TP
316 .B S_IROTH
317 00004 others have read permission
318 .TP
319 .B S_IWOTH
320 00002 others have write permission
321 .TP
322 .B S_IXOTH
323 00001 others have execute permission
324 .RE
325 .TP
326 .BR O_DIRECT " (since Linux 2.4.10)"
327 Try to minimize cache effects of the I/O to and from this file.
328 In general this will degrade performance, but it is useful in
329 special situations, such as when applications do their own caching.
330 File I/O is done directly to/from user-space buffers.
331 The
332 .B O_DIRECT
333 flag on its own makes an effort to transfer data synchronously,
334 but does not give the guarantees of the
335 .B O_SYNC
336 flag that data and necessary metadata are transferred.
337 To guarantee synchronous I/O,
338 .B O_SYNC
339 must be used in addition to
340 .BR O_DIRECT .
341 See NOTES below for further discussion.
342 .sp
343 A semantically similar (but deprecated) interface for block devices
344 is described in
345 .BR raw (8).
346 .TP
347 .B O_DIRECTORY
348 If \fIpathname\fP is not a directory, cause the open to fail.
349 .\" But see the following and its replies:
350 .\" http://marc.theaimsgroup.com/?t=112748702800001&r=1&w=2
351 .\" [PATCH] open: O_DIRECTORY and O_CREAT together should fail
352 .\" O_DIRECTORY | O_CREAT causes O_DIRECTORY to be ignored.
353 This flag was added in kernel version 2.1.126, to
354 avoid denial-of-service problems if
355 .BR opendir (3)
356 is called on a
357 FIFO or tape device.
358 .TP
359 .B O_DSYNC
360 Write operations on the file will complete according to the requirements of
361 synchronized I/O
362 .I data
363 integrity completion.
364
365 By the time
366 .BR write (2)
367 (and similar)
368 return, the output data
369 has been transferred to the underlying hardware,
370 along with any file metadata that would be required to retrieve that data
371 (i.e., as though each
372 .BR write (2)
373 was followed by a call to
374 .BR fdatasync (2)).
375 .IR "See NOTES below" .
376 .TP
377 .B O_EXCL
378 Ensure that this call creates the file:
379 if this flag is specified in conjunction with
380 .BR O_CREAT ,
381 and
382 .I pathname
383 already exists, then
384 .BR open ()
385 will fail.
386
387 When these two flags are specified, symbolic links are not followed:
388 .\" POSIX.1-2001 explicitly requires this behavior.
389 if
390 .I pathname
391 is a symbolic link, then
392 .BR open ()
393 fails regardless of where the symbolic link points to.
394
395 In general, the behavior of
396 .B O_EXCL
397 is undefined if it is used without
398 .BR O_CREAT .
399 There is one exception: on Linux 2.6 and later,
400 .B O_EXCL
401 can be used without
402 .B O_CREAT
403 if
404 .I pathname
405 refers to a block device.
406 If the block device is in use by the system (e.g., mounted),
407 .BR open ()
408 fails with the error
409 .BR EBUSY .
410
411 On NFS,
412 .B O_EXCL
413 is supported only when using NFSv3 or later on kernel 2.6 or later.
414 In NFS environments where
415 .B O_EXCL
416 support is not provided, programs that rely on it
417 for performing locking tasks will contain a race condition.
418 Portable programs that want to perform atomic file locking using a lockfile,
419 and need to avoid reliance on NFS support for
420 .BR O_EXCL ,
421 can create a unique file on
422 the same filesystem (e.g., incorporating hostname and PID), and use
423 .BR link (2)
424 to make a link to the lockfile.
425 If
426 .BR link (2)
427 returns 0, the lock is successful.
428 Otherwise, use
429 .BR stat (2)
430 on the unique file to check if its link count has increased to 2,
431 in which case the lock is also successful.
432 .TP
433 .B O_LARGEFILE
434 (LFS)
435 Allow files whose sizes cannot be represented in an
436 .I off_t
437 (but can be represented in an
438 .IR off64_t )
439 to be opened.
440 The
441 .B _LARGEFILE64_SOURCE
442 macro must be defined
443 (before including
444 .I any
445 header files)
446 in order to obtain this definition.
447 Setting the
448 .B _FILE_OFFSET_BITS
449 feature test macro to 64 (rather than using
450 .BR O_LARGEFILE )
451 is the preferred
452 method of accessing large files on 32-bit systems (see
453 .BR feature_test_macros (7)).
454 .TP
455 .BR O_NOATIME " (since Linux 2.6.8)"
456 Do not update the file last access time
457 .RI ( st_atime
458 in the inode)
459 when the file is
460 .BR read (2).
461 This flag is intended for use by indexing or backup programs,
462 where its use can significantly reduce the amount of disk activity.
463 This flag may not be effective on all filesystems.
464 One example is NFS, where the server maintains the access time.
465 .\" The O_NOATIME flag also affects the treatment of st_atime
466 .\" by mmap() and readdir(2), MTK, Dec 04.
467 .TP
468 .B O_NOCTTY
469 If
470 .I pathname
471 refers to a terminal device\(emsee
472 .BR tty (4)\(emit
473 will not become the process's controlling terminal even if the
474 process does not have one.
475 .TP
476 .B O_NOFOLLOW
477 If \fIpathname\fP is a symbolic link, then the open fails.
478 This is a FreeBSD extension, which was added to Linux in version 2.1.126.
479 Symbolic links in earlier components of the pathname will still be
480 followed.
481 See also
482 .BR O_PATH
483 below.
484 .\" The headers from glibc 2.0.100 and later include a
485 .\" definition of this flag; \fIkernels before 2.1.126 will ignore it if
486 .\" used\fP.
487 .TP
488 .BR O_NONBLOCK " or " O_NDELAY
489 When possible, the file is opened in nonblocking mode.
490 Neither the
491 .BR open ()
492 nor any subsequent operations on the file descriptor which is
493 returned will cause the calling process to wait.
494 For the handling of FIFOs (named pipes), see also
495 .BR fifo (7).
496 For a discussion of the effect of
497 .B O_NONBLOCK
498 in conjunction with mandatory file locks and with file leases, see
499 .BR fcntl (2).
500 .TP
501 .BR O_PATH " (since Linux 2.6.39)"
502 .\" commit 1abf0c718f15a56a0a435588d1b104c7a37dc9bd
503 .\" commit 326be7b484843988afe57566b627fb7a70beac56
504 .\" commit 65cfc6722361570bfe255698d9cd4dccaf47570d
505 .\"
506 .\" http://thread.gmane.org/gmane.linux.man/2790/focus=3496
507 .\"     Subject: Re: [PATCH] open(2): document O_PATH
508 .\"     Newsgroups: gmane.linux.man, gmane.linux.kernel
509 .\"
510 Obtain a file descriptor that can be used for two purposes:
511 to indicate a location in the filesystem tree and
512 to perform operations that act purely at the file descriptor level.
513 The file itself is not opened, and other file operations (e.g.,
514 .BR read (2),
515 .BR write (2),
516 .BR fchmod (2),
517 .BR fchown (2),
518 .BR fgetxattr (2),
519 .BR mmap (2))
520 fail with the error
521 .BR EBADF .
522
523 The following operations
524 .I can
525 be performed on the resulting file descriptor:
526 .RS
527 .IP * 3
528 .BR close (2);
529 .BR fchdir (2)
530 (since Linux 3.5);
531 .\" commit 332a2e1244bd08b9e3ecd378028513396a004a24
532 .BR fstat (2)
533 (since Linux 3.6).
534 .\" fstat(): commit 55815f70147dcfa3ead5738fd56d3574e2e3c1c2
535 .IP *
536 Duplicating the file descriptor
537 .RB ( dup (2),
538 .BR fcntl (2)
539 .BR F_DUPFD ,
540 etc.).
541 .IP *
542 Getting and setting file descriptor flags
543 .RB ( fcntl (2)
544 .BR F_GETFD
545 and
546 .BR F_SETFD ).
547 .IP *
548 Retrieving open file status flags using the
549 .BR fcntl (2)
550 .BR F_GETFL
551 operation: the returned flags will include the bit
552 .BR O_PATH .
553 .IP *
554 Passing the file descriptor as the
555 .IR dirfd
556 argument of
557 .BR openat (2)
558 and the other "*at()" system calls.
559 This includes
560 .BR linkat (2)
561 with
562 .BR AT_EMPTY_PATH
563 (or via procfs using
564 .BR AT_SYMLINK_FOLLOW )
565 even if the file is not a directory.
566 .IP *
567 Passing the file descriptor to another process via a UNIX domain socket
568 (see
569 .BR SCM_RIGHTS
570 in
571 .BR unix (7)).
572 .RE
573 .IP
574 When
575 .B O_PATH
576 is specified in
577 .IR flags ,
578 flag bits other than
579 .BR O_CLOEXEC ,
580 .BR O_DIRECTORY ,
581 and
582 .BR O_NOFOLLOW
583 are ignored.
584
585 If
586 .I pathname
587 is a symbolic link and the
588 .BR O_NOFOLLOW
589 flag is also specified,
590 then the call returns a file descriptor referring to the symbolic link.
591 This file descriptor can be used as the
592 .I dirfd
593 argument in calls to
594 .BR fchownat (2),
595 .BR fstatat (2),
596 .BR linkat (2),
597 and
598 .BR readlinkat (2)
599 with an empty pathname to have the calls operate on the symbolic link.
600 .TP
601 .B O_SYNC
602 Write operations on the file will complete according to the requirements of
603 synchronized I/O
604 .I file
605 integrity completion
606 (by contrast with the
607 synchronized I/O
608 .I data
609 integrity completion
610 provided by
611 .BR O_DSYNC .)
612
613 By the time
614 .BR write (2)
615 (and similar)
616 return, the output data and associated file metadata
617 have been transferred to the underlying hardware
618 (i.e., as though each
619 .BR write (2)
620 was followed by a call to
621 .BR fsync (2)).
622 .IR "See NOTES below" .
623 .TP
624 .BR O_TMPFILE " (since Linux 3.11)"
625 .\" commit 60545d0d4610b02e55f65d141c95b18ccf855b6e
626 .\" commit f4e0c30c191f87851c4a53454abb55ee276f4a7e
627 .\" commit bb458c644a59dbba3a1fe59b27106c5e68e1c4bd
628 Create an unnamed temporary file.
629 The
630 .I pathname
631 argument specifies a directory;
632 an unnamed inode will be created in that directory's filesystem.
633 Anything written to the resulting file will be lost when
634 the last file descriptor is closed, unless the file is given a name.
635
636 .B O_TMPFILE
637 must be specified with one of
638 .B O_RDWR
639 or
640 .B O_WRONLY
641 and, optionally,
642 .BR O_EXCL .
643 If
644 .B O_EXCL
645 is not specified, then
646 .BR linkat (2)
647 can be used to link the temporary file into the filesystem, making it
648 permanent, using code like the following:
649
650 .in +4n
651 .nf
652 char path[PATH_MAX];
653 fd = open("/path/to/dir", O_TMPFILE | O_RDWR,
654                         S_IRUSR | S_IWUSR);
655
656 /* File I/O on 'fd'... */
657
658 snprintf(path, PATH_MAX,  "/proc/self/fd/%d", fd);
659 linkat(AT_FDCWD, path, AT_FDCWD, "/path/for/file",
660                         AT_SYMLINK_FOLLOW);
661 .fi
662 .in
663
664 In this case,
665 the
666 .BR open ()
667 .I mode
668 argument determines the file permission mode, as with
669 .BR O_CREAT .
670
671 Specifying
672 .B O_EXCL
673 in conjunction with
674 .B O_TMPFILE
675 prevents a temporary file from being linked into the filesystem
676 in the above manner.
677 (Note that the meaning of
678 .B O_EXCL
679 in this case is different from the meaning of
680 .B O_EXCL
681 otherwise.)
682
683
684 There are two main use cases for
685 .\" Inspired by http://lwn.net/Articles/559147/
686 .BR O_TMPFILE :
687 .RS
688 .IP * 3
689 Improved
690 .BR tmpfile (3)
691 functionality: race-free creation of temporary files that
692 (1) are automatically deleted when closed;
693 (2) can never be reached via any pathname;
694 (3) are not subject to symlink attacks; and
695 (4) do not require the caller to devise unique names.
696 .IP *
697 Creating a file that is initially invisible, which is then populated
698 with data and adjusted to have appropriate filesystem attributes
699 .RB ( chown (2),
700 .BR chmod (2),
701 .BR fsetxattr (2),
702 etc.)
703 before being atomically linked into the filesystem
704 in a fully formed state (using
705 .BR linkat (2)
706 as described above).
707 .RE
708 .IP
709 .B O_TMPFILE
710 requires support by the underlying filesystem;
711 only a subset of Linux filesystems provide that support.
712 In the initial implementation, support was provided in
713 the ext2, ext3, ext4, UDF, Minix, and shmem filesystems.
714 XFS support was added
715 .\" commit 99b6436bc29e4f10e4388c27a3e4810191cc4788
716 .\" commit ab29743117f9f4c22ac44c13c1647fb24fb2bafe
717 in Linux 3.15.
718 .TP
719 .B O_TRUNC
720 If the file already exists and is a regular file and the access mode allows
721 writing (i.e., is
722 .B O_RDWR
723 or
724 .BR O_WRONLY )
725 it will be truncated to length 0.
726 If the file is a FIFO or terminal device file, the
727 .B O_TRUNC
728 flag is ignored.
729 Otherwise, the effect of
730 .B O_TRUNC
731 is unspecified.
732 .SS creat()
733 .BR creat ()
734 is equivalent to
735 .BR open ()
736 with
737 .I flags
738 equal to
739 .BR O_CREAT|O_WRONLY|O_TRUNC .
740 .SS openat()
741 The
742 .BR openat ()
743 system call operates in exactly the same way as
744 .BR open (),
745 except for the differences described here.
746
747 If the pathname given in
748 .I pathname
749 is relative, then it is interpreted relative to the directory
750 referred to by the file descriptor
751 .I dirfd
752 (rather than relative to the current working directory of
753 the calling process, as is done by
754 .BR open ()
755 for a relative pathname).
756
757 If
758 .I pathname
759 is relative and
760 .I dirfd
761 is the special value
762 .BR AT_FDCWD ,
763 then
764 .I pathname
765 is interpreted relative to the current working
766 directory of the calling process (like
767 .BR open ()).
768
769 If
770 .I pathname
771 is absolute, then
772 .I dirfd
773 is ignored.
774 .SH RETURN VALUE
775 .BR open (),
776 .BR openat (),
777 and
778 .BR creat ()
779 return the new file descriptor, or \-1 if an error occurred
780 (in which case,
781 .I errno
782 is set appropriately).
783 .SH ERRORS
784 .BR open (),
785 .BR openat (),
786 and
787 .BR creat ()
788 can fail with the following errors:
789 .TP
790 .B EACCES
791 The requested access to the file is not allowed, or search permission
792 is denied for one of the directories in the path prefix of
793 .IR pathname ,
794 or the file did not exist yet and write access to the parent directory
795 is not allowed.
796 (See also
797 .BR path_resolution (7).)
798 .TP
799 .B EDQUOT
800 Where
801 .B O_CREAT
802 is specified, the file does not exist, and the user's quota of disk
803 blocks or inodes on the filesystem has been exhausted.
804 .TP
805 .B EEXIST
806 .I pathname
807 already exists and
808 .BR O_CREAT " and " O_EXCL
809 were used.
810 .TP
811 .B EFAULT
812 .I pathname
813 points outside your accessible address space.
814 .TP
815 .B EFBIG
816 See
817 .BR EOVERFLOW .
818 .TP
819 .B EINTR
820 While blocked waiting to complete an open of a slow device
821 (e.g., a FIFO; see
822 .BR fifo (7)),
823 the call was interrupted by a signal handler; see
824 .BR signal (7).
825 .TP
826 .B EINVAL
827 The filesystem does not support the
828 .BR O_DIRECT
829 flag.
830 See
831 .BR NOTES
832 for more information.
833 .TP
834 .B EINVAL
835 Invalid value in
836 .\" In particular, __O_TMPFILE instead of O_TMPFILE
837 .IR flags .
838 .TP
839 .B EINVAL
840 .B O_TMPFILE
841 was specified in
842 .IR flags ,
843 but neither
844 .B O_WRONLY
845 nor
846 .B O_RDWR
847 was specified.
848 .TP
849 .B EISDIR
850 .I pathname
851 refers to a directory and the access requested involved writing
852 (that is,
853 .B O_WRONLY
854 or
855 .B O_RDWR
856 is set).
857 .TP
858 .B EISDIR
859 .I pathname
860 refers to an existing directory,
861 .B O_TMPFILE
862 and one of
863 .B O_WRONLY
864 or
865 .B O_RDWR
866 were specified in
867 .IR flags ,
868 but this kernel version does not provide the
869 .B O_TMPFILE
870 functionality.
871 .TP
872 .B ELOOP
873 Too many symbolic links were encountered in resolving
874 .IR pathname .
875 .TP
876 .B ELOOP
877 .I pathname
878 was a symbolic link, and
879 .I flags
880 specified
881 .BR O_NOFOLLOW
882 but not
883 .BR O_PATH .
884 .TP
885 .B EMFILE
886 The process already has the maximum number of files open
887 (see the description of
888 .BR RLIMIT_NOFILE
889 in
890 .BR getrlimit (2)).
891 .TP
892 .B ENAMETOOLONG
893 .I pathname
894 was too long.
895 .TP
896 .B ENFILE
897 The system limit on the total number of open files has been reached.
898 .TP
899 .B ENODEV
900 .I pathname
901 refers to a device special file and no corresponding device exists.
902 (This is a Linux kernel bug; in this situation
903 .B ENXIO
904 must be returned.)
905 .TP
906 .B ENOENT
907 .B O_CREAT
908 is not set and the named file does not exist.
909 Or, a directory component in
910 .I pathname
911 does not exist or is a dangling symbolic link.
912 .TP
913 .B ENOENT
914 .I pathname
915 refers to a nonexistent directory,
916 .B O_TMPFILE
917 and one of
918 .B O_WRONLY
919 or
920 .B O_RDWR
921 were specified in
922 .IR flags ,
923 but this kernel version does not provide the
924 .B O_TMPFILE
925 functionality.
926 .TP
927 .B ENOMEM
928 Insufficient kernel memory was available.
929 .TP
930 .B ENOSPC
931 .I pathname
932 was to be created but the device containing
933 .I pathname
934 has no room for the new file.
935 .TP
936 .B ENOTDIR
937 A component used as a directory in
938 .I pathname
939 is not, in fact, a directory, or \fBO_DIRECTORY\fP was specified and
940 .I pathname
941 was not a directory.
942 .TP
943 .B ENXIO
944 .BR O_NONBLOCK " | " O_WRONLY
945 is set, the named file is a FIFO, and
946 no process has the FIFO open for reading.
947 Or, the file is a device special file and no corresponding device exists.
948 .TP
949 .BR EOPNOTSUPP
950 The filesystem containing
951 .I pathname
952 does not support
953 .BR O_TMPFILE .
954 .TP
955 .B EOVERFLOW
956 .I pathname
957 refers to a regular file that is too large to be opened.
958 The usual scenario here is that an application compiled
959 on a 32-bit platform without
960 .I -D_FILE_OFFSET_BITS=64
961 tried to open a file whose size exceeds
962 .I (1<<31)-1
963 bytes;
964 see also
965 .B O_LARGEFILE
966 above.
967 This is the error specified by POSIX.1-2001;
968 in kernels before 2.6.24, Linux gave the error
969 .B EFBIG
970 for this case.
971 .\" See http://bugzilla.kernel.org/show_bug.cgi?id=7253
972 .\" "Open of a large file on 32-bit fails with EFBIG, should be EOVERFLOW"
973 .\" Reported 2006-10-03
974 .TP
975 .B EPERM
976 The
977 .B O_NOATIME
978 flag was specified, but the effective user ID of the caller
979 .\" Strictly speaking, it's the filesystem UID... (MTK)
980 did not match the owner of the file and the caller was not privileged
981 .RB ( CAP_FOWNER ).
982 .TP
983 .B EPERM
984 The operation was prevented by a file seal; see
985 .BR fcntl (2).
986 .TP
987 .B EROFS
988 .I pathname
989 refers to a file on a read-only filesystem and write access was
990 requested.
991 .TP
992 .B ETXTBSY
993 .I pathname
994 refers to an executable image which is currently being executed and
995 write access was requested.
996 .TP
997 .B EWOULDBLOCK
998 The
999 .B O_NONBLOCK
1000 flag was specified, and an incompatible lease was held on the file
1001 (see
1002 .BR fcntl (2)).
1003 .PP
1004 The following additional errors can occur for
1005 .BR openat ():
1006 .TP
1007 .B EBADF
1008 .I dirfd
1009 is not a valid file descriptor.
1010 .TP
1011 .B ENOTDIR
1012 .I pathname
1013 is a relative pathname and
1014 .I dirfd
1015 is a file descriptor referring to a file other than a directory.
1016 .SH VERSIONS
1017 .BR openat ()
1018 was added to Linux in kernel 2.6.16;
1019 library support was added to glibc in version 2.4.
1020 .SH CONFORMING TO
1021 .BR open (),
1022 .BR creat ()
1023 SVr4, 4.3BSD, POSIX.1-2001, POSIX.1-2008.
1024
1025 .BR openat ():
1026 POSIX.1-2008.
1027
1028 The
1029 .BR O_DIRECT ,
1030 .BR O_NOATIME ,
1031 .BR O_PATH ,
1032 and
1033 .BR O_TMPFILE
1034 flags are Linux-specific.
1035 One must define
1036 .B _GNU_SOURCE
1037 to obtain their definitions.
1038
1039 The
1040 .BR O_CLOEXEC ,
1041 .BR O_DIRECTORY ,
1042 and
1043 .BR O_NOFOLLOW
1044 flags are not specified in POSIX.1-2001,
1045 but are specified in POSIX.1-2008.
1046 Since glibc 2.12, one can obtain their definitions by defining either
1047 .B _POSIX_C_SOURCE
1048 with a value greater than or equal to 200809L or
1049 .BR _XOPEN_SOURCE
1050 with a value greater than or equal to 700.
1051 In glibc 2.11 and earlier, one obtains the definitions by defining
1052 .BR _GNU_SOURCE .
1053
1054 As noted in
1055 .BR feature_test_macros (7),
1056 feature test macros such as
1057 .BR _POSIX_C_SOURCE ,
1058 .BR _XOPEN_SOURCE ,
1059 and
1060 .B _GNU_SOURCE
1061 must be defined before including
1062 .I any
1063 header files.
1064 .SH NOTES
1065 Under Linux, the
1066 .B O_NONBLOCK
1067 flag indicates that one wants to open
1068 but does not necessarily have the intention to read or write.
1069 This is typically used to open devices in order to get a file descriptor
1070 for use with
1071 .BR ioctl (2).
1072
1073 .LP
1074 The (undefined) effect of
1075 .B O_RDONLY | O_TRUNC
1076 varies among implementations.
1077 On many systems the file is actually truncated.
1078 .\" Linux 2.0, 2.5: truncate
1079 .\" Solaris 5.7, 5.8: truncate
1080 .\" Irix 6.5: truncate
1081 .\" Tru64 5.1B: truncate
1082 .\" HP-UX 11.22: truncate
1083 .\" FreeBSD 4.7: truncate
1084
1085 Note that
1086 .BR open ()
1087 can open device special files, but
1088 .BR creat ()
1089 cannot create them; use
1090 .BR mknod (2)
1091 instead.
1092
1093 If the file is newly created, its
1094 .IR st_atime ,
1095 .IR st_ctime ,
1096 .I st_mtime
1097 fields
1098 (respectively, time of last access, time of last status change, and
1099 time of last modification; see
1100 .BR stat (2))
1101 are set
1102 to the current time, and so are the
1103 .I st_ctime
1104 and
1105 .I st_mtime
1106 fields of the
1107 parent directory.
1108 Otherwise, if the file is modified because of the
1109 .B O_TRUNC
1110 flag, its st_ctime and st_mtime fields are set to the current time.
1111 .\"
1112 .\"
1113 .SS Open file descriptions
1114 The term open file description is the one used by POSIX to refer to the
1115 entries in the system-wide table of open files.
1116 In other contexts, this object is
1117 variously also called an "open file object",
1118 a "file handle", an "open file table entry",
1119 or\(emin kernel-developer parlance\(ema
1120 .IR "struct file" .
1121
1122 When a file descriptor is duplicated (using
1123 .BR dup (2)
1124 or similar),
1125 the duplicate refers to the same open file description
1126 as the original file descriptor,
1127 and the two file descriptors consequently share
1128 the file offset and file status flags.
1129 Such sharing can also occur between processes:
1130 a child process created via
1131 .BR fork (2)
1132 inherits duplicates of its parent's file descriptors,
1133 and those duplicates refer to the same open file descriptions.
1134
1135 Each
1136 .BR open (2)
1137 of a file creates a new open file description;
1138 thus, there may be multiple open file descriptions
1139 corresponding to a file inode.
1140 .\"
1141 .\"
1142 .SS Synchronized I/O
1143 The POSIX.1-2008 "synchronized I/O" option
1144 specifies different variants of synchronized I/O,
1145 and specifies the
1146 .BR open ()
1147 flags
1148 .BR O_SYNC ,
1149 .BR O_DSYNC ,
1150 and
1151 .BR O_RSYNC
1152 for controlling the behavior.
1153 Regardless of whether an implementation supports this option,
1154 it must at least support the use of
1155 .BR O_SYNC
1156 for regular files.
1157
1158 Linux implements
1159 .BR O_SYNC
1160 and
1161 .BR O_DSYNC ,
1162 but not
1163 .BR O_RSYNC .
1164 (Somewhat incorrectly, glibc defines
1165 .BR O_RSYNC
1166 to have the same value as
1167 .BR O_SYNC .)
1168
1169 .BR O_SYNC
1170 provides synchronized I/O
1171 .I file
1172 integrity completion,
1173 meaning write operations will flush data and all associated metadata
1174 to the underlying hardware.
1175 .BR O_DSYNC
1176 provides synchronized I/O
1177 .I data
1178 integrity completion,
1179 meaning write operations will flush data
1180 to the underlying hardware,
1181 but will only flush metadata updates that are required
1182 to allow a subsequent read operation to complete successfully.
1183 Data integrity completion can reduce the number of disk operations
1184 that are required for applications that don't need the guarantees
1185 of file integrity completion.
1186
1187 To understand the difference between the two types of completion,
1188 consider two pieces of file metadata:
1189 the file last modification timestamp
1190 .RI ( st_mtime )
1191 and the file length.
1192 All write operations will update the last file modification timestamp,
1193 but only writes that add data to the end of the
1194 file will change the file length.
1195 The last modification timestamp is not needed to ensure that
1196 a read completes successfully, but the file length is.
1197 Thus,
1198 .BR O_DSYNC
1199 would only guarantee to flush updates to the file length metadata
1200 (whereas
1201 .BR O_SYNC
1202 would also always flush the last modification timestamp metadata).
1203
1204 Before Linux 2.6.33, Linux implemented only the
1205 .BR O_SYNC
1206 flag for
1207 .BR open ().
1208 However, when that flag was specified,
1209 most filesystems actually provided the equivalent of synchronized I/O
1210 .I data
1211 integrity completion (i.e.,
1212 .BR O_SYNC
1213 was actually implemented as the equivalent of
1214 .BR O_DSYNC ).
1215
1216 Since Linux 2.6.33, proper
1217 .BR O_SYNC
1218 support is provided.
1219 However, to ensure backward binary compatibility,
1220 .BR O_DSYNC
1221 was defined with the same value as the historical
1222 .BR O_SYNC ,
1223 and
1224 .BR O_SYNC
1225 was defined as a new (two-bit) flag value that includes the
1226 .BR O_DSYNC
1227 flag value.
1228 This ensures that applications compiled against
1229 new headers get at least
1230 .BR O_DSYNC
1231 semantics on pre-2.6.33 kernels.
1232 .\"
1233 .\"
1234 .SS NFS
1235 There are many infelicities in the protocol underlying NFS, affecting
1236 amongst others
1237 .BR O_SYNC " and " O_NDELAY .
1238
1239 On NFS filesystems with UID mapping enabled,
1240 .BR open ()
1241 may
1242 return a file descriptor but, for example,
1243 .BR read (2)
1244 requests are denied
1245 with \fBEACCES\fP.
1246 This is because the client performs
1247 .BR open ()
1248 by checking the
1249 permissions, but UID mapping is performed by the server upon
1250 read and write requests.
1251 .\"
1252 .\"
1253 .SS File access mode
1254 Unlike the other values that can be specified in
1255 .IR flags ,
1256 the
1257 .I "access mode"
1258 values
1259 .BR O_RDONLY ", " O_WRONLY ", and " O_RDWR
1260 do not specify individual bits.
1261 Rather, they define the low order two bits of
1262 .IR flags ,
1263 and are defined respectively as 0, 1, and 2.
1264 In other words, the combination
1265 .B "O_RDONLY | O_WRONLY"
1266 is a logical error, and certainly does not have the same meaning as
1267 .BR O_RDWR .
1268
1269 Linux reserves the special, nonstandard access mode 3 (binary 11) in
1270 .I flags
1271 to mean:
1272 check for read and write permission on the file and return a descriptor
1273 that can't be used for reading or writing.
1274 This nonstandard access mode is used by some Linux drivers to return a
1275 descriptor that is to be used only for device-specific
1276 .BR ioctl (2)
1277 operations.
1278 .\" See for example util-linux's disk-utils/setfdprm.c
1279 .\" For some background on access mode 3, see
1280 .\" http://thread.gmane.org/gmane.linux.kernel/653123
1281 .\" "[RFC] correct flags to f_mode conversion in __dentry_open"
1282 .\" LKML, 12 Mar 2008
1283 .\"
1284 .\"
1285 .SS Rationale for openat() and other "directory file descriptor" APIs
1286 .BR openat ()
1287 and the other system calls and library functions that take
1288 a directory file descriptor argument
1289 (i.e.,
1290 .BR execveat (2),
1291 .BR faccessat (2),
1292 .BR fanotify_mark (2),
1293 .BR fchmodat (2),
1294 .BR fchownat (2),
1295 .BR fstatat (2),
1296 .BR futimesat (2),
1297 .BR linkat (2),
1298 .BR mkdirat (2),
1299 .BR mknodat (2),
1300 .BR name_to_handle_at (2),
1301 .BR readlinkat (2),
1302 .BR renameat (2),
1303 .BR symlinkat (2),
1304 .BR unlinkat (2),
1305 .BR utimensat (2)
1306 .BR mkfifoat (3),
1307 and
1308 .BR scandirat (3))
1309 are supported
1310 for two reasons.
1311 Here, the explanation is in terms of the
1312 .BR openat ()
1313 call, but the rationale is analogous for the other interfaces.
1314
1315 First,
1316 .BR openat ()
1317 allows an application to avoid race conditions that could
1318 occur when using
1319 .BR open ()
1320 to open files in directories other than the current working directory.
1321 These race conditions result from the fact that some component
1322 of the directory prefix given to
1323 .BR open ()
1324 could be changed in parallel with the call to
1325 .BR open ().
1326 Suppose, for example, that we wish to create the file
1327 .I path/to/xxx.dep
1328 if the file
1329 .I path/to/xxx
1330 exists.
1331 The problem is that between the existence check and the file creation step,
1332 .I path
1333 or
1334 .I to
1335 (which might be symbolic links)
1336 could be modified to point to a different location.
1337 Such races can be avoided by
1338 opening a file descriptor for the target directory,
1339 and then specifying that file descriptor as the
1340 .I dirfd
1341 argument of (say)
1342 .BR fstatat (2)
1343 and
1344 .BR openat ().
1345
1346 Second,
1347 .BR openat ()
1348 allows the implementation of a per-thread "current working
1349 directory", via file descriptor(s) maintained by the application.
1350 (This functionality can also be obtained by tricks based
1351 on the use of
1352 .IR /proc/self/fd/ dirfd,
1353 but less efficiently.)
1354 .\"
1355 .\"
1356 .SS O_DIRECT
1357 .LP
1358 The
1359 .B O_DIRECT
1360 flag may impose alignment restrictions on the length and address
1361 of user-space buffers and the file offset of I/Os.
1362 In Linux alignment
1363 restrictions vary by filesystem and kernel version and might be
1364 absent entirely.
1365 However there is currently no filesystem\-independent
1366 interface for an application to discover these restrictions for a given
1367 file or filesystem.
1368 Some filesystems provide their own interfaces
1369 for doing so, for example the
1370 .B XFS_IOC_DIOINFO
1371 operation in
1372 .BR xfsctl (3).
1373 .LP
1374 Under Linux 2.4, transfer sizes, and the alignment of the user buffer
1375 and the file offset must all be multiples of the logical block size
1376 of the filesystem.
1377 Since Linux 2.6.0, alignment to the logical block size of the
1378 underlying storage (typically 512 bytes) suffices.
1379 The logical block size can be determined using the
1380 .BR ioctl (2)
1381 .B BLKSSZGET
1382 operation or from the shell using the command:
1383
1384     blockdev \-\-getss
1385 .LP
1386 .B O_DIRECT
1387 I/Os should never be run concurrently with the
1388 .BR fork (2)
1389 system call,
1390 if the memory buffer is a private mapping
1391 (i.e., any mapping created with the
1392 .BR mmap (2)
1393 .BR MAP_PRIVATE
1394 flag;
1395 this includes memory allocated on the heap and statically allocated buffers).
1396 Any such I/Os, whether submitted via an asynchronous I/O interface or from
1397 another thread in the process,
1398 should be completed before
1399 .BR fork (2)
1400 is called.
1401 Failure to do so can result in data corruption and undefined behavior in
1402 parent and child processes.
1403 This restriction does not apply when the memory buffer for the
1404 .B O_DIRECT
1405 I/Os was created using
1406 .BR shmat (2)
1407 or
1408 .BR mmap (2)
1409 with the
1410 .B MAP_SHARED
1411 flag.
1412 Nor does this restriction apply when the memory buffer has been advised as
1413 .B MADV_DONTFORK
1414 with
1415 .BR madvise (2),
1416 ensuring that it will not be available
1417 to the child after
1418 .BR fork (2).
1419 .LP
1420 The
1421 .B O_DIRECT
1422 flag was introduced in SGI IRIX, where it has alignment
1423 restrictions similar to those of Linux 2.4.
1424 IRIX has also a
1425 .BR fcntl (2)
1426 call to query appropriate alignments, and sizes.
1427 FreeBSD 4.x introduced
1428 a flag of the same name, but without alignment restrictions.
1429 .LP
1430 .B O_DIRECT
1431 support was added under Linux in kernel version 2.4.10.
1432 Older Linux kernels simply ignore this flag.
1433 Some filesystems may not implement the flag and
1434 .BR open ()
1435 will fail with
1436 .B EINVAL
1437 if it is used.
1438 .LP
1439 Applications should avoid mixing
1440 .B O_DIRECT
1441 and normal I/O to the same file,
1442 and especially to overlapping byte regions in the same file.
1443 Even when the filesystem correctly handles the coherency issues in
1444 this situation, overall I/O throughput is likely to be slower than
1445 using either mode alone.
1446 Likewise, applications should avoid mixing
1447 .BR mmap (2)
1448 of files with direct I/O to the same files.
1449 .LP
1450 The behavior of
1451 .B O_DIRECT
1452 with NFS will differ from local filesystems.
1453 Older kernels, or
1454 kernels configured in certain ways, may not support this combination.
1455 The NFS protocol does not support passing the flag to the server, so
1456 .B O_DIRECT
1457 I/O will bypass the page cache only on the client; the server may
1458 still cache the I/O.
1459 The client asks the server to make the I/O
1460 synchronous to preserve the synchronous semantics of
1461 .BR O_DIRECT .
1462 Some servers will perform poorly under these circumstances, especially
1463 if the I/O size is small.
1464 Some servers may also be configured to
1465 lie to clients about the I/O having reached stable storage; this
1466 will avoid the performance penalty at some risk to data integrity
1467 in the event of server power failure.
1468 The Linux NFS client places no alignment restrictions on
1469 .B O_DIRECT
1470 I/O.
1471 .PP
1472 In summary,
1473 .B O_DIRECT
1474 is a potentially powerful tool that should be used with caution.
1475 It is recommended that applications treat use of
1476 .B O_DIRECT
1477 as a performance option which is disabled by default.
1478 .PP
1479 .RS
1480 "The thing that has always disturbed me about O_DIRECT is that the whole
1481 interface is just stupid, and was probably designed by a deranged monkey
1482 on some serious mind-controlling substances."\(emLinus
1483 .RE
1484 .SH BUGS
1485 Currently, it is not possible to enable signal-driven
1486 I/O by specifying
1487 .B O_ASYNC
1488 when calling
1489 .BR open ();
1490 use
1491 .BR fcntl (2)
1492 to enable this flag.
1493 .\" FIXME . Check bugzilla report on open(O_ASYNC)
1494 .\" See http://bugzilla.kernel.org/show_bug.cgi?id=5993
1495
1496 One must check for two different error codes,
1497 .B EISDIR
1498 and
1499 .BR ENOENT ,
1500 when trying to determine whether the kernel supports
1501 .B O_TMPFILE
1502 functionality.
1503 .SH SEE ALSO
1504 .BR chmod (2),
1505 .BR chown (2),
1506 .BR close (2),
1507 .BR dup (2),
1508 .BR fcntl (2),
1509 .BR link (2),
1510 .BR lseek (2),
1511 .BR mknod (2),
1512 .BR mmap (2),
1513 .BR mount (2),
1514 .BR open_by_handle_at (2),
1515 .BR read (2),
1516 .BR socket (2),
1517 .BR stat (2),
1518 .BR umask (2),
1519 .BR unlink (2),
1520 .BR write (2),
1521 .BR fopen (3),
1522 .BR fifo (7),
1523 .BR path_resolution (7),
1524 .BR symlink (7)
1525 .SH COLOPHON
1526 This page is part of release 3.79 of the Linux
1527 .I man-pages
1528 project.
1529 A description of the project,
1530 information about reporting bugs,
1531 and the latest version of this page,
1532 can be found at
1533 \%http://www.kernel.org/doc/man\-pages/.