open.2: O_EXCL can be used without O_CREAT for block devices

Since Linux 2.6 there is a possibility to use O_EXCL without
O_CREAT. See patch: http://lkml.org/lkml/2003/8/10/221.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Ivana Hutarova Varekova 2010-11-15 06:58:11 +01:00 committed by Michael Kerrisk
parent d1c9ea80c3
commit 10b7a94568
1 changed files with 17 additions and 6 deletions

View File

@ -48,7 +48,7 @@
.\" O_TTYINIT. Eventually these may need to be documented. --mtk
.\" FIXME Linux 2.6.33 has O_DSYNC, and a hidden __O_SYNC.
.\"
.TH OPEN 2 2010-09-10 "Linux" "Linux Programmer's Manual"
.TH OPEN 2 2010-11-15 "Linux" "Linux Programmer's Manual"
.SH NAME
open, creat \- open and possibly create a file or device
.SH SYNOPSIS
@ -319,11 +319,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 +328,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.