1 /* Copyright (C) 1991, 1992 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU C Library; see the file COPYING.LIB. If
16 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
17 Cambridge, MA 02139, USA. */
20 * POSIX Standard: 5.1.2 Directory Operations <dirent.h>
32 #include <gnu/types.h>
38 /* Directory entry structure. */
41 __ino_t d_fileno; /* File serial number. */
42 size_t d_namlen; /* Length of the file name. */
44 /* Only this member is in the POSIX standard. */
45 char d_name[1]; /* File name (actually longer). */
48 #if defined(__USE_BSD) || defined(__USE_MISC)
49 #define d_ino d_fileno /* Backward compatibility. */
52 /* Directory stream type. */
55 int __fd; /* File descriptor. */
57 char *__data; /* Directory block. */
58 size_t __allocation; /* Space allocated for the block. */
59 size_t __offset; /* Current offset into the block. */
60 size_t __size; /* Total valid data in the block. */
62 struct dirent __entry; /* Returned by `readdir'. */
66 /* Open a directory stream on NAME.
67 Return a DIR stream on the directory, or NULL if it could not be opened. */
68 extern DIR *EXFUN(opendir, (CONST char *__name));
70 /* Close the directory stream DIRP.
71 Return 0 if successful, -1 if not. */
72 extern int EXFUN(closedir, (DIR *__dirp));
74 /* Read a directory entry from DIRP.
75 Return a pointer to a `struct dirent' describing the entry,
76 or NULL for EOF or error. The storage returned may be overwritten
77 by a later readdir call on the same DIR stream. */
78 extern struct dirent *EXFUN(readdir, (DIR *__dirp));
80 /* Rewind DIRP to the beginning of the directory. */
81 extern void EXFUN(rewinddir, (DIR *__dirp));
83 #if defined(__USE_BSD) || defined(__USE_MISC)
86 /* Get the definitions of the POSIX.1 limits. */
87 #include <posix1_lim.h>
89 /* `MAXNAMLEN' is the BSD name for what POSIX calls `NAME_MAX'. */
91 #define MAXNAMLEN NAME_MAX
97 #include <gnu/types.h>
99 /* Seek to position POS on DIRP. */
100 extern void EXFUN(seekdir, (DIR *__dirp, __off_t __pos));
102 /* Return the current position of DIRP. */
103 extern __off_t EXFUN(telldir, (DIR *__dirp));
105 #endif /* Use BSD or misc. */
111 #endif /* dirent.h */