From 9ad8e31ee817854515bca6274ff960317dc479bb Mon Sep 17 00:00:00 2001 From: Mike Barcroft Date: Tue, 10 Sep 2002 18:12:16 +0000 Subject: Fix namespace issues by using the relatively new visibility primitives. --- include/dirent.h | 47 ++++++++++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 17 deletions(-) (limited to 'include') diff --git a/include/dirent.h b/include/dirent.h index b3de757a0427..f6e4ccd53c19 100644 --- a/include/dirent.h +++ b/include/dirent.h @@ -41,13 +41,18 @@ * The kernel defines the format of directory entries returned by * the getdirentries(2) system call. */ +#include #include -#ifdef _POSIX_SOURCE -typedef void * DIR; -#else +#if __BSD_VISIBLE || __XSI_VISIBLE +/* + * XXX this is probably illegal in the __XSI_VISIBLE case, but brings us closer + * to the specification. + */ +#define d_ino d_fileno /* backward and XSI compatibility */ +#endif -#define d_ino d_fileno /* backward compatibility */ +#if __BSD_VISIBLE /* definitions for library routines operating on directories. */ #define DIRBLKSIZ 1024 @@ -80,29 +85,37 @@ typedef struct _dirdesc { #define NULL 0 #endif -#endif /* _POSIX_SOURCE */ +#else /* !__BSD_VISIBLE */ -#ifndef _KERNEL +typedef void * DIR; -#include +#endif /* __BSD_VISIBLE */ + +#ifndef _KERNEL __BEGIN_DECLS +#if __BSD_VISIBLE +DIR *__opendir2(const char *, int); +int alphasort(const void *, const void *); +int getdents(int, char *, int); +int getdirentries(int, char *, int, long *); +#endif DIR *opendir(const char *); struct dirent * readdir(DIR *); +#if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE >= 500 +int readdir_r(DIR *, struct dirent *, struct dirent **); +#endif void rewinddir(DIR *); -int closedir(DIR *); -#ifndef _POSIX_SOURCE -DIR *__opendir2(const char *, int); -long telldir(DIR *); -void seekdir(DIR *, long); +#if __BSD_VISIBLE int scandir(const char *, struct dirent ***, int (*)(struct dirent *), int (*)(const void *, const void *)); -int alphasort(const void *, const void *); -int getdents(int, char *, int); -int getdirentries(int, char *, int, long *); -int readdir_r(DIR *, struct dirent *, struct dirent **); -#endif /* not POSIX */ +#endif +#if __XSI_VISIBLE +void seekdir(DIR *, long); +long telldir(DIR *); +#endif +int closedir(DIR *); __END_DECLS #endif /* !_KERNEL */ -- cgit v1.3