1 /*- 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 * 7 * @(#)dirent.h 8.1 (Berkeley) 06/08/93 8 */ 9 10 #ifndef _DIRENT_H_ 11 #define _DIRENT_H_ 12 13 /* 14 * The kernel defines the format of directory entries returned by 15 * the getdirentries(2) system call. 16 */ 17 #include <sys/dirent.h> 18 19 #ifdef _POSIX_SOURCE 20 typedef void * DIR; 21 #else 22 23 #define d_ino d_fileno /* backward compatibility */ 24 25 /* definitions for library routines operating on directories. */ 26 #define DIRBLKSIZ 1024 27 28 /* structure describing an open directory. */ 29 typedef struct _dirdesc { 30 int dd_fd; /* file descriptor associated with directory */ 31 long dd_loc; /* offset in current buffer */ 32 long dd_size; /* amount of data returned by getdirentries */ 33 char *dd_buf; /* data buffer */ 34 int dd_len; /* size of data buffer */ 35 long dd_seek; /* magic cookie returned by getdirentries */ 36 long dd_rewind; /* magic cookie for rewinding */ 37 } DIR; 38 39 #define dirfd(dirp) ((dirp)->dd_fd) 40 41 #ifndef NULL 42 #define NULL 0 43 #endif 44 45 #endif /* _POSIX_SOURCE */ 46 47 #ifndef KERNEL 48 49 #include <sys/cdefs.h> 50 51 __BEGIN_DECLS 52 DIR *opendir __P((const char *)); 53 struct dirent *readdir __P((DIR *)); 54 void rewinddir __P((DIR *)); 55 int closedir __P((DIR *)); 56 #ifndef _POSIX_SOURCE 57 long telldir __P((const DIR *)); 58 void seekdir __P((DIR *, long)); 59 int scandir __P((const char *, struct dirent ***, 60 int (*)(struct dirent *), int (*)(const void *, const void *))); 61 int alphasort __P((const void *, const void *)); 62 int getdirentries __P((int, char *, int, long *)); 63 #endif /* not POSIX */ 64 __END_DECLS 65 66 #endif /* !KERNEL */ 67 68 #endif /* !_DIRENT_H_ */ 69