Open SCAP Library: fts_sun.h Source File

Open SCAP Library

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

fts_sun.h
1 /*
2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 4. Neither the name of the University nor the names of its contributors
14 * may be used to endorse or promote products derived from this software
15 * without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * @(#)fts.h 8.3 (Berkeley) 8/14/94
30 */
31
32 #include "config.h"
33
34 #if !defined(HAVE_FTS_OPEN)
35
36 #ifndef _FTS_H
37 #define _FTS_H 1
38
39
40 #if defined(__GLIBC__)
41 #include <features.h>
42 #else
43
44 # define __THROW
45 #ifdef __cplusplus
46 # define __BEGIN_DECLS extern "C" {
47 # define __END_DECLS }
48 #else
49 # define __BEGIN_DECLS
50 # define __END_DECLS
51 #endif
52
53 #if defined(hpux)
54 # define _D_EXACT_NAMLEN(d) ((d)->d_namlen)
55 # define _INCLUDE_POSIX_SOURCE
56 # define _LARGEFILE64_SOURCE
57 #endif
58
59 /* This needs to be ifdef SOLARIS */
60 #if defined(__SVR4)
61 # define _D_EXACT_NAMLEN(d) (strlen((d)->d_name))
62 # ifndef _INCLUDE_POSIX_SOURCE
63 # define _INCLUDE_POSIX_SOURCE
64 # endif
65 # ifndef _LARGEFILE64_SOURCE
66 # define _LARGEFILE64_SOURCE
67 # endif
68 #endif
69
70 #endif
71
72 #include <sys/types.h>
73 #include <sys/stat.h>
74 #include <dirent.h>
75
76 /* The fts interface is incompatible with the LFS interface which
77 transparently uses the 64-bit file access functions. */
78
79 #ifdef __USE_FILE_OFFSET64
80 # error "<fts.h> cannot be used with -D_FILE_OFFSET_BITS==64"
81 #endif
82
83
84 typedef struct {
85 /*@owned@*/
86 struct _ftsent *fts_cur;
87 /*@owned@*/ /*@null@*/
88 struct _ftsent *fts_child;
89 /*@owned@*/ /*@null@*/
90 struct _ftsent **fts_array;
91 dev_t fts_dev;
92 /*@owned@*/
93 char *fts_path;
94 int fts_rfd;
95 int fts_pathlen;
96 int fts_nitems;
97 /*@null@*/
98 int (*fts_compar) (const void *, const void *)
99 /*@*/;
101 DIR * (*fts_opendir) (const char * path)
102 /*@globals fileSystem @*/
103 /*@modifies fileSystem @*/;
104 struct dirent * (*fts_readdir) (DIR * dir)
105 /*@globals fileSystem @*/
106 /*@modifies *dir, fileSystem @*/;
107 int (*fts_closedir) (/*@only@*/ DIR * dir)
108 /*@globals fileSystem @*/
109 /*@modifies *dir, fileSystem @*/;
110 int (*fts_stat) (const char * path, /*@out@*/ struct stat * st)
111 /*@globals fileSystem @*/
112 /*@modifies *st, fileSystem @*/;
113 int (*fts_lstat) (const char * path, /*@out@*/ struct stat * st)
114 /*@globals fileSystem @*/
115 /*@modifies *st, fileSystem @*/;
116
117 #define FTS_COMFOLLOW 0x0001
118 #define FTS_LOGICAL 0x0002
119 #define FTS_NOCHDIR 0x0004
120 #define FTS_NOSTAT 0x0008
121 #define FTS_PHYSICAL 0x0010
122 #define FTS_SEEDOT 0x0020
123 #define FTS_XDEV 0x0040
124 #define FTS_WHITEOUT 0x0080
125 #define FTS_OPTIONMASK 0x00ff
127 #define FTS_NAMEONLY 0x0100
128 #define FTS_STOP 0x0200
129 int fts_options;
130 } FTS;
131
132 typedef struct _ftsent {
133 /*@dependent@*/
134 struct _ftsent *fts_cycle;
135 /*@dependent@*/
136 struct _ftsent *fts_parent;
137 /*@dependent@*/
138 struct _ftsent *fts_link;
139 long fts_number;
140 void *fts_pointer;
141 /*@dependent@*/
142 char *fts_accpath;
143 /*@dependent@*/
144 char *fts_path;
145 int fts_errno;
146 int fts_symfd;
147 u_short fts_pathlen;
148 u_short fts_namelen;
150 ino_t fts_ino;
151 dev_t fts_dev;
152 nlink_t fts_nlink;
154 #define FTS_ROOTPARENTLEVEL -1
155 #define FTS_ROOTLEVEL 0
156 short fts_level;
158 #define FTS_D 1
159 #define FTS_DC 2
160 #define FTS_DEFAULT 3
161 #define FTS_DNR 4
162 #define FTS_DOT 5
163 #define FTS_DP 6
164 #define FTS_ERR 7
165 #define FTS_F 8
166 #define FTS_INIT 9
167 #define FTS_NS 10
168 #define FTS_NSOK 11
169 #define FTS_SL 12
170 #define FTS_SLNONE 13
171 #define FTS_W 14
172 u_short fts_info;
174 #define FTS_DONTCHDIR 0x01
175 #define FTS_SYMFOLLOW 0x02
176 u_short fts_flags;
178 #define FTS_AGAIN 1
179 #define FTS_FOLLOW 2
180 #define FTS_NOINSTR 3
181 #define FTS_SKIP 4
182 u_short fts_instr;
184 /*@dependent@*/
185 struct stat *fts_statp;
186 char fts_name[1];
187 } FTSENT;
188
189 __BEGIN_DECLS
190
191 extern int dirfd (DIR * dirp);
192
199 /*@unused@*/ /*@dependent@*/
200 FTSENT *fts_children (FTS * sp, int instr) __THROW
201 /*@globals fileSystem, internalState @*/
202 /*@modifies *sp, fileSystem, internalState @*/;
203
209 /*@unused@*/
210 int fts_close (/*@only@*/ FTS * sp) __THROW
211 /*@globals fileSystem, internalState @*/
212 /*@modifies *sp, fileSystem, internalState @*/;
213
221 /*@unused@*/ /*@only@*/
222 FTS *fts_open (char * const * argv, int options,
223 /*@null@*/
224 int (*compar) (const FTSENT **, const FTSENT **)) __THROW
225 /*@*/;
226
232 /*@unused@*/ /*@null@*/
233 FTSENT *fts_read (FTS * sp) __THROW
234 /*@globals fileSystem, internalState @*/
235 /*@modifies *sp, fileSystem, internalState @*/;
236
244 /*@unused@*/
245 int fts_set (FTS * sp, FTSENT * p, int instr) __THROW
246 /*@modifies *p @*/;
247
248 __END_DECLS
249
250 #endif /* fts.h */
251 #else
252 #if defined(__SVR4) && defined(__sun)
253 #include <fts.h>
254 #endif /* defined(__SVR4) && defined(__sun) */
255
256 #endif /* HAVE_FTS_OPEN */
_ftsent::fts_cycle
struct _ftsent * fts_cycle
Definition: fts_sun.h:134
_ftsent::fts_pointer
void * fts_pointer
Definition: fts_sun.h:140
_ftsent::fts_dev
dev_t fts_dev
Definition: fts_sun.h:151
_ftsent::fts_parent
struct _ftsent * fts_parent
Definition: fts_sun.h:136
_ftsent::fts_namelen
u_short fts_namelen
Definition: fts_sun.h:148
_ftsent::fts_level
short fts_level
Definition: fts_sun.h:156
_ftsent::fts_symfd
int fts_symfd
Definition: fts_sun.h:146
FTS::fts_rfd
int fts_rfd
Definition: fts_sun.h:94
_ftsent::fts_ino
ino_t fts_ino
Definition: fts_sun.h:150
FTS::fts_path
char * fts_path
Definition: fts_sun.h:93
FTS::fts_nitems
int fts_nitems
Definition: fts_sun.h:96
_ftsent::fts_path
char * fts_path
Definition: fts_sun.h:144
FTS
Definition: fts_sun.h:84
_ftsent::fts_accpath
char * fts_accpath
Definition: fts_sun.h:142
_ftsent::fts_name
char fts_name[1]
Definition: fts_sun.h:186
_ftsent
Definition: fts_sun.h:132
_ftsent::fts_statp
struct stat * fts_statp
Definition: fts_sun.h:185
_ftsent::fts_errno
int fts_errno
Definition: fts_sun.h:145
_ftsent::fts_nlink
nlink_t fts_nlink
Definition: fts_sun.h:152
FTS::fts_dev
dev_t fts_dev
Definition: fts_sun.h:91
FTS::fts_cur
struct _ftsent * fts_cur
Definition: fts_sun.h:86
FTS::fts_child
struct _ftsent * fts_child
Definition: fts_sun.h:88
FTS::fts_array
struct _ftsent ** fts_array
Definition: fts_sun.h:90
_ftsent::fts_number
long fts_number
Definition: fts_sun.h:139
_ftsent::fts_pathlen
u_short fts_pathlen
Definition: fts_sun.h:147
_ftsent::fts_link
struct _ftsent * fts_link
Definition: fts_sun.h:138
FTS::fts_pathlen
int fts_pathlen
Definition: fts_sun.h:95