Fix things so that _NETBSD_SOURCE correctly exposes the dirfd() and

the insides of struct _dirdesc.  Also make the existence of struct
_dirdesc visible to POSIX applications since this is less ugly than
pretending that DIR is a void *.
This commit is contained in:
bjh21 2003-04-29 23:08:13 +00:00
parent d46d73437c
commit 8758baf5b6
1 changed files with 7 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: dirent.h,v 1.18 2003/04/28 23:16:12 bjh21 Exp $ */
/* $NetBSD: dirent.h,v 1.19 2003/04/29 23:08:13 bjh21 Exp $ */
/*-
* Copyright (c) 1989, 1993
@ -51,15 +51,15 @@
#define d_ino d_fileno /* backward compatibility */
#endif
#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)
typedef void * DIR;
#else
typedef struct _dirdesc DIR;
#if defined(_NETBSD_SOURCE)
/* definitions for library routines operating on directories. */
#define DIRBLKSIZ 1024
/* structure describing an open directory. */
typedef struct _dirdesc {
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 getdents */
@ -68,7 +68,7 @@ typedef struct _dirdesc {
off_t dd_seek; /* magic cookie returned by getdents */
long dd_rewind; /* magic cookie for rewinding */
int dd_flags; /* flags for readdir */
} DIR;
};
#define dirfd(dirp) ((dirp)->dd_fd)
@ -80,7 +80,7 @@ typedef struct _dirdesc {
#include <sys/null.h>
#endif /* _POSIX_C_SOURCE || _XOPEN_SOURCE */
#endif
#ifndef _KERNEL