treewide: readdir64() -> readdir(), readdir64_r() -> readdir_r()
[unleashed.git] / include / dirent.h
blob3bb800b841ad8d16f6bdff5f96d985a6aa38b343
1 /*
2 * CDDL HEADER START
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]
19 * CDDL HEADER END
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 */
32 #ifndef _DIRENT_H
33 #define _DIRENT_H
35 #include <sys/feature_tests.h>
37 #include <sys/types.h>
38 #include <sys/dirent.h>
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
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)
53 typedef struct {
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() */
61 #else
63 typedef struct {
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)
98 #endif
100 extern int readdir_r(DIR *_RESTRICT_KYWD, struct dirent *_RESTRICT_KYWD,
101 struct dirent **_RESTRICT_KYWD);
103 #ifdef __cplusplus
105 #endif
107 #endif /* _DIRENT_H */