OSDN Git Service

(split) LDP: Update original to v3.37.
[linuxjm/LDP_man-pages.git] / original / man2 / open.2
index beb1cbe..12d22da 100644 (file)
@@ -47,8 +47,9 @@
 .\" 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
@@ -79,7 +80,7 @@ By default, the new file descriptor is set to remain open across an
 .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
@@ -280,11 +281,11 @@ special situations, such as when applications do their own caching.
 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 .
@@ -319,11 +320,6 @@ and
 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.
@@ -333,6 +329,22 @@ is a symbolic link, then
 .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.
@@ -373,7 +385,7 @@ Setting the
 .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
@@ -391,9 +403,9 @@ One example is NFS, where the server maintains the access time.
 .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
@@ -823,7 +835,7 @@ as a performance option which is disabled by default.
 .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