Browse Source

Make DIR a private type within libc, give it the same underlying

typedef regardless of __BSD_VISIBLE, and eliminate the dirfd() macro.
ok guenther@
OPENBSD_5_2
matthew 12 years ago
parent
commit
2eb7e244b3
1 changed files with 4 additions and 25 deletions
  1. +4
    -25
      src/include/dirent.h

+ 4
- 25
src/include/dirent.h View File

@ -1,4 +1,4 @@
/* $OpenBSD: dirent.h,v 1.26 2012/03/22 01:44:19 guenther Exp $ */
/* $OpenBSD: dirent.h,v 1.27 2012/03/22 04:11:53 matthew Exp $ */
/* $NetBSD: dirent.h,v 1.9 1995/03/26 20:13:37 jtc Exp $ */ /* $NetBSD: dirent.h,v 1.9 1995/03/26 20:13:37 jtc Exp $ */
/*- /*-
@ -54,30 +54,13 @@
#define d_ino d_fileno /* backward compatibility */ #define d_ino d_fileno /* backward compatibility */
#endif #endif
#if __BSD_VISIBLE || __XPG_VISIBLE > 600
#define dirfd(dirp) ((dirp)->dd_fd)
#endif
typedef struct _dirdesc DIR;
#if __BSD_VISIBLE #if __BSD_VISIBLE
/* definitions for library routines operating on directories. */ /* definitions for library routines operating on directories. */
#define DIRBLKSIZ 1024 #define DIRBLKSIZ 1024
struct _telldir;
/* 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 */
off_t dd_seek; /* magic cookie returned by getdirentries */
off_t dd_rewind; /* magic cookie for rewinding */
int dd_unused; /* was flags for readdir */
struct _telldir *dd_td; /* telldir position recording */
void *dd_lock; /* mutex to protect struct */
} DIR;
#ifndef NULL #ifndef NULL
#ifdef __GNUG__ #ifdef __GNUG__
#define NULL __null #define NULL __null
@ -88,11 +71,7 @@ typedef struct _dirdesc {
#endif /* __GNUG__ */ #endif /* __GNUG__ */
#endif /* !NULL */ #endif /* !NULL */
#else /* !__BSD_VISIBLE */
typedef void * DIR;
#endif /* !__BSD_VISIBLE */
#endif /* __BSD_VISIBLE */
#ifndef _KERNEL #ifndef _KERNEL
__BEGIN_DECLS __BEGIN_DECLS
@ -121,7 +100,7 @@ int scandir(const char *, struct dirent ***, int (*)(struct dirent *),
int alphasort(const struct dirent **, const struct dirent **); int alphasort(const struct dirent **, const struct dirent **);
#endif #endif
#if __POSIX_VISIBLE >= 200809 || __XPG_VISIBLE > 600 #if __POSIX_VISIBLE >= 200809 || __XPG_VISIBLE > 600
int (dirfd)(DIR *);
int dirfd(DIR *);
#endif #endif
__END_DECLS __END_DECLS


Loading…
Cancel
Save