summaryrefslogtreecommitdiffstats
path: root/include/dirent.h
diff options
context:
space:
mode:
authorgleb <gleb@FreeBSD.org>2012-05-19 12:44:27 +0000
committergleb <gleb@FreeBSD.org>2012-05-19 12:44:27 +0000
commit53af2dbdcaab2b0af0595c7972b876b8ef9e9ae6 (patch)
tree52b234943a3ae78c62d839ca39a00589e970906a /include/dirent.h
parent9409c11a935c0490bedd5a31b003a34bb8caea1f (diff)
downloadFreeBSD-src-53af2dbdcaab2b0af0595c7972b876b8ef9e9ae6.zip
FreeBSD-src-53af2dbdcaab2b0af0595c7972b876b8ef9e9ae6.tar.gz
Hide DIR definition by making it an opaque struct typedef.
Introduce dirfd() libc exported symbol replacing macro with same name, preserve _dirfd() macro for internal use. Replace dirp->dd_fd with dirfd() call. Avoid using dirfd as variable name to prevent shadowing global symbol. Sponsored by: Google Summer Of Code 2011
Diffstat (limited to 'include/dirent.h')
-rw-r--r--include/dirent.h21
1 files changed, 3 insertions, 18 deletions
diff --git a/include/dirent.h b/include/dirent.h
index e3ef149..941a977 100644
--- a/include/dirent.h
+++ b/include/dirent.h
@@ -55,24 +55,8 @@
/* definitions for library routines operating on directories. */
#define DIRBLKSIZ 1024
-struct _telldir; /* see telldir.h */
-struct pthread_mutex;
-
-/* structure describing an open directory. */
-typedef struct _dirdesc {
- int dd_fd; /* file descriptor associated with directory */
- long dd_loc; /* offset in current buffer */
- long dd_size; /* amount of data returned by getdirentries */
- char *dd_buf; /* data buffer */
- int dd_len; /* size of data buffer */
- long dd_seek; /* magic cookie returned by getdirentries */
- long dd_rewind; /* magic cookie for rewinding */
- int dd_flags; /* flags for readdir */
- struct pthread_mutex *dd_lock; /* lock */
- struct _telldir *dd_td; /* telldir position recording */
-} DIR;
-
-#define dirfd(dirp) ((dirp)->dd_fd)
+struct _dirdesc;
+typedef struct _dirdesc DIR;
/* flags for opendir2 */
#define DTF_HIDEW 0x0001 /* hide whiteout entries */
@@ -91,6 +75,7 @@ typedef void * DIR;
__BEGIN_DECLS
#if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE >= 700
int alphasort(const struct dirent **, const struct dirent **);
+int dirfd(DIR *);
#endif
#if __BSD_VISIBLE
DIR *__opendir2(const char *, int);
OpenPOWER on IntegriCloud