source: trunk/src/emx/include/dirent.h@ 1036

Last change on this file since 1036 was 732, checked in by bird, 22 years ago

#668: Initial changed related to Large File Support (>2GB).

  • Property cvs2svn:cvs-rev set to 1.2
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 5.0 KB
Line 
1/*-
2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by the University of
16 * California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)dirent.h 8.2 (Berkeley) 7/28/94
34 * $FreeBSD: src/include/dirent.h,v 1.13 2002/09/10 18:12:16 mike Exp $
35 */
36
37/** @file
38 * FreeBSD 5.1
39 * @changes bird: Merged in EMX stuff and internal LIBC stuff.
40 */
41
42#ifndef _DIRENT_H_
43#define _DIRENT_H_
44
45/*
46 * The kernel defines the format of directory entries returned by
47 * the getdirentries(2) system call.
48 */
49#include <sys/cdefs.h>
50#include <sys/dirent.h>
51
52#if __BSD_VISIBLE || __XSI_VISIBLE
53/*
54 * XXX this is probably illegal in the __XSI_VISIBLE case, but brings us closer
55 * to the specification.
56 */
57#define d_ino d_fileno /* backward and XSI compatibility */
58#endif
59
60#if __BSD_VISIBLE
61
62/* definitions for library routines operating on directories. */
63#define DIRBLKSIZ 1024
64
65struct _telldir; /* see telldir.h */
66
67/* bird: EMX internal structure. */
68struct _dircontents
69{
70 struct _dircontents * _d_next;
71 char * _d_entry;
72 __off_t _d_size;
73 unsigned short _d_time;
74 unsigned short _d_date;
75 unsigned short _d_attr;
76 unsigned char _d_type;
77};
78
79/* structure describing an open directory. */
80typedef struct _dirdesc {
81#if 0
82 int dd_fd; /* file descriptor associated with directory */
83 long dd_loc; /* offset in current buffer */
84 long dd_size; /* amount of data returned by getdirentries */
85 char *dd_buf; /* data buffer */
86 int dd_len; /* size of data buffer */
87 long dd_seek; /* magic cookie returned by getdirentries */
88 long dd_rewind; /* magic cookie for rewinding */
89 int dd_flags; /* flags for readdir */
90 void *dd_lock; /* hack to avoid including <pthread.h> */
91 struct _telldir *dd_td; /* telldir position recording */
92#else
93 int dd_id;
94 long dd_loc;
95 struct _dircontents * dd_contents;
96 struct _dircontents * dd_cp;
97 struct dirent dd_dirent;
98#endif
99} DIR;
100
101#define dirfd(dirp) ((dirp)->dd_fd)
102
103/* flags for opendir2 */
104#define DTF_HIDEW 0x0001 /* hide whiteout entries */
105#define DTF_NODUP 0x0002 /* don't return duplicate names */
106#define DTF_REWIND 0x0004 /* rewind after reading union stack */
107#define __DTF_READALL 0x0008 /* everything has been read */
108
109#ifndef NULL
110#define NULL 0
111#endif
112
113#else /* !__BSD_VISIBLE */
114
115typedef void * DIR;
116
117#endif /* __BSD_VISIBLE */
118
119#ifndef _KERNEL
120
121__BEGIN_DECLS
122#if __BSD_VISIBLE
123/** @todo DIR *__opendir2(const char *, int); */
124/** @todo int alphasort(const void *, const void *); */
125/** @todo int getdents(int, char *, int); */
126/** @todo int getdirentries(int, char *, int, long *); */
127#endif
128DIR *opendir(const char *);
129struct dirent *
130 readdir(DIR *);
131#if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE >= 500
132int readdir_r(DIR *, struct dirent *, struct dirent **);
133#endif
134void rewinddir(DIR *);
135#if __BSD_VISIBLE
136int scandir(const char *, struct dirent ***,
137 int (*)(struct dirent *), int (*)(const void *, const void *));
138#endif
139#if __XSI_VISIBLE
140void seekdir(DIR *, long);
141long telldir(DIR *);
142#endif
143int closedir(DIR *);
144
145
146/* bird: EMX extra - start */
147DIR *_opendir (__const__ char *);
148struct dirent *_readdir (DIR *);
149void _seekdir (DIR *, long);
150long _telldir (DIR *);
151int _closedir (DIR *);
152void _rewinddir (DIR *);
153/* bird: EMX extra - end */
154
155__END_DECLS
156
157#endif /* !_KERNEL */
158
159#endif /* !_DIRENT_H_ */
Note: See TracBrowser for help on using the repository browser.