dirent.h revision 289b68b2ec2b2c951db19012779e24a98f520cda
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
#ifndef _DIRENT_H
#define _DIRENT_H
#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.6.1.5 */
#include <sys/feature_tests.h>
#ifdef __cplusplus
extern "C" {
#endif
#if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX)
#endif /* defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) */
#if !defined(__XOPEN_OR_POSIX)
typedef struct {
int dd_fd; /* file descriptor */
int dd_loc; /* offset in block */
int dd_size; /* amount of valid data */
char *dd_buf; /* directory block */
} DIR; /* stream data from opendir() */
#else
typedef struct {
int d_fd; /* file descriptor */
int d_loc; /* offset in block */
int d_size; /* amount of valid data */
char *d_buf; /* directory block */
} DIR; /* stream data from opendir() */
#endif /* !defined(__XOPEN_OR_POSIX) */
#if defined(__STDC__)
/* large file compilation environment setup */
#ifdef __PRAGMA_REDEFINE_EXTNAME
#else
#define alphasort alphasort64
#endif
#endif /* _FILE_OFFSET_BITS == 64 */
/* In the LP64 compilation environment, all APIs are already large file */
#if defined(_LP64) && defined(_LARGEFILE64_SOURCE)
#ifdef __PRAGMA_REDEFINE_EXTNAME
#else
#define alphsort64 alphasort
#endif
#endif /* _LP64 && _LARGEFILE64_SOURCE */
#if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || \
defined(_ATFILE_SOURCE)
#endif /* defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) ... */
#if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX)
int (*)(const struct dirent *),
int (*)(const struct dirent **,
const struct dirent **));
const struct dirent **);
#endif /* defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) */
#if defined(__EXTENSIONS__) || !defined(_POSIX_C_SOURCE) || \
defined(_XOPEN_SOURCE)
#endif /* defined(__EXTENSIONS__) || !defined(_POSIX_C_SOURCE) ... */
/* transitional large file interface */
!defined(__PRAGMA_REDEFINE_EXTNAME))
#if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX)
int (*)(const struct dirent64 *),
int (*)(const struct dirent64 **,
const struct dirent64 **));
#endif /* defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) */
#endif
#else
#if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || \
defined(_ATFILE_SOURCE)
extern int dirfd();
#endif /* defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) ... */
#if defined(__EXTENSIONS__) || !defined(_POSIX_C_SOURCE) || \
defined(_XOPEN_SOURCE)
extern long telldir();
extern void seekdir();
#endif /* defined(__EXTENSIONS__) || !defined(_POSIX_C_SOURCE) ... */
extern void rewinddir();
extern int closedir();
/* transitional large file interface */
!defined(__PRAGMA_REDEFINE_EXTNAME))
#endif
#endif
#if defined(__EXTENSIONS__) || !defined(_POSIX_C_SOURCE) || \
defined(_XOPEN_SOURCE)
#endif
/*
* readdir_r() prototype is defined here.
*
* There are several variations, depending on whether compatibility with old
* POSIX draft specifications or the final specification is desired and on
* whether the large file compilation environment is active. To combat a
* combinatorial explosion, enabling large files implies using the final
* specification (since the definition of the large file environment
* considerably postdates that of the final readdir_r specification).
*
* In the LP64 compilation environment, all APIs are already large file,
* and since there are no 64-bit applications that can have seen the
* draft implementation, again, we use the final POSIX specification.
*/
#if defined(__EXTENSIONS__) || defined(_REENTRANT) || \
defined(_POSIX_PTHREAD_SEMANTICS)
#if defined(__STDC__)
#ifdef __PRAGMA_REDEFINE_EXTNAME
struct dirent **_RESTRICT_KYWD);
#else /* __PRAGMA_REDEFINE_EXTNAME */
#ifdef __lint
#define readdir_r __posix_readdir_r
#else /* !__lint */
static int
}
#endif /* !__lint */
#endif /* __PRAGMA_REDEFINE_EXTNAME */
#else /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
#endif /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
#else /* !_LP64 && _FILE_OFFSET_BITS == 32 */
#if defined(_LP64)
#ifdef __PRAGMA_REDEFINE_EXTNAME
#else
#define readdir64_r readdir_r
#endif
#else /* _LP64 */
#ifdef __PRAGMA_REDEFINE_EXTNAME
#else
#define readdir_r readdir64_r
#endif
#endif /* _LP64 */
struct dirent **_RESTRICT_KYWD);
#endif /* !_LP64 && _FILE_OFFSET_BITS == 32 */
!defined(__PRAGMA_REDEFINE_EXTNAME))
/* transitional large file interface */
struct dirent64 **_RESTRICT_KYWD);
#endif
#else /* __STDC__ */
#ifdef __PRAGMA_REDEFINE_EXTNAME
extern int readdir_r();
#else /* __PRAGMA_REDEFINE_EXTNAME */
extern int __posix_readdir_r();
#ifdef __lint
#define readdir_r __posix_readdir_r
#else /* !__lint */
static int
{
}
#endif /* !__lint */
#endif /* __PRAGMA_REDEFINE_EXTNAME */
#else /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
#endif /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
#else /* !_LP64 && _FILE_OFFSET_BITS == 32 */
#if defined(_LP64)
#ifdef __PRAGMA_REDEFINE_EXTNAME
#else
#define readdir64_r readdir
#endif
#else /* _LP64 */
#ifdef __PRAGMA_REDEFINE_EXTNAME
#else
#define readdir_r readdir64_r
#endif
#endif /* _LP64 */
extern int readdir_r();
#endif /* !_LP64 && _FILE_OFFSET_BITS == 32 */
!defined(__PRAGMA_REDEFINE_EXTNAME))
/* transitional large file interface */
extern int readdir64_r();
#endif
#endif /* __STDC__ */
#endif /* defined(__EXTENSIONS__) || defined(_REENTRANT)... */
#ifdef __cplusplus
}
#endif
#endif /* _DIRENT_H */