1FSTATAT(2)                 Linux Programmer's Manual                FSTATAT(2)
2
3
4

NAME

6       fstatat - get file status relative to a directory file descriptor
7

SYNOPSIS

9       #include <fcntl.h> /* Definition of AT_* constants */
10       #include <sys/stat.h>
11
12       int fstatat(int dirfd, const char *pathname, struct stat *buf,
13                   int flags);
14
15   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
16
17       fstatat():
18       Since glibc 2.10: _XOPEN_SOURCE >= 700 || _POSIX_C_SOURCE >= 200809L
19       Before glibc 2.10: _ATFILE_SOURCE
20

DESCRIPTION

22       The  fstatat() system call operates in exactly the same way as stat(2),
23       except for the differences described in this manual page.
24
25       If the pathname given in pathname is relative, then it  is  interpreted
26       relative  to  the  directory  referred  to by the file descriptor dirfd
27       (rather than relative to the current working directory of  the  calling
28       process, as is done by stat(2) for a relative pathname).
29
30       If  pathname  is relative and dirfd is the special value AT_FDCWD, then
31       pathname is interpreted relative to the current  working  directory  of
32       the calling process (like stat(2)).
33
34       If pathname is absolute, then dirfd is ignored.
35
36       flags can either be 0, or include the following flag:
37
38       AT_SYMLINK_NOFOLLOW
39              If  pathname  is a symbolic link, do not dereference it: instead
40              return information about the link itself,  like  lstat(2).   (By
41              default, fstatat() dereferences symbolic links, like stat(2).)
42

RETURN VALUE

44       On success, fstatat() returns 0.  On error, -1 is returned and errno is
45       set to indicate the error.
46

ERRORS

48       The same errors that occur for stat(2) can also  occur  for  fstatat().
49       The following additional errors can occur for fstatat():
50
51       EBADF  dirfd is not a valid file descriptor.
52
53       EINVAL Invalid flag specified in flags.
54
55       ENOTDIR
56              pathname is relative and dirfd is a file descriptor referring to
57              a file other than a directory.
58

VERSIONS

60       fstatat() was added to Linux in kernel 2.6.16.
61

CONFORMING TO

63       POSIX.1-2008.  A similar system call exists on Solaris.
64

NOTES

66       See openat(2) for an explanation of the need for fstatat().
67

SEE ALSO

69       openat(2), stat(2), path_resolution(7), symlink(7)
70

COLOPHON

72       This page is part of release 3.25 of the Linux  man-pages  project.   A
73       description  of  the project, and information about reporting bugs, can
74       be found at http://www.kernel.org/doc/man-pages/.
75
76
77
78Linux                             2009-12-13                        FSTATAT(2)
Impressum