.\" FIXME . Apr 08: The next POSIX revision has O_EXEC, O_SEARCH, and
.\" O_TTYINIT. Eventually these may need to be documented. --mtk
.\" FIXME Linux 2.6.33 has O_DSYNC, and a hidden __O_SYNC.
+.\" FIXME: Linux 2.6.39 added O_PATH
.\"
-.TH OPEN 2 2010-09-10 "Linux" "Linux Programmer's Manual"
+.TH OPEN 2 2012-02-27 "Linux" "Linux Programmer's Manual"
.SH NAME
open, creat \- open and possibly create a file or device
.SH SYNOPSIS
.B FD_CLOEXEC
file descriptor flag described in
.BR fcntl (2)
-is initially disabled; the Linux-specific
+is initially disabled; the
.B O_CLOEXEC
flag, described below, can be used to change this default).
The file offset is set to the beginning of the file (see
File I/O is done directly to/from user space buffers.
The
.B O_DIRECT
-flag on its own makes at an effort to transfer data synchronously,
+flag on its own makes an effort to transfer data synchronously,
but does not give the guarantees of the
.B O_SYNC
-that data and necessary metadata are transferred.
-To guarantee synchronous I/O the
+flag that data and necessary metadata are transferred.
+To guarantee synchronous I/O,
.B O_SYNC
must be used in addition to
.BR O_DIRECT .
already exists, then
.BR open ()
will fail.
-The behavior of
-.B O_EXCL
-is undefined if
-.B O_CREAT
-is not specified.
When these two flags are specified, symbolic links are not followed:
.\" POSIX.1-2001 explicitly requires this behavior.
.BR open ()
fails regardless of where the symbolic link points to.
+In general, the behavior of
+.B O_EXCL
+is undefined if it is used without
+.BR O_CREAT .
+There is one exception: on Linux 2.6 and later,
+.B O_EXCL
+can be used without
+.B O_CREAT
+if
+.I pathname
+refers to a block device.
+If the block device is in use by the system (e.g., mounted),
+.BR open ()
+fails with the error
+.BR EBUSY .
+
On NFS,
.B O_EXCL
is only supported when using NFSv3 or later on kernel 2.6 or later.
.B _FILE_OFFSET_BITS
feature test macro to 64 (rather than using
.BR O_LARGEFILE )
-is the preferred method of obtaining
+is the preferred
method of accessing large files on 32-bit systems (see
.BR feature_test_macros (7)).
.TP
.B O_NOCTTY
If
.I pathname
-refers to a terminal device \(em see
-.BR tty (4)
-\(em it will not become the process's controlling terminal even if the
+refers to a terminal device\(emsee
+.BR tty (4)\(em
+it will not become the process's controlling terminal even if the
process does not have one.
.TP
.B O_NOFOLLOW
.RS
"The thing that has always disturbed me about O_DIRECT is that the whole
interface is just stupid, and was probably designed by a deranged monkey
-on some serious mind-controlling substances." \(em Linus
+on some serious mind-controlling substances."\(emLinus
.RE
.SH BUGS
Currently, it is not possible to enable signal-driven