1 | /** @file
|
---|
2 | * IPRT - File I/O.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2010 Oracle Corporation
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
9 | * available from http://www.virtualbox.org. This file is free software;
|
---|
10 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
11 | * General Public License (GPL) as published by the Free Software
|
---|
12 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
13 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
14 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | *
|
---|
16 | * The contents of this file may alternatively be used under the terms
|
---|
17 | * of the Common Development and Distribution License Version 1.0
|
---|
18 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
19 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
20 | * CDDL are applicable instead of those of the GPL.
|
---|
21 | *
|
---|
22 | * You may elect to license modified versions of this file under the
|
---|
23 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
24 | */
|
---|
25 |
|
---|
26 | #ifndef ___iprt_file_h
|
---|
27 | #define ___iprt_file_h
|
---|
28 |
|
---|
29 | #include <iprt/cdefs.h>
|
---|
30 | #include <iprt/types.h>
|
---|
31 | #include <iprt/stdarg.h>
|
---|
32 | #include <iprt/fs.h>
|
---|
33 |
|
---|
34 | RT_C_DECLS_BEGIN
|
---|
35 |
|
---|
36 | /** @defgroup grp_rt_fileio RTFile - File I/O
|
---|
37 | * @ingroup grp_rt
|
---|
38 | * @{
|
---|
39 | */
|
---|
40 |
|
---|
41 | /** Platform specific text line break.
|
---|
42 | * @deprecated Use text I/O streams and '\\n'. See iprt/stream.h. */
|
---|
43 | #if defined(RT_OS_OS2) || defined(RT_OS_WINDOWS)
|
---|
44 | # define RTFILE_LINEFEED "\r\n"
|
---|
45 | #else
|
---|
46 | # define RTFILE_LINEFEED "\n"
|
---|
47 | #endif
|
---|
48 |
|
---|
49 | /** Platform specific native standard input "handle". */
|
---|
50 | #ifdef RT_OS_WINDOWS
|
---|
51 | # define RTFILE_NATIVE_STDIN ((uint32_t)-10)
|
---|
52 | #else
|
---|
53 | # define RTFILE_NATIVE_STDIN 0
|
---|
54 | #endif
|
---|
55 |
|
---|
56 | /** Platform specific native standard outt "handle". */
|
---|
57 | #ifdef RT_OS_WINDOWS
|
---|
58 | # define RTFILE_NATIVE_STDOUT ((uint32_t)-11)
|
---|
59 | #else
|
---|
60 | # define RTFILE_NATIVE_STDOUT 1
|
---|
61 | #endif
|
---|
62 |
|
---|
63 | /** Platform specific native standard error "handle". */
|
---|
64 | #ifdef RT_OS_WINDOWS
|
---|
65 | # define RTFILE_NATIVE_STDERR ((uint32_t)-12)
|
---|
66 | #else
|
---|
67 | # define RTFILE_NATIVE_STDERR 2
|
---|
68 | #endif
|
---|
69 |
|
---|
70 |
|
---|
71 | /**
|
---|
72 | * Checks if the specified file name exists and is a regular file.
|
---|
73 | *
|
---|
74 | * Symbolic links will be resolved.
|
---|
75 | *
|
---|
76 | * @returns true if it's a regular file, false if it isn't.
|
---|
77 | * @param pszPath The path to the file.
|
---|
78 | *
|
---|
79 | * @sa RTDirExists, RTPathExists, RTSymlinkExists.
|
---|
80 | */
|
---|
81 | RTDECL(bool) RTFileExists(const char *pszPath);
|
---|
82 |
|
---|
83 | /**
|
---|
84 | * Queries the size of a file, given the path to it.
|
---|
85 | *
|
---|
86 | * Symbolic links will be resolved.
|
---|
87 | *
|
---|
88 | * @returns IPRT status code.
|
---|
89 | * @param pszPath The path to the file.
|
---|
90 | * @param pcbFile Where to return the file size (bytes).
|
---|
91 | *
|
---|
92 | * @sa RTFileGetSize, RTPathQueryInfoEx.
|
---|
93 | */
|
---|
94 | RTDECL(int) RTFileQuerySize(const char *pszPath, uint64_t *pcbFile);
|
---|
95 |
|
---|
96 |
|
---|
97 | /** @name Open flags
|
---|
98 | * @{ */
|
---|
99 | /** Open the file with read access. */
|
---|
100 | #define RTFILE_O_READ UINT32_C(0x00000001)
|
---|
101 | /** Open the file with write access. */
|
---|
102 | #define RTFILE_O_WRITE UINT32_C(0x00000002)
|
---|
103 | /** Open the file with read & write access. */
|
---|
104 | #define RTFILE_O_READWRITE UINT32_C(0x00000003)
|
---|
105 | /** The file access mask.
|
---|
106 | * @remarks The value 0 is invalid. */
|
---|
107 | #define RTFILE_O_ACCESS_MASK UINT32_C(0x00000003)
|
---|
108 |
|
---|
109 | /** Open file in APPEND mode, so all writes to the file handle will
|
---|
110 | * append data at the end of the file.
|
---|
111 | * @remarks It is ignored if write access is not requested, that is
|
---|
112 | * RTFILE_O_WRITE is not set. */
|
---|
113 | #define RTFILE_O_APPEND UINT32_C(0x00000004)
|
---|
114 | /* UINT32_C(0x00000008) is unused atm. */
|
---|
115 |
|
---|
116 | /** Sharing mode: deny none. */
|
---|
117 | #define RTFILE_O_DENY_NONE UINT32_C(0x00000080)
|
---|
118 | /** Sharing mode: deny read. */
|
---|
119 | #define RTFILE_O_DENY_READ UINT32_C(0x00000010)
|
---|
120 | /** Sharing mode: deny write. */
|
---|
121 | #define RTFILE_O_DENY_WRITE UINT32_C(0x00000020)
|
---|
122 | /** Sharing mode: deny read and write. */
|
---|
123 | #define RTFILE_O_DENY_READWRITE UINT32_C(0x00000030)
|
---|
124 | /** Sharing mode: deny all. */
|
---|
125 | #define RTFILE_O_DENY_ALL RTFILE_O_DENY_READWRITE
|
---|
126 | /** Sharing mode: do NOT deny delete (NT).
|
---|
127 | * @remarks This might not be implemented on all platforms, and will be
|
---|
128 | * defaulted & ignored on those.
|
---|
129 | */
|
---|
130 | #define RTFILE_O_DENY_NOT_DELETE UINT32_C(0x00000040)
|
---|
131 | /** Sharing mode mask. */
|
---|
132 | #define RTFILE_O_DENY_MASK UINT32_C(0x000000f0)
|
---|
133 |
|
---|
134 | /** Action: Open an existing file (the default action). */
|
---|
135 | #define RTFILE_O_OPEN UINT32_C(0x00000700)
|
---|
136 | /** Action: Create a new file or open an existing one. */
|
---|
137 | #define RTFILE_O_OPEN_CREATE UINT32_C(0x00000100)
|
---|
138 | /** Action: Create a new a file. */
|
---|
139 | #define RTFILE_O_CREATE UINT32_C(0x00000200)
|
---|
140 | /** Action: Create a new file or replace an existing one. */
|
---|
141 | #define RTFILE_O_CREATE_REPLACE UINT32_C(0x00000300)
|
---|
142 | /** Action mask. */
|
---|
143 | #define RTFILE_O_ACTION_MASK UINT32_C(0x00000700)
|
---|
144 |
|
---|
145 | /** Turns off indexing of files on Windows hosts, *CREATE* only.
|
---|
146 | * @remarks Window only. */
|
---|
147 | #define RTFILE_O_NOT_CONTENT_INDEXED UINT32_C(0x00000800)
|
---|
148 | /** Truncate the file.
|
---|
149 | * @remarks This will not truncate files opened for read-only.
|
---|
150 | * @remarks The trunction doesn't have to be atomically, so anyone else opening
|
---|
151 | * the file may be racing us. The caller is responsible for not causing
|
---|
152 | * this race. */
|
---|
153 | #define RTFILE_O_TRUNCATE UINT32_C(0x00001000)
|
---|
154 | /** Make the handle inheritable on RTProcessCreate(/exec). */
|
---|
155 | #define RTFILE_O_INHERIT UINT32_C(0x00002000)
|
---|
156 | /** Open file in non-blocking mode - non-portable.
|
---|
157 | * @remarks This flag may not be supported on all platforms, in which case it's
|
---|
158 | * considered an invalid parameter. */
|
---|
159 | #define RTFILE_O_NON_BLOCK UINT32_C(0x00004000)
|
---|
160 | /** Write through directly to disk. Workaround to avoid iSCSI
|
---|
161 | * initiator deadlocks on Windows hosts.
|
---|
162 | * @remarks This might not be implemented on all platforms, and will be ignored
|
---|
163 | * on those. */
|
---|
164 | #define RTFILE_O_WRITE_THROUGH UINT32_C(0x00008000)
|
---|
165 |
|
---|
166 | /** Attribute access: Attributes can be read if the file is being opened with
|
---|
167 | * read access, and can be written with write access. */
|
---|
168 | #define RTFILE_O_ACCESS_ATTR_DEFAULT UINT32_C(0x00000000)
|
---|
169 | /** Attribute access: Attributes can be read.
|
---|
170 | * @remarks Windows only. */
|
---|
171 | #define RTFILE_O_ACCESS_ATTR_READ UINT32_C(0x00010000)
|
---|
172 | /** Attribute access: Attributes can be written.
|
---|
173 | * @remarks Windows only. */
|
---|
174 | #define RTFILE_O_ACCESS_ATTR_WRITE UINT32_C(0x00020000)
|
---|
175 | /** Attribute access: Attributes can be both read & written.
|
---|
176 | * @remarks Windows only. */
|
---|
177 | #define RTFILE_O_ACCESS_ATTR_READWRITE UINT32_C(0x00030000)
|
---|
178 | /** Attribute access: The file attributes access mask.
|
---|
179 | * @remarks Windows only. */
|
---|
180 | #define RTFILE_O_ACCESS_ATTR_MASK UINT32_C(0x00030000)
|
---|
181 |
|
---|
182 | /** Open file for async I/O
|
---|
183 | * @remarks This flag may not be needed on all platforms, and will be ignored on
|
---|
184 | * those. */
|
---|
185 | #define RTFILE_O_ASYNC_IO UINT32_C(0x00040000)
|
---|
186 |
|
---|
187 | /** Disables caching.
|
---|
188 | *
|
---|
189 | * Useful when using very big files which might bring the host I/O scheduler to
|
---|
190 | * its knees during high I/O load.
|
---|
191 | *
|
---|
192 | * @remarks This flag might impose restrictions
|
---|
193 | * on the buffer alignment, start offset and/or transfer size.
|
---|
194 | *
|
---|
195 | * On Linux the buffer needs to be aligned to the 512 sector
|
---|
196 | * boundary.
|
---|
197 | *
|
---|
198 | * On Windows the FILE_FLAG_NO_BUFFERING is used (see
|
---|
199 | * http://msdn.microsoft.com/en-us/library/cc644950(VS.85).aspx ).
|
---|
200 | * The buffer address, the transfer size and offset needs to be aligned
|
---|
201 | * to the sector size of the volume. Furthermore FILE_APPEND_DATA is
|
---|
202 | * disabled. To write beyond the size of file use RTFileSetSize prior
|
---|
203 | * writing the data to the file.
|
---|
204 | *
|
---|
205 | * This flag does not work on Solaris if the target filesystem is ZFS.
|
---|
206 | * RTFileOpen will return an error with that configuration. When used
|
---|
207 | * with UFS the same alginment restrictions apply like Linux and
|
---|
208 | * Windows.
|
---|
209 | *
|
---|
210 | * @remarks This might not be implemented on all platforms, and will be ignored
|
---|
211 | * on those.
|
---|
212 | */
|
---|
213 | #define RTFILE_O_NO_CACHE UINT32_C(0x00080000)
|
---|
214 |
|
---|
215 | /** Unix file mode mask for use when creating files. */
|
---|
216 | #define RTFILE_O_CREATE_MODE_MASK UINT32_C(0x1ff00000)
|
---|
217 | /** The number of bits to shift to get the file mode mask.
|
---|
218 | * To extract it: (fFlags & RTFILE_O_CREATE_MODE_MASK) >> RTFILE_O_CREATE_MODE_SHIFT.
|
---|
219 | */
|
---|
220 | #define RTFILE_O_CREATE_MODE_SHIFT 20
|
---|
221 |
|
---|
222 | /*UINT32_C(0x20000000),
|
---|
223 | UINT32_C(0x40000000)
|
---|
224 | and UINT32_C(0x80000000) are unused atm. */
|
---|
225 |
|
---|
226 | /** Mask of all valid flags.
|
---|
227 | * @remark This doesn't validate the access mode properly.
|
---|
228 | */
|
---|
229 | #define RTFILE_O_VALID_MASK UINT32_C(0x1ffffff7)
|
---|
230 |
|
---|
231 | /** @} */
|
---|
232 |
|
---|
233 |
|
---|
234 | #ifdef IN_RING3
|
---|
235 | /**
|
---|
236 | * Force the use of open flags for all files opened after the setting is
|
---|
237 | * changed. The caller is responsible for not causing races with RTFileOpen().
|
---|
238 | *
|
---|
239 | * @returns iprt status code.
|
---|
240 | * @param fOpenForAccess Access mode to which the set/mask settings apply.
|
---|
241 | * @param fSet Open flags to be forced set.
|
---|
242 | * @param fMask Open flags to be masked out.
|
---|
243 | */
|
---|
244 | RTR3DECL(int) RTFileSetForceFlags(unsigned fOpenForAccess, unsigned fSet, unsigned fMask);
|
---|
245 | #endif /* IN_RING3 */
|
---|
246 |
|
---|
247 | /**
|
---|
248 | * Open a file.
|
---|
249 | *
|
---|
250 | * @returns iprt status code.
|
---|
251 | * @param pFile Where to store the handle to the opened file.
|
---|
252 | * @param pszFilename Path to the file which is to be opened. (UTF-8)
|
---|
253 | * @param fOpen Open flags, i.e a combination of the RTFILE_O_* defines.
|
---|
254 | * The ACCESS, ACTION and DENY flags are mandatory!
|
---|
255 | */
|
---|
256 | RTDECL(int) RTFileOpen(PRTFILE pFile, const char *pszFilename, uint32_t fOpen);
|
---|
257 |
|
---|
258 | /**
|
---|
259 | * Open a file given as a format string.
|
---|
260 | *
|
---|
261 | * @returns iprt status code.
|
---|
262 | * @param pFile Where to store the handle to the opened file.
|
---|
263 | * @param fOpen Open flags, i.e a combination of the RTFILE_O_* defines.
|
---|
264 | * The ACCESS, ACTION and DENY flags are mandatory!
|
---|
265 | * @param pszFilenameFmt Format string givin the path to the file which is to
|
---|
266 | * be opened. (UTF-8)
|
---|
267 | * @param ... Arguments to the format string.
|
---|
268 | */
|
---|
269 | RTDECL(int) RTFileOpenF(PRTFILE pFile, uint32_t fOpen, const char *pszFilenameFmt, ...);
|
---|
270 |
|
---|
271 | /**
|
---|
272 | * Open a file given as a format string.
|
---|
273 | *
|
---|
274 | * @returns iprt status code.
|
---|
275 | * @param pFile Where to store the handle to the opened file.
|
---|
276 | * @param fOpen Open flags, i.e a combination of the RTFILE_O_* defines.
|
---|
277 | * The ACCESS, ACTION and DENY flags are mandatory!
|
---|
278 | * @param pszFilenameFmt Format string givin the path to the file which is to
|
---|
279 | * be opened. (UTF-8)
|
---|
280 | * @param va Arguments to the format string.
|
---|
281 | */
|
---|
282 | RTDECL(int) RTFileOpenV(PRTFILE pFile, uint32_t fOpen, const char *pszFilenameFmt, va_list va);
|
---|
283 |
|
---|
284 | /**
|
---|
285 | * Open the bit bucket (aka /dev/null or nul).
|
---|
286 | *
|
---|
287 | * @returns IPRT status code.
|
---|
288 | * @param phFile Where to store the handle to the opened file.
|
---|
289 | * @param fAccess The desired access only, i.e. read, write or both.
|
---|
290 | */
|
---|
291 | RTDECL(int) RTFileOpenBitBucket(PRTFILE phFile, uint32_t fAccess);
|
---|
292 |
|
---|
293 | /**
|
---|
294 | * Close a file opened by RTFileOpen().
|
---|
295 | *
|
---|
296 | * @returns iprt status code.
|
---|
297 | * @param File The file handle to close.
|
---|
298 | */
|
---|
299 | RTDECL(int) RTFileClose(RTFILE File);
|
---|
300 |
|
---|
301 | /**
|
---|
302 | * Creates an IPRT file handle from a native one.
|
---|
303 | *
|
---|
304 | * @returns IPRT status code.
|
---|
305 | * @param pFile Where to store the IPRT file handle.
|
---|
306 | * @param uNative The native handle.
|
---|
307 | */
|
---|
308 | RTDECL(int) RTFileFromNative(PRTFILE pFile, RTHCINTPTR uNative);
|
---|
309 |
|
---|
310 | /**
|
---|
311 | * Gets the native handle for an IPRT file handle.
|
---|
312 | *
|
---|
313 | * @return The native handle.
|
---|
314 | * @param File The IPRT file handle.
|
---|
315 | */
|
---|
316 | RTDECL(RTHCINTPTR) RTFileToNative(RTFILE File);
|
---|
317 |
|
---|
318 | /**
|
---|
319 | * Delete a file.
|
---|
320 | *
|
---|
321 | * @returns iprt status code.
|
---|
322 | * @param pszFilename Path to the file which is to be deleted. (UTF-8)
|
---|
323 | * @todo This is a RTPath api!
|
---|
324 | */
|
---|
325 | RTDECL(int) RTFileDelete(const char *pszFilename);
|
---|
326 |
|
---|
327 | /** @name Seek flags.
|
---|
328 | * @{ */
|
---|
329 | /** Seek from the start of the file. */
|
---|
330 | #define RTFILE_SEEK_BEGIN 0x00
|
---|
331 | /** Seek from the current file position. */
|
---|
332 | #define RTFILE_SEEK_CURRENT 0x01
|
---|
333 | /** Seek from the end of the file. */
|
---|
334 | #define RTFILE_SEEK_END 0x02
|
---|
335 | /** @internal */
|
---|
336 | #define RTFILE_SEEK_FIRST RTFILE_SEEK_BEGIN
|
---|
337 | /** @internal */
|
---|
338 | #define RTFILE_SEEK_LAST RTFILE_SEEK_END
|
---|
339 | /** @} */
|
---|
340 |
|
---|
341 |
|
---|
342 | /**
|
---|
343 | * Changes the read & write position in a file.
|
---|
344 | *
|
---|
345 | * @returns iprt status code.
|
---|
346 | * @param File Handle to the file.
|
---|
347 | * @param offSeek Offset to seek.
|
---|
348 | * @param uMethod Seek method, i.e. one of the RTFILE_SEEK_* defines.
|
---|
349 | * @param poffActual Where to store the new file position.
|
---|
350 | * NULL is allowed.
|
---|
351 | */
|
---|
352 | RTDECL(int) RTFileSeek(RTFILE File, int64_t offSeek, unsigned uMethod, uint64_t *poffActual);
|
---|
353 |
|
---|
354 | /**
|
---|
355 | * Read bytes from a file.
|
---|
356 | *
|
---|
357 | * @returns iprt status code.
|
---|
358 | * @param File Handle to the file.
|
---|
359 | * @param pvBuf Where to put the bytes we read.
|
---|
360 | * @param cbToRead How much to read.
|
---|
361 | * @param *pcbRead How much we actually read .
|
---|
362 | * If NULL an error will be returned for a partial read.
|
---|
363 | */
|
---|
364 | RTDECL(int) RTFileRead(RTFILE File, void *pvBuf, size_t cbToRead, size_t *pcbRead);
|
---|
365 |
|
---|
366 | /**
|
---|
367 | * Read bytes from a file at a given offset.
|
---|
368 | * This function may modify the file position.
|
---|
369 | *
|
---|
370 | * @returns iprt status code.
|
---|
371 | * @param File Handle to the file.
|
---|
372 | * @param off Where to read.
|
---|
373 | * @param pvBuf Where to put the bytes we read.
|
---|
374 | * @param cbToRead How much to read.
|
---|
375 | * @param *pcbRead How much we actually read .
|
---|
376 | * If NULL an error will be returned for a partial read.
|
---|
377 | */
|
---|
378 | RTDECL(int) RTFileReadAt(RTFILE File, RTFOFF off, void *pvBuf, size_t cbToRead, size_t *pcbRead);
|
---|
379 |
|
---|
380 | /**
|
---|
381 | * Write bytes to a file.
|
---|
382 | *
|
---|
383 | * @returns iprt status code.
|
---|
384 | * @param File Handle to the file.
|
---|
385 | * @param pvBuf What to write.
|
---|
386 | * @param cbToWrite How much to write.
|
---|
387 | * @param *pcbWritten How much we actually wrote.
|
---|
388 | * If NULL an error will be returned for a partial write.
|
---|
389 | */
|
---|
390 | RTDECL(int) RTFileWrite(RTFILE File, const void *pvBuf, size_t cbToWrite, size_t *pcbWritten);
|
---|
391 |
|
---|
392 | /**
|
---|
393 | * Write bytes to a file at a given offset.
|
---|
394 | * This function may modify the file position.
|
---|
395 | *
|
---|
396 | * @returns iprt status code.
|
---|
397 | * @param File Handle to the file.
|
---|
398 | * @param off Where to write.
|
---|
399 | * @param pvBuf What to write.
|
---|
400 | * @param cbToWrite How much to write.
|
---|
401 | * @param *pcbWritten How much we actually wrote.
|
---|
402 | * If NULL an error will be returned for a partial write.
|
---|
403 | */
|
---|
404 | RTDECL(int) RTFileWriteAt(RTFILE File, RTFOFF off, const void *pvBuf, size_t cbToWrite, size_t *pcbWritten);
|
---|
405 |
|
---|
406 | /**
|
---|
407 | * Flushes the buffers for the specified file.
|
---|
408 | *
|
---|
409 | * @returns iprt status code.
|
---|
410 | * @param File Handle to the file.
|
---|
411 | */
|
---|
412 | RTDECL(int) RTFileFlush(RTFILE File);
|
---|
413 |
|
---|
414 | /**
|
---|
415 | * Set the size of the file.
|
---|
416 | *
|
---|
417 | * @returns iprt status code.
|
---|
418 | * @param File Handle to the file.
|
---|
419 | * @param cbSize The new file size.
|
---|
420 | */
|
---|
421 | RTDECL(int) RTFileSetSize(RTFILE File, uint64_t cbSize);
|
---|
422 |
|
---|
423 | /**
|
---|
424 | * Query the size of the file.
|
---|
425 | *
|
---|
426 | * @returns iprt status code.
|
---|
427 | * @param File Handle to the file.
|
---|
428 | * @param pcbSize Where to store the filesize.
|
---|
429 | */
|
---|
430 | RTDECL(int) RTFileGetSize(RTFILE File, uint64_t *pcbSize);
|
---|
431 |
|
---|
432 | /**
|
---|
433 | * Determine the maximum file size.
|
---|
434 | *
|
---|
435 | * @returns The max size of the file.
|
---|
436 | * -1 on failure, the file position is undefined.
|
---|
437 | * @param File Handle to the file.
|
---|
438 | * @see RTFileGetMaxSizeEx.
|
---|
439 | */
|
---|
440 | RTDECL(RTFOFF) RTFileGetMaxSize(RTFILE File);
|
---|
441 |
|
---|
442 | /**
|
---|
443 | * Determine the maximum file size.
|
---|
444 | *
|
---|
445 | * @returns IPRT status code.
|
---|
446 | * @param File Handle to the file.
|
---|
447 | * @param pcbMax Where to store the max file size.
|
---|
448 | * @see RTFileGetMaxSize.
|
---|
449 | */
|
---|
450 | RTDECL(int) RTFileGetMaxSizeEx(RTFILE File, PRTFOFF pcbMax);
|
---|
451 |
|
---|
452 | /**
|
---|
453 | * Determine the maximum file size depending on the file system the file is stored on.
|
---|
454 | *
|
---|
455 | * @returns The max size of the file.
|
---|
456 | * -1 on failure.
|
---|
457 | * @param File Handle to the file.
|
---|
458 | */
|
---|
459 | RTDECL(RTFOFF) RTFileGetMaxSize(RTFILE File);
|
---|
460 |
|
---|
461 | /**
|
---|
462 | * Gets the current file position.
|
---|
463 | *
|
---|
464 | * @returns File offset.
|
---|
465 | * @returns ~0UUL on failure.
|
---|
466 | * @param File Handle to the file.
|
---|
467 | */
|
---|
468 | RTDECL(uint64_t) RTFileTell(RTFILE File);
|
---|
469 |
|
---|
470 | /**
|
---|
471 | * Checks if the supplied handle is valid.
|
---|
472 | *
|
---|
473 | * @returns true if valid.
|
---|
474 | * @returns false if invalid.
|
---|
475 | * @param File The file handle
|
---|
476 | */
|
---|
477 | RTDECL(bool) RTFileIsValid(RTFILE File);
|
---|
478 |
|
---|
479 | /**
|
---|
480 | * Copies a file.
|
---|
481 | *
|
---|
482 | * @returns VERR_ALREADY_EXISTS if the destination file exists.
|
---|
483 | * @returns VBox Status code.
|
---|
484 | *
|
---|
485 | * @param pszSrc The path to the source file.
|
---|
486 | * @param pszDst The path to the destination file.
|
---|
487 | * This file will be created.
|
---|
488 | */
|
---|
489 | RTDECL(int) RTFileCopy(const char *pszSrc, const char *pszDst);
|
---|
490 |
|
---|
491 | /**
|
---|
492 | * Copies a file given the handles to both files.
|
---|
493 | *
|
---|
494 | * @returns VBox Status code.
|
---|
495 | *
|
---|
496 | * @param FileSrc The source file. The file position is unaltered.
|
---|
497 | * @param FileDst The destination file.
|
---|
498 | * On successful returns the file position is at the end of the file.
|
---|
499 | * On failures the file position and size is undefined.
|
---|
500 | */
|
---|
501 | RTDECL(int) RTFileCopyByHandles(RTFILE FileSrc, RTFILE FileDst);
|
---|
502 |
|
---|
503 | /** Flags for RTFileCopyEx().
|
---|
504 | * @{ */
|
---|
505 | /** Do not use RTFILE_O_DENY_WRITE on the source file to allow for copying files opened for writing. */
|
---|
506 | #define RTFILECOPY_FLAGS_NO_SRC_DENY_WRITE RT_BIT(0)
|
---|
507 | /** Do not use RTFILE_O_DENY_WRITE on the target file. */
|
---|
508 | #define RTFILECOPY_FLAGS_NO_DST_DENY_WRITE RT_BIT(1)
|
---|
509 | /** Do not use RTFILE_O_DENY_WRITE on either of the two files. */
|
---|
510 | #define RTFILECOPY_FLAGS_NO_DENY_WRITE ( RTFILECOPY_FLAGS_NO_SRC_DENY_WRITE | RTFILECOPY_FLAGS_NO_DST_DENY_WRITE )
|
---|
511 | /** */
|
---|
512 | #define RTFILECOPY_FLAGS_MASK UINT32_C(0x00000003)
|
---|
513 | /** @} */
|
---|
514 |
|
---|
515 | /**
|
---|
516 | * Copies a file.
|
---|
517 | *
|
---|
518 | * @returns VERR_ALREADY_EXISTS if the destination file exists.
|
---|
519 | * @returns VBox Status code.
|
---|
520 | *
|
---|
521 | * @param pszSrc The path to the source file.
|
---|
522 | * @param pszDst The path to the destination file.
|
---|
523 | * This file will be created.
|
---|
524 | * @param fFlags Flags (RTFILECOPY_*).
|
---|
525 | * @param pfnProgress Pointer to callback function for reporting progress.
|
---|
526 | * @param pvUser User argument to pass to pfnProgress along with the completion percentage.
|
---|
527 | */
|
---|
528 | RTDECL(int) RTFileCopyEx(const char *pszSrc, const char *pszDst, uint32_t fFlags, PFNRTPROGRESS pfnProgress, void *pvUser);
|
---|
529 |
|
---|
530 | /**
|
---|
531 | * Copies a file given the handles to both files and
|
---|
532 | * provide progress callbacks.
|
---|
533 | *
|
---|
534 | * @returns IPRT status code.
|
---|
535 | *
|
---|
536 | * @param FileSrc The source file. The file position is unaltered.
|
---|
537 | * @param FileDst The destination file.
|
---|
538 | * On successful returns the file position is at the end of the file.
|
---|
539 | * On failures the file position and size is undefined.
|
---|
540 | * @param pfnProgress Pointer to callback function for reporting progress.
|
---|
541 | * @param pvUser User argument to pass to pfnProgress along with the completion percentage.
|
---|
542 | */
|
---|
543 | RTDECL(int) RTFileCopyByHandlesEx(RTFILE FileSrc, RTFILE FileDst, PFNRTPROGRESS pfnProgress, void *pvUser);
|
---|
544 |
|
---|
545 | /**
|
---|
546 | * Renames a file.
|
---|
547 | *
|
---|
548 | * Identical to RTPathRename except that it will ensure that the source is not a directory.
|
---|
549 | *
|
---|
550 | * @returns IPRT status code.
|
---|
551 | * @returns VERR_ALREADY_EXISTS if the destination file exists.
|
---|
552 | *
|
---|
553 | * @param pszSrc The path to the source file.
|
---|
554 | * @param pszDst The path to the destination file.
|
---|
555 | * This file will be created.
|
---|
556 | * @param fRename See RTPathRename.
|
---|
557 | */
|
---|
558 | RTDECL(int) RTFileRename(const char *pszSrc, const char *pszDst, unsigned fRename);
|
---|
559 |
|
---|
560 |
|
---|
561 | /** @name RTFileMove flags (bit masks).
|
---|
562 | * @{ */
|
---|
563 | /** Replace destination file if present. */
|
---|
564 | #define RTFILEMOVE_FLAGS_REPLACE 0x1
|
---|
565 | /** @} */
|
---|
566 |
|
---|
567 | /**
|
---|
568 | * Moves a file.
|
---|
569 | *
|
---|
570 | * RTFileMove differs from RTFileRename in that it works across volumes.
|
---|
571 | *
|
---|
572 | * @returns IPRT status code.
|
---|
573 | * @returns VERR_ALREADY_EXISTS if the destination file exists.
|
---|
574 | *
|
---|
575 | * @param pszSrc The path to the source file.
|
---|
576 | * @param pszDst The path to the destination file.
|
---|
577 | * This file will be created.
|
---|
578 | * @param fMove A combination of the RTFILEMOVE_* flags.
|
---|
579 | */
|
---|
580 | RTDECL(int) RTFileMove(const char *pszSrc, const char *pszDst, unsigned fMove);
|
---|
581 |
|
---|
582 |
|
---|
583 | /** @page pg_rt_filelock RT File locking API description
|
---|
584 | *
|
---|
585 | * File locking general rules:
|
---|
586 | *
|
---|
587 | * Region to lock or unlock can be located beyond the end of file, this can be used for
|
---|
588 | * growing files.
|
---|
589 | * Read (or Shared) locks can be acquired held by an unlimited number of processes at the
|
---|
590 | * same time, but a Write (or Exclusive) lock can only be acquired by one process, and
|
---|
591 | * cannot coexist with a Shared lock. To acquire a Read lock, a process must wait until
|
---|
592 | * there are no processes holding any Write locks. To acquire a Write lock, a process must
|
---|
593 | * wait until there are no processes holding either kind of lock.
|
---|
594 | * By default, RTFileLock and RTFileChangeLock calls returns error immediately if the lock
|
---|
595 | * can't be acquired due to conflict with other locks, however they can be called in wait mode.
|
---|
596 | *
|
---|
597 | * Differences in implementation:
|
---|
598 | *
|
---|
599 | * Win32, OS/2: Locking is mandatory, since locks are enforced by the operating system.
|
---|
600 | * I.e. when file region is locked in Read mode, any write in it will fail; in case of Write
|
---|
601 | * lock - region can be read and writed only by lock's owner.
|
---|
602 | *
|
---|
603 | * Win32: File size change (RTFileSetSize) is not controlled by locking at all (!) in the
|
---|
604 | * operation system. Also see comments to RTFileChangeLock API call.
|
---|
605 | *
|
---|
606 | * Linux/Posix: By default locks in Unixes are advisory. This means that cooperating processes
|
---|
607 | * may use locks to coordinate access to a file between themselves, but programs are also free
|
---|
608 | * to ignore locks and access the file in any way they choose to.
|
---|
609 | *
|
---|
610 | * Additional reading:
|
---|
611 | * http://en.wikipedia.org/wiki/File_locking
|
---|
612 | * http://unixhelp.ed.ac.uk/CGI/man-cgi?fcntl+2
|
---|
613 | * http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/lockfileex.asp
|
---|
614 | */
|
---|
615 |
|
---|
616 | /** @name Lock flags (bit masks).
|
---|
617 | * @{ */
|
---|
618 | /** Read access, can be shared with others. */
|
---|
619 | #define RTFILE_LOCK_READ 0x00
|
---|
620 | /** Write access, one at a time. */
|
---|
621 | #define RTFILE_LOCK_WRITE 0x01
|
---|
622 | /** Don't wait for other locks to be released. */
|
---|
623 | #define RTFILE_LOCK_IMMEDIATELY 0x00
|
---|
624 | /** Wait till conflicting locks have been released. */
|
---|
625 | #define RTFILE_LOCK_WAIT 0x02
|
---|
626 | /** Valid flags mask */
|
---|
627 | #define RTFILE_LOCK_MASK 0x03
|
---|
628 | /** @} */
|
---|
629 |
|
---|
630 |
|
---|
631 | /**
|
---|
632 | * Locks a region of file for read (shared) or write (exclusive) access.
|
---|
633 | *
|
---|
634 | * @returns iprt status code.
|
---|
635 | * @returns VERR_FILE_LOCK_VIOLATION if lock can't be acquired.
|
---|
636 | * @param File Handle to the file.
|
---|
637 | * @param fLock Lock method and flags, see RTFILE_LOCK_* defines.
|
---|
638 | * @param offLock Offset of lock start.
|
---|
639 | * @param cbLock Length of region to lock, may overlap the end of file.
|
---|
640 | */
|
---|
641 | RTDECL(int) RTFileLock(RTFILE File, unsigned fLock, int64_t offLock, uint64_t cbLock);
|
---|
642 |
|
---|
643 | /**
|
---|
644 | * Changes a lock type from read to write or from write to read.
|
---|
645 | * The region to type change must correspond exactly to an existing locked region.
|
---|
646 | * If change can't be done due to locking conflict and non-blocking mode is used, error is
|
---|
647 | * returned and lock keeps its state (see next warning).
|
---|
648 | *
|
---|
649 | * WARNING: win32 implementation of this call is not atomic, it transforms to a pair of
|
---|
650 | * calls RTFileUnlock and RTFileLock. Potentially the previously acquired lock can be
|
---|
651 | * lost, i.e. function is called in non-blocking mode, previous lock is freed, new lock can't
|
---|
652 | * be acquired, and old lock (previous state) can't be acquired back too. This situation
|
---|
653 | * may occurs _only_ if the other process is acquiring a _write_ lock in blocking mode or
|
---|
654 | * in race condition with the current call.
|
---|
655 | * In this very bad case special error code VERR_FILE_LOCK_LOST will be returned.
|
---|
656 | *
|
---|
657 | * @returns iprt status code.
|
---|
658 | * @returns VERR_FILE_NOT_LOCKED if region was not locked.
|
---|
659 | * @returns VERR_FILE_LOCK_VIOLATION if lock type can't be changed, lock remains its type.
|
---|
660 | * @returns VERR_FILE_LOCK_LOST if lock was lost, we haven't this lock anymore :(
|
---|
661 | * @param File Handle to the file.
|
---|
662 | * @param fLock Lock method and flags, see RTFILE_LOCK_* defines.
|
---|
663 | * @param offLock Offset of lock start.
|
---|
664 | * @param cbLock Length of region to lock, may overlap the end of file.
|
---|
665 | */
|
---|
666 | RTDECL(int) RTFileChangeLock(RTFILE File, unsigned fLock, int64_t offLock, uint64_t cbLock);
|
---|
667 |
|
---|
668 | /**
|
---|
669 | * Unlocks previously locked region of file.
|
---|
670 | * The region to unlock must correspond exactly to an existing locked region.
|
---|
671 | *
|
---|
672 | * @returns iprt status code.
|
---|
673 | * @returns VERR_FILE_NOT_LOCKED if region was not locked.
|
---|
674 | * @param File Handle to the file.
|
---|
675 | * @param offLock Offset of lock start.
|
---|
676 | * @param cbLock Length of region to unlock, may overlap the end of file.
|
---|
677 | */
|
---|
678 | RTDECL(int) RTFileUnlock(RTFILE File, int64_t offLock, uint64_t cbLock);
|
---|
679 |
|
---|
680 |
|
---|
681 | /**
|
---|
682 | * Query information about an open file.
|
---|
683 | *
|
---|
684 | * @returns iprt status code.
|
---|
685 | *
|
---|
686 | * @param File Handle to the file.
|
---|
687 | * @param pObjInfo Object information structure to be filled on successful return.
|
---|
688 | * @param enmAdditionalAttribs Which set of additional attributes to request.
|
---|
689 | * Use RTFSOBJATTRADD_NOTHING if this doesn't matter.
|
---|
690 | */
|
---|
691 | RTDECL(int) RTFileQueryInfo(RTFILE File, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAdditionalAttribs);
|
---|
692 |
|
---|
693 | /**
|
---|
694 | * Changes one or more of the timestamps associated of file system object.
|
---|
695 | *
|
---|
696 | * @returns iprt status code.
|
---|
697 | * @retval VERR_NOT_SUPPORTED is returned if the operation isn't supported by
|
---|
698 | * the OS.
|
---|
699 | *
|
---|
700 | * @param File Handle to the file.
|
---|
701 | * @param pAccessTime Pointer to the new access time. NULL if not to be changed.
|
---|
702 | * @param pModificationTime Pointer to the new modifcation time. NULL if not to be changed.
|
---|
703 | * @param pChangeTime Pointer to the new change time. NULL if not to be changed.
|
---|
704 | * @param pBirthTime Pointer to the new time of birth. NULL if not to be changed.
|
---|
705 | *
|
---|
706 | * @remark The file system might not implement all these time attributes,
|
---|
707 | * the API will ignore the ones which aren't supported.
|
---|
708 | *
|
---|
709 | * @remark The file system might not implement the time resolution
|
---|
710 | * employed by this interface, the time will be chopped to fit.
|
---|
711 | *
|
---|
712 | * @remark The file system may update the change time even if it's
|
---|
713 | * not specified.
|
---|
714 | *
|
---|
715 | * @remark POSIX can only set Access & Modification and will always set both.
|
---|
716 | */
|
---|
717 | RTDECL(int) RTFileSetTimes(RTFILE File, PCRTTIMESPEC pAccessTime, PCRTTIMESPEC pModificationTime,
|
---|
718 | PCRTTIMESPEC pChangeTime, PCRTTIMESPEC pBirthTime);
|
---|
719 |
|
---|
720 | /**
|
---|
721 | * Gets one or more of the timestamps associated of file system object.
|
---|
722 | *
|
---|
723 | * @returns iprt status code.
|
---|
724 | * @param File Handle to the file.
|
---|
725 | * @param pAccessTime Where to store the access time. NULL is ok.
|
---|
726 | * @param pModificationTime Where to store the modifcation time. NULL is ok.
|
---|
727 | * @param pChangeTime Where to store the change time. NULL is ok.
|
---|
728 | * @param pBirthTime Where to store the time of birth. NULL is ok.
|
---|
729 | *
|
---|
730 | * @remark This is wrapper around RTFileQueryInfo() and exists to complement RTFileSetTimes().
|
---|
731 | */
|
---|
732 | RTDECL(int) RTFileGetTimes(RTFILE File, PRTTIMESPEC pAccessTime, PRTTIMESPEC pModificationTime,
|
---|
733 | PRTTIMESPEC pChangeTime, PRTTIMESPEC pBirthTime);
|
---|
734 |
|
---|
735 | /**
|
---|
736 | * Changes the mode flags of an open file.
|
---|
737 | *
|
---|
738 | * The API requires at least one of the mode flag sets (Unix/Dos) to
|
---|
739 | * be set. The type is ignored.
|
---|
740 | *
|
---|
741 | * @returns iprt status code.
|
---|
742 | * @param File Handle to the file.
|
---|
743 | * @param fMode The new file mode, see @ref grp_rt_fs for details.
|
---|
744 | */
|
---|
745 | RTDECL(int) RTFileSetMode(RTFILE File, RTFMODE fMode);
|
---|
746 |
|
---|
747 | /**
|
---|
748 | * Gets the mode flags of an open file.
|
---|
749 | *
|
---|
750 | * @returns iprt status code.
|
---|
751 | * @param File Handle to the file.
|
---|
752 | * @param pfMode Where to store the file mode, see @ref grp_rt_fs for details.
|
---|
753 | *
|
---|
754 | * @remark This is wrapper around RTFileQueryInfo()
|
---|
755 | * and exists to complement RTFileSetMode().
|
---|
756 | */
|
---|
757 | RTDECL(int) RTFileGetMode(RTFILE File, uint32_t *pfMode);
|
---|
758 |
|
---|
759 | /**
|
---|
760 | * Changes the owner and/or group of an open file.
|
---|
761 | *
|
---|
762 | * @returns iprt status code.
|
---|
763 | * @param File Handle to the file.
|
---|
764 | * @param uid The new file owner user id. Pass NIL_RTUID to leave
|
---|
765 | * this unchanged.
|
---|
766 | * @param gid The new group id. Pass NIL_RTGID to leave this
|
---|
767 | * unchanged.
|
---|
768 | */
|
---|
769 | RTDECL(int) RTFileSetOwner(RTFILE File, uint32_t uid, uint32_t gid);
|
---|
770 |
|
---|
771 | /**
|
---|
772 | * Gets the owner and/or group of an open file.
|
---|
773 | *
|
---|
774 | * @returns iprt status code.
|
---|
775 | * @param File Handle to the file.
|
---|
776 | * @param pUid Where to store the owner user id. NULL is ok.
|
---|
777 | * @param pGid Where to store the group id. NULL is ok.
|
---|
778 | *
|
---|
779 | * @remark This is wrapper around RTFileQueryInfo() and exists to complement RTFileGetOwner().
|
---|
780 | */
|
---|
781 | RTDECL(int) RTFileGetOwner(RTFILE File, uint32_t *pUid, uint32_t *pGid);
|
---|
782 |
|
---|
783 | /**
|
---|
784 | * Executes an IOCTL on a file descriptor.
|
---|
785 | *
|
---|
786 | * This function is currently only available in L4 and posix environments.
|
---|
787 | * Attemps at calling it from code shared with any other platforms will break things!
|
---|
788 | *
|
---|
789 | * The rational for defining this API is to simplify L4 porting of audio drivers,
|
---|
790 | * and to remove some of the assumptions on RTFILE being a file descriptor on
|
---|
791 | * platforms using the posix file implementation.
|
---|
792 | *
|
---|
793 | * @returns iprt status code.
|
---|
794 | * @param File Handle to the file.
|
---|
795 | * @param iRequest IOCTL request to carry out.
|
---|
796 | * @param pvData IOCTL data.
|
---|
797 | * @param cbData Size of the IOCTL data.
|
---|
798 | * @param piRet Return value of the IOCTL request.
|
---|
799 | */
|
---|
800 | RTDECL(int) RTFileIoCtl(RTFILE File, unsigned long ulRequest, void *pvData, unsigned cbData, int *piRet);
|
---|
801 |
|
---|
802 | /**
|
---|
803 | * Query the sizes of a filesystem.
|
---|
804 | *
|
---|
805 | * @returns iprt status code.
|
---|
806 | * @retval VERR_NOT_SUPPORTED is returned if the operation isn't supported by
|
---|
807 | * the OS.
|
---|
808 | *
|
---|
809 | * @param hFile The file handle.
|
---|
810 | * @param pcbTotal Where to store the total filesystem space. (Optional)
|
---|
811 | * @param pcbFree Where to store the remaining free space in the filesystem. (Optional)
|
---|
812 | * @param pcbBlock Where to store the block size. (Optional)
|
---|
813 | * @param pcbSector Where to store the sector size. (Optional)
|
---|
814 | *
|
---|
815 | * @sa RTFsQuerySizes
|
---|
816 | */
|
---|
817 | RTDECL(int) RTFileQueryFsSizes(RTFILE hFile, PRTFOFF pcbTotal, RTFOFF *pcbFree,
|
---|
818 | uint32_t *pcbBlock, uint32_t *pcbSector);
|
---|
819 |
|
---|
820 | /**
|
---|
821 | * Reads the file into memory.
|
---|
822 | *
|
---|
823 | * The caller must free the memory using RTFileReadAllFree().
|
---|
824 | *
|
---|
825 | * @returns IPRT status code.
|
---|
826 | * @param pszFilename The name of the file.
|
---|
827 | * @param ppvFile Where to store the pointer to the memory on successful return.
|
---|
828 | * @param pcbFile Where to store the size of the returned memory.
|
---|
829 | *
|
---|
830 | * @remarks Note that this function may be implemented using memory mapping, which means
|
---|
831 | * that the file may remain open until RTFileReadAllFree() is called. It also
|
---|
832 | * means that the return memory may reflect the state of the file when it's
|
---|
833 | * accessed instead of when this call was done. So, in short, don't use this
|
---|
834 | * API for volatile files, then rather use the extended variant with a
|
---|
835 | * yet-to-be-defined flag.
|
---|
836 | */
|
---|
837 | RTDECL(int) RTFileReadAll(const char *pszFilename, void **ppvFile, size_t *pcbFile);
|
---|
838 |
|
---|
839 | /**
|
---|
840 | * Reads the file into memory.
|
---|
841 | *
|
---|
842 | * The caller must free the memory using RTFileReadAllFree().
|
---|
843 | *
|
---|
844 | * @returns IPRT status code.
|
---|
845 | * @param pszFilename The name of the file.
|
---|
846 | * @param off The offset to start reading at.
|
---|
847 | * @param cbMax The maximum number of bytes to read into memory. Specify RTFOFF_MAX
|
---|
848 | * to read to the end of the file.
|
---|
849 | * @param fFlags See RTFILE_RDALL_*.
|
---|
850 | * @param ppvFile Where to store the pointer to the memory on successful return.
|
---|
851 | * @param pcbFile Where to store the size of the returned memory.
|
---|
852 | *
|
---|
853 | * @remarks See the remarks for RTFileReadAll.
|
---|
854 | */
|
---|
855 | RTDECL(int) RTFileReadAllEx(const char *pszFilename, RTFOFF off, RTFOFF cbMax, uint32_t fFlags, void **ppvFile, size_t *pcbFile);
|
---|
856 |
|
---|
857 | /**
|
---|
858 | * Reads the file into memory.
|
---|
859 | *
|
---|
860 | * The caller must free the memory using RTFileReadAllFree().
|
---|
861 | *
|
---|
862 | * @returns IPRT status code.
|
---|
863 | * @param File The handle to the file.
|
---|
864 | * @param ppvFile Where to store the pointer to the memory on successful return.
|
---|
865 | * @param pcbFile Where to store the size of the returned memory.
|
---|
866 | *
|
---|
867 | * @remarks See the remarks for RTFileReadAll.
|
---|
868 | */
|
---|
869 | RTDECL(int) RTFileReadAllByHandle(RTFILE File, void **ppvFile, size_t *pcbFile);
|
---|
870 |
|
---|
871 | /**
|
---|
872 | * Reads the file into memory.
|
---|
873 | *
|
---|
874 | * The caller must free the memory using RTFileReadAllFree().
|
---|
875 | *
|
---|
876 | * @returns IPRT status code.
|
---|
877 | * @param File The handle to the file.
|
---|
878 | * @param off The offset to start reading at.
|
---|
879 | * @param cbMax The maximum number of bytes to read into memory. Specify RTFOFF_MAX
|
---|
880 | * to read to the end of the file.
|
---|
881 | * @param fFlags See RTFILE_RDALL_*.
|
---|
882 | * @param ppvFile Where to store the pointer to the memory on successful return.
|
---|
883 | * @param pcbFile Where to store the size of the returned memory.
|
---|
884 | *
|
---|
885 | * @remarks See the remarks for RTFileReadAll.
|
---|
886 | */
|
---|
887 | RTDECL(int) RTFileReadAllByHandleEx(RTFILE File, RTFOFF off, RTFOFF cbMax, uint32_t fFlags, void **ppvFile, size_t *pcbFile);
|
---|
888 |
|
---|
889 | /**
|
---|
890 | * Frees the memory returned by one of the RTFileReadAll(), RTFileReadAllEx(),
|
---|
891 | * RTFileReadAllByHandle() and RTFileReadAllByHandleEx() functions.
|
---|
892 | *
|
---|
893 | * @param pvFile Pointer to the memory.
|
---|
894 | * @param cbFile The size of the memory.
|
---|
895 | */
|
---|
896 | RTDECL(void) RTFileReadAllFree(void *pvFile, size_t cbFile);
|
---|
897 |
|
---|
898 | /** @name RTFileReadAllEx and RTFileReadAllHandleEx flags
|
---|
899 | * The open flags are ignored by RTFileReadAllHandleEx.
|
---|
900 | * @{ */
|
---|
901 | #define RTFILE_RDALL_O_DENY_NONE RTFILE_O_DENY_NONE
|
---|
902 | #define RTFILE_RDALL_O_DENY_READ RTFILE_O_DENY_READ
|
---|
903 | #define RTFILE_RDALL_O_DENY_WRITE RTFILE_O_DENY_WRITE
|
---|
904 | #define RTFILE_RDALL_O_DENY_READWRITE RTFILE_O_DENY_READWRITE
|
---|
905 | #define RTFILE_RDALL_O_DENY_ALL RTFILE_O_DENY_ALL
|
---|
906 | #define RTFILE_RDALL_O_DENY_NOT_DELETE RTFILE_O_DENY_NOT_DELETE
|
---|
907 | #define RTFILE_RDALL_O_DENY_MASK RTFILE_O_DENY_MASK
|
---|
908 | /** Mask of valid flags. */
|
---|
909 | #define RTFILE_RDALL_VALID_MASK RTFILE_RDALL_O_DENY_MASK
|
---|
910 | /** @} */
|
---|
911 |
|
---|
912 |
|
---|
913 | #ifdef IN_RING3
|
---|
914 |
|
---|
915 | /** @page pg_rt_asyncio RT File async I/O API
|
---|
916 | *
|
---|
917 | * File operations are usually blocking the calling thread until
|
---|
918 | * they completed making it impossible to let the thread do anything
|
---|
919 | * else in-between.
|
---|
920 | * The RT File async I/O API provides an easy and efficient way to
|
---|
921 | * access files asynchronously using the native facilities provided
|
---|
922 | * by each operating system.
|
---|
923 | *
|
---|
924 | * @section sec_rt_asyncio_objects Objects
|
---|
925 | *
|
---|
926 | * There are two objects used in this API.
|
---|
927 | * The first object is the request. A request contains every information
|
---|
928 | * needed two complete the file operation successfully like the start offset
|
---|
929 | * and pointer to the source or destination buffer.
|
---|
930 | * Requests are created with RTFileAioReqCreate() and destroyed with
|
---|
931 | * RTFileAioReqDestroy().
|
---|
932 | * Because creating a request may require allocating various operating
|
---|
933 | * system dependent resources and may be quite expensive it is possible
|
---|
934 | * to use a request more than once to save CPU cycles.
|
---|
935 | * A request is constructed with either RTFileAioReqPrepareRead()
|
---|
936 | * which will set up a request to read from the given file or
|
---|
937 | * RTFileAioReqPrepareWrite() which will write to a given file.
|
---|
938 | *
|
---|
939 | * The second object is the context. A file is associated with a context
|
---|
940 | * and requests for this file may complete only on the context the file
|
---|
941 | * was associated with and not on the context given in RTFileAioCtxSubmit()
|
---|
942 | * (see below for further information).
|
---|
943 | * RTFileAioCtxWait() is used to wait for completion of requests which were
|
---|
944 | * associated with the context. While waiting for requests the thread can not
|
---|
945 | * respond to global state changes. That's why the API provides a way to let
|
---|
946 | * RTFileAioCtxWait() return immediately no matter how many requests
|
---|
947 | * have finished through RTFileAioCtxWakeup(). The return code is
|
---|
948 | * VERR_INTERRUPTED to let the thread know that he got interrupted.
|
---|
949 | *
|
---|
950 | * @section sec_rt_asyncio_request_states Request states
|
---|
951 | *
|
---|
952 | * Created:
|
---|
953 | * After a request was created with RTFileAioReqCreate() it is in the same state
|
---|
954 | * like it just completed successfully. RTFileAioReqGetRC() will return VINF_SUCCESS
|
---|
955 | * and a transfer size of 0. RTFileAioReqGetUser() will return NULL. The request can be
|
---|
956 | * destroyed RTFileAioReqDestroy(). It is also allowed to prepare a the request
|
---|
957 | * for a data transfer with the RTFileAioReqPrepare* methods.
|
---|
958 | * Calling any other method like RTFileAioCtxSubmit() will return VERR_FILE_AIO_NOT_PREPARED
|
---|
959 | * and RTFileAioReqCancel() returns VERR_FILE_AIO_NOT_SUBMITTED.
|
---|
960 | *
|
---|
961 | * Prepared:
|
---|
962 | * A request will enter this state if one of the RTFileAioReqPrepare* methods
|
---|
963 | * is called. In this state you can still destroy and retrieve the user data
|
---|
964 | * associated with the request but trying to cancel the request or getting
|
---|
965 | * the result of the operation will return VERR_FILE_AIO_NOT_SUBMITTED.
|
---|
966 | *
|
---|
967 | * Submitted:
|
---|
968 | * A prepared request can be submitted with RTFileAioCtxSubmit(). If the operation
|
---|
969 | * succeeds it is not allowed to touch the request or free any resources until
|
---|
970 | * it completed through RTFileAioCtxWait(). The only allowed method is RTFileAioReqCancel()
|
---|
971 | * which tries to cancel the request. The request will go into the completed state
|
---|
972 | * and RTFileAioReqGetRC() will return VERR_FILE_AIO_CANCELED.
|
---|
973 | * If the request completes not matter if successfully or with an error it will
|
---|
974 | * switch into the completed state. RTFileReqDestroy() fails if the given request
|
---|
975 | * is in this state.
|
---|
976 | *
|
---|
977 | * Completed:
|
---|
978 | * The request will be in this state after it completed and returned through
|
---|
979 | * RTFileAioCtxWait(). RTFileAioReqGetRC() returns the final result code
|
---|
980 | * and the number of bytes transferred.
|
---|
981 | * The request can be used for new data transfers.
|
---|
982 | *
|
---|
983 | * @section sec_rt_asyncio_threading Threading
|
---|
984 | *
|
---|
985 | * The API is a thin wrapper around the specific host OS APIs and therefore
|
---|
986 | * relies on the thread safety of the underlying API.
|
---|
987 | * The interesting functions with regards to thread safety are RTFileAioCtxSubmit()
|
---|
988 | * and RTFileAioCtxWait(). RTFileAioCtxWait() must not be called from different
|
---|
989 | * threads at the same time with the same context handle. The same applies to
|
---|
990 | * RTFileAioCtxSubmit(). However it is possible to submit new requests from a different
|
---|
991 | * thread while waiting for completed requests on another thread with RTFileAioCtxWait().
|
---|
992 | *
|
---|
993 | * @section sec_rt_asyncio_implementations Differences in implementation
|
---|
994 | *
|
---|
995 | * Because the host APIs are quite different on every OS and every API has other limitations
|
---|
996 | * there are some things to consider to make the code as portable as possible.
|
---|
997 | *
|
---|
998 | * The first restriction at the moment is that every buffer has to be aligned to a 512 byte boundary.
|
---|
999 | * This limitation comes from the Linux io_* interface. To use the interface the file
|
---|
1000 | * must be opened with O_DIRECT. This flag disables the kernel cache too which may
|
---|
1001 | * degrade performance but is unfortunately the only way to make asynchronous
|
---|
1002 | * I/O work till today (if O_DIRECT is omitted io_submit will revert to sychronous behavior
|
---|
1003 | * and will return when the requests finished and when they are queued).
|
---|
1004 | * It is mostly used by DBMS which do theire own caching.
|
---|
1005 | * Furthermore there is no filesystem independent way to discover the restrictions at least
|
---|
1006 | * for the 2.4 kernel series. Since 2.6 the 512 byte boundary seems to be used by all
|
---|
1007 | * file systems. So Linus comment about this flag is comprehensible but Linux
|
---|
1008 | * lacks an alternative at the moment.
|
---|
1009 | *
|
---|
1010 | * The next limitation applies only to Windows. Requests are not associated with the
|
---|
1011 | * I/O context they are associated with but with the file the request is for.
|
---|
1012 | * The file needs to be associated with exactly one I/O completion port and requests
|
---|
1013 | * for this file will only arrive at that context after they completed and not on
|
---|
1014 | * the context the request was submitted.
|
---|
1015 | * To associate a file with a specific context RTFileAioCtxAssociateWithFile() is
|
---|
1016 | * used. It is only implemented on Windows and does nothing on the other platforms.
|
---|
1017 | * If the file needs to be associated with different context for some reason
|
---|
1018 | * the file must be closed first. After it was opened again the new context
|
---|
1019 | * can be associated with the other context.
|
---|
1020 | * This can't be done by the API because there is no way to retrieve the flags
|
---|
1021 | * the file was opened with.
|
---|
1022 | */
|
---|
1023 |
|
---|
1024 | /**
|
---|
1025 | * Global limits for the AIO API.
|
---|
1026 | */
|
---|
1027 | typedef struct RTFILEAIOLIMITS
|
---|
1028 | {
|
---|
1029 | /** Global number of simultaneous outstanding requests allowed.
|
---|
1030 | * RTFILEAIO_UNLIMITED_REQS means no limit. */
|
---|
1031 | uint32_t cReqsOutstandingMax;
|
---|
1032 | /** The alignment data buffers need to have.
|
---|
1033 | * 0 means no alignment restrictions. */
|
---|
1034 | uint32_t cbBufferAlignment;
|
---|
1035 | } RTFILEAIOLIMITS;
|
---|
1036 | /** A pointer to a AIO limits structure. */
|
---|
1037 | typedef RTFILEAIOLIMITS *PRTFILEAIOLIMITS;
|
---|
1038 |
|
---|
1039 | /**
|
---|
1040 | * Returns the global limits for the AIO API.
|
---|
1041 | *
|
---|
1042 | * @returns IPRT status code.
|
---|
1043 | * @retval VERR_NOT_SUPPORTED if the host does not support the async I/O API.
|
---|
1044 | *
|
---|
1045 | * @param pAioLimits Where to store the global limit information.
|
---|
1046 | */
|
---|
1047 | RTDECL(int) RTFileAioGetLimits(PRTFILEAIOLIMITS pAioLimits);
|
---|
1048 |
|
---|
1049 | /**
|
---|
1050 | * Creates an async I/O request handle.
|
---|
1051 | *
|
---|
1052 | * @returns IPRT status code.
|
---|
1053 | * @param phReq Where to store the request handle.
|
---|
1054 | */
|
---|
1055 | RTDECL(int) RTFileAioReqCreate(PRTFILEAIOREQ phReq);
|
---|
1056 |
|
---|
1057 | /**
|
---|
1058 | * Destroys an async I/O request handle.
|
---|
1059 | *
|
---|
1060 | * @returns IPRT status code.
|
---|
1061 | * @retval VERR_FILE_AIO_IN_PROGRESS if the request is still in progress.
|
---|
1062 | *
|
---|
1063 | * @param hReq The request handle.
|
---|
1064 | */
|
---|
1065 | RTDECL(int) RTFileAioReqDestroy(RTFILEAIOREQ hReq);
|
---|
1066 |
|
---|
1067 | /**
|
---|
1068 | * Prepares an async read request.
|
---|
1069 | *
|
---|
1070 | * @returns IPRT status code.
|
---|
1071 | * @retval VERR_FILE_AIO_IN_PROGRESS if the request is still in progress.
|
---|
1072 | *
|
---|
1073 | * @param hReq The request handle.
|
---|
1074 | * @param hFile The file to read from.
|
---|
1075 | * @param off The offset to start reading at.
|
---|
1076 | * @param pvBuf Where to store the read bits.
|
---|
1077 | * @param cbRead Number of bytes to read.
|
---|
1078 | * @param pvUser Opaque user data associated with this request which
|
---|
1079 | * can be retrieved with RTFileAioReqGetUser().
|
---|
1080 | */
|
---|
1081 | RTDECL(int) RTFileAioReqPrepareRead(RTFILEAIOREQ hReq, RTFILE hFile, RTFOFF off,
|
---|
1082 | void *pvBuf, size_t cbRead, void *pvUser);
|
---|
1083 |
|
---|
1084 | /**
|
---|
1085 | * Prepares an async write request.
|
---|
1086 | *
|
---|
1087 | * @returns IPRT status code.
|
---|
1088 | * @retval VERR_FILE_AIO_IN_PROGRESS if the request is still in progress.
|
---|
1089 | *
|
---|
1090 | * @param hReq The request handle.
|
---|
1091 | * @param hFile The file to write to.
|
---|
1092 | * @param off The offset to start writing at.
|
---|
1093 | * @param pvBuf The bits to write.
|
---|
1094 | * @param cbWrite Number of bytes to write.
|
---|
1095 | * @param pvUser Opaque user data associated with this request which
|
---|
1096 | * can be retrieved with RTFileAioReqGetUser().
|
---|
1097 | */
|
---|
1098 | RTDECL(int) RTFileAioReqPrepareWrite(RTFILEAIOREQ hReq, RTFILE hFile, RTFOFF off,
|
---|
1099 | void const *pvBuf, size_t cbWrite, void *pvUser);
|
---|
1100 |
|
---|
1101 | /**
|
---|
1102 | * Prepares an async flush of all cached data associated with a file handle.
|
---|
1103 | *
|
---|
1104 | * @returns IPRT status code.
|
---|
1105 | * @retval VERR_FILE_AIO_IN_PROGRESS if the request is still in progress.
|
---|
1106 | *
|
---|
1107 | * @param hReq The request handle.
|
---|
1108 | * @param hFile The file to flush.
|
---|
1109 | * @param pvUser Opaque user data associated with this request which
|
---|
1110 | * can be retrieved with RTFileAioReqGetUser().
|
---|
1111 | *
|
---|
1112 | * @remarks May also flush other caches on some platforms.
|
---|
1113 | */
|
---|
1114 | RTDECL(int) RTFileAioReqPrepareFlush(RTFILEAIOREQ hReq, RTFILE hFile, void *pvUser);
|
---|
1115 |
|
---|
1116 | /**
|
---|
1117 | * Gets the opaque user data associated with the given request.
|
---|
1118 | *
|
---|
1119 | * @returns Opaque user data.
|
---|
1120 | * @retval NULL if the request hasn't been prepared yet.
|
---|
1121 | *
|
---|
1122 | * @param hReq The request handle.
|
---|
1123 | */
|
---|
1124 | RTDECL(void *) RTFileAioReqGetUser(RTFILEAIOREQ hReq);
|
---|
1125 |
|
---|
1126 | /**
|
---|
1127 | * Cancels a pending request.
|
---|
1128 | *
|
---|
1129 | * @returns IPRT status code.
|
---|
1130 | * @retval VINF_SUCCESS If the request was canceled.
|
---|
1131 | * @retval VERR_FILE_AIO_NOT_SUBMITTED If the request wasn't submitted yet.
|
---|
1132 | * @retval VERR_FILE_AIO_IN_PROGRESS If the request could not be canceled because it is already processed.
|
---|
1133 | * @retval VERR_FILE_AIO_COMPLETED If the request could not be canceled because it already completed.
|
---|
1134 | *
|
---|
1135 | * @param hReq The request to cancel.
|
---|
1136 | */
|
---|
1137 | RTDECL(int) RTFileAioReqCancel(RTFILEAIOREQ hReq);
|
---|
1138 |
|
---|
1139 | /**
|
---|
1140 | * Gets the status of a completed request.
|
---|
1141 | *
|
---|
1142 | * @returns The IPRT status code of the given request.
|
---|
1143 | * @retval VERR_FILE_AIO_NOT_SUBMITTED if the request wasn't submitted yet.
|
---|
1144 | * @retval VERR_FILE_AIO_CANCELED if the request was canceled.
|
---|
1145 | * @retval VERR_FILE_AIO_IN_PROGRESS if the request isn't yet completed.
|
---|
1146 | *
|
---|
1147 | * @param hReq The request handle.
|
---|
1148 | * @param pcbTransferred Where to store the number of bytes transferred.
|
---|
1149 | * Optional since it is not relevant for all kinds of
|
---|
1150 | * requests.
|
---|
1151 | */
|
---|
1152 | RTDECL(int) RTFileAioReqGetRC(RTFILEAIOREQ hReq, size_t *pcbTransferred);
|
---|
1153 |
|
---|
1154 |
|
---|
1155 |
|
---|
1156 | /**
|
---|
1157 | * Creates an async I/O context.
|
---|
1158 | *
|
---|
1159 | * @todo briefly explain what an async context is here or in the page
|
---|
1160 | * above.
|
---|
1161 | *
|
---|
1162 | * @returns IPRT status code.
|
---|
1163 | * @param phAioCtx Where to store the async I/O context handle.
|
---|
1164 | * @param cAioReqsMax How many async I/O requests the context should be capable
|
---|
1165 | * to handle. Pass RTFILEAIO_UNLIMITED_REQS if the
|
---|
1166 | * context should support an unlimited number of
|
---|
1167 | * requests.
|
---|
1168 | */
|
---|
1169 | RTDECL(int) RTFileAioCtxCreate(PRTFILEAIOCTX phAioCtx, uint32_t cAioReqsMax);
|
---|
1170 |
|
---|
1171 | /** Unlimited number of requests.
|
---|
1172 | * Used with RTFileAioCtxCreate and RTFileAioCtxGetMaxReqCount. */
|
---|
1173 | #define RTFILEAIO_UNLIMITED_REQS UINT32_MAX
|
---|
1174 |
|
---|
1175 | /**
|
---|
1176 | * Destroys an async I/O context.
|
---|
1177 | *
|
---|
1178 | * @returns IPRT status code.
|
---|
1179 | * @param hAioCtx The async I/O context handle.
|
---|
1180 | */
|
---|
1181 | RTDECL(int) RTFileAioCtxDestroy(RTFILEAIOCTX hAioCtx);
|
---|
1182 |
|
---|
1183 | /**
|
---|
1184 | * Get the maximum number of requests one aio context can handle.
|
---|
1185 | *
|
---|
1186 | * @returns Maximum number of tasks the context can handle.
|
---|
1187 | * RTFILEAIO_UNLIMITED_REQS if there is no limit.
|
---|
1188 | *
|
---|
1189 | * @param hAioCtx The async I/O context handle.
|
---|
1190 | * If NIL_RTAIOCONTEXT is passed the maximum value
|
---|
1191 | * which can be passed to RTFileAioCtxCreate()
|
---|
1192 | * is returned.
|
---|
1193 | */
|
---|
1194 | RTDECL(uint32_t) RTFileAioCtxGetMaxReqCount(RTFILEAIOCTX hAioCtx);
|
---|
1195 |
|
---|
1196 | /**
|
---|
1197 | * Associates a file with an async I/O context.
|
---|
1198 | * Requests for this file will arrive at the completion port
|
---|
1199 | * associated with the file.
|
---|
1200 | *
|
---|
1201 | * @returns IPRT status code.
|
---|
1202 | *
|
---|
1203 | * @param hAioCtx The async I/O context handle.
|
---|
1204 | * @param hFile The file handle.
|
---|
1205 | */
|
---|
1206 | RTDECL(int) RTFileAioCtxAssociateWithFile(RTFILEAIOCTX hAioCtx, RTFILE hFile);
|
---|
1207 |
|
---|
1208 | /**
|
---|
1209 | * Submits a set of requests to an async I/O context for processing.
|
---|
1210 | *
|
---|
1211 | * @returns IPRT status code.
|
---|
1212 | * @returns VERR_FILE_AIO_INSUFFICIENT_RESSOURCES if the maximum number of
|
---|
1213 | * simultaneous outstanding requests would be exceeded.
|
---|
1214 | *
|
---|
1215 | * @param hAioCtx The async I/O context handle.
|
---|
1216 | * @param pahReqs Pointer to an array of request handles.
|
---|
1217 | * @param cReqs The number of entries in the array.
|
---|
1218 | *
|
---|
1219 | * @remarks It is possible that some requests could be submitted successfully
|
---|
1220 | * even if the method returns an error code. In that case RTFileAioReqGetRC()
|
---|
1221 | * can be used to determine the status of a request.
|
---|
1222 | * If it returns VERR_FILE_AIO_IN_PROGRESS it was submitted successfully.
|
---|
1223 | * Any other error code may indicate why the request failed.
|
---|
1224 | * VERR_FILE_AIO_NOT_SUBMITTED indicates that a request wasn't submitted
|
---|
1225 | * probably because the previous request encountered an error.
|
---|
1226 | *
|
---|
1227 | * @remarks @a cReqs uses the type size_t while it really is a uint32_t, this is
|
---|
1228 | * to avoid annoying warnings when using RT_ELEMENTS and similar
|
---|
1229 | * macros.
|
---|
1230 | */
|
---|
1231 | RTDECL(int) RTFileAioCtxSubmit(RTFILEAIOCTX hAioCtx, PRTFILEAIOREQ pahReqs, size_t cReqs);
|
---|
1232 |
|
---|
1233 | /**
|
---|
1234 | * Waits for request completion.
|
---|
1235 | *
|
---|
1236 | * Only one thread at a time may call this API on a context.
|
---|
1237 | *
|
---|
1238 | * @returns IPRT status code.
|
---|
1239 | * @retval VERR_INVALID_POINTER If pcReqs or/and pahReqs are invalid.
|
---|
1240 | * @retval VERR_INVALID_HANDLE If hAioCtx is invalid.
|
---|
1241 | * @retval VERR_OUT_OF_RANGE If cMinReqs is larger than cReqs.
|
---|
1242 | * @retval VERR_INVALID_PARAMETER If cReqs is 0.
|
---|
1243 | * @retval VERR_TIMEOUT If cMinReqs didn't complete before the
|
---|
1244 | * timeout expired.
|
---|
1245 | * @retval VERR_INTERRUPTED If the completion context was interrupted
|
---|
1246 | * by RTFileAioCtxWakeup().
|
---|
1247 | * @retval VERR_FILE_AIO_NO_REQUEST If there are no pending request.
|
---|
1248 | *
|
---|
1249 | * @param hAioCtx The async I/O context handle to wait and get
|
---|
1250 | * completed requests from.
|
---|
1251 | * @param cMinReqs The minimum number of requests which have to
|
---|
1252 | * complete before this function returns.
|
---|
1253 | * @param cMillies The number of milliseconds to wait before returning
|
---|
1254 | * VERR_TIMEOUT. Use RT_INDEFINITE_WAIT to wait
|
---|
1255 | * forever.
|
---|
1256 | * @param pahReqs Pointer to an array where the handles of the
|
---|
1257 | * completed requests will be stored on success.
|
---|
1258 | * @param cReqs The number of entries @a pahReqs can hold.
|
---|
1259 | * @param pcReqs Where to store the number of returned (complete)
|
---|
1260 | * requests. This will always be set.
|
---|
1261 | *
|
---|
1262 | * @remarks The wait will be resume if interrupted by a signal. An
|
---|
1263 | * RTFileAioCtxWaitNoResume variant can be added later if it becomes
|
---|
1264 | * necessary.
|
---|
1265 | *
|
---|
1266 | * @remarks @a cMinReqs and @a cReqs use the type size_t while they really are
|
---|
1267 | * uint32_t's, this is to avoid annoying warnings when using
|
---|
1268 | * RT_ELEMENTS and similar macros.
|
---|
1269 | */
|
---|
1270 | RTDECL(int) RTFileAioCtxWait(RTFILEAIOCTX hAioCtx, size_t cMinReqs, RTMSINTERVAL cMillies,
|
---|
1271 | PRTFILEAIOREQ pahReqs, size_t cReqs, uint32_t *pcReqs);
|
---|
1272 |
|
---|
1273 | /**
|
---|
1274 | * Forces any RTFileAioCtxWait() call on another thread to return immediately.
|
---|
1275 | *
|
---|
1276 | * @returns IPRT status code.
|
---|
1277 | *
|
---|
1278 | * @param hAioCtx The handle of the async I/O context to wakeup.
|
---|
1279 | */
|
---|
1280 | RTDECL(int) RTFileAioCtxWakeup(RTFILEAIOCTX hAioCtx);
|
---|
1281 |
|
---|
1282 | #endif /* IN_RING3 */
|
---|
1283 |
|
---|
1284 | /** @} */
|
---|
1285 |
|
---|
1286 | RT_C_DECLS_END
|
---|
1287 |
|
---|
1288 | #endif
|
---|
1289 |
|
---|