1FSTATAT(2) Linux Programmer's Manual FSTATAT(2)
2
3
4
6 fstatat - get file status relative to a directory file descriptor
7
9 #define _ATFILE_SOURCE
10 #include <sys/stat.h>
11
12 int fstatat(int dirfd, const char *pathname, struct stat *buf, int flags);
13
15 The fstatat() system call operates in exactly the same way as stat(2),
16 except for the differences described in this manual page.
17
18 If the pathname given in pathname is relative, then it is interpreted
19 relative to the directory referred to by the file descriptor dirfd
20 (rather than relative to the current working directory of the calling
21 process, as is done by stat(2) for a relative pathname).
22
23 If pathname is relative and dirfd is the special value AT_FDCWD, then
24 pathname is interpreted relative to the current working directory of
25 the calling process (like stat(2)).
26
27 If pathname is absolute, then dirfd is ignored.
28
29 flags can either be 0, or include the following flag:
30
31 AT_SYMLINK_NOFOLLOW
32 If pathname is a symbolic link, do not dereference it: instead
33 return information about the link itself, like lstat(2). (By
34 default, fstatat() dereferences symbolic links, like stat(2).)
35
37 On success, fstatat() returns 0. On error, -1 is returned and errno is
38 set to indicate the error.
39
41 The same errors that occur for stat(2) can also occur for fstatat().
42 The following additional errors can occur for fstatat():
43
44 EBADF dirfd is not a valid file descriptor.
45
46 EINVAL Invalid flag specified in flags.
47
48 ENOTDIR
49 pathname is relative and dirfd is a file descriptor referring to
50 a file other than a directory.
51
53 See openat(2) for an explanation of the need for fstatat().
54
56 This system call is non-standard but is proposed for inclusion in a
57 future revision of POSIX.1. A similar system call exists on Solaris.
58
60 fstatat() was added to Linux in kernel 2.6.16.
61
63 openat(2), path_resolution(2), stat(2)
64
65
66
67Linux 2.6.16 2006-04-30 FSTATAT(2)