1*49cdfc7eSAndroid Build Coastguard Worker /*
2*49cdfc7eSAndroid Build Coastguard Worker *
3*49cdfc7eSAndroid Build Coastguard Worker * Copyright (c) International Business Machines Corp., 2002
4*49cdfc7eSAndroid Build Coastguard Worker *
5*49cdfc7eSAndroid Build Coastguard Worker * This program is free software; you can redistribute it and/or modify
6*49cdfc7eSAndroid Build Coastguard Worker * it under the terms of the GNU General Public License as published by
7*49cdfc7eSAndroid Build Coastguard Worker * the Free Software Foundation; either version 2 of the License, or
8*49cdfc7eSAndroid Build Coastguard Worker * (at your option) any later version.
9*49cdfc7eSAndroid Build Coastguard Worker *
10*49cdfc7eSAndroid Build Coastguard Worker * This program is distributed in the hope that it will be useful,
11*49cdfc7eSAndroid Build Coastguard Worker * but WITHOUT ANY WARRANTY; without even the implied warranty of
12*49cdfc7eSAndroid Build Coastguard Worker * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
13*49cdfc7eSAndroid Build Coastguard Worker * the GNU General Public License for more details.
14*49cdfc7eSAndroid Build Coastguard Worker *
15*49cdfc7eSAndroid Build Coastguard Worker * You should have received a copy of the GNU General Public License
16*49cdfc7eSAndroid Build Coastguard Worker * along with this program; if not, write to the Free Software
17*49cdfc7eSAndroid Build Coastguard Worker * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18*49cdfc7eSAndroid Build Coastguard Worker */
19*49cdfc7eSAndroid Build Coastguard Worker
20*49cdfc7eSAndroid Build Coastguard Worker /* 10/31/2002 Port to LTP [email protected] */
21*49cdfc7eSAndroid Build Coastguard Worker /* 06/30/2001 Port to Linux [email protected] */
22*49cdfc7eSAndroid Build Coastguard Worker
23*49cdfc7eSAndroid Build Coastguard Worker /*
24*49cdfc7eSAndroid Build Coastguard Worker * NAME
25*49cdfc7eSAndroid Build Coastguard Worker * nftw64.c - Test of nftw64()
26*49cdfc7eSAndroid Build Coastguard Worker */
27*49cdfc7eSAndroid Build Coastguard Worker
28*49cdfc7eSAndroid Build Coastguard Worker #include <pwd.h>
29*49cdfc7eSAndroid Build Coastguard Worker #include "nftw64.h"
30*49cdfc7eSAndroid Build Coastguard Worker
31*49cdfc7eSAndroid Build Coastguard Worker void setup(void);
32*49cdfc7eSAndroid Build Coastguard Worker void blenter(void);
33*49cdfc7eSAndroid Build Coastguard Worker void blexit(void);
34*49cdfc7eSAndroid Build Coastguard Worker void anyfail(void);
35*49cdfc7eSAndroid Build Coastguard Worker
36*49cdfc7eSAndroid Build Coastguard Worker char progname[] = "nftw64.c";
37*49cdfc7eSAndroid Build Coastguard Worker
38*49cdfc7eSAndroid Build Coastguard Worker /** LTP Port **/
39*49cdfc7eSAndroid Build Coastguard Worker #define FAILED 0
40*49cdfc7eSAndroid Build Coastguard Worker #define PASSED 1
41*49cdfc7eSAndroid Build Coastguard Worker
42*49cdfc7eSAndroid Build Coastguard Worker int local_flag = PASSED;
43*49cdfc7eSAndroid Build Coastguard Worker int block_number;
44*49cdfc7eSAndroid Build Coastguard Worker
45*49cdfc7eSAndroid Build Coastguard Worker FILE *temp;
46*49cdfc7eSAndroid Build Coastguard Worker char *TCID = "nftw6401";
47*49cdfc7eSAndroid Build Coastguard Worker int TST_TOTAL = 10;
48*49cdfc7eSAndroid Build Coastguard Worker
49*49cdfc7eSAndroid Build Coastguard Worker struct passwd *ltpuser; /* password struct for ltpuser */
50*49cdfc7eSAndroid Build Coastguard Worker /**************/
51*49cdfc7eSAndroid Build Coastguard Worker
52*49cdfc7eSAndroid Build Coastguard Worker /* Used for error return for some library routines */
53*49cdfc7eSAndroid Build Coastguard Worker int s2;
54*49cdfc7eSAndroid Build Coastguard Worker
55*49cdfc7eSAndroid Build Coastguard Worker /* error messages formatted here. */
56*49cdfc7eSAndroid Build Coastguard Worker char ebuf[ERR_BUF_SIZ];
57*49cdfc7eSAndroid Build Coastguard Worker
58*49cdfc7eSAndroid Build Coastguard Worker /*
59*49cdfc7eSAndroid Build Coastguard Worker * Local data declarations.
60*49cdfc7eSAndroid Build Coastguard Worker */
61*49cdfc7eSAndroid Build Coastguard Worker char *dirlist[NDIRLISTENTS];
62*49cdfc7eSAndroid Build Coastguard Worker
63*49cdfc7eSAndroid Build Coastguard Worker int visit;
64*49cdfc7eSAndroid Build Coastguard Worker int next_fd[4];
65*49cdfc7eSAndroid Build Coastguard Worker
66*49cdfc7eSAndroid Build Coastguard Worker pathdata pathdat[] = {
67*49cdfc7eSAndroid Build Coastguard Worker {
68*49cdfc7eSAndroid Build Coastguard Worker "./tmp/data",
69*49cdfc7eSAndroid Build Coastguard Worker S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH,
70*49cdfc7eSAndroid Build Coastguard Worker DIR, ""}, {
71*49cdfc7eSAndroid Build Coastguard Worker "./tmp/byebye",
72*49cdfc7eSAndroid Build Coastguard Worker S_IRWXU | S_IRWXG | S_IROTH | S_IWOTH,
73*49cdfc7eSAndroid Build Coastguard Worker REG, "byebye!\n"}, {
74*49cdfc7eSAndroid Build Coastguard Worker "./tmp/data/d333",
75*49cdfc7eSAndroid Build Coastguard Worker S_IRWXU | S_IRWXG | S_IRWXO,
76*49cdfc7eSAndroid Build Coastguard Worker DIR, ""}, {
77*49cdfc7eSAndroid Build Coastguard Worker "./tmp/data/d666",
78*49cdfc7eSAndroid Build Coastguard Worker S_IRWXU | S_IRWXG | S_IRWXO,
79*49cdfc7eSAndroid Build Coastguard Worker DIR, ""}, {
80*49cdfc7eSAndroid Build Coastguard Worker "./tmp/data/d777",
81*49cdfc7eSAndroid Build Coastguard Worker S_IRWXU | S_IRWXG
82*49cdfc7eSAndroid Build Coastguard Worker | S_IRWXO,
83*49cdfc7eSAndroid Build Coastguard Worker DIR, ""}, {
84*49cdfc7eSAndroid Build Coastguard Worker "./tmp/data/dirg",
85*49cdfc7eSAndroid Build Coastguard Worker S_IRWXU
86*49cdfc7eSAndroid Build Coastguard Worker |
87*49cdfc7eSAndroid Build Coastguard Worker S_IRWXG
88*49cdfc7eSAndroid Build Coastguard Worker |
89*49cdfc7eSAndroid Build Coastguard Worker S_IROTH
90*49cdfc7eSAndroid Build Coastguard Worker |
91*49cdfc7eSAndroid Build Coastguard Worker S_IWOTH,
92*49cdfc7eSAndroid Build Coastguard Worker DIR,
93*49cdfc7eSAndroid Build Coastguard Worker ""}, {
94*49cdfc7eSAndroid Build Coastguard Worker "./tmp/data/dirh",
95*49cdfc7eSAndroid Build Coastguard Worker S_IRWXU
96*49cdfc7eSAndroid Build Coastguard Worker |
97*49cdfc7eSAndroid Build Coastguard Worker S_IRWXG
98*49cdfc7eSAndroid Build Coastguard Worker |
99*49cdfc7eSAndroid Build Coastguard Worker S_IROTH
100*49cdfc7eSAndroid Build Coastguard Worker |
101*49cdfc7eSAndroid Build Coastguard Worker S_IWOTH,
102*49cdfc7eSAndroid Build Coastguard Worker DIR,
103*49cdfc7eSAndroid Build Coastguard Worker ""},
104*49cdfc7eSAndroid Build Coastguard Worker {
105*49cdfc7eSAndroid Build Coastguard Worker "./tmp/data/dirl",
106*49cdfc7eSAndroid Build Coastguard Worker S_IRWXU | S_IRWXG | S_IROTH | S_IWOTH,
107*49cdfc7eSAndroid Build Coastguard Worker DIR, ""}, {
108*49cdfc7eSAndroid Build Coastguard Worker "./tmp/data/d333/errs",
109*49cdfc7eSAndroid Build Coastguard Worker S_IRWXU | S_IRWXG | S_IROTH | S_IWOTH,
110*49cdfc7eSAndroid Build Coastguard Worker REG, "Do not eat yellow snow!\n"}, {
111*49cdfc7eSAndroid Build Coastguard Worker "./tmp/data/d666/errs",
112*49cdfc7eSAndroid Build Coastguard Worker S_IRWXU | S_IRWXG |
113*49cdfc7eSAndroid Build Coastguard Worker S_IROTH | S_IWOTH,
114*49cdfc7eSAndroid Build Coastguard Worker REG,
115*49cdfc7eSAndroid Build Coastguard Worker "Do not eat yellow snow!\n"},
116*49cdfc7eSAndroid Build Coastguard Worker {
117*49cdfc7eSAndroid Build Coastguard Worker "./tmp/data/d777/errs",
118*49cdfc7eSAndroid Build Coastguard Worker S_IRWXU | S_IRWXG | S_IROTH | S_IWOTH,
119*49cdfc7eSAndroid Build Coastguard Worker REG, "Do not eat yellow snow!\n"}, {
120*49cdfc7eSAndroid Build Coastguard Worker "./tmp/data/dirg/filebad",
121*49cdfc7eSAndroid Build Coastguard Worker S_IRUSR | S_IWUSR | S_IRGRP |
122*49cdfc7eSAndroid Build Coastguard Worker S_IROTH,
123*49cdfc7eSAndroid Build Coastguard Worker REG, ""}, {
124*49cdfc7eSAndroid Build Coastguard Worker "./tmp/data/dirg/fileok",
125*49cdfc7eSAndroid Build Coastguard Worker S_IRUSR | S_IWUSR |
126*49cdfc7eSAndroid Build Coastguard Worker S_IRGRP | S_IROTH,
127*49cdfc7eSAndroid Build Coastguard Worker REG, ""}, {
128*49cdfc7eSAndroid Build Coastguard Worker "./tmp/data/dirg/symlink",
129*49cdfc7eSAndroid Build Coastguard Worker S_IRWXU |
130*49cdfc7eSAndroid Build Coastguard Worker S_IRWXG |
131*49cdfc7eSAndroid Build Coastguard Worker S_IRWXO,
132*49cdfc7eSAndroid Build Coastguard Worker SYM,
133*49cdfc7eSAndroid Build Coastguard Worker "../../byebye"},
134*49cdfc7eSAndroid Build Coastguard Worker {
135*49cdfc7eSAndroid Build Coastguard Worker "./tmp/data/dirg/dir_left.1",
136*49cdfc7eSAndroid Build Coastguard Worker S_IRWXU | S_IRWXG | S_IROTH | S_IWOTH,
137*49cdfc7eSAndroid Build Coastguard Worker DIR, ""}, {
138*49cdfc7eSAndroid Build Coastguard Worker "./tmp/data/dirg/dir_left.1/dir_left.2",
139*49cdfc7eSAndroid Build Coastguard Worker S_IRWXU | S_IRWXG | S_IROTH | S_IWOTH,
140*49cdfc7eSAndroid Build Coastguard Worker DIR, ""}, {
141*49cdfc7eSAndroid Build Coastguard Worker "./tmp/data/dirg/dir_right.1",
142*49cdfc7eSAndroid Build Coastguard Worker S_IRWXU | S_IRWXG | S_IRWXO,
143*49cdfc7eSAndroid Build Coastguard Worker DIR, ""}, {
144*49cdfc7eSAndroid Build Coastguard Worker "./tmp/data/dirg/dir_left.1/dir_left.2/left.3",
145*49cdfc7eSAndroid Build Coastguard Worker S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP
146*49cdfc7eSAndroid Build Coastguard Worker | S_IROTH,
147*49cdfc7eSAndroid Build Coastguard Worker REG, ""}, {
148*49cdfc7eSAndroid Build Coastguard Worker "./tmp/data/dirh/dir_left.1",
149*49cdfc7eSAndroid Build Coastguard Worker S_IRWXU | S_IRWXG | S_IROTH
150*49cdfc7eSAndroid Build Coastguard Worker | S_IWOTH,
151*49cdfc7eSAndroid Build Coastguard Worker DIR, ""}, {
152*49cdfc7eSAndroid Build Coastguard Worker "./tmp/data/dirh/dir_right.1",
153*49cdfc7eSAndroid Build Coastguard Worker S_IRWXU |
154*49cdfc7eSAndroid Build Coastguard Worker S_IRWXG |
155*49cdfc7eSAndroid Build Coastguard Worker S_IROTH |
156*49cdfc7eSAndroid Build Coastguard Worker S_IWOTH,
157*49cdfc7eSAndroid Build Coastguard Worker DIR, ""}, {
158*49cdfc7eSAndroid Build Coastguard Worker "./tmp/data/dirh/dir_left.1/dir_left.2",
159*49cdfc7eSAndroid Build Coastguard Worker S_IRWXU
160*49cdfc7eSAndroid Build Coastguard Worker |
161*49cdfc7eSAndroid Build Coastguard Worker S_IRWXG
162*49cdfc7eSAndroid Build Coastguard Worker |
163*49cdfc7eSAndroid Build Coastguard Worker S_IROTH
164*49cdfc7eSAndroid Build Coastguard Worker |
165*49cdfc7eSAndroid Build Coastguard Worker S_IWOTH,
166*49cdfc7eSAndroid Build Coastguard Worker DIR,
167*49cdfc7eSAndroid Build Coastguard Worker ""},
168*49cdfc7eSAndroid Build Coastguard Worker {
169*49cdfc7eSAndroid Build Coastguard Worker "./tmp/data/dirh/dir_left.1/dir_left.2/left.3",
170*49cdfc7eSAndroid Build Coastguard Worker S_IRWXU | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH,
171*49cdfc7eSAndroid Build Coastguard Worker REG, "left leaf\n"}, {
172*49cdfc7eSAndroid Build Coastguard Worker "./tmp/data/dirh/dir_right.1/dir_right.2",
173*49cdfc7eSAndroid Build Coastguard Worker S_IRWXU | S_IRWXG | S_IROTH | S_IWOTH,
174*49cdfc7eSAndroid Build Coastguard Worker DIR, ""}, {
175*49cdfc7eSAndroid Build Coastguard Worker "./tmp/data/dirh/dir_right.1/dir_right.2/right.3",
176*49cdfc7eSAndroid Build Coastguard Worker S_IRWXU | S_IRGRP | S_IWGRP | S_IROTH
177*49cdfc7eSAndroid Build Coastguard Worker | S_IWOTH,
178*49cdfc7eSAndroid Build Coastguard Worker REG, "right leaf\n"}, {
179*49cdfc7eSAndroid Build Coastguard Worker "./tmp/data/dirl/dir_left.1",
180*49cdfc7eSAndroid Build Coastguard Worker S_IRWXU |
181*49cdfc7eSAndroid Build Coastguard Worker S_IRWXG |
182*49cdfc7eSAndroid Build Coastguard Worker S_IROTH |
183*49cdfc7eSAndroid Build Coastguard Worker S_IWOTH,
184*49cdfc7eSAndroid Build Coastguard Worker DIR, ""}, {
185*49cdfc7eSAndroid Build Coastguard Worker "./tmp/data/dirl/dir_left.1/dir_left.2",
186*49cdfc7eSAndroid Build Coastguard Worker S_IRWXU
187*49cdfc7eSAndroid Build Coastguard Worker |
188*49cdfc7eSAndroid Build Coastguard Worker S_IRWXG
189*49cdfc7eSAndroid Build Coastguard Worker |
190*49cdfc7eSAndroid Build Coastguard Worker S_IROTH
191*49cdfc7eSAndroid Build Coastguard Worker |
192*49cdfc7eSAndroid Build Coastguard Worker S_IWOTH,
193*49cdfc7eSAndroid Build Coastguard Worker DIR,
194*49cdfc7eSAndroid Build Coastguard Worker ""},
195*49cdfc7eSAndroid Build Coastguard Worker {
196*49cdfc7eSAndroid Build Coastguard Worker "./tmp/data/dirl/dir_left.1/dir_left.2/left.3",
197*49cdfc7eSAndroid Build Coastguard Worker 0,
198*49cdfc7eSAndroid Build Coastguard Worker SYM, "../../../dirh"}, {
199*49cdfc7eSAndroid Build Coastguard Worker "./tmp/data/dirl/dir_right.1",
200*49cdfc7eSAndroid Build Coastguard Worker S_IRWXU | S_IRWXG | S_IROTH | S_IWOTH,
201*49cdfc7eSAndroid Build Coastguard Worker DIR, ""}, {
202*49cdfc7eSAndroid Build Coastguard Worker "./tmp/data/dirl/dir_right.1/dir_right.2",
203*49cdfc7eSAndroid Build Coastguard Worker S_IRWXU | S_IRWXG | S_IROTH |
204*49cdfc7eSAndroid Build Coastguard Worker S_IWOTH,
205*49cdfc7eSAndroid Build Coastguard Worker DIR, ""}, {
206*49cdfc7eSAndroid Build Coastguard Worker "./tmp/data/dirl/dir_right.1/dir_right.2/right.3",
207*49cdfc7eSAndroid Build Coastguard Worker 0,
208*49cdfc7eSAndroid Build Coastguard Worker SYM, "../dir_right.2"}, {
209*49cdfc7eSAndroid Build Coastguard Worker "./tmp/data/loop",
210*49cdfc7eSAndroid Build Coastguard Worker 0,
211*49cdfc7eSAndroid Build Coastguard Worker SYM,
212*49cdfc7eSAndroid Build Coastguard Worker "./loop"}
213*49cdfc7eSAndroid Build Coastguard Worker };
214*49cdfc7eSAndroid Build Coastguard Worker
215*49cdfc7eSAndroid Build Coastguard Worker char *goodlist[] = {
216*49cdfc7eSAndroid Build Coastguard Worker "/dirh",
217*49cdfc7eSAndroid Build Coastguard Worker "/dirh/dir_left.1",
218*49cdfc7eSAndroid Build Coastguard Worker "/dirh/dir_right.1",
219*49cdfc7eSAndroid Build Coastguard Worker "/dirh/dir_left.1/dir_left.2",
220*49cdfc7eSAndroid Build Coastguard Worker "/dirh/dir_right.1/dir_right.2",
221*49cdfc7eSAndroid Build Coastguard Worker "/dirh/dir_left.1/dir_left.2/left.3",
222*49cdfc7eSAndroid Build Coastguard Worker "/dirh/dir_right.1/dir_right.2/right.3"
223*49cdfc7eSAndroid Build Coastguard Worker };
224*49cdfc7eSAndroid Build Coastguard Worker
225*49cdfc7eSAndroid Build Coastguard Worker struct list badlist[] = {
226*49cdfc7eSAndroid Build Coastguard Worker {"/dirg", FTW_D},
227*49cdfc7eSAndroid Build Coastguard Worker {"/dirg/dir_left.1", FTW_D},
228*49cdfc7eSAndroid Build Coastguard Worker /* not FTW_NS in following since stat can't fail if file exists */
229*49cdfc7eSAndroid Build Coastguard Worker {"/dirg/filebad", FTW_F},
230*49cdfc7eSAndroid Build Coastguard Worker {"/dirg/fileok", FTW_F},
231*49cdfc7eSAndroid Build Coastguard Worker {"/dirg/symlink", FTW_SL},
232*49cdfc7eSAndroid Build Coastguard Worker {"/dirg/dir_right.1", FTW_DNR},
233*49cdfc7eSAndroid Build Coastguard Worker {"/dirg/dir_left.1/dir_left.2", FTW_D},
234*49cdfc7eSAndroid Build Coastguard Worker {"/dirg/dir_left.1/dir_left.2/left.3", FTW_F},
235*49cdfc7eSAndroid Build Coastguard Worker };
236*49cdfc7eSAndroid Build Coastguard Worker
237*49cdfc7eSAndroid Build Coastguard Worker struct list mnem[] = {
238*49cdfc7eSAndroid Build Coastguard Worker {"FTW_F", FTW_F},
239*49cdfc7eSAndroid Build Coastguard Worker {"FTW_D", FTW_D},
240*49cdfc7eSAndroid Build Coastguard Worker {"FTW_DNR", FTW_DNR},
241*49cdfc7eSAndroid Build Coastguard Worker {"FTW_NS", FTW_NS},
242*49cdfc7eSAndroid Build Coastguard Worker {"FTW_SL", FTW_SL},
243*49cdfc7eSAndroid Build Coastguard Worker {"FTW_DP", FTW_DP},
244*49cdfc7eSAndroid Build Coastguard Worker {"FTW_SLN", FTW_SLN},
245*49cdfc7eSAndroid Build Coastguard Worker };
246*49cdfc7eSAndroid Build Coastguard Worker
247*49cdfc7eSAndroid Build Coastguard Worker int npathdats, ngoods, nbads, nmnem;
248*49cdfc7eSAndroid Build Coastguard Worker
249*49cdfc7eSAndroid Build Coastguard Worker /*--------------------------------------------------------------*/
main(void)250*49cdfc7eSAndroid Build Coastguard Worker int main(void)
251*49cdfc7eSAndroid Build Coastguard Worker {
252*49cdfc7eSAndroid Build Coastguard Worker setup(); /* temp file is now open */
253*49cdfc7eSAndroid Build Coastguard Worker
254*49cdfc7eSAndroid Build Coastguard Worker npathdats = ARRAY_SIZE(pathdat);
255*49cdfc7eSAndroid Build Coastguard Worker ngoods = ARRAY_SIZE(goodlist);
256*49cdfc7eSAndroid Build Coastguard Worker nbads = ARRAY_SIZE(badlist);
257*49cdfc7eSAndroid Build Coastguard Worker nmnem = ARRAY_SIZE(mnem);
258*49cdfc7eSAndroid Build Coastguard Worker
259*49cdfc7eSAndroid Build Coastguard Worker setup_path();
260*49cdfc7eSAndroid Build Coastguard Worker
261*49cdfc7eSAndroid Build Coastguard Worker /*---------------- ENTER BLOCK 0 --------------------------------*/
262*49cdfc7eSAndroid Build Coastguard Worker blenter();
263*49cdfc7eSAndroid Build Coastguard Worker #ifdef DEBUG
264*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp,
265*49cdfc7eSAndroid Build Coastguard Worker "A call to int nftw64(const char *path, int (*fn)(const\n");
266*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "char *, const struct stat *, int, struct FTW *), int\n");
267*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "depth, int flags) shall recursively descend the\n");
268*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "directory hierarchy rooted in path until it has\n");
269*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp,
270*49cdfc7eSAndroid Build Coastguard Worker "traversed the whole tree, calling the function fn for\n");
271*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "each object in the directory tree, and return 0.\n\n");
272*49cdfc7eSAndroid Build Coastguard Worker #endif
273*49cdfc7eSAndroid Build Coastguard Worker test1A();
274*49cdfc7eSAndroid Build Coastguard Worker blexit();
275*49cdfc7eSAndroid Build Coastguard Worker /*--------------- EXIT BLOCK 0 ---------------------------------*/
276*49cdfc7eSAndroid Build Coastguard Worker
277*49cdfc7eSAndroid Build Coastguard Worker /*---------------- ENTER BLOCK 1 --------------------------------*/
278*49cdfc7eSAndroid Build Coastguard Worker blenter();
279*49cdfc7eSAndroid Build Coastguard Worker #ifdef DEBUG
280*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp,
281*49cdfc7eSAndroid Build Coastguard Worker "A call to int nftw64(const char *path, int (*fn)(const\n");
282*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "char *, const struct stat *, int, struct FTW *), int\n");
283*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "depth, int flags) when flags contains FTW_PHYS shall\n");
284*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "not traverse symbolic links.\n\n");
285*49cdfc7eSAndroid Build Coastguard Worker #endif
286*49cdfc7eSAndroid Build Coastguard Worker test2A();
287*49cdfc7eSAndroid Build Coastguard Worker blexit();
288*49cdfc7eSAndroid Build Coastguard Worker /*--------------- EXIT BLOCK 1 ---------------------------------*/
289*49cdfc7eSAndroid Build Coastguard Worker
290*49cdfc7eSAndroid Build Coastguard Worker /*---------------- ENTER BLOCK 2 --------------------------------*/
291*49cdfc7eSAndroid Build Coastguard Worker blenter();
292*49cdfc7eSAndroid Build Coastguard Worker #ifdef DEBUG
293*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp,
294*49cdfc7eSAndroid Build Coastguard Worker "A call to int nftw64(const char *path, int (*fn)(const\n");
295*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "char *, const struct stat *, int, struct FTW *), int\n");
296*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp,
297*49cdfc7eSAndroid Build Coastguard Worker "depth, int flags) when flags does not contain FTW_PHYS\n");
298*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp,
299*49cdfc7eSAndroid Build Coastguard Worker "shall follow links instead of reporting them and shall\n");
300*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "not report the same file twice.\n\n");
301*49cdfc7eSAndroid Build Coastguard Worker #endif
302*49cdfc7eSAndroid Build Coastguard Worker test3A();
303*49cdfc7eSAndroid Build Coastguard Worker blexit();
304*49cdfc7eSAndroid Build Coastguard Worker /*--------------- EXIT BLOCK 2 ---------------------------------*/
305*49cdfc7eSAndroid Build Coastguard Worker
306*49cdfc7eSAndroid Build Coastguard Worker /*---------------- ENTER BLOCK 3 --------------------------------*/
307*49cdfc7eSAndroid Build Coastguard Worker blenter();
308*49cdfc7eSAndroid Build Coastguard Worker #ifdef DEBUG
309*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp,
310*49cdfc7eSAndroid Build Coastguard Worker "A call to int nftw64(const char *path, int (*fn)(const\n");
311*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "char *, const struct stat *, int, struct FTW *), int\n");
312*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp,
313*49cdfc7eSAndroid Build Coastguard Worker "depth, int flags) when flags contains FTW_DEPTH shall\n");
314*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "report all files in a directory before reporting the\n");
315*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "directory.\n\n");
316*49cdfc7eSAndroid Build Coastguard Worker #endif
317*49cdfc7eSAndroid Build Coastguard Worker test4A();
318*49cdfc7eSAndroid Build Coastguard Worker blexit();
319*49cdfc7eSAndroid Build Coastguard Worker /*--------------- EXIT BLOCK 3 ---------------------------------*/
320*49cdfc7eSAndroid Build Coastguard Worker
321*49cdfc7eSAndroid Build Coastguard Worker /*---------------- ENTER BLOCK 4 --------------------------------*/
322*49cdfc7eSAndroid Build Coastguard Worker blenter();
323*49cdfc7eSAndroid Build Coastguard Worker #ifdef DEBUG
324*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp,
325*49cdfc7eSAndroid Build Coastguard Worker "A call to int nftw64(const char *path, int (*fn)(const\n");
326*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "char *, const struct stat *, int, struct FTW *), int\n");
327*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "depth, int flags) when flags does not contain\n");
328*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "FTW_DEPTH shall report a directory before reporting\n");
329*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "the files in that directory.\n\n");
330*49cdfc7eSAndroid Build Coastguard Worker #endif
331*49cdfc7eSAndroid Build Coastguard Worker test5A();
332*49cdfc7eSAndroid Build Coastguard Worker blexit();
333*49cdfc7eSAndroid Build Coastguard Worker /*--------------- EXIT BLOCK 4 ---------------------------------*/
334*49cdfc7eSAndroid Build Coastguard Worker
335*49cdfc7eSAndroid Build Coastguard Worker /*---------------- ENTER BLOCK 5 --------------------------------*/
336*49cdfc7eSAndroid Build Coastguard Worker blenter();
337*49cdfc7eSAndroid Build Coastguard Worker #ifdef DEBUG
338*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp,
339*49cdfc7eSAndroid Build Coastguard Worker "A call to int nftw64(const char *path, int (*fn)(const\n");
340*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "char *, const struct stat *, int, struct FTW *), int\n");
341*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp,
342*49cdfc7eSAndroid Build Coastguard Worker "depth, int flags) when flags contains FTW_CHDIR shall\n");
343*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp,
344*49cdfc7eSAndroid Build Coastguard Worker "change the current working directory to each directory\n");
345*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "as it reports files in that directory.\n\n");
346*49cdfc7eSAndroid Build Coastguard Worker #endif
347*49cdfc7eSAndroid Build Coastguard Worker test6A();
348*49cdfc7eSAndroid Build Coastguard Worker blexit();
349*49cdfc7eSAndroid Build Coastguard Worker /*--------------- EXIT BLOCK 5 ---------------------------------*/
350*49cdfc7eSAndroid Build Coastguard Worker
351*49cdfc7eSAndroid Build Coastguard Worker /*---------------- ENTER BLOCK 6 --------------------------------*/
352*49cdfc7eSAndroid Build Coastguard Worker blenter();
353*49cdfc7eSAndroid Build Coastguard Worker #ifdef DEBUG
354*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp,
355*49cdfc7eSAndroid Build Coastguard Worker "A call to int nftw64(const char *path, int (*fn)(const\n");
356*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "char *, const struct stat *, int, struct FTW *), int\n");
357*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "depth, int flags) shall pass the path-name of the\n");
358*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "current object as the first argument of the function\n");
359*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "fn.\n\n");
360*49cdfc7eSAndroid Build Coastguard Worker #endif
361*49cdfc7eSAndroid Build Coastguard Worker test7A();
362*49cdfc7eSAndroid Build Coastguard Worker blexit();
363*49cdfc7eSAndroid Build Coastguard Worker /*--------------- EXIT BLOCK 6 ---------------------------------*/
364*49cdfc7eSAndroid Build Coastguard Worker
365*49cdfc7eSAndroid Build Coastguard Worker /*---------------- ENTER BLOCK 7 --------------------------------*/
366*49cdfc7eSAndroid Build Coastguard Worker blenter();
367*49cdfc7eSAndroid Build Coastguard Worker #ifdef DEBUG
368*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp,
369*49cdfc7eSAndroid Build Coastguard Worker "A call to int nftw64(const char *path, int (*fn)(const\n");
370*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "char *, const struct stat *, int, struct FTW *), int\n");
371*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "depth, int flags) shall pass a pointer to a stat\n");
372*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "structure containing information about the current\n");
373*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "object as the second argument to fn.\n\n");
374*49cdfc7eSAndroid Build Coastguard Worker #endif
375*49cdfc7eSAndroid Build Coastguard Worker test8A();
376*49cdfc7eSAndroid Build Coastguard Worker blexit();
377*49cdfc7eSAndroid Build Coastguard Worker /*--------------- EXIT BLOCK 7 ---------------------------------*/
378*49cdfc7eSAndroid Build Coastguard Worker
379*49cdfc7eSAndroid Build Coastguard Worker /*---------------- ENTER BLOCK 8 --------------------------------*/
380*49cdfc7eSAndroid Build Coastguard Worker blenter();
381*49cdfc7eSAndroid Build Coastguard Worker #ifdef DEBUG
382*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp,
383*49cdfc7eSAndroid Build Coastguard Worker "A call to int nftw64(const char *path, int (*fn)(const\n");
384*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "char *, const struct stat *, int, struct FTW *), int\n");
385*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "depth, int flags) shall pass FTW_F as the third\n");
386*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp,
387*49cdfc7eSAndroid Build Coastguard Worker "argument of the function fn when the object is a file.\n\n");
388*49cdfc7eSAndroid Build Coastguard Worker #endif
389*49cdfc7eSAndroid Build Coastguard Worker test9A();
390*49cdfc7eSAndroid Build Coastguard Worker blexit();
391*49cdfc7eSAndroid Build Coastguard Worker /*--------------- EXIT BLOCK 8 ---------------------------------*/
392*49cdfc7eSAndroid Build Coastguard Worker
393*49cdfc7eSAndroid Build Coastguard Worker /*---------------- ENTER BLOCK 9 --------------------------------*/
394*49cdfc7eSAndroid Build Coastguard Worker blenter();
395*49cdfc7eSAndroid Build Coastguard Worker #ifdef DEBUG
396*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp,
397*49cdfc7eSAndroid Build Coastguard Worker "A call to int nftw64(const char *path, int (*fn)(const\n");
398*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "char *, const struct stat *, int, struct FTW *), int\n");
399*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "depth, int flags) shall pass FTW_D as the third\n");
400*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "argument of the function fn when the object is a\n");
401*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "directory.\n\n");
402*49cdfc7eSAndroid Build Coastguard Worker #endif
403*49cdfc7eSAndroid Build Coastguard Worker test10A();
404*49cdfc7eSAndroid Build Coastguard Worker blexit();
405*49cdfc7eSAndroid Build Coastguard Worker /*--------------- EXIT BLOCK 9 ---------------------------------*/
406*49cdfc7eSAndroid Build Coastguard Worker
407*49cdfc7eSAndroid Build Coastguard Worker /*---------------- ENTER BLOCK 10 --------------------------------*/
408*49cdfc7eSAndroid Build Coastguard Worker blenter();
409*49cdfc7eSAndroid Build Coastguard Worker #ifdef DEBUG
410*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp,
411*49cdfc7eSAndroid Build Coastguard Worker "A call to int nftw64(const char *path, int (*fn)(const\n");
412*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "char *, const struct stat *, int, struct FTW *), int\n");
413*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "depth, int flags) shall pass FTW_DP as the third\n");
414*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "argument of the function fn when the object is a\n");
415*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "directory and subdirectories have been visited.\n\n");
416*49cdfc7eSAndroid Build Coastguard Worker #endif
417*49cdfc7eSAndroid Build Coastguard Worker test11A();
418*49cdfc7eSAndroid Build Coastguard Worker blexit();
419*49cdfc7eSAndroid Build Coastguard Worker /*--------------- EXIT BLOCK 10 ---------------------------------*/
420*49cdfc7eSAndroid Build Coastguard Worker
421*49cdfc7eSAndroid Build Coastguard Worker /*---------------- ENTER BLOCK 11 --------------------------------*/
422*49cdfc7eSAndroid Build Coastguard Worker blenter();
423*49cdfc7eSAndroid Build Coastguard Worker #ifdef DEBUG
424*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp,
425*49cdfc7eSAndroid Build Coastguard Worker "A call to int nftw64(const char *path, int (*fn)(const\n");
426*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "char *, const struct stat *, int, struct FTW *), int\n");
427*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "depth, int flags) shall pass FTW_SL as the third\n");
428*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "argument of the function fn when the object is a\n");
429*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "symbolic link.\n\n");
430*49cdfc7eSAndroid Build Coastguard Worker #endif
431*49cdfc7eSAndroid Build Coastguard Worker test12A();
432*49cdfc7eSAndroid Build Coastguard Worker blexit();
433*49cdfc7eSAndroid Build Coastguard Worker /*--------------- EXIT BLOCK 11 ---------------------------------*/
434*49cdfc7eSAndroid Build Coastguard Worker
435*49cdfc7eSAndroid Build Coastguard Worker /*---------------- ENTER BLOCK 12 --------------------------------*/
436*49cdfc7eSAndroid Build Coastguard Worker blenter();
437*49cdfc7eSAndroid Build Coastguard Worker #ifdef DEBUG
438*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp,
439*49cdfc7eSAndroid Build Coastguard Worker "A call to int nftw64(const char *path, int (*fn)(const\n");
440*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "char *, const struct stat *, int, struct FTW *), int\n");
441*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "depth, int flags) shall pass FTW_SLN as the third\n");
442*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "argument of the function fn when the object is a\n");
443*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "symbolic link that does not name an existing file.\n\n");
444*49cdfc7eSAndroid Build Coastguard Worker #endif
445*49cdfc7eSAndroid Build Coastguard Worker test13A();
446*49cdfc7eSAndroid Build Coastguard Worker blexit();
447*49cdfc7eSAndroid Build Coastguard Worker /*--------------- EXIT BLOCK 12 ---------------------------------*/
448*49cdfc7eSAndroid Build Coastguard Worker
449*49cdfc7eSAndroid Build Coastguard Worker /*---------------- ENTER BLOCK 13 --------------------------------*/
450*49cdfc7eSAndroid Build Coastguard Worker blenter();
451*49cdfc7eSAndroid Build Coastguard Worker #ifdef DEBUG
452*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp,
453*49cdfc7eSAndroid Build Coastguard Worker "A call to int nftw64(const char *path, int (*fn)(const\n");
454*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "char *, const struct stat *, int, struct FTW *), int\n");
455*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "depth, int flags) shall pass FTW_DNR as the third\n");
456*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "argument of the function fn when the object is a\n");
457*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "directory that cannot be read.\n\n");
458*49cdfc7eSAndroid Build Coastguard Worker #endif
459*49cdfc7eSAndroid Build Coastguard Worker test14A();
460*49cdfc7eSAndroid Build Coastguard Worker blexit();
461*49cdfc7eSAndroid Build Coastguard Worker /*--------------- EXIT BLOCK 13 ---------------------------------*/
462*49cdfc7eSAndroid Build Coastguard Worker
463*49cdfc7eSAndroid Build Coastguard Worker /*---------------- ENTER BLOCK 14 --------------------------------*/
464*49cdfc7eSAndroid Build Coastguard Worker blenter();
465*49cdfc7eSAndroid Build Coastguard Worker #ifdef DEBUG
466*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp,
467*49cdfc7eSAndroid Build Coastguard Worker "A call to int nftw64(const char *path, int (*fn)(const\n");
468*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "char *, const struct stat *, int, struct FTW *), int\n");
469*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "depth, int flags) shall pass FTW_NS as the third\n");
470*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp,
471*49cdfc7eSAndroid Build Coastguard Worker "argument of the function fn when stat() failed on the\n");
472*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "object because of lack of appropriate permission.\n\n");
473*49cdfc7eSAndroid Build Coastguard Worker #endif
474*49cdfc7eSAndroid Build Coastguard Worker test15A();
475*49cdfc7eSAndroid Build Coastguard Worker blexit();
476*49cdfc7eSAndroid Build Coastguard Worker /*--------------- EXIT BLOCK 14 ---------------------------------*/
477*49cdfc7eSAndroid Build Coastguard Worker
478*49cdfc7eSAndroid Build Coastguard Worker /*---------------- ENTER BLOCK 15 --------------------------------*/
479*49cdfc7eSAndroid Build Coastguard Worker blenter();
480*49cdfc7eSAndroid Build Coastguard Worker #ifdef DEBUG
481*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp,
482*49cdfc7eSAndroid Build Coastguard Worker "A call to int nftw64(const char *path, int (*fn)(const\n");
483*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "char *, const struct stat *, int, struct FTW *), int\n");
484*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "depth, int flags) shall pass a structure which\n");
485*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "contains the offset into the pathname of the object\n");
486*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "and the depth relative to the root of the walk\n");
487*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp,
488*49cdfc7eSAndroid Build Coastguard Worker "starting from 0 as the fourth argument of the function\n");
489*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "fn.\n\n");
490*49cdfc7eSAndroid Build Coastguard Worker #endif
491*49cdfc7eSAndroid Build Coastguard Worker test16A();
492*49cdfc7eSAndroid Build Coastguard Worker blexit();
493*49cdfc7eSAndroid Build Coastguard Worker /*--------------- EXIT BLOCK 15 ---------------------------------*/
494*49cdfc7eSAndroid Build Coastguard Worker
495*49cdfc7eSAndroid Build Coastguard Worker /*---------------- ENTER BLOCK 16 --------------------------------*/
496*49cdfc7eSAndroid Build Coastguard Worker blenter();
497*49cdfc7eSAndroid Build Coastguard Worker #ifdef DEBUG
498*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp,
499*49cdfc7eSAndroid Build Coastguard Worker "A call to int nftw64(const char *path, int (*fn)(const\n");
500*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "char *, const struct stat *, int, struct FTW *), int\n");
501*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "depth, int flags) shall pass FTW_SL as the third\n");
502*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "argument to the function fn if and only if the\n");
503*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "FTW_PHYS flag is included in flags.\n\n");
504*49cdfc7eSAndroid Build Coastguard Worker #endif
505*49cdfc7eSAndroid Build Coastguard Worker test17A();
506*49cdfc7eSAndroid Build Coastguard Worker blexit();
507*49cdfc7eSAndroid Build Coastguard Worker /*--------------- EXIT BLOCK 16 ---------------------------------*/
508*49cdfc7eSAndroid Build Coastguard Worker
509*49cdfc7eSAndroid Build Coastguard Worker /*---------------- ENTER BLOCK 17 --------------------------------*/
510*49cdfc7eSAndroid Build Coastguard Worker blenter();
511*49cdfc7eSAndroid Build Coastguard Worker #ifdef DEBUG
512*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp,
513*49cdfc7eSAndroid Build Coastguard Worker "A call to int nftw64(const char *path, int (*fn)(const\n");
514*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "char *, const struct stat *, int, struct FTW *), int\n");
515*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "depth, int flags) shall pass FTW_SLN as the third\n");
516*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "argument to the function fn if and only if the\n");
517*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "FTW_PHYS flag is not included in flags.\n\n");
518*49cdfc7eSAndroid Build Coastguard Worker #endif
519*49cdfc7eSAndroid Build Coastguard Worker test18A();
520*49cdfc7eSAndroid Build Coastguard Worker blexit();
521*49cdfc7eSAndroid Build Coastguard Worker /*--------------- EXIT BLOCK 17 ---------------------------------*/
522*49cdfc7eSAndroid Build Coastguard Worker
523*49cdfc7eSAndroid Build Coastguard Worker /*---------------- ENTER BLOCK 18 --------------------------------*/
524*49cdfc7eSAndroid Build Coastguard Worker blenter();
525*49cdfc7eSAndroid Build Coastguard Worker #ifdef DEBUG
526*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "On a call to int nftw64(const char *path, int\n");
527*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "(*fn)(const char *, const struct stat *, int, struct\n");
528*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp,
529*49cdfc7eSAndroid Build Coastguard Worker "FTW *), int depth, int flags) when the third argument\n");
530*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "passed to the function fn is FTW_DNR then the\n");
531*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp,
532*49cdfc7eSAndroid Build Coastguard Worker "descendants of the directory shall not be processed.\n\n");
533*49cdfc7eSAndroid Build Coastguard Worker #endif
534*49cdfc7eSAndroid Build Coastguard Worker test19A();
535*49cdfc7eSAndroid Build Coastguard Worker blexit();
536*49cdfc7eSAndroid Build Coastguard Worker /*--------------- EXIT BLOCK 18 ---------------------------------*/
537*49cdfc7eSAndroid Build Coastguard Worker
538*49cdfc7eSAndroid Build Coastguard Worker /*---------------- ENTER BLOCK 19 --------------------------------*/
539*49cdfc7eSAndroid Build Coastguard Worker blenter();
540*49cdfc7eSAndroid Build Coastguard Worker #ifdef DEBUG
541*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp,
542*49cdfc7eSAndroid Build Coastguard Worker "A call to int nftw64(const char *path, int (*fn)(const\n");
543*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "char *, const struct stat *, int, struct FTW *), int\n");
544*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp,
545*49cdfc7eSAndroid Build Coastguard Worker "depth, int flags) shall close any file descriptors or\n");
546*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp,
547*49cdfc7eSAndroid Build Coastguard Worker "directory streams used to traverse the directory tree.\n\n");
548*49cdfc7eSAndroid Build Coastguard Worker #endif
549*49cdfc7eSAndroid Build Coastguard Worker test20A();
550*49cdfc7eSAndroid Build Coastguard Worker blexit();
551*49cdfc7eSAndroid Build Coastguard Worker /*--------------- EXIT BLOCK 19 ---------------------------------*/
552*49cdfc7eSAndroid Build Coastguard Worker
553*49cdfc7eSAndroid Build Coastguard Worker /*---------------- ENTER BLOCK 20 --------------------------------*/
554*49cdfc7eSAndroid Build Coastguard Worker blenter();
555*49cdfc7eSAndroid Build Coastguard Worker #ifdef DEBUG
556*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "On a call to int nftw64(const char *path, int\n");
557*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "(*fn)(const char *, const struct stat *, int, struct\n");
558*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "FTW *), int depth, int flags) depth shall be the\n");
559*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp,
560*49cdfc7eSAndroid Build Coastguard Worker "maximum number of file descriptors used for the search.\n\n");
561*49cdfc7eSAndroid Build Coastguard Worker #endif
562*49cdfc7eSAndroid Build Coastguard Worker test21A();
563*49cdfc7eSAndroid Build Coastguard Worker blexit();
564*49cdfc7eSAndroid Build Coastguard Worker /*--------------- EXIT BLOCK 20 ---------------------------------*/
565*49cdfc7eSAndroid Build Coastguard Worker
566*49cdfc7eSAndroid Build Coastguard Worker /*---------------- ENTER BLOCK 21 --------------------------------*/
567*49cdfc7eSAndroid Build Coastguard Worker blenter();
568*49cdfc7eSAndroid Build Coastguard Worker #ifdef DEBUG
569*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp,
570*49cdfc7eSAndroid Build Coastguard Worker "A call to int nftw64(const char *path, int (*fn)(const\n");
571*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "char *, const struct stat *, int, struct FTW *), int\n");
572*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "depth, int flags) shall use at most one file\n");
573*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "descriptor for each directory level.\n\n");
574*49cdfc7eSAndroid Build Coastguard Worker #endif
575*49cdfc7eSAndroid Build Coastguard Worker test22A();
576*49cdfc7eSAndroid Build Coastguard Worker blexit();
577*49cdfc7eSAndroid Build Coastguard Worker /*--------------- EXIT BLOCK 21 ---------------------------------*/
578*49cdfc7eSAndroid Build Coastguard Worker
579*49cdfc7eSAndroid Build Coastguard Worker /*---------------- ENTER BLOCK 22 --------------------------------*/
580*49cdfc7eSAndroid Build Coastguard Worker blenter();
581*49cdfc7eSAndroid Build Coastguard Worker #ifdef DEBUG
582*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp,
583*49cdfc7eSAndroid Build Coastguard Worker "A call to int nftw64(const char *path, int (*fn)(const\n");
584*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "char *, const struct stat *, int, struct FTW *), int\n");
585*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "depth, int flags) when the function fn returns a\n");
586*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "non-zero value shall stop and return the value\n");
587*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "returned by fn.\n\n");
588*49cdfc7eSAndroid Build Coastguard Worker #endif
589*49cdfc7eSAndroid Build Coastguard Worker test23A();
590*49cdfc7eSAndroid Build Coastguard Worker blexit();
591*49cdfc7eSAndroid Build Coastguard Worker /*--------------- EXIT BLOCK 22 ---------------------------------*/
592*49cdfc7eSAndroid Build Coastguard Worker
593*49cdfc7eSAndroid Build Coastguard Worker /*---------------- ENTER BLOCK 23 --------------------------------*/
594*49cdfc7eSAndroid Build Coastguard Worker blenter();
595*49cdfc7eSAndroid Build Coastguard Worker #ifdef DEBUG
596*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "ENAMETOOLONG in errno and return -1 on a call to int\n");
597*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp,
598*49cdfc7eSAndroid Build Coastguard Worker "nftw64(const char *path, int (*fn)(const char *, const\n");
599*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "struct stat *, int, struct FTW *), int depth, int\n");
600*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "flags) when the length of path exceeds PATH_MAX.\n\n");
601*49cdfc7eSAndroid Build Coastguard Worker #endif
602*49cdfc7eSAndroid Build Coastguard Worker test24A();
603*49cdfc7eSAndroid Build Coastguard Worker blexit();
604*49cdfc7eSAndroid Build Coastguard Worker /*--------------- EXIT BLOCK 23 ---------------------------------*/
605*49cdfc7eSAndroid Build Coastguard Worker
606*49cdfc7eSAndroid Build Coastguard Worker /*---------------- ENTER BLOCK 24 --------------------------------*/
607*49cdfc7eSAndroid Build Coastguard Worker blenter();
608*49cdfc7eSAndroid Build Coastguard Worker #ifdef DEBUG
609*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "ENAMETOOLONG in errno and return -1 on a call to int\n");
610*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp,
611*49cdfc7eSAndroid Build Coastguard Worker "nftw64(const char *path, int (*fn)(const char *, const\n");
612*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "struct stat *, int, struct FTW *), int depth, int\n");
613*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "flags) when a component of path exceeds NAME_MAX.\n\n");
614*49cdfc7eSAndroid Build Coastguard Worker #endif
615*49cdfc7eSAndroid Build Coastguard Worker test25A();
616*49cdfc7eSAndroid Build Coastguard Worker blexit();
617*49cdfc7eSAndroid Build Coastguard Worker /*--------------- EXIT BLOCK 24 ---------------------------------*/
618*49cdfc7eSAndroid Build Coastguard Worker
619*49cdfc7eSAndroid Build Coastguard Worker /*---------------- ENTER BLOCK 25 --------------------------------*/
620*49cdfc7eSAndroid Build Coastguard Worker blenter();
621*49cdfc7eSAndroid Build Coastguard Worker #ifdef DEBUG
622*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "ENOENT in errno and return -1 on a call to int\n");
623*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp,
624*49cdfc7eSAndroid Build Coastguard Worker "nftw64(const char *path, int (*fn)(const char *, const\n");
625*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "struct stat *, int, struct FTW *), int depth, int\n");
626*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp,
627*49cdfc7eSAndroid Build Coastguard Worker "flags) when path points to a file which does not exist.\n\n");
628*49cdfc7eSAndroid Build Coastguard Worker #endif
629*49cdfc7eSAndroid Build Coastguard Worker test26A();
630*49cdfc7eSAndroid Build Coastguard Worker blexit();
631*49cdfc7eSAndroid Build Coastguard Worker /*--------------- EXIT BLOCK 25 ---------------------------------*/
632*49cdfc7eSAndroid Build Coastguard Worker
633*49cdfc7eSAndroid Build Coastguard Worker /*---------------- ENTER BLOCK 26 --------------------------------*/
634*49cdfc7eSAndroid Build Coastguard Worker blenter();
635*49cdfc7eSAndroid Build Coastguard Worker #ifdef DEBUG
636*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "ENOENT in errno and return -1 on a call to int\n");
637*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp,
638*49cdfc7eSAndroid Build Coastguard Worker "nftw64(const char *path, int (*fn)(const char *, const\n");
639*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "struct stat *, int, struct FTW *), int depth, int\n");
640*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "flags) when path points to an empty string.\n\n");
641*49cdfc7eSAndroid Build Coastguard Worker #endif
642*49cdfc7eSAndroid Build Coastguard Worker test27A();
643*49cdfc7eSAndroid Build Coastguard Worker blexit();
644*49cdfc7eSAndroid Build Coastguard Worker /*--------------- EXIT BLOCK 26 ---------------------------------*/
645*49cdfc7eSAndroid Build Coastguard Worker
646*49cdfc7eSAndroid Build Coastguard Worker /*---------------- ENTER BLOCK 27 --------------------------------*/
647*49cdfc7eSAndroid Build Coastguard Worker blenter();
648*49cdfc7eSAndroid Build Coastguard Worker #ifdef DEBUG
649*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "ENOTDIR in errno and return -1 on a call to int\n");
650*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp,
651*49cdfc7eSAndroid Build Coastguard Worker "nftw64(const char *path, int (*fn)(const char *, const\n");
652*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "struct stat *, int, struct FTW *), int depth, int\n");
653*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "flags) when path is not a directory.\n\n");
654*49cdfc7eSAndroid Build Coastguard Worker #endif
655*49cdfc7eSAndroid Build Coastguard Worker test28A();
656*49cdfc7eSAndroid Build Coastguard Worker blexit();
657*49cdfc7eSAndroid Build Coastguard Worker /*--------------- EXIT BLOCK 27 ---------------------------------*/
658*49cdfc7eSAndroid Build Coastguard Worker
659*49cdfc7eSAndroid Build Coastguard Worker /*---------------- ENTER BLOCK 28 --------------------------------*/
660*49cdfc7eSAndroid Build Coastguard Worker blenter();
661*49cdfc7eSAndroid Build Coastguard Worker #ifdef DEBUG
662*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "EACCES in errno and return -1 on a call to int\n");
663*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp,
664*49cdfc7eSAndroid Build Coastguard Worker "nftw64(const char *path, int (*fn)(const char *, const\n");
665*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "struct stat *, int, struct FTW *), int depth, int\n");
666*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "flags) when search permission is denied for any\n");
667*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "component of path.\n\n");
668*49cdfc7eSAndroid Build Coastguard Worker #endif
669*49cdfc7eSAndroid Build Coastguard Worker test29A();
670*49cdfc7eSAndroid Build Coastguard Worker blexit();
671*49cdfc7eSAndroid Build Coastguard Worker /*--------------- EXIT BLOCK 28 ---------------------------------*/
672*49cdfc7eSAndroid Build Coastguard Worker
673*49cdfc7eSAndroid Build Coastguard Worker /*---------------- ENTER BLOCK 29 --------------------------------*/
674*49cdfc7eSAndroid Build Coastguard Worker blenter();
675*49cdfc7eSAndroid Build Coastguard Worker #ifdef DEBUG
676*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "EACCES in errno and return -1 on a call to int\n");
677*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp,
678*49cdfc7eSAndroid Build Coastguard Worker "nftw64(const char *path, int (*fn)(const char *, const\n");
679*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "struct stat *, int, struct FTW *), int depth, int\n");
680*49cdfc7eSAndroid Build Coastguard Worker fprintf(temp, "flags) when read permission is denied for path.\n\n");
681*49cdfc7eSAndroid Build Coastguard Worker #endif
682*49cdfc7eSAndroid Build Coastguard Worker test30A();
683*49cdfc7eSAndroid Build Coastguard Worker blexit();
684*49cdfc7eSAndroid Build Coastguard Worker /*--------------- EXIT BLOCK 29 ---------------------------------*/
685*49cdfc7eSAndroid Build Coastguard Worker
686*49cdfc7eSAndroid Build Coastguard Worker cleanup_function();
687*49cdfc7eSAndroid Build Coastguard Worker
688*49cdfc7eSAndroid Build Coastguard Worker anyfail(); /* THIS CALL DOES NOT RETURN - EXITS!! */
689*49cdfc7eSAndroid Build Coastguard Worker
690*49cdfc7eSAndroid Build Coastguard Worker tst_exit();
691*49cdfc7eSAndroid Build Coastguard Worker }
692*49cdfc7eSAndroid Build Coastguard Worker
693*49cdfc7eSAndroid Build Coastguard Worker /*--------------------------------------------------------------*/
694*49cdfc7eSAndroid Build Coastguard Worker
695*49cdfc7eSAndroid Build Coastguard Worker /** LTP Port **/
696*49cdfc7eSAndroid Build Coastguard Worker /*
697*49cdfc7eSAndroid Build Coastguard Worker * setup
698*49cdfc7eSAndroid Build Coastguard Worker *
699*49cdfc7eSAndroid Build Coastguard Worker * Do set up - here its a dummy function
700*49cdfc7eSAndroid Build Coastguard Worker */
setup(void)701*49cdfc7eSAndroid Build Coastguard Worker void setup(void)
702*49cdfc7eSAndroid Build Coastguard Worker {
703*49cdfc7eSAndroid Build Coastguard Worker /* Direct debug output to stderr */
704*49cdfc7eSAndroid Build Coastguard Worker temp = stderr;
705*49cdfc7eSAndroid Build Coastguard Worker
706*49cdfc7eSAndroid Build Coastguard Worker /* Get the user id "nobody" */
707*49cdfc7eSAndroid Build Coastguard Worker if ((ltpuser = getpwnam("nobody")) == NULL) {
708*49cdfc7eSAndroid Build Coastguard Worker perror("change_owner: nobody not found in /etc/passwd");
709*49cdfc7eSAndroid Build Coastguard Worker exit(1);
710*49cdfc7eSAndroid Build Coastguard Worker }
711*49cdfc7eSAndroid Build Coastguard Worker
712*49cdfc7eSAndroid Build Coastguard Worker /* Switch to "nobody" */
713*49cdfc7eSAndroid Build Coastguard Worker setuid(ltpuser->pw_uid);
714*49cdfc7eSAndroid Build Coastguard Worker
715*49cdfc7eSAndroid Build Coastguard Worker tst_tmpdir();
716*49cdfc7eSAndroid Build Coastguard Worker }
717*49cdfc7eSAndroid Build Coastguard Worker
718*49cdfc7eSAndroid Build Coastguard Worker /*
719*49cdfc7eSAndroid Build Coastguard Worker * Function: blenter()
720*49cdfc7eSAndroid Build Coastguard Worker *
721*49cdfc7eSAndroid Build Coastguard Worker * Description: Print message on entering a new block
722*49cdfc7eSAndroid Build Coastguard Worker */
blenter(void)723*49cdfc7eSAndroid Build Coastguard Worker void blenter(void)
724*49cdfc7eSAndroid Build Coastguard Worker {
725*49cdfc7eSAndroid Build Coastguard Worker local_flag = PASSED;
726*49cdfc7eSAndroid Build Coastguard Worker return;
727*49cdfc7eSAndroid Build Coastguard Worker }
728*49cdfc7eSAndroid Build Coastguard Worker
729*49cdfc7eSAndroid Build Coastguard Worker /*
730*49cdfc7eSAndroid Build Coastguard Worker * Function: blexit()
731*49cdfc7eSAndroid Build Coastguard Worker *
732*49cdfc7eSAndroid Build Coastguard Worker * Description: This function will exit a block, a block may be a logical unit
733*49cdfc7eSAndroid Build Coastguard Worker * of a test. It will report the status if the test ie fail or
734*49cdfc7eSAndroid Build Coastguard Worker * pass.
735*49cdfc7eSAndroid Build Coastguard Worker */
blexit(void)736*49cdfc7eSAndroid Build Coastguard Worker void blexit(void)
737*49cdfc7eSAndroid Build Coastguard Worker {
738*49cdfc7eSAndroid Build Coastguard Worker (local_flag == PASSED) ? tst_resm(TPASS, "Test block %d", block_number)
739*49cdfc7eSAndroid Build Coastguard Worker : tst_resm(TFAIL, "Test block %d", block_number);
740*49cdfc7eSAndroid Build Coastguard Worker block_number++;
741*49cdfc7eSAndroid Build Coastguard Worker return;
742*49cdfc7eSAndroid Build Coastguard Worker }
743*49cdfc7eSAndroid Build Coastguard Worker
744*49cdfc7eSAndroid Build Coastguard Worker /*
745*49cdfc7eSAndroid Build Coastguard Worker *
746*49cdfc7eSAndroid Build Coastguard Worker * Function: anyfail()
747*49cdfc7eSAndroid Build Coastguard Worker *
748*49cdfc7eSAndroid Build Coastguard Worker * Description: Exit a test.
749*49cdfc7eSAndroid Build Coastguard Worker */
anyfail(void)750*49cdfc7eSAndroid Build Coastguard Worker void anyfail(void)
751*49cdfc7eSAndroid Build Coastguard Worker {
752*49cdfc7eSAndroid Build Coastguard Worker (local_flag == FAILED) ? tst_resm(TFAIL, "Test failed")
753*49cdfc7eSAndroid Build Coastguard Worker : tst_resm(TPASS, "Test passed");
754*49cdfc7eSAndroid Build Coastguard Worker tst_rmdir();
755*49cdfc7eSAndroid Build Coastguard Worker tst_exit();
756*49cdfc7eSAndroid Build Coastguard Worker }
757*49cdfc7eSAndroid Build Coastguard Worker
758*49cdfc7eSAndroid Build Coastguard Worker /**************/
759