Update powerpc-nofpu libm-test-ulps.
[glibc.git] / io / fts.h
blob867677a27e5c82ba61ec5a1df72d666358c35967
1 /* File tree traversal functions declarations.
2 Copyright (C) 1994-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
20 * Copyright (c) 1989, 1993
21 * The Regents of the University of California. All rights reserved.
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the above copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 4. Neither the name of the University nor the names of its contributors
32 * may be used to endorse or promote products derived from this software
33 * without specific prior written permission.
35 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
36 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
37 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
38 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
39 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
40 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
41 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
42 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
43 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
44 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
45 * SUCH DAMAGE.
47 * @(#)fts.h 8.3 (Berkeley) 8/14/94
50 #ifndef _FTS_H
51 #define _FTS_H 1
53 #include <features.h>
54 #include <sys/types.h>
57 typedef struct {
58 struct _ftsent *fts_cur; /* current node */
59 struct _ftsent *fts_child; /* linked list of children */
60 struct _ftsent **fts_array; /* sort array */
61 dev_t fts_dev; /* starting device # */
62 char *fts_path; /* path for this descent */
63 int fts_rfd; /* fd for root */
64 int fts_pathlen; /* sizeof(path) */
65 int fts_nitems; /* elements in the sort array */
66 int (*fts_compar) (const void *, const void *); /* compare fn */
68 #define FTS_COMFOLLOW 0x0001 /* follow command line symlinks */
69 #define FTS_LOGICAL 0x0002 /* logical walk */
70 #define FTS_NOCHDIR 0x0004 /* don't change directories */
71 #define FTS_NOSTAT 0x0008 /* don't get stat info */
72 #define FTS_PHYSICAL 0x0010 /* physical walk */
73 #define FTS_SEEDOT 0x0020 /* return dot and dot-dot */
74 #define FTS_XDEV 0x0040 /* don't cross devices */
75 #define FTS_WHITEOUT 0x0080 /* return whiteout information */
76 #define FTS_OPTIONMASK 0x00ff /* valid user option mask */
78 #define FTS_NAMEONLY 0x0100 /* (private) child names only */
79 #define FTS_STOP 0x0200 /* (private) unrecoverable error */
80 int fts_options; /* fts_open options, global flags */
81 } FTS;
83 #ifdef __USE_LARGEFILE64
84 typedef struct {
85 struct _ftsent64 *fts_cur; /* current node */
86 struct _ftsent64 *fts_child; /* linked list of children */
87 struct _ftsent64 **fts_array; /* sort array */
88 dev_t fts_dev; /* starting device # */
89 char *fts_path; /* path for this descent */
90 int fts_rfd; /* fd for root */
91 int fts_pathlen; /* sizeof(path) */
92 int fts_nitems; /* elements in the sort array */
93 int (*fts_compar) (const void *, const void *); /* compare fn */
94 int fts_options; /* fts_open options, global flags */
95 } FTS64;
96 #endif
98 typedef struct _ftsent {
99 struct _ftsent *fts_cycle; /* cycle node */
100 struct _ftsent *fts_parent; /* parent directory */
101 struct _ftsent *fts_link; /* next file in directory */
102 long fts_number; /* local numeric value */
103 void *fts_pointer; /* local address value */
104 char *fts_accpath; /* access path */
105 char *fts_path; /* root path */
106 int fts_errno; /* errno for this node */
107 int fts_symfd; /* fd for symlink */
108 unsigned short fts_pathlen; /* strlen(fts_path) */
109 unsigned short fts_namelen; /* strlen(fts_name) */
111 ino_t fts_ino; /* inode */
112 dev_t fts_dev; /* device */
113 nlink_t fts_nlink; /* link count */
115 #define FTS_ROOTPARENTLEVEL -1
116 #define FTS_ROOTLEVEL 0
117 short fts_level; /* depth (-1 to N) */
119 #define FTS_D 1 /* preorder directory */
120 #define FTS_DC 2 /* directory that causes cycles */
121 #define FTS_DEFAULT 3 /* none of the above */
122 #define FTS_DNR 4 /* unreadable directory */
123 #define FTS_DOT 5 /* dot or dot-dot */
124 #define FTS_DP 6 /* postorder directory */
125 #define FTS_ERR 7 /* error; errno is set */
126 #define FTS_F 8 /* regular file */
127 #define FTS_INIT 9 /* initialized only */
128 #define FTS_NS 10 /* stat(2) failed */
129 #define FTS_NSOK 11 /* no stat(2) requested */
130 #define FTS_SL 12 /* symbolic link */
131 #define FTS_SLNONE 13 /* symbolic link without target */
132 #define FTS_W 14 /* whiteout object */
133 unsigned short fts_info; /* user flags for FTSENT structure */
135 #define FTS_DONTCHDIR 0x01 /* don't chdir .. to the parent */
136 #define FTS_SYMFOLLOW 0x02 /* followed a symlink to get here */
137 unsigned short fts_flags; /* private flags for FTSENT structure */
139 #define FTS_AGAIN 1 /* read node again */
140 #define FTS_FOLLOW 2 /* follow symbolic link */
141 #define FTS_NOINSTR 3 /* no instructions */
142 #define FTS_SKIP 4 /* discard node */
143 unsigned short fts_instr; /* fts_set() instructions */
145 struct stat *fts_statp; /* stat(2) information */
146 char fts_name[1]; /* file name */
147 } FTSENT;
149 #ifdef __USE_LARGEFILE64
150 typedef struct _ftsent64 {
151 struct _ftsent64 *fts_cycle; /* cycle node */
152 struct _ftsent64 *fts_parent; /* parent directory */
153 struct _ftsent64 *fts_link; /* next file in directory */
154 long fts_number; /* local numeric value */
155 void *fts_pointer; /* local address value */
156 char *fts_accpath; /* access path */
157 char *fts_path; /* root path */
158 int fts_errno; /* errno for this node */
159 int fts_symfd; /* fd for symlink */
160 unsigned short fts_pathlen; /* strlen(fts_path) */
161 unsigned short fts_namelen; /* strlen(fts_name) */
163 ino64_t fts_ino; /* inode */
164 dev_t fts_dev; /* device */
165 nlink_t fts_nlink; /* link count */
167 short fts_level; /* depth (-1 to N) */
169 unsigned short fts_info; /* user flags for FTSENT structure */
171 unsigned short fts_flags; /* private flags for FTSENT structure */
173 unsigned short fts_instr; /* fts_set() instructions */
175 struct stat64 *fts_statp; /* stat(2) information */
176 char fts_name[1]; /* file name */
177 } FTSENT64;
178 #endif
180 __BEGIN_DECLS
181 #ifndef __USE_FILE_OFFSET64
182 FTSENT *fts_children (FTS *, int);
183 int fts_close (FTS *);
184 FTS *fts_open (char * const *, int,
185 int (*)(const FTSENT **, const FTSENT **));
186 FTSENT *fts_read (FTS *);
187 int fts_set (FTS *, FTSENT *, int) __THROW;
188 #else
189 # ifdef __REDIRECT
190 FTSENT *__REDIRECT (fts_children, (FTS *, int), fts64_children);
191 int __REDIRECT (fts_close, (FTS *), fts64_close);
192 FTS *__REDIRECT (fts_open, (char * const *, int,
193 int (*)(const FTSENT **, const FTSENT **)),
194 fts64_open);
195 FTSENT *__REDIRECT (fts_read, (FTS *), fts64_read);
196 int __REDIRECT_NTH (fts_set, (FTS *, FTSENT *, int), fts64_set);
197 # else
198 # define fts_children fts64_children
199 # define fts_close fts64_close
200 # define fts_open fts64_open
201 # define fts_read fts64_read
202 # define fts_set fts64_set
203 # endif
204 #endif
205 #ifdef __USE_LARGEFILE64
206 FTSENT64 *fts64_children (FTS64 *, int);
207 int fts64_close (FTS64 *);
208 FTS64 *fts64_open (char * const *, int,
209 int (*)(const FTSENT64 **, const FTSENT64 **));
210 FTSENT64 *fts64_read (FTS64 *);
211 int fts64_set (FTS64 *, FTSENT64 *, int) __THROW;
212 #endif
213 __END_DECLS
215 #endif /* fts.h */