Mercurial > projects > ldc
comparison druntime/import/stdc/posix/dirent.d @ 760:6f33b427bfd1
Seems like hg ignores .di files, so I missed a bunch of stuff. complete druntime should be there now :)
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Wed, 12 Nov 2008 00:19:18 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
759:d3eb054172f9 | 760:6f33b427bfd1 |
---|---|
1 /** | |
2 * D header file for POSIX. | |
3 * | |
4 * Copyright: Public Domain | |
5 * License: Public Domain | |
6 * Authors: Sean Kelly | |
7 * Standards: The Open Group Base Specifications Issue 6, IEEE Std 1003.1, 2004 Edition | |
8 */ | |
9 module stdc.posix.dirent; | |
10 | |
11 private import stdc.posix.config; | |
12 public import stdc.posix.sys.types; // for ino_t | |
13 | |
14 extern (C): | |
15 | |
16 // | |
17 // Required | |
18 // | |
19 /* | |
20 DIR | |
21 | |
22 struct dirent | |
23 { | |
24 char[] d_name; | |
25 } | |
26 | |
27 int closedir(DIR*); | |
28 DIR* opendir(in char*); | |
29 dirent* readdir(DIR*); | |
30 void rewinddir(DIR*); | |
31 */ | |
32 | |
33 version( linux ) | |
34 { | |
35 // NOTE: The following constants are non-standard Linux definitions | |
36 // for dirent.d_type. | |
37 enum | |
38 { | |
39 DT_UNKNOWN = 0, | |
40 DT_FIFO = 1, | |
41 DT_CHR = 2, | |
42 DT_DIR = 4, | |
43 DT_BLK = 6, | |
44 DT_REG = 8, | |
45 DT_LNK = 10, | |
46 DT_SOCK = 12, | |
47 DT_WHT = 14 | |
48 } | |
49 | |
50 struct dirent | |
51 { | |
52 ino_t d_ino; | |
53 off_t d_off; | |
54 ushort d_reclen; | |
55 ubyte d_type; | |
56 char[256] d_name; | |
57 } | |
58 | |
59 struct DIR | |
60 { | |
61 // Managed by OS | |
62 } | |
63 | |
64 static if( __USE_LARGEFILE64 ) | |
65 { | |
66 dirent* readdir64(DIR*); | |
67 alias readdir64 readdir; | |
68 } | |
69 else | |
70 { | |
71 dirent* readdir(DIR*); | |
72 } | |
73 } | |
74 else version( darwin ) | |
75 { | |
76 enum | |
77 { | |
78 DT_UNKNOWN = 0, | |
79 DT_FIFO = 1, | |
80 DT_CHR = 2, | |
81 DT_DIR = 4, | |
82 DT_BLK = 6, | |
83 DT_REG = 8, | |
84 DT_LNK = 10, | |
85 DT_SOCK = 12, | |
86 DT_WHT = 14 | |
87 } | |
88 | |
89 align(4) | |
90 struct dirent | |
91 { | |
92 ino_t d_ino; | |
93 ushort d_reclen; | |
94 ubyte d_type; | |
95 ubyte d_namlen; | |
96 char[256] d_name; | |
97 } | |
98 | |
99 struct DIR | |
100 { | |
101 // Managed by OS | |
102 } | |
103 | |
104 dirent* readdir(DIR*); | |
105 } | |
106 else version( freebsd ) | |
107 { | |
108 enum | |
109 { | |
110 DT_UNKNOWN = 0, | |
111 DT_FIFO = 1, | |
112 DT_CHR = 2, | |
113 DT_DIR = 4, | |
114 DT_BLK = 6, | |
115 DT_REG = 8, | |
116 DT_LNK = 10, | |
117 DT_SOCK = 12, | |
118 DT_WHT = 14 | |
119 } | |
120 | |
121 align(4) | |
122 struct dirent | |
123 { | |
124 uint d_fileno; | |
125 ushort d_reclen; | |
126 ubyte d_type; | |
127 ubyte d_namelen; | |
128 char[256] d_name; | |
129 } | |
130 | |
131 struct _telldir; | |
132 struct DIR | |
133 { | |
134 int dd_fd; | |
135 c_long dd_loc; | |
136 c_long dd_size; | |
137 char* dd_buf; | |
138 int dd_len; | |
139 c_long dd_seek; | |
140 c_long dd_rewind; | |
141 int dd_flags; | |
142 void* dd_lock; | |
143 _telldir* dd_td; | |
144 } | |
145 | |
146 dirent* readdir(DIR*); | |
147 } | |
148 else | |
149 { | |
150 dirent* readdir(DIR*); | |
151 } | |
152 | |
153 int closedir(DIR*); | |
154 DIR* opendir(in char*); | |
155 //dirent* readdir(DIR*); | |
156 void rewinddir(DIR*); | |
157 | |
158 // | |
159 // Thread-Safe Functions (TSF) | |
160 // | |
161 /* | |
162 int readdir_r(DIR*, dirent*, dirent**); | |
163 */ | |
164 | |
165 version( linux ) | |
166 { | |
167 static if( __USE_LARGEFILE64 ) | |
168 { | |
169 int readdir_r64(DIR*, dirent*, dirent**); | |
170 alias readdir_r64 readdir_r; | |
171 } | |
172 else | |
173 { | |
174 int readdir_r(DIR*, dirent*, dirent**); | |
175 } | |
176 } | |
177 else version( darwin ) | |
178 { | |
179 int readdir_r(DIR*, dirent*, dirent**); | |
180 } | |
181 else version( freebsd ) | |
182 { | |
183 int readdir_r(DIR*, dirent*, dirent**); | |
184 } | |
185 | |
186 // | |
187 // XOpen (XSI) | |
188 // | |
189 /* | |
190 void seekdir(DIR*, c_long); | |
191 c_long telldir(DIR*); | |
192 */ | |
193 | |
194 version( linux ) | |
195 { | |
196 void seekdir(DIR*, c_long); | |
197 c_long telldir(DIR*); | |
198 } |