summaryrefslogtreecommitdiffstats
path: root/include/dirent.h
diff options
context:
space:
mode:
authormike <mike@FreeBSD.org>2002-09-10 18:12:16 +0000
committermike <mike@FreeBSD.org>2002-09-10 18:12:16 +0000
commit520d2c38c6c32a552e5644201b149a8f64421551 (patch)
treefe9a9607cb3e929fc652b2ff859bbcf59ff52334 /include/dirent.h
parent13b9ff97a2054b7b53b7233e259e4ad3b4dcb312 (diff)
downloadFreeBSD-src-520d2c38c6c32a552e5644201b149a8f64421551.zip
FreeBSD-src-520d2c38c6c32a552e5644201b149a8f64421551.tar.gz
Fix namespace issues by using the relatively new visibility
primitives.
Diffstat (limited to 'include/dirent.h')
-rw-r--r--include/dirent.h47
1 files changed, 30 insertions, 17 deletions
diff --git a/include/dirent.h b/include/dirent.h
index b3de757..f6e4ccd 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 <sys/cdefs.h>
#include <sys/dirent.h>
-#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 <sys/cdefs.h>
+#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 */
OpenPOWER on IntegriCloud