]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man2/fstatat.2
SEE ALSO: add symlink.7
[thirdparty/man-pages.git] / man2 / fstatat.2
1 .\" Hey Emacs! This file is -*- nroff -*- source.
2 .\"
3 .\" This manpage is Copyright (C) 2006, Michael Kerrisk
4 .\"
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
8 .\"
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
13 .\"
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date. The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein. The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
20 .\" professionally.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\"
25 .\"
26 .TH FSTATAT 2 2006-04-30 "Linux" "Linux Programmer's Manual"
27 .SH NAME
28 fstatat \- get file status relative to a directory file descriptor
29 .SH SYNOPSIS
30 .nf
31 .B #define _ATFILE_SOURCE
32 .B #include <fcntl.h> /* Definition of AT_* constants */
33 .B #include <sys/stat.h>
34 .sp
35 .BI "int fstatat(int " dirfd ", const char *" pathname ", struct stat *" \
36 buf ,
37 .BI " int " flags );
38 .fi
39 .SH DESCRIPTION
40 The
41 .BR fstatat ()
42 system call operates in exactly the same way as
43 .BR stat (2),
44 except for the differences described in this manual page.
45
46 If the pathname given in
47 .I pathname
48 is relative, then it is interpreted relative to the directory
49 referred to by the file descriptor
50 .I dirfd
51 (rather than relative to the current working directory of
52 the calling process, as is done by
53 .BR stat (2)
54 for a relative pathname).
55
56 If
57 .I pathname
58 is relative and
59 .I dirfd
60 is the special value
61 .BR AT_FDCWD ,
62 then
63 .I pathname
64 is interpreted relative to the current working
65 directory of the calling process (like
66 .BR stat (2)).
67
68 If
69 .I pathname
70 is absolute, then
71 .I dirfd
72 is ignored.
73
74 .I flags
75 can either be 0, or include the following flag:
76 .TP
77 .B AT_SYMLINK_NOFOLLOW
78 If
79 .I pathname
80 is a symbolic link, do not dereference it:
81 instead return information about the link itself, like
82 .BR lstat (2).
83 (By default,
84 .BR fstatat ()
85 dereferences symbolic links, like
86 .BR stat (2).)
87 .SH "RETURN VALUE"
88 On success,
89 .BR fstatat ()
90 returns 0.
91 On error, \-1 is returned and
92 .I errno
93 is set to indicate the error.
94 .SH ERRORS
95 The same errors that occur for
96 .BR stat (2)
97 can also occur for
98 .BR fstatat ().
99 The following additional errors can occur for
100 .BR fstatat ():
101 .TP
102 .B EBADF
103 .I dirfd
104 is not a valid file descriptor.
105 .TP
106 .B EINVAL
107 Invalid flag specified in
108 .IR flags .
109 .TP
110 .B ENOTDIR
111 .I pathname
112 is relative and
113 .I dirfd
114 is a file descriptor referring to a file other than a directory.
115 .SH VERSIONS
116 .BR fstatat ()
117 was added to Linux in kernel 2.6.16.
118 .SH "CONFORMING TO"
119 This system call is non-standard but is proposed
120 for inclusion in a future revision of POSIX.1.
121 A similar system call exists on Solaris.
122 .SH NOTES
123 See
124 .BR openat (2)
125 for an explanation of the need for
126 .BR fstatat ().
127 .SH "SEE ALSO"
128 .BR openat (2),
129 .BR stat (2),
130 .BR path_resolution (7),
131 .BR symlink (7)