libc: rename struct FTW quit to __quit
[unleashed.git] / include / ftw.h
blob2462a75a5cafc6e09ea4cbf4787a4c75dcd6533d
1 /*
2 * CDDL HEADER START
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.
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.
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]
19 * CDDL HEADER END
22 * Copyright 2014 Garrett D'Amore <garrett@damore.org>
24 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
25 * Use is subject to license terms.
28 /* Copyright (c) 1988 AT&T */
29 /* All Rights Reserved */
32 #ifndef _FTW_H
33 #define _FTW_H
35 #include <sys/feature_tests.h>
37 #include <sys/types.h>
38 #include <sys/stat.h>
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
45 * Codes for the third argument to the user-supplied function.
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 */
55 #define FTW_DL 8 /* private interface for find utility */
58 * Codes for the fourth argument to nftw. You can specify the
59 * union of these flags.
62 #define FTW_PHYS 01 /* use lstat instead of stat */
63 #define FTW_MOUNT 02 /* do not cross a mount point */
64 #define FTW_CHDIR 04 /* chdir to each directory before reading */
65 #define FTW_DEPTH 010 /* call descendents before calling the parent */
66 #define FTW_ANYERR 020 /* return FTW_NS on any stat failure */
67 #define FTW_HOPTION 040 /* private interface for find utility */
68 #define FTW_NOLOOP 0100 /* private interface for find utility */
70 #if defined(__EXTENSIONS__) || !defined(_XOPEN_SOURCE) || defined(_XPG4_2)
71 struct FTW
73 int __quit;
74 int base;
75 int level;
77 #endif /* defined(__EXTENSIONS__) || !defined(_XOPEN_SOURCE) ... */
80 * legal values for quit
83 #define FTW_SKD 1
84 #define FTW_FOLLOW 2
85 #define FTW_PRUNE 4
87 /* large file compilation environment setup */
88 #if !defined(_LP64) && _FILE_OFFSET_BITS == 64
89 #ifdef __PRAGMA_REDEFINE_EXTNAME
90 #pragma redefine_extname _xftw _xftw64
91 #pragma redefine_extname _ftw _ftw64
92 #if !defined(_XOPEN_SOURCE) || defined(_XPG5)
93 #pragma redefine_extname nftw nftw64
94 #endif
95 #else /* __PRAGMA_REDEFINE_EXTNAME */
96 #define _xftw _xftw64
97 #define _ftw _ftw64
98 #if !defined(_XOPEN_SOURCE) || defined(_XPG5)
99 #define nftw nftw64
100 #endif
101 #endif /* __PRAGMA_REDEFINE_EXTNAME */
102 #endif /* !_LP64 && _FILE_OFFSET_BITS == 64 */
104 /* In the LP64 compilation environment, all APIs are already large file */
105 #if defined(_LP64) && defined(_LARGEFILE64_SOURCE)
106 #ifdef __PRAGMA_REDEFINE_EXTNAME
107 #pragma redefine_extname _xftw64 _xftw
108 #pragma redefine_extname _ftw64 _ftw
109 #if !defined(_XOPEN_SOURCE) || defined(_XPG5)
110 #pragma redefine_extname nftw64 nftw
111 #endif
112 #else /* __PRAGMA_REDEFINE_EXTNAME */
113 #define _xftw64 _xftw
114 #define _ftw64 _ftw
115 #if !defined(_XOPEN_SOURCE) || defined(_XPG5)
116 #define nftw64 nftw
117 #endif
118 #endif /* __PRAGMA_REDEFINE_EXTNAME */
119 #endif /* _LP64 && _LARGEFILE64_SOURCE */
121 extern int ftw(const char *,
122 int (*)(const char *, const struct stat *, int), int);
123 extern int _xftw(int, const char *,
124 int (*)(const char *, const struct stat *, int), int);
125 #if defined(__EXTENSIONS__) || !defined(_XOPEN_SOURCE) || defined(_XPG4_2)
126 extern int nftw(const char *,
127 int (*)(const char *, const struct stat *, int, struct FTW *),
128 int, int);
129 #endif /* defined(__EXTENSIONS__) || !defined(_XOPEN_SOURCE) ... */
132 * transitional large file interface versions
134 #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \
135 !defined(__PRAGMA_REDEFINE_EXTNAME))
136 extern int ftw64(const char *,
137 int (*)(const char *, const struct stat64 *, int), int);
138 extern int _xftw64(int, const char *,
139 int (*)(const char *, const struct stat64 *, int), int);
140 #if !defined(_XOPEN_SOURCE)
141 extern int nftw64(const char *,
142 int (*)(const char *, const struct stat64 *, int, struct FTW *),
143 int, int);
144 #endif /* !defined(_XOPEN_SOURCE) */
145 #endif /* _LARGEFILE64_SOURCE .. */
147 #define _XFTWVER 2 /* version of file tree walk */
149 #define ftw(path, fn, depth) _xftw(_XFTWVER, (path), (fn), (depth))
151 #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \
152 !defined(__PRAGMA_REDEFINE_EXTNAME))
153 #define ftw64(path, fn, depth) _xftw64(_XFTWVER, (path), (fn), (depth))
154 #endif
156 #ifdef __cplusplus
158 #endif
160 #endif /* _FTW_H */