xref: /php-src/ext/standard/php_filestat.h (revision 01b3fc03)
1 /*
2    +----------------------------------------------------------------------+
3    | Copyright (c) The PHP Group                                          |
4    +----------------------------------------------------------------------+
5    | This source file is subject to version 3.01 of the PHP license,      |
6    | that is bundled with this package in the file LICENSE, and is        |
7    | available through the world-wide-web at the following url:           |
8    | https://www.php.net/license/3_01.txt                                 |
9    | If you did not receive a copy of the PHP license and are unable to   |
10    | obtain it through the world-wide-web, please send a note to          |
11    | license@php.net so we can mail you a copy immediately.               |
12    +----------------------------------------------------------------------+
13    | Author:  Jim Winstead <jimw@php.net>                                 |
14    +----------------------------------------------------------------------+
15 */
16 
17 #ifndef PHP_FILESTAT_H
18 #define PHP_FILESTAT_H
19 
20 PHP_RINIT_FUNCTION(filestat);
21 PHP_RSHUTDOWN_FUNCTION(filestat);
22 
23 #ifdef PHP_WIN32
24 #define S_IRUSR S_IREAD
25 #define S_IWUSR S_IWRITE
26 #define S_IXUSR S_IEXEC
27 #define S_IRGRP S_IREAD
28 #define S_IWGRP S_IWRITE
29 #define S_IXGRP S_IEXEC
30 #define S_IROTH S_IREAD
31 #define S_IWOTH S_IWRITE
32 #define S_IXOTH S_IEXEC
33 
34 #undef getgid
35 #define getgroups(a, b) 0
36 #define getgid() 1
37 #define getuid() 1
38 #endif
39 
40 /* Compatibility. */
41 typedef size_t php_stat_len;
42 
43 PHPAPI void php_clear_stat_cache(bool clear_realpath_cache, const char *filename, size_t filename_len);
44 PHPAPI void php_stat(zend_string *filename, int type, zval *return_value);
45 
46 /* Switches for various filestat functions: */
47 #define FS_PERMS    0
48 #define FS_INODE    1
49 #define FS_SIZE     2
50 #define FS_OWNER    3
51 #define FS_GROUP    4
52 #define FS_ATIME    5
53 #define FS_MTIME    6
54 #define FS_CTIME    7
55 #define FS_TYPE     8
56 #define FS_IS_W     9
57 #define FS_IS_R    10
58 #define FS_IS_X    11
59 #define FS_IS_FILE 12
60 #define FS_IS_DIR  13
61 #define FS_IS_LINK 14
62 #define FS_EXISTS  15
63 #define FS_LSTAT   16
64 #define FS_STAT    17
65 #define FS_LPERMS  18
66 
67 #endif /* PHP_FILESTAT_H */
68