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