2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 /* Copyright (c) 1988 AT&T */
27 /* All Rights Reserved */
28
29
30 #ifndef _FTW_H
31 #define _FTW_H
32
33 #pragma ident "%Z%%M% %I% %E% SMI"
34
35 #include <sys/feature_tests.h>
36
37 #include <sys/types.h>
38 #include <sys/stat.h>
39
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43
44 /*
45 * Codes for the third argument to the user-supplied function.
46 */
47
48 #define FTW_F 0 /* file */
49 #define FTW_D 1 /* directory */
50 #define FTW_DNR 2 /* directory without read permission */
51 #define FTW_NS 3 /* unknown type, stat failed */
52 #define FTW_SL 4 /* symbolic link */
53 #define FTW_DP 6 /* directory */
54 #define FTW_SLN 7 /* symbolic link that points to nonexistent file */
105 #endif /* __PRAGMA_REDEFINE_EXTNAME */
106 #endif /* !_LP64 && _FILE_OFFSET_BITS == 64 */
107
108 /* In the LP64 compilation environment, all APIs are already large file */
109 #if defined(_LP64) && defined(_LARGEFILE64_SOURCE)
110 #ifdef __PRAGMA_REDEFINE_EXTNAME
111 #pragma redefine_extname _xftw64 _xftw
112 #pragma redefine_extname _ftw64 _ftw
113 #if !defined(_XOPEN_SOURCE) || defined(_XPG5)
114 #pragma redefine_extname nftw64 nftw
115 #endif
116 #else /* __PRAGMA_REDEFINE_EXTNAME */
117 #define _xftw64 _xftw
118 #define _ftw64 _ftw
119 #if !defined(_XOPEN_SOURCE) || defined(_XPG5)
120 #define nftw64 nftw
121 #endif
122 #endif /* __PRAGMA_REDEFINE_EXTNAME */
123 #endif /* _LP64 && _LARGEFILE64_SOURCE */
124
125 #if defined(__STDC__)
126
127 extern int ftw(const char *,
128 int (*)(const char *, const struct stat *, int), int);
129 extern int _xftw(int, const char *,
130 int (*)(const char *, const struct stat *, int), int);
131 #if defined(__EXTENSIONS__) || !defined(_XOPEN_SOURCE) || defined(_XPG4_2)
132 extern int nftw(const char *,
133 int (*)(const char *, const struct stat *, int, struct FTW *),
134 int, int);
135 #endif /* defined(__EXTENSIONS__) || !defined(_XOPEN_SOURCE) ... */
136
137 /*
138 * transitional large file interface versions
139 */
140 #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \
141 !defined(__PRAGMA_REDEFINE_EXTNAME))
142 extern int ftw64(const char *,
143 int (*)(const char *, const struct stat64 *, int), int);
144 extern int _xftw64(int, const char *,
145 int (*)(const char *, const struct stat64 *, int), int);
146 #if !defined(_XOPEN_SOURCE)
147 extern int nftw64(const char *,
148 int (*)(const char *, const struct stat64 *, int, struct FTW *),
149 int, int);
150 #endif /* !defined(_XOPEN_SOURCE) */
151 #endif /* _LARGEFILE64_SOURCE .. */
152
153 #else /* __STDC__ */
154
155 extern int ftw(), _xftw();
156
157 #if defined(__EXTENSIONS__) || !defined(_XOPEN_SOURCE) || defined(_XPG4_2)
158 extern int nftw();
159 #endif /* defined(__EXTENSIONS__) || !defined(_XOPEN_SOURCE) ... */
160
161 /* transitional large file interface versions */
162 #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \
163 !defined(__PRAGMA_REDEFINE_EXTNAME))
164 extern int ftw64();
165 extern int _xftw64();
166 #if !defined(_XOPEN_SOURCE)
167 extern int nftw64();
168 #endif /* !defined(_XOPEN_SOURCE) */
169 #endif /* _LARGEFILE64_SOURCE .. */
170
171 #endif /* __STDC__ */
172
173 #define _XFTWVER 2 /* version of file tree walk */
174
175 #define ftw(path, fn, depth) _xftw(_XFTWVER, (path), (fn), (depth))
176
177 #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \
178 !defined(__PRAGMA_REDEFINE_EXTNAME))
179 #define ftw64(path, fn, depth) _xftw64(_XFTWVER, (path), (fn), (depth))
180 #endif
181
182 #ifdef __cplusplus
183 }
184 #endif
185
186 #endif /* _FTW_H */
|
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2014 Garrett D'Amore <garrett@damore.org>
23 *
24 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
25 * Use is subject to license terms.
26 */
27
28 /* Copyright (c) 1988 AT&T */
29 /* All Rights Reserved */
30
31
32 #ifndef _FTW_H
33 #define _FTW_H
34
35 #include <sys/feature_tests.h>
36
37 #include <sys/types.h>
38 #include <sys/stat.h>
39
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43
44 /*
45 * Codes for the third argument to the user-supplied function.
46 */
47
48 #define FTW_F 0 /* file */
49 #define FTW_D 1 /* directory */
50 #define FTW_DNR 2 /* directory without read permission */
51 #define FTW_NS 3 /* unknown type, stat failed */
52 #define FTW_SL 4 /* symbolic link */
53 #define FTW_DP 6 /* directory */
54 #define FTW_SLN 7 /* symbolic link that points to nonexistent file */
105 #endif /* __PRAGMA_REDEFINE_EXTNAME */
106 #endif /* !_LP64 && _FILE_OFFSET_BITS == 64 */
107
108 /* In the LP64 compilation environment, all APIs are already large file */
109 #if defined(_LP64) && defined(_LARGEFILE64_SOURCE)
110 #ifdef __PRAGMA_REDEFINE_EXTNAME
111 #pragma redefine_extname _xftw64 _xftw
112 #pragma redefine_extname _ftw64 _ftw
113 #if !defined(_XOPEN_SOURCE) || defined(_XPG5)
114 #pragma redefine_extname nftw64 nftw
115 #endif
116 #else /* __PRAGMA_REDEFINE_EXTNAME */
117 #define _xftw64 _xftw
118 #define _ftw64 _ftw
119 #if !defined(_XOPEN_SOURCE) || defined(_XPG5)
120 #define nftw64 nftw
121 #endif
122 #endif /* __PRAGMA_REDEFINE_EXTNAME */
123 #endif /* _LP64 && _LARGEFILE64_SOURCE */
124
125 extern int ftw(const char *,
126 int (*)(const char *, const struct stat *, int), int);
127 extern int _xftw(int, const char *,
128 int (*)(const char *, const struct stat *, int), int);
129 #if defined(__EXTENSIONS__) || !defined(_XOPEN_SOURCE) || defined(_XPG4_2)
130 extern int nftw(const char *,
131 int (*)(const char *, const struct stat *, int, struct FTW *),
132 int, int);
133 #endif /* defined(__EXTENSIONS__) || !defined(_XOPEN_SOURCE) ... */
134
135 /*
136 * transitional large file interface versions
137 */
138 #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \
139 !defined(__PRAGMA_REDEFINE_EXTNAME))
140 extern int ftw64(const char *,
141 int (*)(const char *, const struct stat64 *, int), int);
142 extern int _xftw64(int, const char *,
143 int (*)(const char *, const struct stat64 *, int), int);
144 #if !defined(_XOPEN_SOURCE)
145 extern int nftw64(const char *,
146 int (*)(const char *, const struct stat64 *, int, struct FTW *),
147 int, int);
148 #endif /* !defined(_XOPEN_SOURCE) */
149 #endif /* _LARGEFILE64_SOURCE .. */
150
151 #define _XFTWVER 2 /* version of file tree walk */
152
153 #define ftw(path, fn, depth) _xftw(_XFTWVER, (path), (fn), (depth))
154
155 #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \
156 !defined(__PRAGMA_REDEFINE_EXTNAME))
157 #define ftw64(path, fn, depth) _xftw64(_XFTWVER, (path), (fn), (depth))
158 #endif
159
160 #ifdef __cplusplus
161 }
162 #endif
163
164 #endif /* _FTW_H */
|