Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ExeBy/smexe_ro.../usr/include
File: dirent.h
/* Copyright (C) 1991-2018 Free Software Foundation, Inc.
[0] Fix | Delete
This file is part of the GNU C Library.
[1] Fix | Delete
[2] Fix | Delete
The GNU C Library is free software; you can redistribute it and/or
[3] Fix | Delete
modify it under the terms of the GNU Lesser General Public
[4] Fix | Delete
License as published by the Free Software Foundation; either
[5] Fix | Delete
version 2.1 of the License, or (at your option) any later version.
[6] Fix | Delete
[7] Fix | Delete
The GNU C Library is distributed in the hope that it will be useful,
[8] Fix | Delete
but WITHOUT ANY WARRANTY; without even the implied warranty of
[9] Fix | Delete
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
[10] Fix | Delete
Lesser General Public License for more details.
[11] Fix | Delete
[12] Fix | Delete
You should have received a copy of the GNU Lesser General Public
[13] Fix | Delete
License along with the GNU C Library; if not, see
[14] Fix | Delete
<http://www.gnu.org/licenses/>. */
[15] Fix | Delete
[16] Fix | Delete
/*
[17] Fix | Delete
* POSIX Standard: 5.1.2 Directory Operations <dirent.h>
[18] Fix | Delete
*/
[19] Fix | Delete
[20] Fix | Delete
#ifndef _DIRENT_H
[21] Fix | Delete
#define _DIRENT_H 1
[22] Fix | Delete
[23] Fix | Delete
#include <features.h>
[24] Fix | Delete
[25] Fix | Delete
__BEGIN_DECLS
[26] Fix | Delete
[27] Fix | Delete
#include <bits/types.h>
[28] Fix | Delete
[29] Fix | Delete
#ifdef __USE_XOPEN
[30] Fix | Delete
# ifndef __ino_t_defined
[31] Fix | Delete
# ifndef __USE_FILE_OFFSET64
[32] Fix | Delete
typedef __ino_t ino_t;
[33] Fix | Delete
# else
[34] Fix | Delete
typedef __ino64_t ino_t;
[35] Fix | Delete
# endif
[36] Fix | Delete
# define __ino_t_defined
[37] Fix | Delete
# endif
[38] Fix | Delete
# if defined __USE_LARGEFILE64 && !defined __ino64_t_defined
[39] Fix | Delete
typedef __ino64_t ino64_t;
[40] Fix | Delete
# define __ino64_t_defined
[41] Fix | Delete
# endif
[42] Fix | Delete
#endif
[43] Fix | Delete
[44] Fix | Delete
/* This file defines `struct dirent'.
[45] Fix | Delete
[46] Fix | Delete
It defines the macro `_DIRENT_HAVE_D_NAMLEN' iff there is a `d_namlen'
[47] Fix | Delete
member that gives the length of `d_name'.
[48] Fix | Delete
[49] Fix | Delete
It defines the macro `_DIRENT_HAVE_D_RECLEN' iff there is a `d_reclen'
[50] Fix | Delete
member that gives the size of the entire directory entry.
[51] Fix | Delete
[52] Fix | Delete
It defines the macro `_DIRENT_HAVE_D_OFF' iff there is a `d_off'
[53] Fix | Delete
member that gives the file offset of the next directory entry.
[54] Fix | Delete
[55] Fix | Delete
It defines the macro `_DIRENT_HAVE_D_TYPE' iff there is a `d_type'
[56] Fix | Delete
member that gives the type of the file.
[57] Fix | Delete
*/
[58] Fix | Delete
[59] Fix | Delete
#include <bits/dirent.h>
[60] Fix | Delete
[61] Fix | Delete
#if defined __USE_MISC && !defined d_fileno
[62] Fix | Delete
# define d_ino d_fileno /* Backward compatibility. */
[63] Fix | Delete
#endif
[64] Fix | Delete
[65] Fix | Delete
/* These macros extract size information from a `struct dirent *'.
[66] Fix | Delete
They may evaluate their argument multiple times, so it must not
[67] Fix | Delete
have side effects. Each of these may involve a relatively costly
[68] Fix | Delete
call to `strlen' on some systems, so these values should be cached.
[69] Fix | Delete
[70] Fix | Delete
_D_EXACT_NAMLEN (DP) returns the length of DP->d_name, not including
[71] Fix | Delete
its terminating null character.
[72] Fix | Delete
[73] Fix | Delete
_D_ALLOC_NAMLEN (DP) returns a size at least (_D_EXACT_NAMLEN (DP) + 1);
[74] Fix | Delete
that is, the allocation size needed to hold the DP->d_name string.
[75] Fix | Delete
Use this macro when you don't need the exact length, just an upper bound.
[76] Fix | Delete
This macro is less likely to require calling `strlen' than _D_EXACT_NAMLEN.
[77] Fix | Delete
*/
[78] Fix | Delete
[79] Fix | Delete
#ifdef _DIRENT_HAVE_D_NAMLEN
[80] Fix | Delete
# define _D_EXACT_NAMLEN(d) ((d)->d_namlen)
[81] Fix | Delete
# define _D_ALLOC_NAMLEN(d) (_D_EXACT_NAMLEN (d) + 1)
[82] Fix | Delete
#else
[83] Fix | Delete
# define _D_EXACT_NAMLEN(d) (strlen ((d)->d_name))
[84] Fix | Delete
# ifdef _DIRENT_HAVE_D_RECLEN
[85] Fix | Delete
# define _D_ALLOC_NAMLEN(d) (((char *) (d) + (d)->d_reclen) - &(d)->d_name[0])
[86] Fix | Delete
# else
[87] Fix | Delete
# define _D_ALLOC_NAMLEN(d) (sizeof (d)->d_name > 1 ? sizeof (d)->d_name : \
[88] Fix | Delete
_D_EXACT_NAMLEN (d) + 1)
[89] Fix | Delete
# endif
[90] Fix | Delete
#endif
[91] Fix | Delete
[92] Fix | Delete
[93] Fix | Delete
#ifdef __USE_MISC
[94] Fix | Delete
/* File types for `d_type'. */
[95] Fix | Delete
enum
[96] Fix | Delete
{
[97] Fix | Delete
DT_UNKNOWN = 0,
[98] Fix | Delete
# define DT_UNKNOWN DT_UNKNOWN
[99] Fix | Delete
DT_FIFO = 1,
[100] Fix | Delete
# define DT_FIFO DT_FIFO
[101] Fix | Delete
DT_CHR = 2,
[102] Fix | Delete
# define DT_CHR DT_CHR
[103] Fix | Delete
DT_DIR = 4,
[104] Fix | Delete
# define DT_DIR DT_DIR
[105] Fix | Delete
DT_BLK = 6,
[106] Fix | Delete
# define DT_BLK DT_BLK
[107] Fix | Delete
DT_REG = 8,
[108] Fix | Delete
# define DT_REG DT_REG
[109] Fix | Delete
DT_LNK = 10,
[110] Fix | Delete
# define DT_LNK DT_LNK
[111] Fix | Delete
DT_SOCK = 12,
[112] Fix | Delete
# define DT_SOCK DT_SOCK
[113] Fix | Delete
DT_WHT = 14
[114] Fix | Delete
# define DT_WHT DT_WHT
[115] Fix | Delete
};
[116] Fix | Delete
[117] Fix | Delete
/* Convert between stat structure types and directory types. */
[118] Fix | Delete
# define IFTODT(mode) (((mode) & 0170000) >> 12)
[119] Fix | Delete
# define DTTOIF(dirtype) ((dirtype) << 12)
[120] Fix | Delete
#endif
[121] Fix | Delete
[122] Fix | Delete
[123] Fix | Delete
/* This is the data type of directory stream objects.
[124] Fix | Delete
The actual structure is opaque to users. */
[125] Fix | Delete
typedef struct __dirstream DIR;
[126] Fix | Delete
[127] Fix | Delete
/* Open a directory stream on NAME.
[128] Fix | Delete
Return a DIR stream on the directory, or NULL if it could not be opened.
[129] Fix | Delete
[130] Fix | Delete
This function is a possible cancellation point and therefore not
[131] Fix | Delete
marked with __THROW. */
[132] Fix | Delete
extern DIR *opendir (const char *__name) __nonnull ((1));
[133] Fix | Delete
[134] Fix | Delete
#ifdef __USE_XOPEN2K8
[135] Fix | Delete
/* Same as opendir, but open the stream on the file descriptor FD.
[136] Fix | Delete
[137] Fix | Delete
This function is a possible cancellation point and therefore not
[138] Fix | Delete
marked with __THROW. */
[139] Fix | Delete
extern DIR *fdopendir (int __fd);
[140] Fix | Delete
#endif
[141] Fix | Delete
[142] Fix | Delete
/* Close the directory stream DIRP.
[143] Fix | Delete
Return 0 if successful, -1 if not.
[144] Fix | Delete
[145] Fix | Delete
This function is a possible cancellation point and therefore not
[146] Fix | Delete
marked with __THROW. */
[147] Fix | Delete
extern int closedir (DIR *__dirp) __nonnull ((1));
[148] Fix | Delete
[149] Fix | Delete
/* Read a directory entry from DIRP. Return a pointer to a `struct
[150] Fix | Delete
dirent' describing the entry, or NULL for EOF or error. The
[151] Fix | Delete
storage returned may be overwritten by a later readdir call on the
[152] Fix | Delete
same DIR stream.
[153] Fix | Delete
[154] Fix | Delete
If the Large File Support API is selected we have to use the
[155] Fix | Delete
appropriate interface.
[156] Fix | Delete
[157] Fix | Delete
This function is a possible cancellation point and therefore not
[158] Fix | Delete
marked with __THROW. */
[159] Fix | Delete
#ifndef __USE_FILE_OFFSET64
[160] Fix | Delete
extern struct dirent *readdir (DIR *__dirp) __nonnull ((1));
[161] Fix | Delete
#else
[162] Fix | Delete
# ifdef __REDIRECT
[163] Fix | Delete
extern struct dirent *__REDIRECT (readdir, (DIR *__dirp), readdir64)
[164] Fix | Delete
__nonnull ((1));
[165] Fix | Delete
# else
[166] Fix | Delete
# define readdir readdir64
[167] Fix | Delete
# endif
[168] Fix | Delete
#endif
[169] Fix | Delete
[170] Fix | Delete
#ifdef __USE_LARGEFILE64
[171] Fix | Delete
extern struct dirent64 *readdir64 (DIR *__dirp) __nonnull ((1));
[172] Fix | Delete
#endif
[173] Fix | Delete
[174] Fix | Delete
#ifdef __USE_POSIX
[175] Fix | Delete
/* Reentrant version of `readdir'. Return in RESULT a pointer to the
[176] Fix | Delete
next entry.
[177] Fix | Delete
[178] Fix | Delete
This function is a possible cancellation point and therefore not
[179] Fix | Delete
marked with __THROW. */
[180] Fix | Delete
# ifndef __USE_FILE_OFFSET64
[181] Fix | Delete
extern int readdir_r (DIR *__restrict __dirp,
[182] Fix | Delete
struct dirent *__restrict __entry,
[183] Fix | Delete
struct dirent **__restrict __result)
[184] Fix | Delete
__nonnull ((1, 2, 3)) __attribute_deprecated__;
[185] Fix | Delete
# else
[186] Fix | Delete
# ifdef __REDIRECT
[187] Fix | Delete
extern int __REDIRECT (readdir_r,
[188] Fix | Delete
(DIR *__restrict __dirp,
[189] Fix | Delete
struct dirent *__restrict __entry,
[190] Fix | Delete
struct dirent **__restrict __result),
[191] Fix | Delete
readdir64_r)
[192] Fix | Delete
__nonnull ((1, 2, 3)) __attribute_deprecated__;
[193] Fix | Delete
# else
[194] Fix | Delete
# define readdir_r readdir64_r
[195] Fix | Delete
# endif
[196] Fix | Delete
# endif
[197] Fix | Delete
[198] Fix | Delete
# ifdef __USE_LARGEFILE64
[199] Fix | Delete
extern int readdir64_r (DIR *__restrict __dirp,
[200] Fix | Delete
struct dirent64 *__restrict __entry,
[201] Fix | Delete
struct dirent64 **__restrict __result)
[202] Fix | Delete
__nonnull ((1, 2, 3)) __attribute_deprecated__;
[203] Fix | Delete
# endif
[204] Fix | Delete
#endif /* POSIX or misc */
[205] Fix | Delete
[206] Fix | Delete
/* Rewind DIRP to the beginning of the directory. */
[207] Fix | Delete
extern void rewinddir (DIR *__dirp) __THROW __nonnull ((1));
[208] Fix | Delete
[209] Fix | Delete
#if defined __USE_MISC || defined __USE_XOPEN
[210] Fix | Delete
# include <bits/types.h>
[211] Fix | Delete
[212] Fix | Delete
/* Seek to position POS on DIRP. */
[213] Fix | Delete
extern void seekdir (DIR *__dirp, long int __pos) __THROW __nonnull ((1));
[214] Fix | Delete
[215] Fix | Delete
/* Return the current position of DIRP. */
[216] Fix | Delete
extern long int telldir (DIR *__dirp) __THROW __nonnull ((1));
[217] Fix | Delete
#endif
[218] Fix | Delete
[219] Fix | Delete
#ifdef __USE_XOPEN2K8
[220] Fix | Delete
[221] Fix | Delete
/* Return the file descriptor used by DIRP. */
[222] Fix | Delete
extern int dirfd (DIR *__dirp) __THROW __nonnull ((1));
[223] Fix | Delete
[224] Fix | Delete
# if defined __OPTIMIZE__ && defined _DIR_dirfd
[225] Fix | Delete
# define dirfd(dirp) _DIR_dirfd (dirp)
[226] Fix | Delete
# endif
[227] Fix | Delete
[228] Fix | Delete
# ifdef __USE_MISC
[229] Fix | Delete
# ifndef MAXNAMLEN
[230] Fix | Delete
/* Get the definitions of the POSIX.1 limits. */
[231] Fix | Delete
# include <bits/posix1_lim.h>
[232] Fix | Delete
[233] Fix | Delete
/* `MAXNAMLEN' is the BSD name for what POSIX calls `NAME_MAX'. */
[234] Fix | Delete
# ifdef NAME_MAX
[235] Fix | Delete
# define MAXNAMLEN NAME_MAX
[236] Fix | Delete
# else
[237] Fix | Delete
# define MAXNAMLEN 255
[238] Fix | Delete
# endif
[239] Fix | Delete
# endif
[240] Fix | Delete
# endif
[241] Fix | Delete
[242] Fix | Delete
# define __need_size_t
[243] Fix | Delete
# include <stddef.h>
[244] Fix | Delete
[245] Fix | Delete
/* Scan the directory DIR, calling SELECTOR on each directory entry.
[246] Fix | Delete
Entries for which SELECT returns nonzero are individually malloc'd,
[247] Fix | Delete
sorted using qsort with CMP, and collected in a malloc'd array in
[248] Fix | Delete
*NAMELIST. Returns the number of entries selected, or -1 on error.
[249] Fix | Delete
[250] Fix | Delete
This function is a cancellation point and therefore not marked with
[251] Fix | Delete
__THROW. */
[252] Fix | Delete
# ifndef __USE_FILE_OFFSET64
[253] Fix | Delete
extern int scandir (const char *__restrict __dir,
[254] Fix | Delete
struct dirent ***__restrict __namelist,
[255] Fix | Delete
int (*__selector) (const struct dirent *),
[256] Fix | Delete
int (*__cmp) (const struct dirent **,
[257] Fix | Delete
const struct dirent **))
[258] Fix | Delete
__nonnull ((1, 2));
[259] Fix | Delete
# else
[260] Fix | Delete
# ifdef __REDIRECT
[261] Fix | Delete
extern int __REDIRECT (scandir,
[262] Fix | Delete
(const char *__restrict __dir,
[263] Fix | Delete
struct dirent ***__restrict __namelist,
[264] Fix | Delete
int (*__selector) (const struct dirent *),
[265] Fix | Delete
int (*__cmp) (const struct dirent **,
[266] Fix | Delete
const struct dirent **)),
[267] Fix | Delete
scandir64) __nonnull ((1, 2));
[268] Fix | Delete
# else
[269] Fix | Delete
# define scandir scandir64
[270] Fix | Delete
# endif
[271] Fix | Delete
# endif
[272] Fix | Delete
[273] Fix | Delete
# if defined __USE_GNU && defined __USE_LARGEFILE64
[274] Fix | Delete
/* This function is like `scandir' but it uses the 64bit dirent structure.
[275] Fix | Delete
Please note that the CMP function must now work with struct dirent64 **. */
[276] Fix | Delete
extern int scandir64 (const char *__restrict __dir,
[277] Fix | Delete
struct dirent64 ***__restrict __namelist,
[278] Fix | Delete
int (*__selector) (const struct dirent64 *),
[279] Fix | Delete
int (*__cmp) (const struct dirent64 **,
[280] Fix | Delete
const struct dirent64 **))
[281] Fix | Delete
__nonnull ((1, 2));
[282] Fix | Delete
# endif
[283] Fix | Delete
[284] Fix | Delete
# ifdef __USE_GNU
[285] Fix | Delete
/* Similar to `scandir' but a relative DIR name is interpreted relative
[286] Fix | Delete
to the directory for which DFD is a descriptor.
[287] Fix | Delete
[288] Fix | Delete
This function is a cancellation point and therefore not marked with
[289] Fix | Delete
__THROW. */
[290] Fix | Delete
# ifndef __USE_FILE_OFFSET64
[291] Fix | Delete
extern int scandirat (int __dfd, const char *__restrict __dir,
[292] Fix | Delete
struct dirent ***__restrict __namelist,
[293] Fix | Delete
int (*__selector) (const struct dirent *),
[294] Fix | Delete
int (*__cmp) (const struct dirent **,
[295] Fix | Delete
const struct dirent **))
[296] Fix | Delete
__nonnull ((2, 3));
[297] Fix | Delete
# else
[298] Fix | Delete
# ifdef __REDIRECT
[299] Fix | Delete
extern int __REDIRECT (scandirat,
[300] Fix | Delete
(int __dfd, const char *__restrict __dir,
[301] Fix | Delete
struct dirent ***__restrict __namelist,
[302] Fix | Delete
int (*__selector) (const struct dirent *),
[303] Fix | Delete
int (*__cmp) (const struct dirent **,
[304] Fix | Delete
const struct dirent **)),
[305] Fix | Delete
scandirat64) __nonnull ((2, 3));
[306] Fix | Delete
# else
[307] Fix | Delete
# define scandirat scandirat64
[308] Fix | Delete
# endif
[309] Fix | Delete
# endif
[310] Fix | Delete
[311] Fix | Delete
/* This function is like `scandir' but it uses the 64bit dirent structure.
[312] Fix | Delete
Please note that the CMP function must now work with struct dirent64 **. */
[313] Fix | Delete
extern int scandirat64 (int __dfd, const char *__restrict __dir,
[314] Fix | Delete
struct dirent64 ***__restrict __namelist,
[315] Fix | Delete
int (*__selector) (const struct dirent64 *),
[316] Fix | Delete
int (*__cmp) (const struct dirent64 **,
[317] Fix | Delete
const struct dirent64 **))
[318] Fix | Delete
__nonnull ((2, 3));
[319] Fix | Delete
# endif
[320] Fix | Delete
[321] Fix | Delete
/* Function to compare two `struct dirent's alphabetically. */
[322] Fix | Delete
# ifndef __USE_FILE_OFFSET64
[323] Fix | Delete
extern int alphasort (const struct dirent **__e1,
[324] Fix | Delete
const struct dirent **__e2)
[325] Fix | Delete
__THROW __attribute_pure__ __nonnull ((1, 2));
[326] Fix | Delete
# else
[327] Fix | Delete
# ifdef __REDIRECT
[328] Fix | Delete
extern int __REDIRECT_NTH (alphasort,
[329] Fix | Delete
(const struct dirent **__e1,
[330] Fix | Delete
const struct dirent **__e2),
[331] Fix | Delete
alphasort64) __attribute_pure__ __nonnull ((1, 2));
[332] Fix | Delete
# else
[333] Fix | Delete
# define alphasort alphasort64
[334] Fix | Delete
# endif
[335] Fix | Delete
# endif
[336] Fix | Delete
[337] Fix | Delete
# if defined __USE_GNU && defined __USE_LARGEFILE64
[338] Fix | Delete
extern int alphasort64 (const struct dirent64 **__e1,
[339] Fix | Delete
const struct dirent64 **__e2)
[340] Fix | Delete
__THROW __attribute_pure__ __nonnull ((1, 2));
[341] Fix | Delete
# endif
[342] Fix | Delete
#endif /* Use XPG7. */
[343] Fix | Delete
[344] Fix | Delete
[345] Fix | Delete
#ifdef __USE_MISC
[346] Fix | Delete
/* Read directory entries from FD into BUF, reading at most NBYTES.
[347] Fix | Delete
Reading starts at offset *BASEP, and *BASEP is updated with the new
[348] Fix | Delete
position after reading. Returns the number of bytes read; zero when at
[349] Fix | Delete
end of directory; or -1 for errors. */
[350] Fix | Delete
# ifndef __USE_FILE_OFFSET64
[351] Fix | Delete
extern __ssize_t getdirentries (int __fd, char *__restrict __buf,
[352] Fix | Delete
size_t __nbytes,
[353] Fix | Delete
__off_t *__restrict __basep)
[354] Fix | Delete
__THROW __nonnull ((2, 4));
[355] Fix | Delete
# else
[356] Fix | Delete
# ifdef __REDIRECT
[357] Fix | Delete
extern __ssize_t __REDIRECT_NTH (getdirentries,
[358] Fix | Delete
(int __fd, char *__restrict __buf,
[359] Fix | Delete
size_t __nbytes,
[360] Fix | Delete
__off64_t *__restrict __basep),
[361] Fix | Delete
getdirentries64) __nonnull ((2, 4));
[362] Fix | Delete
# else
[363] Fix | Delete
# define getdirentries getdirentries64
[364] Fix | Delete
# endif
[365] Fix | Delete
# endif
[366] Fix | Delete
[367] Fix | Delete
# ifdef __USE_LARGEFILE64
[368] Fix | Delete
extern __ssize_t getdirentries64 (int __fd, char *__restrict __buf,
[369] Fix | Delete
size_t __nbytes,
[370] Fix | Delete
__off64_t *__restrict __basep)
[371] Fix | Delete
__THROW __nonnull ((2, 4));
[372] Fix | Delete
# endif
[373] Fix | Delete
#endif /* Use misc. */
[374] Fix | Delete
[375] Fix | Delete
#ifdef __USE_GNU
[376] Fix | Delete
/* Function to compare two `struct dirent's by name & version. */
[377] Fix | Delete
# ifndef __USE_FILE_OFFSET64
[378] Fix | Delete
extern int versionsort (const struct dirent **__e1,
[379] Fix | Delete
const struct dirent **__e2)
[380] Fix | Delete
__THROW __attribute_pure__ __nonnull ((1, 2));
[381] Fix | Delete
# else
[382] Fix | Delete
# ifdef __REDIRECT
[383] Fix | Delete
extern int __REDIRECT_NTH (versionsort,
[384] Fix | Delete
(const struct dirent **__e1,
[385] Fix | Delete
const struct dirent **__e2),
[386] Fix | Delete
versionsort64)
[387] Fix | Delete
__attribute_pure__ __nonnull ((1, 2));
[388] Fix | Delete
# else
[389] Fix | Delete
# define versionsort versionsort64
[390] Fix | Delete
# endif
[391] Fix | Delete
# endif
[392] Fix | Delete
[393] Fix | Delete
# ifdef __USE_LARGEFILE64
[394] Fix | Delete
extern int versionsort64 (const struct dirent64 **__e1,
[395] Fix | Delete
const struct dirent64 **__e2)
[396] Fix | Delete
__THROW __attribute_pure__ __nonnull ((1, 2));
[397] Fix | Delete
# endif
[398] Fix | Delete
#endif /* Use GNU. */
[399] Fix | Delete
[400] Fix | Delete
__END_DECLS
[401] Fix | Delete
[402] Fix | Delete
#endif /* dirent.h */
[403] Fix | Delete
[404] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function