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       #define _ATFILE_SOURCE
10       #include <fcntl.h> /* Definition of AT_* constants */
11       #include <sys/stat.h>
12
13       int fstatat(int dirfd, const char *pathname, struct stat *buf,
14                   int flags);
15

DESCRIPTION

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

RETURN VALUE

39       On success, fstatat() returns 0.  On error, -1 is returned and errno is
40       set to indicate the error.
41

ERRORS

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

VERSIONS

55       fstatat() was added to Linux in kernel 2.6.16.
56

CONFORMING TO

58       POSIX.1-2008.  A similar system call exists on Solaris.
59

NOTES

61       See openat(2) for an explanation of the need for fstatat().
62

SEE ALSO

64       openat(2), stat(2), path_resolution(7), symlink(7)
65

COLOPHON

67       This page is part of release 3.22 of the Linux  man-pages  project.   A
68       description  of  the project, and information about reporting bugs, can
69       be found at http://www.kernel.org/doc/man-pages/.
70
71
72
73Linux                             2008-08-21                        FSTATAT(2)
Impressum