4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2014 Garrett D'Amore <garrett@damore.org>
25 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
26 * Use is subject to license terms.
29 /* Copyright (c) 1988 AT&T */
30 /* All Rights Reserved */
35 #include <sys/feature_tests.h>
37 #include <sys/types.h>
38 #include <sys/dirent.h>
44 #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX)
46 #define MAXNAMLEN 512 /* maximum filename length */
47 #define DIRBUF 8192 /* buffer size for fs-indep. dirs */
49 #endif /* defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) */
51 #if !defined(__XOPEN_OR_POSIX)
54 int dd_fd
; /* file descriptor */
55 int dd_loc
; /* offset in block */
56 int dd_size
; /* amount of valid data */
57 char *dd_buf
; /* directory block */
58 } DIR; /* stream data from opendir() */
64 int d_fd
; /* file descriptor */
65 int d_loc
; /* offset in block */
66 int d_size
; /* amount of valid data */
67 char *d_buf
; /* directory block */
68 } DIR; /* stream data from opendir() */
70 #endif /* !defined(__XOPEN_OR_POSIX) */
72 extern DIR *opendir(const char *);
73 #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || \
74 defined(_ATFILE_SOURCE)
75 extern DIR *fdopendir(int);
76 extern int dirfd(DIR *);
77 #endif /* defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) ... */
78 #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX)
79 extern int scandir(const char *, struct dirent
*(*[]),
80 int (*)(const struct dirent
*),
81 int (*)(const struct dirent
**,
82 const struct dirent
**));
83 extern int alphasort(const struct dirent
**,
84 const struct dirent
**);
85 #endif /* defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) */
86 extern struct dirent
*readdir(DIR *);
87 #if defined(__EXTENSIONS__) || !defined(_POSIX_C_SOURCE) || \
88 defined(_XOPEN_SOURCE)
89 extern long telldir(DIR *);
90 extern void seekdir(DIR *, long);
91 #endif /* defined(__EXTENSIONS__) || !defined(_POSIX_C_SOURCE) ... */
92 extern void rewinddir(DIR *);
93 extern int closedir(DIR *);
95 #if defined(__EXTENSIONS__) || !defined(_POSIX_C_SOURCE) || \
96 defined(_XOPEN_SOURCE)
97 #define rewinddir(dirp) seekdir(dirp, 0L)
100 extern int readdir_r(DIR *_RESTRICT_KYWD
, struct dirent
*_RESTRICT_KYWD
,
101 struct dirent
**_RESTRICT_KYWD
);
107 #endif /* _DIRENT_H */