~ubuntu-branches/debian/lenny/fpc/lenny

« back to all changes in this revision

Viewing changes to fpcsrc/packages/base/httpd/httpd-2.0/apr/apr_file_info.inc

  • Committer: Bazaar Package Importer
  • Author(s): Mazen Neifer, Torsten Werner, Mazen Neifer
  • Date: 2008-05-17 17:12:11 UTC
  • mfrom: (3.1.9 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080517171211-9qi33xhd9evfa0kg
Tags: 2.2.0-dfsg1-9
[ Torsten Werner ]
* Add Mazen Neifer to Uploaders field.

[ Mazen Neifer ]
* Moved FPC sources into a version dependent directory from /usr/share/fpcsrc
  to /usr/share/fpcsrc/${FPCVERSION}. This allow installing more than on FPC
  release.
* Fixed far call issue in compiler preventing building huge binearies.
  (closes: #477743)
* Updated building dependencies, recomennded and suggested packages.
* Moved fppkg to fp-utils as it is just a helper tool and is not required by
  compiler.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
 
2
 * applicable.
 
3
 *
 
4
 * Licensed under the Apache License, Version 2.0 (the "License");
 
5
 * you may not use this file except in compliance with the License.
 
6
 * You may obtain a copy of the License at
 
7
 *
 
8
 *     http://www.apache.org/licenses/LICENSE-2.0
 
9
 *
 
10
 * Unless required by applicable law or agreed to in writing, software
 
11
 * distributed under the License is distributed on an "AS IS" BASIS,
 
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
13
 * See the License for the specific language governing permissions and
 
14
 * limitations under the License.
 
15
 }
 
16
 
 
17
{
 
18
 * @file apr_file_info.h
 
19
 * @brief APR File Information
 
20
 }
 
21
 
 
22
{#include "apr.h"
 
23
#include "apr_user.h"
 
24
#include "apr_pools.h"
 
25
#include "apr_tables.h"
 
26
#include "apr_time.h"
 
27
#include "apr_errno.h"
 
28
 
 
29
#if APR_HAVE_SYS_UIO_H
 
30
#include <sys/uio.h>
 
31
#endif}
 
32
 
 
33
{
 
34
 * @defgroup apr_file_info File Information
 
35
 * @ingroup APR 
 
36
 }
 
37
 
 
38
{ Many applications use the type member to determine the
 
39
 * existance of a file or initialization of the file info,
 
40
 * so the APR_NOFILE value must be distinct from APR_UNKFILE.
 
41
 }
 
42
 
 
43
{ apr_filetype_e values for the filetype member of the
 
44
 * apr_file_info_t structure
 
45
 * @warning: Not all of the filetypes below can be determined.
 
46
 * For example, a given platform might not correctly report 
 
47
 * a socket descriptor as APR_SOCK if that type isn't 
 
48
 * well-identified on that platform.  In such cases where
 
49
 * a filetype exists but cannot be described by the recognized
 
50
 * flags below, the filetype will be APR_UNKFILE.  If the
 
51
 * filetype member is not determined, the type will be APR_NOFILE.
 
52
 }
 
53
 
 
54
type
 
55
  apr_filetype_e = (
 
56
    APR_NOFILE = 0,     {< no file type determined }
 
57
    APR_REG,            {< a regular file }
 
58
    APR_DIR,            {< a directory }
 
59
    APR_CHR,            {< a character device }
 
60
    APR_BLK,            {< a block device }
 
61
    APR_PIPE,           {< a FIFO / pipe }
 
62
    APR_LNK,            {< a symbolic link }
 
63
    APR_SOCK,           {< a [unix domain] socket }
 
64
    APR_UNKFILE = 127   {< a file of some other unknown type }
 
65
  );
 
66
 
 
67
{
 
68
 * @defgroup apr_file_permissions File Permissions flags 
 
69
 * @
 
70
 }
 
71
 
 
72
const
 
73
  APR_USETID =     $8000; {< Set user id }
 
74
  APR_UREAD =      $0400; {< Read by user }
 
75
  APR_UWRITE =     $0200; {< Write by user }
 
76
  APR_UEXECUTE =   $0100; {< Execute by user }
 
77
 
 
78
  APR_GSETID =     $4000; {< Set group id }
 
79
  APR_GREAD =      $0040; {< Read by group }
 
80
  APR_GWRITE =     $0020; {< Write by group }
 
81
  APR_GEXECUTE =   $0010; {< Execute by group }
 
82
 
 
83
  APR_WSTICKY =    $2000; {< Sticky bit }
 
84
  APR_WREAD =      $0004; {< Read by others }
 
85
  APR_WWRITE =     $0002; {< Write by others }
 
86
  APR_WEXECUTE =   $0001; {< Execute by others }
 
87
 
 
88
  APR_OS_DEFAULT = $0FFF; {< use OS's default permissions }
 
89
 
 
90
{ additional permission flags for apr_file_copy  and apr_file_append }
 
91
  APR_FILE_SOURCE_PERMS = $1000; {< Copy source file's permissions }
 
92
 
 
93
{
 
94
 * Structure for referencing directories.
 
95
 }
 
96
type
 
97
  apr_dir_t = record end;
 
98
  Papr_dir_t = ^apr_dir_t;
 
99
  PPapr_dir_t = ^Papr_dir_t;
 
100
  
 
101
{
 
102
 * Structure for determining file permissions.
 
103
 }
 
104
  apr_fileperms_t = apr_int32_t;
 
105
 
 
106
{$if defined(WIN32) or defined(NETWARE)}
 
107
{
 
108
 * Structure for determining the inode of the file.
 
109
 }
 
110
  apr_ino_t = apr_uint64_t;
 
111
{
 
112
 * Structure for determining the device the file is on.
 
113
 }
 
114
  apr_dev_t = apr_uint32_t;
 
115
{$else}
 
116
{ The inode of the file. }
 
117
  apr_ino_t = ino_t;
 
118
{
 
119
 * Structure for determining the device the file is on.
 
120
 }
 
121
  apr_dev_t = dev_t;
 
122
{$endif}
 
123
 
 
124
{
 
125
 * @defgroup apr_file_stat Stat Functions
 
126
 * @
 
127
 }
 
128
 
 
129
const
 
130
  APR_FINFO_LINK =  $00000001; {< Stat the link not the file itself if it is a link }
 
131
  APR_FINFO_MTIME = $00000010; {< Modification Time }
 
132
  APR_FINFO_CTIME = $00000020; {< Creation Time }
 
133
  APR_FINFO_ATIME = $00000040; {< Access Time }
 
134
  APR_FINFO_SIZE =  $00000100; {< Size of the file }
 
135
  APR_FINFO_CSIZE = $00000200; {< Storage size consumed by the file }
 
136
  APR_FINFO_DEV =   $00001000; {< Device }
 
137
  APR_FINFO_INODE = $00002000; {< Inode }
 
138
  APR_FINFO_NLINK = $00004000; {< Number of links }
 
139
  APR_FINFO_TYPE =  $00008000; {< Type }
 
140
  APR_FINFO_USER =  $00010000; {< User }
 
141
  APR_FINFO_GROUP = $00020000; {< Group }
 
142
  APR_FINFO_UPROT = $00100000; {< User protection bits }
 
143
  APR_FINFO_GPROT = $00200000; {< Group protection bits }
 
144
  APR_FINFO_WPROT = $00400000; {< World protection bits }
 
145
  APR_FINFO_ICASE = $01000000; {< if dev is case insensitive }
 
146
  APR_FINFO_NAME =  $02000000; {< ->name in proper case }
 
147
 
 
148
  APR_FINFO_MIN =   $00008170; {< type, mtime, ctime, atime, size }
 
149
  APR_FINFO_IDENT = $00003000; {< dev and inode }
 
150
  APR_FINFO_OWNER = $00030000; {< user and group }
 
151
  APR_FINFO_PROT =  $00700000; {<  all protections }
 
152
  APR_FINFO_NORM =  $0073b170; {<  an atomic unix apr_stat() }
 
153
  APR_FINFO_DIRENT = $02000000; {<  an atomic unix apr_dir_read() }
 
154
 
 
155
{
 
156
 * The file information structure.  This is analogous to the POSIX
 
157
 * stat structure.
 
158
 }
 
159
type
 
160
  apr_finfo_t = record
 
161
    { Allocates memory and closes lingering handles in the specified pool }
 
162
    pool: Papr_pool_t;
 
163
    { The bitmask describing valid fields of this apr_finfo_t structure
 
164
     *  including all available 'wanted' fields and potentially more }
 
165
    valid: apr_int32_t;
 
166
    { The access permissions of the file.  Mimics Unix access rights. }
 
167
    protection: apr_fileperms_t;
 
168
    { The type of file.  One of APR_REG, APR_DIR, APR_CHR, APR_BLK, APR_PIPE,
 
169
     * APR_LNK or APR_SOCK.  If the type is undetermined, the value is APR_NOFILE.
 
170
     * If the type cannot be determined, the value is APR_UNKFILE.
 
171
     }
 
172
    filetype: apr_filetype_e;
 
173
    { The user id that owns the file }
 
174
    user: apr_uid_t;
 
175
    { The group id that owns the file }
 
176
    group: apr_gid_t;
 
177
    { The inode of the file. }
 
178
    inode: apr_ino_t;
 
179
    { The id of the device the file is on. }
 
180
    device: apr_dev_t;
 
181
    { The number of hard links to the file. }
 
182
    nlink: apr_int32_t;
 
183
    { The size of the file }
 
184
    size: apr_off_t;
 
185
    { The storage size consumed by the file }
 
186
    csize: apr_off_t;
 
187
    { The time the file was last accessed }
 
188
    atime: apr_time_t;
 
189
    { The time the file was last modified }
 
190
    mtime: apr_time_t;
 
191
    { The time the file was last changed }
 
192
    ctime: apr_time_t;
 
193
    { The pathname of the file (possibly unrooted) }
 
194
    fname: PChar;
 
195
    { The file's name (no path) in filesystem case }
 
196
    name: PChar;
 
197
    { The file's handle, if accessed (can be submitted to apr_duphandle) }
 
198
    filehand: Papr_file_t;
 
199
  end;
 
200
  
 
201
  Papr_finfo_t = ^apr_finfo_t;
 
202
 
 
203
{
 
204
 * get the specified file's stats.  The file is specified by filename, 
 
205
 * instead of using a pre-opened file.
 
206
 * @param finfo Where to store the information about the file, which is
 
207
 * never touched if the call fails.
 
208
 * @param fname The name of the file to stat.
 
209
 * @param wanted The desired apr_finfo_t fields, as a bit flag of APR_FINFO_
 
210
                 values 
 
211
 * @param cont the pool to use to allocate the new file. 
 
212
 *
 
213
 * @note If @c APR_INCOMPLETE is returned all the fields in @a finfo may
 
214
 *       not be filled in, and you need to check the @c finfo->valid bitmask
 
215
 *       to verify that what you're looking for is there.
 
216
 }
 
217
function apr_stat(finfo: Papr_finfo_t; const fname: PChar;
 
218
 wanted: apr_int32_t; cont: Papr_pool_t): apr_status_t;
 
219
 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
 
220
 external LibAPR name LibNamePrefix + 'apr_stat' + LibSuff16;
 
221
 
 
222
{
 
223
 * get the specified file's stats.  The file is specified by filename, 
 
224
 * instead of using a pre-opened file.  If the file is a symlink, this function
 
225
 * will get the stats for the symlink not the file the symlink refers to.
 
226
 * @param finfo Where to store the information about the file, which is
 
227
 * never touched if the call fails.
 
228
 * @param fname The name of the file to stat.
 
229
 * @param wanted The desired apr_finfo_t fields, as a bit flag of APR_FINFO_ values 
 
230
 * @param cont the pool to use to allocate the new file. 
 
231
 * @deprecated This function is deprecated, it's equivalent to calling apr_stat with 
 
232
 * the wanted flag value APR_FINFO_LINK
 
233
 }
 
234
function apr_lstat(finfo: Papr_finfo_t; const fname: PChar;
 
235
 wanted: apr_int32_t; cont: Papr_pool_t): apr_status_t;
 
236
 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
 
237
 external LibAPR name LibNamePrefix + 'apr_lstat' + LibSuff16;
 
238
 
 
239
{
 
240
 * @defgroup apr_dir Directory Manipulation Functions
 
241
 }
 
242
 
 
243
{
 
244
 * Open the specified directory.
 
245
 * @param new_dir The opened directory descriptor.
 
246
 * @param dirname The full path to the directory (use / on all systems)
 
247
 * @param cont The pool to use.
 
248
 }
 
249
function apr_dir_open(new_dir: PPapr_dir_t; const dirname: PChar;
 
250
 cont: Papr_pool_t): apr_status_t;
 
251
 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
 
252
 external LibAPR name LibNamePrefix + 'apr_dir_open' + LibSuff12;
 
253
 
 
254
{
 
255
 * close the specified directory. 
 
256
 * @param thedir the directory descriptor to close.
 
257
 }
 
258
function apr_dir_close(thedir: Papr_dir_t): apr_status_t;
 
259
 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
 
260
 external LibAPR name LibNamePrefix + 'apr_dir_close' + LibSuff4;
 
261
 
 
262
{
 
263
 * Read the next entry from the specified directory. 
 
264
 * @param finfo the file info structure and filled in by apr_dir_read
 
265
 * @param wanted The desired apr_finfo_t fields, as a bit flag of APR_FINFO_
 
266
                 values 
 
267
 * @param thedir the directory descriptor returned from apr_dir_open
 
268
 * @remark No ordering is guaranteed for the entries read.
 
269
 *
 
270
 * @note If @c APR_INCOMPLETE is returned all the fields in @a finfo may
 
271
 *       not be filled in, and you need to check the @c finfo->valid bitmask
 
272
 *       to verify that what you're looking for is there.
 
273
 }
 
274
function apr_dir_read(finfo: Papr_finfo_t; wanted: apr_int32_t;
 
275
 thedir: Papr_dir_t): apr_status_t;
 
276
 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
 
277
 external LibAPR name LibNamePrefix + 'apr_dir_read' + LibSuff12;
 
278
 
 
279
{
 
280
 * Rewind the directory to the first entry.
 
281
 * @param thedir the directory descriptor to rewind.
 
282
 }
 
283
function apr_dir_rewind(thedir: Papr_dir_t): apr_status_t;
 
284
 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
 
285
 external LibAPR name LibNamePrefix + 'apr_dir_rewind' + LibSuff4;
 
286
 
 
287
{
 
288
 * @defgroup apr_filepath Filepath Manipulation Functions
 
289
 }
 
290
 
 
291
const
 
292
  { Cause apr_filepath_merge to fail if addpath is above rootpath }
 
293
  APR_FILEPATH_NOTABOVEROOT =  $01;
 
294
 
 
295
{ internal: Only meaningful with APR_FILEPATH_NOTABOVEROOT }
 
296
  APR_FILEPATH_SECUREROOTTEST =$02;
 
297
 
 
298
{ Cause apr_filepath_merge to fail if addpath is above rootpath,
 
299
 * even given a rootpath /foo/bar and an addpath ../bar/bash
 
300
 }
 
301
  APR_FILEPATH_SECUREROOT =    $03;
 
302
 
 
303
{ Fail apr_filepath_merge if the merged path is relative }
 
304
  APR_FILEPATH_NOTRELATIVE =   $04;
 
305
 
 
306
{ Fail apr_filepath_merge if the merged path is absolute }
 
307
  APR_FILEPATH_NOTABSOLUTE =   $08;
 
308
 
 
309
{ Return the file system's native path format (e.g. path delimiters
 
310
 * of ':' on MacOS9, '\' on Win32, etc.) }
 
311
  APR_FILEPATH_NATIVE =        $10;
 
312
 
 
313
{ Resolve the true case of existing directories and file elements
 
314
 * of addpath, (resolving any aliases on Win32) and append a proper 
 
315
 * trailing slash if a directory
 
316
 }
 
317
  APR_FILEPATH_TRUENAME =      $20;
 
318
 
 
319
{
 
320
 * Extract the rootpath from the given filepath
 
321
 * @param rootpath the root file path returned with APR_SUCCESS or APR_EINCOMPLETE
 
322
 * @param filepath the pathname to parse for its root component
 
323
 * @param flags the desired rules to apply, from
 
324
 * <PRE>
 
325
 *      APR_FILEPATH_NATIVE    Use native path seperators (e.g. '\' on Win32)
 
326
 *      APR_FILEPATH_TRUENAME  Tests that the root exists, and makes it proper
 
327
 * </PRE>
 
328
 * @param p the pool to allocate the new path string from
 
329
 * @remark on return, filepath points to the first non-root character in the
 
330
 * given filepath.  In the simplest example, given a filepath of "/foo", 
 
331
 * returns the rootpath of "/" and filepath points at "foo".  This is far 
 
332
 * more complex on other platforms, which will canonicalize the root form
 
333
 * to a consistant format, given the APR_FILEPATH_TRUENAME flag, and also
 
334
 * test for the validity of that root (e.g., that a drive d:/ or network 
 
335
 * share //machine/foovol/). 
 
336
 * The function returns APR_ERELATIVE if filepath isn't rooted (an
 
337
 * error), APR_EINCOMPLETE if the root path is ambigious (but potentially
 
338
 * legitimate, e.g. "/" on Windows is incomplete because it doesn't specify
 
339
 * the drive letter), or APR_EBADPATH if the root is simply invalid.
 
340
 * APR_SUCCESS is returned if filepath is an absolute path.
 
341
 }
 
342
function apr_filepath_root(const rootpath, filepath: PPChar;
 
343
 flags: apr_int32_t; p: Papr_pool_t): apr_status_t;
 
344
 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
 
345
 external LibAPR name LibNamePrefix + 'apr_filepath_root' + LibSuff16;
 
346
 
 
347
{
 
348
 * Merge additional file path onto the previously processed rootpath
 
349
 * @param newpath the merged paths returned
 
350
 * @param rootpath the root file path (NULL uses the current working path)
 
351
 * @param addpath the path to add to the root path
 
352
 * @param flags the desired APR_FILEPATH_ rules to apply when merging
 
353
 * @param p the pool to allocate the new path string from
 
354
 * @remark if the flag APR_FILEPATH_TRUENAME is given, and the addpath 
 
355
 * contains wildcard characters ('*', '?') on platforms that don't support 
 
356
 * such characters within filenames, the paths will be merged, but the 
 
357
 * result code will be APR_EPATHWILD, and all further segments will not
 
358
 * reflect the true filenames including the wildcard and following segments.
 
359
 }
 
360
function apr_filepath_merge(newpath: PPChar; const rootpath, addpath: PPChar;
 
361
 flags: apr_int32_t; p: Papr_pool_t): apr_status_t;
 
362
 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
 
363
 external LibAPR name LibNamePrefix + 'apr_filepath_merge' + LibSuff20;
 
364
 
 
365
{
 
366
 * Split a search path into separate components
 
367
 * @param pathelts the returned components of the search path
 
368
 * @param liststr the search path (e.g., <tt>getenv("PATH")</tt>)
 
369
 * @param p the pool to allocate the array and path components from
 
370
 * @remark empty path componenta do not become part of @a pathelts.
 
371
 * @remark the path separator in @a liststr is system specific;
 
372
 * e.g., ':' on Unix, ';' on Windows, etc.
 
373
 }
 
374
function apr_filepath_list_split(pathelts: PPapr_array_header_t;
 
375
 const liststr: PChar; p: Papr_pool_t): apr_status_t;
 
376
 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
 
377
 external LibAPR name LibNamePrefix + 'apr_filepath_list_split' + LibSuff12;
 
378
 
 
379
{
 
380
 * Merge a list of search path components into a single search path
 
381
 * @param liststr the returned search path; may be NULL if @a pathelts is empty
 
382
 * @param pathelts the components of the search path
 
383
 * @param p the pool to allocate the search path from
 
384
 * @remark emtpy strings in the source array are ignored.
 
385
 * @remark the path separator in @a liststr is system specific;
 
386
 * e.g., ':' on Unix, ';' on Windows, etc.
 
387
 }
 
388
function apr_filepath_list_merge(liststr: PPChar;
 
389
 pathelts: Papr_array_header_t; p: Papr_pool_t): apr_status_t;
 
390
 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
 
391
 external LibAPR name LibNamePrefix + 'apr_filepath_list_merge' + LibSuff12;
 
392
 
 
393
{
 
394
 * Return the default file path (for relative file names)
 
395
 * @param path the default path string returned
 
396
 * @param flags optional flag APR_FILEPATH_NATIVE to retrieve the
 
397
 *              default file path in os-native format.
 
398
 * @param p the pool to allocate the default path string from
 
399
 }
 
400
function apr_filepath_get(path: PPChar; flags: apr_int32_t;
 
401
 p: Papr_pool_t): apr_status_t;
 
402
 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
 
403
 external LibAPR name LibNamePrefix + 'apr_filepath_get' + LibSuff12;
 
404
 
 
405
{
 
406
 * Set the default file path (for relative file names)
 
407
 * @param path the default path returned
 
408
 * @param p the pool to allocate any working storage
 
409
 }
 
410
function apr_filepath_set(const path: PChar; p: Papr_pool_t): apr_status_t;
 
411
 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
 
412
 external LibAPR name LibNamePrefix + 'apr_filepath_set' + LibSuff8;
 
413
 
 
414
const
 
415
  { The FilePath character encoding is unknown }
 
416
  APR_FILEPATH_ENCODING_UNKNOWN = 0;
 
417
 
 
418
  { The FilePath character encoding is locale-dependent }
 
419
  APR_FILEPATH_ENCODING_LOCALE =  1;
 
420
 
 
421
  { The FilePath character encoding is UTF-8 }
 
422
  APR_FILEPATH_ENCODING_UTF8 =    2;
 
423
 
 
424
{
 
425
 * Determine the encoding used internally by the FilePath functions
 
426
 * @param style points to a variable which receives the encoding style flag
 
427
 * @param p the pool to allocate any working storage
 
428
 * @remark Use @c apr_os_locale_encoding and/or @c apr_os_default_encoding
 
429
 * to get the name of the path encoding if it's not UTF-8.
 
430
 }
 
431
function apr_filepath_encoding(style: PInteger; p: Papr_pool_t): apr_status_t;
 
432
 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
 
433
 external LibAPR name LibNamePrefix + 'apr_filepath_encoding' + LibSuff8;
 
434