xref: /PHP-7.2/ext/standard/php_filestat.h (revision 7a7ec01a)
1 /*
2    +----------------------------------------------------------------------+
3    | PHP Version 7                                                        |
4    +----------------------------------------------------------------------+
5    | Copyright (c) 1997-2018 The PHP Group                                |
6    +----------------------------------------------------------------------+
7    | This source file is subject to version 3.01 of the PHP license,      |
8    | that is bundled with this package in the file LICENSE, and is        |
9    | available through the world-wide-web at the following url:           |
10    | http://www.php.net/license/3_01.txt                                  |
11    | If you did not receive a copy of the PHP license and are unable to   |
12    | obtain it through the world-wide-web, please send a note to          |
13    | license@php.net so we can mail you a copy immediately.               |
14    +----------------------------------------------------------------------+
15    | Author:  Jim Winstead <jimw@php.net>                                 |
16    +----------------------------------------------------------------------+
17 */
18 
19 /* $Id$ */
20 
21 #ifndef PHP_FILESTAT_H
22 #define PHP_FILESTAT_H
23 
24 PHP_RINIT_FUNCTION(filestat);
25 PHP_RSHUTDOWN_FUNCTION(filestat);
26 
27 PHP_FUNCTION(realpath_cache_size);
28 PHP_FUNCTION(realpath_cache_get);
29 PHP_FUNCTION(clearstatcache);
30 PHP_FUNCTION(fileatime);
31 PHP_FUNCTION(filectime);
32 PHP_FUNCTION(filegroup);
33 PHP_FUNCTION(fileinode);
34 PHP_FUNCTION(filemtime);
35 PHP_FUNCTION(fileowner);
36 PHP_FUNCTION(fileperms);
37 PHP_FUNCTION(filesize);
38 PHP_FUNCTION(filetype);
39 PHP_FUNCTION(is_writable);
40 PHP_FUNCTION(is_readable);
41 PHP_FUNCTION(is_executable);
42 PHP_FUNCTION(is_file);
43 PHP_FUNCTION(is_dir);
44 PHP_FUNCTION(is_link);
45 PHP_FUNCTION(file_exists);
46 PHP_NAMED_FUNCTION(php_if_stat);
47 PHP_NAMED_FUNCTION(php_if_lstat);
48 PHP_FUNCTION(disk_total_space);
49 PHP_FUNCTION(disk_free_space);
50 PHP_FUNCTION(chown);
51 PHP_FUNCTION(chgrp);
52 #if HAVE_LCHOWN
53 PHP_FUNCTION(lchown);
54 #endif
55 #if HAVE_LCHOWN
56 PHP_FUNCTION(lchgrp);
57 #endif
58 PHP_FUNCTION(chmod);
59 #if HAVE_UTIME
60 PHP_FUNCTION(touch);
61 #endif
62 PHP_FUNCTION(clearstatcache);
63 
64 #ifdef PHP_WIN32
65 #define S_IRUSR S_IREAD
66 #define S_IWUSR S_IWRITE
67 #define S_IXUSR S_IEXEC
68 #define S_IRGRP S_IREAD
69 #define S_IWGRP S_IWRITE
70 #define S_IXGRP S_IEXEC
71 #define S_IROTH S_IREAD
72 #define S_IWOTH S_IWRITE
73 #define S_IXOTH S_IEXEC
74 
75 #undef getgid
76 #define getgroups(a, b) 0
77 #define getgid() 1
78 #define getuid() 1
79 #endif
80 
81 /* Compatibility. */
82 typedef size_t php_stat_len;
83 
84 PHPAPI void php_clear_stat_cache(zend_bool clear_realpath_cache, const char *filename, size_t filename_len);
85 PHPAPI void php_stat(const char *filename, size_t filename_length, int type, zval *return_value);
86 
87 /* Switches for various filestat functions: */
88 #define FS_PERMS    0
89 #define FS_INODE    1
90 #define FS_SIZE     2
91 #define FS_OWNER    3
92 #define FS_GROUP    4
93 #define FS_ATIME    5
94 #define FS_MTIME    6
95 #define FS_CTIME    7
96 #define FS_TYPE     8
97 #define FS_IS_W     9
98 #define FS_IS_R    10
99 #define FS_IS_X    11
100 #define FS_IS_FILE 12
101 #define FS_IS_DIR  13
102 #define FS_IS_LINK 14
103 #define FS_EXISTS  15
104 #define FS_LSTAT   16
105 #define FS_STAT    17
106 
107 #endif /* PHP_FILESTAT_H */
108