Changeset View
Changeset View
Standalone View
Standalone View
lib/libc/sys/stat.2
Show First 20 Lines • Show All 78 Lines • ▼ Show 20 Lines | |||||
The | The | ||||
.Fn fstatat | .Fn fstatat | ||||
system call is equivalent to | system call is equivalent to | ||||
.Fn stat | .Fn stat | ||||
and | and | ||||
.Fn lstat | .Fn lstat | ||||
except when the | except when the | ||||
.Fa path | .Fa path | ||||
specifies a relative path. | specifies a relative path, or the | ||||
In this case the status is retrieved from a file relative to | .Dv AT_BENEATH | ||||
flag is provided. | |||||
For | |||||
.Fn fstatat | |||||
and relative | |||||
.Fa path , | |||||
the status is retrieved from a file relative to | |||||
the directory associated with the file descriptor | the directory associated with the file descriptor | ||||
.Fa fd | .Fa fd | ||||
instead of the current working directory. | instead of the current working directory. | ||||
For | |||||
.Dv AT_BENEATH | |||||
and absolute | |||||
.Fa path , | |||||
the status is retrieved from a file specified by the | |||||
.Fa path , | |||||
but addition permission checks are performed, see below. | |||||
jonathan: "addition" -> "additional"? | |||||
kibAuthorUnsubmitted Done Inline ActionsWill fix in the next patch upload. kib: Will fix in the next patch upload. | |||||
.Pp | .Pp | ||||
The values for the | The values for the | ||||
.Fa flag | .Fa flag | ||||
are constructed by a bitwise-inclusive OR of flags from this list, | are constructed by a bitwise-inclusive OR of flags from this list, | ||||
defined in | defined in | ||||
.In fcntl.h : | .In fcntl.h : | ||||
.Bl -tag -width indent | .Bl -tag -width indent | ||||
.It Dv AT_SYMLINK_NOFOLLOW | .It Dv AT_SYMLINK_NOFOLLOW | ||||
Show All 20 Lines | |||||
.Fn stat | .Fn stat | ||||
or | or | ||||
.Fn lstat | .Fn lstat | ||||
respectively, depending on whether or not the | respectively, depending on whether or not the | ||||
.Dv AT_SYMLINK_NOFOLLOW | .Dv AT_SYMLINK_NOFOLLOW | ||||
bit is set in | bit is set in | ||||
.Fa flag . | .Fa flag . | ||||
.Pp | .Pp | ||||
When | |||||
.Fn fstatat | |||||
is called with an absolute | |||||
.Fa path | |||||
without the | |||||
.Dv AT_BENEATH | |||||
flag, it ignores the | |||||
.Fa fd | |||||
argument. | |||||
When | |||||
.Dv AT_BENEATH | |||||
is specified with an absolute | |||||
.Fa path , | |||||
a directory passed by the | |||||
.Fa fd | |||||
argument is used as the starting point for the resolution. | |||||
jonathanUnsubmitted Not Done Inline ActionsI'm not entirely sure what this is saying... isn't the root directory the starting point for the resolution? Are you trying to say something like:
? jonathan: I'm not entirely sure what this is saying... isn't the root directory the starting point for… | |||||
kibAuthorUnsubmitted Done Inline ActionsNo. First, please look at the starting point definition in open(2). I tend to agree that the term is confusing since its meaning is taken by intuition. Second, no, it is not enough that the path pass through the directory, its tail after the last entry to the directory must not escape the hierarchy. kib: No.
First, please look at the starting point definition in open(2). I tend to agree that the… | |||||
emasteUnsubmitted Not Done Inline ActionsYes, the trouble is the intuitive meaning of "starting point." emaste: Yes, the trouble is the intuitive meaning of "starting point." | |||||
.Pp | |||||
The | The | ||||
.Fa sb | .Fa sb | ||||
argument is a pointer to a | argument is a pointer to a | ||||
.Vt stat | .Vt stat | ||||
structure | structure | ||||
as defined by | as defined by | ||||
.In sys/stat.h | .In sys/stat.h | ||||
and into which information is placed concerning the file. | and into which information is placed concerning the file. | ||||
▲ Show 20 Lines • Show All 264 Lines • ▼ Show 20 Lines | |||||
The | The | ||||
.Fa path | .Fa path | ||||
argument is not an absolute path and | argument is not an absolute path and | ||||
.Fa fd | .Fa fd | ||||
is neither | is neither | ||||
.Dv AT_FDCWD | .Dv AT_FDCWD | ||||
nor a file descriptor associated with a directory. | nor a file descriptor associated with a directory. | ||||
.It Bq Er ENOTCAPABLE | .It Bq Er ENOTCAPABLE | ||||
The | |||||
.Dv AT_BENEATH | |||||
flag was specified but | |||||
.Fa path | .Fa path | ||||
is not strictly relative to the starting directory. | is an absolute path, | ||||
For example, | or contained a ".." component leading to a | ||||
.Fa path | directory outside of the directory hierarchy specified by | ||||
is absolute or includes a ".." component that escapes the starting directory. | .Fa fd , | ||||
and the process is in capability mode or the | |||||
.Dv AT_BENEATH | |||||
flag was provided. | |||||
.El | .El | ||||
.Sh SEE ALSO | .Sh SEE ALSO | ||||
.Xr access 2 , | .Xr access 2 , | ||||
.Xr chmod 2 , | .Xr chmod 2 , | ||||
.Xr chown 2 , | .Xr chown 2 , | ||||
.Xr fhstat 2 , | .Xr fhstat 2 , | ||||
.Xr statfs 2 , | .Xr statfs 2 , | ||||
.Xr utimes 2 , | .Xr utimes 2 , | ||||
Show All 34 Lines |
"addition" -> "additional"?