OSDN Git Service

LDP: Update original to LDP v3.67
[linuxjm/LDP_man-pages.git] / original / man2 / open.2
index 0779afd..8f2511e 100644 (file)
@@ -48,7 +48,7 @@
 .\" FIXME . Apr 08: The next POSIX revision has O_EXEC, O_SEARCH, and
 .\" O_TTYINIT.  Eventually these may need to be documented.  --mtk
 .\"
-.TH OPEN 2 2014-04-20 "Linux" "Linux Programmer's Manual"
+.TH OPEN 2 2014-05-10 "Linux" "Linux Programmer's Manual"
 .SH NAME
 open, openat, creat \- open and possibly create a file
 .SH SYNOPSIS
@@ -101,10 +101,10 @@ By default, the new file descriptor is set to remain open across an
 (i.e., the
 .B FD_CLOEXEC
 file descriptor flag described in
-.BR fcntl (2)
+.BR fcntl (2))
 is initially disabled; the
 .B O_CLOEXEC
-flag, described below, can be used to change this default).
+flag, described below, can be used to change this default.
 The file offset is set to the beginning of the file (see
 .BR lseek (2)).
 .PP
@@ -113,12 +113,14 @@ A call to
 creates a new
 .IR "open file description" ,
 an entry in the system-wide table of open files.
-This entry records the file offset and the file status flags
-(modifiable via the
-.BR fcntl (2)
-.B F_SETFL
-operation).
-A file descriptor is a reference to one of these entries;
+(This object is variously also called an "open file object",
+a "file handle", an "open file table entry",
+or\(emin kernel-developer parlance\(ema
+.IR "struct file" .
+The term "open file description" is used by POSIX.)
+The open file description records the file offset and the file status flags
+(see below).
+A file descriptor is a reference to an open file description;
 this reference is unaffected if
 .I pathname
 is subsequently removed or modified to refer to a different file.
@@ -208,7 +210,7 @@ for further details.
 See also BUGS, below.
 .TP
 .BR O_CLOEXEC " (since Linux 2.6.23)"
-.\" NOTE! several otehr man pages refer to this text
+.\" NOTE! several other man pages refer to this text
 Enable the close-on-exec flag for the new file descriptor.
 Specifying this flag permits a program to avoid additional
 .BR fcntl (2)
@@ -232,7 +234,7 @@ at the same time as another thread does a
 plus
 .BR execve (2).
 Depending on the order of execution,
-the race may lead to the file desriptor returned by
+the race may lead to the file descriptor returned by
 .BR open ()
 being unintentionally leaked to the program executed by the child process
 created by
@@ -556,13 +558,19 @@ Retrieving open file status flags using the
 .BR F_GETFL
 operation: the returned flags will include the bit
 .BR O_PATH .
-
 .IP *
 Passing the file descriptor as the
 .IR dirfd
 argument of
 .BR openat (2)
 and the other "*at()" system calls.
+This includes
+.BR linkat (2)
+with
+.BR AT_EMPTY_PATH
+(or via procfs using
+.BR AT_SYMLINK_FOLLOW )
+even if the file is not a directory.
 .IP *
 Passing the file descriptor to another process via a UNIX domain socket
 (see
@@ -709,7 +717,7 @@ as described above).
 requires support by the underlying filesystem;
 only a subset of Linux filesystems provide that support.
 In the initial implementation, support was provided in
-the ex2, ext3, ext4, UDF, Minix, and shmem filesystems.
+the ext2, ext3, ext4, UDF, Minix, and shmem filesystems.
 XFS support was added
 .\" commit 99b6436bc29e4f10e4388c27a3e4810191cc4788
 .\" commit ab29743117f9f4c22ac44c13c1647fb24fb2bafe
@@ -725,7 +733,7 @@ it will be truncated to length 0.
 If the file is a FIFO or terminal device file, the
 .B O_TRUNC
 flag is ignored.
-Otherwise the effect of
+Otherwise, the effect of
 .B O_TRUNC
 is unspecified.
 .SS creat()
@@ -746,7 +754,7 @@ except for the differences described here.
 If the pathname given in
 .I pathname
 is relative, then it is interpreted relative to the directory
-relative to by the file descriptor
+referred to by the file descriptor
 .I dirfd
 (rather than relative to the current working directory of
 the calling process, as is done by
@@ -937,8 +945,8 @@ was not a directory.
 .TP
 .B ENXIO
 .BR O_NONBLOCK " | " O_WRONLY
-is set, the named file is a FIFO and
-no process has the file open for reading.
+is set, the named file is a FIFO, and
+no process has the FIFO open for reading.
 Or, the file is a device special file and no corresponding device exists.
 .TP
 .BR EOPNOTSUPP
@@ -1001,7 +1009,7 @@ is not a valid file descriptor.
 .TP
 .B ENOTDIR
 .I pathname
-is relative and
+is a relative pathname and
 .I dirfd
 is a file descriptor referring to a file other than a directory.
 .SH VERSIONS
@@ -1322,7 +1330,14 @@ operation in
 Under Linux 2.4, transfer sizes, and the alignment of the user buffer
 and the file offset must all be multiples of the logical block size
 of the filesystem.
-Under Linux 2.6, alignment to 512-byte boundaries suffices.
+Since Linux 2.6.0, alignment to the logical block size of the
+underlying storage (typically 512 bytes) suffices.
+The logical block size can be determined using the
+.BR ioctl (2)
+.B BLKSSZGET
+operation or from the shell using the command:
+
+    blockdev \-\-getss
 .LP
 .B O_DIRECT
 I/Os should never be run concurrently with the
@@ -1452,7 +1467,7 @@ functionality.
 .BR mknod (2),
 .BR mmap (2),
 .BR mount (2),
-.BR open_by_name_at (2),
+.BR open_by_handle_at (2),
 .BR read (2),
 .BR socket (2),
 .BR stat (2),
@@ -1464,10 +1479,11 @@ functionality.
 .BR path_resolution (7),
 .BR symlink (7)
 .SH COLOPHON
-This page is part of release 3.65 of the Linux
+This page is part of release 3.67 of the Linux
 .I man-pages
 project.
 A description of the project,
-and information about reporting bugs,
+information about reporting bugs,
+and the latest version of this page,
 can be found at
 \%http://www.kernel.org/doc/man\-pages/.