statx.2: Rework discussion of identification of target file

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2017-04-23 13:09:43 +02:00
parent c8701bafb9
commit 7e43caf4db
1 changed files with 30 additions and 20 deletions

View File

@ -118,38 +118,48 @@ and
.IR flags
identify the target file in one of the following ways:
.TP
[*] By absolute pathname.
An absolute pathname
If
.I pathname
points to an absolute pathname and
begins with a slash,
then it is an absolute pathname that identifies the target file.
In this case,
.I dirfd
is ignored.
The file is looked up by name, starting from the root of the
filesystem as seen by the calling process.
.TP
[*] By cwd-relative pathname.
A relative pathname
If
.I pathname
points to a relative pathname and
is a string that begins with a character other than a slash and
.IR dirfd
is
.BR AT_FDCWD .
The file is looked up by name, starting from the current working directory.
.TP
[*] By dir-relative pathname.
.BR AT_FDCWD ,
then
.I pathname
points to relative pathname and
is a relative pathname that is interpreted relative to the process's
current working directory.
.TP
A pathname interpreted relative to a directory file descriptor
If
.I pathname
is a string that begins with a character other than a slash and
.I dirfd
is a file descriptor referring to a directory.
The file is looked up by name, starting from the directory specified by
is a file descriptor that refers to a directory, then
.I pathname
is a relative pathname that is interpreted relative to the directory
referred to by
.IR dirfd .
.TP
[*] By file descriptor.
By file descriptor
If
.IR pathname
is NULL and
.I dirfd
is a file descriptor.
The file attached to the file descriptor is queried directly.
The file descriptor may refer to any type of file, not just
a directory.
is NULL, then the target file is the one referred to by the file descriptor
.IR dirfd .
.I dirfd
may refer to any type of file, not just a directory.
(The
.B AT_EMPTY_PATH
flag described below provides similar functionality.)
.PP
.I flags
can be used to influence a pathname-based lookup.