Mercurial > hg > octave-lojdl > gnulib-hg
annotate lib/fstatat.c @ 17464:290d581e2e24
autoupdate
author | Karl Berry <karl@freefriends.org> |
---|---|
date | Sat, 10 Aug 2013 07:10:55 -0700 |
parents | e542fd46ad6f |
children |
rev | line source |
---|---|
7677
5617bb70e723
* lib/openat.h (rpl_fstatat): New macro, if
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
1 /* Work around an fstatat bug on Solaris 9. |
5617bb70e723
* lib/openat.h (rpl_fstatat): New macro, if
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
2 |
17249
e542fd46ad6f
maint: update all copyright year number ranges
Eric Blake <eblake@redhat.com>
parents:
17137
diff
changeset
|
3 Copyright (C) 2006, 2009-2013 Free Software Foundation, Inc. |
7677
5617bb70e723
* lib/openat.h (rpl_fstatat): New macro, if
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
4 |
9309
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
7677
diff
changeset
|
5 This program is free software: you can redistribute it and/or modify |
7677
5617bb70e723
* lib/openat.h (rpl_fstatat): New macro, if
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
6 it under the terms of the GNU General Public License as published by |
9309
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
7677
diff
changeset
|
7 the Free Software Foundation; either version 3 of the License, or |
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
7677
diff
changeset
|
8 (at your option) any later version. |
7677
5617bb70e723
* lib/openat.h (rpl_fstatat): New macro, if
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
9 |
5617bb70e723
* lib/openat.h (rpl_fstatat): New macro, if
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
10 This program is distributed in the hope that it will be useful, |
5617bb70e723
* lib/openat.h (rpl_fstatat): New macro, if
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
5617bb70e723
* lib/openat.h (rpl_fstatat): New macro, if
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5617bb70e723
* lib/openat.h (rpl_fstatat): New macro, if
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
13 GNU General Public License for more details. |
5617bb70e723
* lib/openat.h (rpl_fstatat): New macro, if
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
14 |
5617bb70e723
* lib/openat.h (rpl_fstatat): New macro, if
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
15 You should have received a copy of the GNU General Public License |
9309
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
7677
diff
changeset
|
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
7677
5617bb70e723
* lib/openat.h (rpl_fstatat): New macro, if
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
17 |
5617bb70e723
* lib/openat.h (rpl_fstatat): New macro, if
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
18 /* Written by Paul Eggert and Jim Meyering. */ |
5617bb70e723
* lib/openat.h (rpl_fstatat): New macro, if
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
19 |
15547
50ebbdbce688
openat: work around AIX 7.1 fstatat issue
Paul Eggert <eggert@cs.ucla.edu>
parents:
15539
diff
changeset
|
20 /* If the user's config.h happens to include <sys/stat.h>, let it include only |
50ebbdbce688
openat: work around AIX 7.1 fstatat issue
Paul Eggert <eggert@cs.ucla.edu>
parents:
15539
diff
changeset
|
21 the system's <sys/stat.h> here, so that orig_fstatat doesn't recurse to |
50ebbdbce688
openat: work around AIX 7.1 fstatat issue
Paul Eggert <eggert@cs.ucla.edu>
parents:
15539
diff
changeset
|
22 rpl_fstatat. */ |
50ebbdbce688
openat: work around AIX 7.1 fstatat issue
Paul Eggert <eggert@cs.ucla.edu>
parents:
15539
diff
changeset
|
23 #define __need_system_sys_stat_h |
7677
5617bb70e723
* lib/openat.h (rpl_fstatat): New macro, if
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
24 #include <config.h> |
5617bb70e723
* lib/openat.h (rpl_fstatat): New macro, if
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
25 |
15547
50ebbdbce688
openat: work around AIX 7.1 fstatat issue
Paul Eggert <eggert@cs.ucla.edu>
parents:
15539
diff
changeset
|
26 /* Get the original definition of fstatat. It might be defined as a macro. */ |
15548
2f8afdd5ebf5
* lib/fstatat.c: Include <sys/types.h> before <sys/stat.h>.
Paul Eggert <eggert@cs.ucla.edu>
parents:
15547
diff
changeset
|
27 #include <sys/types.h> |
15547
50ebbdbce688
openat: work around AIX 7.1 fstatat issue
Paul Eggert <eggert@cs.ucla.edu>
parents:
15539
diff
changeset
|
28 #include <sys/stat.h> |
50ebbdbce688
openat: work around AIX 7.1 fstatat issue
Paul Eggert <eggert@cs.ucla.edu>
parents:
15539
diff
changeset
|
29 #undef __need_system_sys_stat_h |
50ebbdbce688
openat: work around AIX 7.1 fstatat issue
Paul Eggert <eggert@cs.ucla.edu>
parents:
15539
diff
changeset
|
30 |
50ebbdbce688
openat: work around AIX 7.1 fstatat issue
Paul Eggert <eggert@cs.ucla.edu>
parents:
15539
diff
changeset
|
31 #if HAVE_FSTATAT |
17099
66fafd5c6640
fchmodat, fchownat, fstatat: use extern-inline
Paul Eggert <eggert@cs.ucla.edu>
parents:
16235
diff
changeset
|
32 static int |
15547
50ebbdbce688
openat: work around AIX 7.1 fstatat issue
Paul Eggert <eggert@cs.ucla.edu>
parents:
15539
diff
changeset
|
33 orig_fstatat (int fd, char const *filename, struct stat *buf, int flags) |
50ebbdbce688
openat: work around AIX 7.1 fstatat issue
Paul Eggert <eggert@cs.ucla.edu>
parents:
15539
diff
changeset
|
34 { |
50ebbdbce688
openat: work around AIX 7.1 fstatat issue
Paul Eggert <eggert@cs.ucla.edu>
parents:
15539
diff
changeset
|
35 return fstatat (fd, filename, buf, flags); |
50ebbdbce688
openat: work around AIX 7.1 fstatat issue
Paul Eggert <eggert@cs.ucla.edu>
parents:
15539
diff
changeset
|
36 } |
50ebbdbce688
openat: work around AIX 7.1 fstatat issue
Paul Eggert <eggert@cs.ucla.edu>
parents:
15539
diff
changeset
|
37 #endif |
50ebbdbce688
openat: work around AIX 7.1 fstatat issue
Paul Eggert <eggert@cs.ucla.edu>
parents:
15539
diff
changeset
|
38 |
15583
716e67b8d5a9
openat: Work around compilation error with OSF/1 5.1 DTK cc.
Bruno Haible <bruno@clisp.org>
parents:
15565
diff
changeset
|
39 /* Write "sys/stat.h" here, not <sys/stat.h>, otherwise OSF/1 5.1 DTK cc |
716e67b8d5a9
openat: Work around compilation error with OSF/1 5.1 DTK cc.
Bruno Haible <bruno@clisp.org>
parents:
15565
diff
changeset
|
40 eliminates this include because of the preliminary #include <sys/stat.h> |
716e67b8d5a9
openat: Work around compilation error with OSF/1 5.1 DTK cc.
Bruno Haible <bruno@clisp.org>
parents:
15565
diff
changeset
|
41 above. */ |
716e67b8d5a9
openat: Work around compilation error with OSF/1 5.1 DTK cc.
Bruno Haible <bruno@clisp.org>
parents:
15565
diff
changeset
|
42 #include "sys/stat.h" |
7677
5617bb70e723
* lib/openat.h (rpl_fstatat): New macro, if
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
43 |
5617bb70e723
* lib/openat.h (rpl_fstatat): New macro, if
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
44 #include <errno.h> |
11973
d71ad7a7711c
fstatat: fix compilation on Solaris
Eric Blake <ebb9@byu.net>
parents:
11942
diff
changeset
|
45 #include <fcntl.h> |
7677
5617bb70e723
* lib/openat.h (rpl_fstatat): New macro, if
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
46 #include <string.h> |
5617bb70e723
* lib/openat.h (rpl_fstatat): New macro, if
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
47 |
16071
1bf33e67ddd8
fstatat: work with cross-compilation
Paul Eggert <eggert@cs.ucla.edu>
parents:
15583
diff
changeset
|
48 #if HAVE_FSTATAT && HAVE_WORKING_FSTATAT_ZERO_FLAG |
15564
17091e26f407
openat: test for fstatat (AT_FDCWD, ..., 0) bug
Paul Eggert <eggert@cs.ucla.edu>
parents:
15548
diff
changeset
|
49 |
17091e26f407
openat: test for fstatat (AT_FDCWD, ..., 0) bug
Paul Eggert <eggert@cs.ucla.edu>
parents:
15548
diff
changeset
|
50 # ifndef LSTAT_FOLLOWS_SLASHED_SYMLINK |
17091e26f407
openat: test for fstatat (AT_FDCWD, ..., 0) bug
Paul Eggert <eggert@cs.ucla.edu>
parents:
15548
diff
changeset
|
51 # define LSTAT_FOLLOWS_SLASHED_SYMLINK 0 |
17091e26f407
openat: test for fstatat (AT_FDCWD, ..., 0) bug
Paul Eggert <eggert@cs.ucla.edu>
parents:
15548
diff
changeset
|
52 # endif |
17091e26f407
openat: test for fstatat (AT_FDCWD, ..., 0) bug
Paul Eggert <eggert@cs.ucla.edu>
parents:
15548
diff
changeset
|
53 |
7677
5617bb70e723
* lib/openat.h (rpl_fstatat): New macro, if
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
54 /* fstatat should always follow symbolic links that end in /, but on |
12044
1b85d0321310
openat: fix fstatat bugs on Solaris 9
Eric Blake <ebb9@byu.net>
parents:
11973
diff
changeset
|
55 Solaris 9 it doesn't if AT_SYMLINK_NOFOLLOW is specified. |
1b85d0321310
openat: fix fstatat bugs on Solaris 9
Eric Blake <ebb9@byu.net>
parents:
11973
diff
changeset
|
56 Likewise, trailing slash on a non-directory should be an error. |
1b85d0321310
openat: fix fstatat bugs on Solaris 9
Eric Blake <ebb9@byu.net>
parents:
11973
diff
changeset
|
57 These are the same problems that lstat.c and stat.c address, so |
15564
17091e26f407
openat: test for fstatat (AT_FDCWD, ..., 0) bug
Paul Eggert <eggert@cs.ucla.edu>
parents:
15548
diff
changeset
|
58 solve it in a similar way. |
17091e26f407
openat: test for fstatat (AT_FDCWD, ..., 0) bug
Paul Eggert <eggert@cs.ucla.edu>
parents:
15548
diff
changeset
|
59 |
17091e26f407
openat: test for fstatat (AT_FDCWD, ..., 0) bug
Paul Eggert <eggert@cs.ucla.edu>
parents:
15548
diff
changeset
|
60 AIX 7.1 fstatat (AT_FDCWD, ..., 0) always fails, which is a bug. |
17091e26f407
openat: test for fstatat (AT_FDCWD, ..., 0) bug
Paul Eggert <eggert@cs.ucla.edu>
parents:
15548
diff
changeset
|
61 Work around this bug if FSTATAT_AT_FDCWD_0_BROKEN is nonzero. */ |
7677
5617bb70e723
* lib/openat.h (rpl_fstatat): New macro, if
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
62 |
5617bb70e723
* lib/openat.h (rpl_fstatat): New macro, if
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
63 int |
5617bb70e723
* lib/openat.h (rpl_fstatat): New macro, if
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
64 rpl_fstatat (int fd, char const *file, struct stat *st, int flag) |
5617bb70e723
* lib/openat.h (rpl_fstatat): New macro, if
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
65 { |
15565
f888e5e48e69
openat: test for fstatat (..., 0) bug
Paul Eggert <eggert@cs.ucla.edu>
parents:
15564
diff
changeset
|
66 int result = orig_fstatat (fd, file, st, flag); |
12044
1b85d0321310
openat: fix fstatat bugs on Solaris 9
Eric Blake <ebb9@byu.net>
parents:
11973
diff
changeset
|
67 size_t len; |
7677
5617bb70e723
* lib/openat.h (rpl_fstatat): New macro, if
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
68 |
15564
17091e26f407
openat: test for fstatat (AT_FDCWD, ..., 0) bug
Paul Eggert <eggert@cs.ucla.edu>
parents:
15548
diff
changeset
|
69 if (LSTAT_FOLLOWS_SLASHED_SYMLINK || result != 0) |
12044
1b85d0321310
openat: fix fstatat bugs on Solaris 9
Eric Blake <ebb9@byu.net>
parents:
11973
diff
changeset
|
70 return result; |
1b85d0321310
openat: fix fstatat bugs on Solaris 9
Eric Blake <ebb9@byu.net>
parents:
11973
diff
changeset
|
71 len = strlen (file); |
1b85d0321310
openat: fix fstatat bugs on Solaris 9
Eric Blake <ebb9@byu.net>
parents:
11973
diff
changeset
|
72 if (flag & AT_SYMLINK_NOFOLLOW) |
7677
5617bb70e723
* lib/openat.h (rpl_fstatat): New macro, if
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
73 { |
12044
1b85d0321310
openat: fix fstatat bugs on Solaris 9
Eric Blake <ebb9@byu.net>
parents:
11973
diff
changeset
|
74 /* Fix lstat behavior. */ |
1b85d0321310
openat: fix fstatat bugs on Solaris 9
Eric Blake <ebb9@byu.net>
parents:
11973
diff
changeset
|
75 if (file[len - 1] != '/' || S_ISDIR (st->st_mode)) |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12046
diff
changeset
|
76 return 0; |
12044
1b85d0321310
openat: fix fstatat bugs on Solaris 9
Eric Blake <ebb9@byu.net>
parents:
11973
diff
changeset
|
77 if (!S_ISLNK (st->st_mode)) |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12046
diff
changeset
|
78 { |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12046
diff
changeset
|
79 errno = ENOTDIR; |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12046
diff
changeset
|
80 return -1; |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
12046
diff
changeset
|
81 } |
15565
f888e5e48e69
openat: test for fstatat (..., 0) bug
Paul Eggert <eggert@cs.ucla.edu>
parents:
15564
diff
changeset
|
82 result = orig_fstatat (fd, file, st, flag & ~AT_SYMLINK_NOFOLLOW); |
7677
5617bb70e723
* lib/openat.h (rpl_fstatat): New macro, if
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
83 } |
12044
1b85d0321310
openat: fix fstatat bugs on Solaris 9
Eric Blake <ebb9@byu.net>
parents:
11973
diff
changeset
|
84 /* Fix stat behavior. */ |
1b85d0321310
openat: fix fstatat bugs on Solaris 9
Eric Blake <ebb9@byu.net>
parents:
11973
diff
changeset
|
85 if (result == 0 && !S_ISDIR (st->st_mode) && file[len - 1] == '/') |
1b85d0321310
openat: fix fstatat bugs on Solaris 9
Eric Blake <ebb9@byu.net>
parents:
11973
diff
changeset
|
86 { |
1b85d0321310
openat: fix fstatat bugs on Solaris 9
Eric Blake <ebb9@byu.net>
parents:
11973
diff
changeset
|
87 errno = ENOTDIR; |
1b85d0321310
openat: fix fstatat bugs on Solaris 9
Eric Blake <ebb9@byu.net>
parents:
11973
diff
changeset
|
88 return -1; |
1b85d0321310
openat: fix fstatat bugs on Solaris 9
Eric Blake <ebb9@byu.net>
parents:
11973
diff
changeset
|
89 } |
7677
5617bb70e723
* lib/openat.h (rpl_fstatat): New macro, if
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
90 return result; |
5617bb70e723
* lib/openat.h (rpl_fstatat): New macro, if
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
91 } |
12046
fb58acddad72
openat: move fstatat and unlinkat into correct files
Eric Blake <ebb9@byu.net>
parents:
12044
diff
changeset
|
92 |
16071
1bf33e67ddd8
fstatat: work with cross-compilation
Paul Eggert <eggert@cs.ucla.edu>
parents:
15583
diff
changeset
|
93 #else /* ! (HAVE_FSTATAT && HAVE_WORKING_FSTATAT_ZERO_FLAG) */ |
12046
fb58acddad72
openat: move fstatat and unlinkat into correct files
Eric Blake <ebb9@byu.net>
parents:
12044
diff
changeset
|
94 |
16235
18a38c9615f0
In commentary, do not use ` to quote.
Paul Eggert <eggert@cs.ucla.edu>
parents:
16201
diff
changeset
|
95 /* On mingw, the gnulib <sys/stat.h> defines 'stat' as a function-like |
12046
fb58acddad72
openat: move fstatat and unlinkat into correct files
Eric Blake <ebb9@byu.net>
parents:
12044
diff
changeset
|
96 macro; but using it in AT_FUNC_F2 causes compilation failure |
fb58acddad72
openat: move fstatat and unlinkat into correct files
Eric Blake <ebb9@byu.net>
parents:
12044
diff
changeset
|
97 because the preprocessor sees a use of a macro that requires two |
fb58acddad72
openat: move fstatat and unlinkat into correct files
Eric Blake <ebb9@byu.net>
parents:
12044
diff
changeset
|
98 arguments but is only given one. Hence, we need an inline |
fb58acddad72
openat: move fstatat and unlinkat into correct files
Eric Blake <ebb9@byu.net>
parents:
12044
diff
changeset
|
99 forwarder to get past the preprocessor. */ |
17099
66fafd5c6640
fchmodat, fchownat, fstatat: use extern-inline
Paul Eggert <eggert@cs.ucla.edu>
parents:
16235
diff
changeset
|
100 static int |
12046
fb58acddad72
openat: move fstatat and unlinkat into correct files
Eric Blake <ebb9@byu.net>
parents:
12044
diff
changeset
|
101 stat_func (char const *name, struct stat *st) |
fb58acddad72
openat: move fstatat and unlinkat into correct files
Eric Blake <ebb9@byu.net>
parents:
12044
diff
changeset
|
102 { |
fb58acddad72
openat: move fstatat and unlinkat into correct files
Eric Blake <ebb9@byu.net>
parents:
12044
diff
changeset
|
103 return stat (name, st); |
fb58acddad72
openat: move fstatat and unlinkat into correct files
Eric Blake <ebb9@byu.net>
parents:
12044
diff
changeset
|
104 } |
fb58acddad72
openat: move fstatat and unlinkat into correct files
Eric Blake <ebb9@byu.net>
parents:
12044
diff
changeset
|
105 |
16235
18a38c9615f0
In commentary, do not use ` to quote.
Paul Eggert <eggert@cs.ucla.edu>
parents:
16201
diff
changeset
|
106 /* Likewise, if there is no native 'lstat', then the gnulib |
12046
fb58acddad72
openat: move fstatat and unlinkat into correct files
Eric Blake <ebb9@byu.net>
parents:
12044
diff
changeset
|
107 <sys/stat.h> defined it as stat, which also needs adjustment. */ |
fb58acddad72
openat: move fstatat and unlinkat into correct files
Eric Blake <ebb9@byu.net>
parents:
12044
diff
changeset
|
108 # if !HAVE_LSTAT |
fb58acddad72
openat: move fstatat and unlinkat into correct files
Eric Blake <ebb9@byu.net>
parents:
12044
diff
changeset
|
109 # undef lstat |
fb58acddad72
openat: move fstatat and unlinkat into correct files
Eric Blake <ebb9@byu.net>
parents:
12044
diff
changeset
|
110 # define lstat stat_func |
fb58acddad72
openat: move fstatat and unlinkat into correct files
Eric Blake <ebb9@byu.net>
parents:
12044
diff
changeset
|
111 # endif |
fb58acddad72
openat: move fstatat and unlinkat into correct files
Eric Blake <ebb9@byu.net>
parents:
12044
diff
changeset
|
112 |
fb58acddad72
openat: move fstatat and unlinkat into correct files
Eric Blake <ebb9@byu.net>
parents:
12044
diff
changeset
|
113 /* Replacement for Solaris' function by the same name. |
fb58acddad72
openat: move fstatat and unlinkat into correct files
Eric Blake <ebb9@byu.net>
parents:
12044
diff
changeset
|
114 <http://www.google.com/search?q=fstatat+site:docs.sun.com> |
fb58acddad72
openat: move fstatat and unlinkat into correct files
Eric Blake <ebb9@byu.net>
parents:
12044
diff
changeset
|
115 First, try to simulate it via l?stat ("/proc/self/fd/FD/FILE"). |
fb58acddad72
openat: move fstatat and unlinkat into correct files
Eric Blake <ebb9@byu.net>
parents:
12044
diff
changeset
|
116 Failing that, simulate it via save_cwd/fchdir/(stat|lstat)/restore_cwd. |
fb58acddad72
openat: move fstatat and unlinkat into correct files
Eric Blake <ebb9@byu.net>
parents:
12044
diff
changeset
|
117 If either the save_cwd or the restore_cwd fails (relatively unlikely), |
fb58acddad72
openat: move fstatat and unlinkat into correct files
Eric Blake <ebb9@byu.net>
parents:
12044
diff
changeset
|
118 then give a diagnostic and exit nonzero. |
fb58acddad72
openat: move fstatat and unlinkat into correct files
Eric Blake <ebb9@byu.net>
parents:
12044
diff
changeset
|
119 Otherwise, this function works just like Solaris' fstatat. */ |
fb58acddad72
openat: move fstatat and unlinkat into correct files
Eric Blake <ebb9@byu.net>
parents:
12044
diff
changeset
|
120 |
16102 | 121 # define AT_FUNC_NAME fstatat |
12046
fb58acddad72
openat: move fstatat and unlinkat into correct files
Eric Blake <ebb9@byu.net>
parents:
12044
diff
changeset
|
122 # define AT_FUNC_F1 lstat |
fb58acddad72
openat: move fstatat and unlinkat into correct files
Eric Blake <ebb9@byu.net>
parents:
12044
diff
changeset
|
123 # define AT_FUNC_F2 stat_func |
fb58acddad72
openat: move fstatat and unlinkat into correct files
Eric Blake <ebb9@byu.net>
parents:
12044
diff
changeset
|
124 # define AT_FUNC_USE_F1_COND AT_SYMLINK_NOFOLLOW |
fb58acddad72
openat: move fstatat and unlinkat into correct files
Eric Blake <ebb9@byu.net>
parents:
12044
diff
changeset
|
125 # define AT_FUNC_POST_FILE_PARAM_DECLS , struct stat *st, int flag |
fb58acddad72
openat: move fstatat and unlinkat into correct files
Eric Blake <ebb9@byu.net>
parents:
12044
diff
changeset
|
126 # define AT_FUNC_POST_FILE_ARGS , st |
fb58acddad72
openat: move fstatat and unlinkat into correct files
Eric Blake <ebb9@byu.net>
parents:
12044
diff
changeset
|
127 # include "at-func.c" |
fb58acddad72
openat: move fstatat and unlinkat into correct files
Eric Blake <ebb9@byu.net>
parents:
12044
diff
changeset
|
128 # undef AT_FUNC_NAME |
fb58acddad72
openat: move fstatat and unlinkat into correct files
Eric Blake <ebb9@byu.net>
parents:
12044
diff
changeset
|
129 # undef AT_FUNC_F1 |
fb58acddad72
openat: move fstatat and unlinkat into correct files
Eric Blake <ebb9@byu.net>
parents:
12044
diff
changeset
|
130 # undef AT_FUNC_F2 |
fb58acddad72
openat: move fstatat and unlinkat into correct files
Eric Blake <ebb9@byu.net>
parents:
12044
diff
changeset
|
131 # undef AT_FUNC_USE_F1_COND |
fb58acddad72
openat: move fstatat and unlinkat into correct files
Eric Blake <ebb9@byu.net>
parents:
12044
diff
changeset
|
132 # undef AT_FUNC_POST_FILE_PARAM_DECLS |
fb58acddad72
openat: move fstatat and unlinkat into correct files
Eric Blake <ebb9@byu.net>
parents:
12044
diff
changeset
|
133 # undef AT_FUNC_POST_FILE_ARGS |
fb58acddad72
openat: move fstatat and unlinkat into correct files
Eric Blake <ebb9@byu.net>
parents:
12044
diff
changeset
|
134 |
15547
50ebbdbce688
openat: work around AIX 7.1 fstatat issue
Paul Eggert <eggert@cs.ucla.edu>
parents:
15539
diff
changeset
|
135 #endif /* !HAVE_FSTATAT */ |