| 1 |
/**************************************************************************/ |
| 2 |
/* */ |
| 3 |
/* This file is part of Frama-C. */ |
| 4 |
/* */ |
| 5 |
/* Copyright (C) 2007-2022 */ |
| 6 |
/* CEA (Commissariat à l'énergie atomique et aux énergies */ |
| 7 |
/* alternatives) */ |
| 8 |
/* */ |
| 9 |
/* you can redistribute it and/or modify it under the terms of the GNU */ |
| 10 |
/* Lesser General Public License as published by the Free Software */ |
| 11 |
/* Foundation, version 2.1. */ |
| 12 |
/* */ |
| 13 |
/* It is distributed in the hope that it will be useful, */ |
| 14 |
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ |
| 15 |
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ |
| 16 |
/* GNU Lesser General Public License for more details. */ |
| 17 |
/* */ |
| 18 |
/* See the GNU Lesser General Public License version 2.1 */ |
| 19 |
/* for more details (enclosed in the file licenses/LGPLv2.1). */ |
| 20 |
/* */ |
| 21 |
/**************************************************************************/ |
| 22 |
|
| 23 |
#ifndef __FC_FTW |
| 24 |
#define __FC_FTW |
| 25 |
#include "features.h" |
| 26 |
__PUSH_FC_STDLIB |
| 27 |
|
| 28 |
__BEGIN_DECLS |
| 29 |
|
| 30 |
struct FTW |
| 31 |
{ |
| 32 |
int base; |
| 33 |
int level; |
| 34 |
}; |
| 35 |
|
| 36 |
enum __fc_ftw |
| 37 |
{ |
| 38 |
FTW_F, |
| 39 |
#define FTW_F FTW_F |
| 40 |
FTW_D, |
| 41 |
#define FTW_D FTW_D |
| 42 |
FTW_DNR, |
| 43 |
#define FTW_DNR FTW_DNR |
| 44 |
FTW_DP, |
| 45 |
#define FTW_DP FTW_DP |
| 46 |
FTW_NS, |
| 47 |
#define FTW_NS FTW_NS |
| 48 |
FTW_SL, |
| 49 |
#define FTW_SL FTW_SL |
| 50 |
FTW_SLN, |
| 51 |
#define FTW_SLN FTW_SLN |
| 52 |
}; |
| 53 |
|
| 54 |
enum __fc_nftw |
| 55 |
{ |
| 56 |
NFTW_PHYS, |
| 57 |
#define NFTW_PHYS NFTW_PHYS |
| 58 |
NFTW_MOUNT, |
| 59 |
#define NFTW_MOUNT NFTW_MOUNT |
| 60 |
NFTW_DEPTH, |
| 61 |
#define NFTW_DEPTH NFTW_DEPTH |
| 62 |
NFTW_CHDIR, |
| 63 |
#define NFTW_CHDIR NFTW_CHDIR |
| 64 |
}; |
| 65 |
|
| 66 |
// From POSIX 1.2008: "Inclusion of the <ftw.h> header may also make visible |
| 67 |
// all symbols from <sys/stat.h>". |
| 68 |
#include "sys/stat.h" |
| 69 |
|
| 70 |
int ftw(const char *path, |
| 71 |
int (*fn)(const char *, const struct stat *ptr, int flag), int ndirs); |
| 72 |
|
| 73 |
int nftw(const char *path, |
| 74 |
int (*fn)(const char *, const struct stat *, int, struct FTW *), |
| 75 |
int fd_limit, int flags); |
| 76 |
|
| 77 |
__END_DECLS |
| 78 |
|
| 79 |
__POP_FC_STDLIB |
| 80 |
#endif |