Commit | Line | Data |
---|---|---|
63174302 | 1 | /*- |
2ebafe45 KM |
2 | * Copyright (c) 1989 The Regents of the University of California. |
3 | * All rights reserved. | |
4 | * | |
63174302 | 5 | * %sccs.include.redist.c% |
2ebafe45 | 6 | * |
289812f3 | 7 | * @(#)dirent.h 5.19 (Berkeley) %G% |
2ebafe45 KM |
8 | */ |
9 | ||
91befe9c KB |
10 | #ifndef _DIRENT_H_ |
11 | #define _DIRENT_H_ | |
5eb1d172 | 12 | |
2ebafe45 | 13 | /* |
289812f3 KM |
14 | * The kernel defines the format of directory entries returned by |
15 | * the getdirentries(2) system call. | |
2ebafe45 | 16 | */ |
289812f3 | 17 | #include <sys/dirent.h> |
2ebafe45 | 18 | |
63174302 KB |
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. */ | |
53a35811 | 26 | #define DIRBLKSIZ 1024 |
2ebafe45 | 27 | |
63174302 | 28 | /* structure describing an open directory. */ |
2ebafe45 | 29 | typedef struct _dirdesc { |
514b4877 KM |
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 */ | |
2ebafe45 KM |
36 | } DIR; |
37 | ||
63174302 | 38 | #define dirfd(dirp) ((dirp)->dd_fd) |
2ebafe45 KM |
39 | |
40 | #ifndef NULL | |
63174302 | 41 | #define NULL 0 |
2ebafe45 | 42 | #endif |
e7ce7d7c | 43 | |
63174302 | 44 | #endif /* _POSIX_SOURCE */ |
e7ce7d7c | 45 | |
5ac3090f DS |
46 | #ifndef KERNEL |
47 | ||
91befe9c KB |
48 | #include <sys/cdefs.h> |
49 | ||
50 | __BEGIN_DECLS | |
51 | DIR *opendir __P((const char *)); | |
52 | struct dirent *readdir __P((DIR *)); | |
53 | void rewinddir __P((DIR *)); | |
54 | int closedir __P((DIR *)); | |
63174302 | 55 | #ifndef _POSIX_SOURCE |
91befe9c KB |
56 | long telldir __P((const DIR *)); |
57 | void seekdir __P((DIR *, long)); | |
58 | int scandir __P((const char *, struct dirent ***, | |
41c3f8bb | 59 | int (*)(struct dirent *), int (*)(const void *, const void *))); |
91befe9c | 60 | int alphasort __P((const void *, const void *)); |
5ac3090f DS |
61 | int getdirentries __P((int, char *, int, long *)); |
62 | #endif /* not POSIX */ | |
91befe9c KB |
63 | __END_DECLS |
64 | ||
5ac3090f DS |
65 | #endif /* !KERNEL */ |
66 | ||
91befe9c | 67 | #endif /* !_DIRENT_H_ */ |