blob: cd854890821c91a1c88b86490b5eea172225ec7a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
|
#ifndef DK4STATT_H_INCLUDED
#define DK4STATT_H_INCLUDED 1
/** @file dk4statt.h Default type definitions for dev_t and ino_t.
Note: The stat() and lstat() functions are sufficient for
non-Windows systems.
On Windows systems the st_dev and st_ino components may contain
dummy contents, the stat structure does not contain information
about symbolic links.
For a portable (both Windows and non-Windows) check whether a file
is a symbolic link, reparse point... use the dk4_file_info_t
data type from dk4fileit.h.
*/
#ifndef DK4CONF_H_INCLUDED
#include "dk4conf.h"
#endif
#ifndef DK4TYES_H_INCLUDED
#include "dk4types.h"
#endif
#if DK4_HAVE_SYS_TYPES_H
#ifndef SYS_TYPES_H_INCLUDED
#include <sys/types.h>
#define SYS_TYPES_H_INCLUDED 1
#endif
#endif
#if DK4_HAVE_SYS_STAT_H
#ifndef SYS_STAT_H_INCLUDED
#include <sys/stat.h>
#define SYS_STAT_H_INCLUDED 1
#endif
#endif
#if DK4_HAVE_DEV_T
/** Device number.
*/
typedef dev_t dk4_dev_t;
#else
#if DK4_HAVE__DEV_T
/** Device number.
*/
typedef _dev_t dk4_dev_t;
#else
/** Device number.
*/
typdef dk4_um_t dk4_dev_t;
#endif
#endif
#if DK4_ON_WINDOWS
/* +++ Windows +++ */
#if DK4_HAVE_INO_T
/** Inode number.
*/
typedef ino_t dk4_ino_t;
#else
#if DK4_HAVE__INO_T
/** Inode number.
*/
typedef _ino_t dk4_ino_t;
#else
/** Inode number.
*/
typedef dk4_um_t dk4_ino_t;
#endif
#endif
/* --- Windows --- */
#else
#if DK4_HAVE_LARGEFILE64_SOURCE && DK4_HAVE_STAT64
/* +++ Unix, stat64 +++ */
#if DK4_HAVE_INO64_T
/** Inode number.
*/
typedef ino64_t dk4_ino_t;
#else
#if DK4_HAVE__INO64_T
/** Inode number.
*/
typedef _ino64_t dk4_ino_t;
#else
#if DK4_HAVE_INO_T
/** Inode number.
*/
typedef ino_t dk4_ino_t;
#else
#if DK4_HAVE__INO_T
typedef _ino_t dk4_ino_t;
#else
/** Inode number.
*/
typedef dk4_um_t dk4_ino_t;
#endif
#endif
#endif
#endif
/* --- Unix, stat64 --- */
#else
/* +++ Unix, stat +++ */
#if DK4_HAVE_INO_T
/** Inode number.
*/
typedef ino_t dk4_ino_t;
#else
#if DK4_HAVE__INO_T
/** Inode number.
*/
typedef _ino_t dk4_ino_t;
#else
/** Inode number.
*/
typedef dk4_um_t dk4_ino_t;
#endif
#endif
/* --- Unix, stat --- */
#endif
#endif
#if DK4_HAVE_MODE_T
/** File mode (type and permissions).
*/
typedef mode_t dk4_mode_t;
#else
/** File mode (type and permissions).
*/
typedef unsigned short dk4_mode_t;
#endif
#if DK4_HAVE_NLINK_T
/** Number of links to inode.
*/
typedef nlink_t dk4_nlink_t;
#else
#if DK4_ON_WINDOWS
/** Number of links to inode.
*/
typedef short dk4_nlink_t;
#else
/** Number of links to inode.
*/
typedef unsigned short dk4_nlink_t;
#endif
#endif
#if DK4_HAVE_UID_T
/** User id.
*/
typedef uid_t dk4_uid_t;
#else
#if DK4_ON_WINDOWS
/** User id.
*/
typedef short dk4_uid_t;
#else
/** User id.
*/
typedef dk4_um_t dk4_uid_t;
#endif
#endif
#if DK4_HAVE_GID_T
/** Group ID.
*/
typedef gid_t dk4_gid_t;
#else
#if DK4_ON_WINDOWS
/** Group ID.
*/
typedef short dk4_gid_t;
#else
/** Group ID.
*/
typedef dk4_um_t dk4_gid_t;
#endif
#endif
#if DK4_ON_WINDOWS
/* +++ Windows +++ */
#if DK4_HAVE_OFF_T
/** File size or position.
*/
typedef off_t dk4_off_t;
#else
#if DK4_HAVE__OFF_T
/** File size or position.
*/
typedef _off_t dk4_off_t;
#else
/** File size or position.
*/
typedef dk4_um_t dk4_off_t;
#endif
#endif
/* --- Windows --- */
#else
#if DK4_HAVE_LARGEFILE64_SOURCE && DK4_HAVE_STAT64
/* +++ Unix, stat64 +++ */
#if DK4_HAVE_OFF64_T
/** File size or position.
*/
typedef off64_t dk4_off_t;
#else
#if DK4_HAVE__OFF64_T
/** File size or position.
*/
typedef _off64_t dk4_off_t;
#else
#if DK4_HAVE_OFF_T
/** File size or position.
*/
typedef off_t dk4_off_t;
#else
#if DK4_HAVE__OFF_T
/** File size or position.
*/
typedef _off_t dk4_off_t;
#else
/** File size or position.
*/
typedef dk4_um_t dk4_off_t;
#endif
#endif
#endif
#endif
/* --- Unix, stat64 --- */
#else
/* +++ Unix, stat +++ */
#if DK4_HAVE_OFF_T
/** File size or position.
*/
typedef off_t dk4_off_t;
#else
#if DK4_HAVE__OFF_T
/** File size or position.
*/
typedef _off_t dk4_off_t;
#else
/** File size or position.
*/
typedef dk4_um_t dk4_off_t;
#endif
#endif
/* --- Unix, stat --- */
#endif
#endif
#if DK4_HAVE_BLKSIZE_T
/** Filesystem block size.
*/
typedef blksize_t dk4_blksize_t;
#else
/** Filesystem block size.
*/
typedef dk4_um_t dk4_blksize_t;
#endif
#if DK4_HAVE_BLKCNT_T
/** Filesystem block count for file.
*/
typedef blkcnt_t dk4_blkcnt_t;
#else
/** Filesystem block count for file.
*/
typedef dk4_um_t dk4_blkcnt_t;
#endif
#if DK4_ON_WINDOWS
/** File statistics.
*/
typedef struct __stat64 dk4_stat_t;
#else
#if DK4_HAVE_LARGEFILE64_SOURCE && DK4_HAVE_STAT64
/** File statistics.
*/
typedef struct stat64 dk4_stat_t;
#else
/** File statistics.
*/
typedef struct stat dk4_stat_t;
#endif
#endif
#endif
|