Section: Linux Programmer's Manual (2)
Return to Main Contents
fstatat - get file status relative to a directory file descriptor
#include <fcntl.h> /* Definition of AT_* constants */
int fstatat(int dirfd, const char *pathname, struct stat *buf,
Feature Test Macro Requirements for glibc (see
- Since glibc 2.10:
_XOPEN_SOURCE >= 700 || _POSIX_C_SOURCE >= 200809L
- Before glibc 2.10:
system call operates in exactly the same way as
except for the differences described in this manual page.
If the pathname given in
is relative, then it is interpreted relative to the directory
referred to by the file descriptor
(rather than relative to the current working directory of
the calling process, as is done by
for a relative pathname).
is relative and
is the special value
is interpreted relative to the current working
directory of the calling process (like
is absolute, then
can either be 0, or include one or more of the following flags ORed:
- AT_EMPTY_PATH (since Linux 2.6.39)
is an empty string, operate on the file referred to by
(which may have been obtained using the
In this case,
can refer to any type of file, not just a directory.
- AT_NO_AUTOMOUNT (since Linux 2.6.38)
Don't automount the terminal ("basename") component of
if it is a directory that is an automount point.
This allows the caller to gather attributes of an automount point
(rather than the location it would mount).
This flag can be used in tools that scan directories
to prevent mass-automounting of a directory of automount points.
flag has no effect if the mount point has already been mounted over.
is a symbolic link, do not dereference it:
instead return information about the link itself, like
dereferences symbolic links, like
On error, -1 is returned and
is set to indicate the error.
The same errors that occur for
can also occur for
The following additional errors can occur for
is not a valid file descriptor.
Invalid flag specified in
is relative and
is a file descriptor referring to a file other than a directory.
was added to Linux in kernel 2.6.16;
library support was added to glibc in version 2.4.
A similar system call exists on Solaris.
for an explanation of the need for
The underlying system call employed by the glibc
wrapper function is actually called
This page is part of release 3.54 of the Linux
A description of the project,
and information about reporting bugs,
can be found at
- RETURN VALUE
- CONFORMING TO
- SEE ALSO
This document was created by
using the manual pages.
Time: 19:24:56 GMT, January 16, 2018