1/*
2 +----------------------------------------------------------------------+
3 | PHP Version 5 |
4 +----------------------------------------------------------------------+
5 | Copyright (c) 1997-2015 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
24PHP_RINIT_FUNCTION(filestat);
25PHP_RSHUTDOWN_FUNCTION(filestat);
26
27PHP_FUNCTION(realpath_cache_size);
28PHP_FUNCTION(realpath_cache_get);
29PHP_FUNCTION(clearstatcache);
30PHP_FUNCTION(fileatime);
31PHP_FUNCTION(filectime);
32PHP_FUNCTION(filegroup);
33PHP_FUNCTION(fileinode);
34PHP_FUNCTION(filemtime);
35PHP_FUNCTION(fileowner);
36PHP_FUNCTION(fileperms);
37PHP_FUNCTION(filesize);
38PHP_FUNCTION(filetype);
39PHP_FUNCTION(is_writable);
40PHP_FUNCTION(is_readable);
41PHP_FUNCTION(is_executable);
42PHP_FUNCTION(is_file);
43PHP_FUNCTION(is_dir);
44PHP_FUNCTION(is_link);
45PHP_FUNCTION(file_exists);
46PHP_NAMED_FUNCTION(php_if_stat);
47PHP_NAMED_FUNCTION(php_if_lstat);
48PHP_FUNCTION(disk_total_space);
49PHP_FUNCTION(disk_free_space);
50PHP_FUNCTION(chown);
51PHP_FUNCTION(chgrp);
52#if HAVE_LCHOWN
53PHP_FUNCTION(lchown);
54#endif
55#if HAVE_LCHOWN
56PHP_FUNCTION(lchgrp);
57#endif
58PHP_FUNCTION(chmod);
59#if HAVE_UTIME
60PHP_FUNCTION(touch);
61#endif
62PHP_FUNCTION(clearstatcache);
63
64#define MAKE_LONG_ZVAL_INCREF(name, val)\
65 MAKE_STD_ZVAL(name); \
66 ZVAL_LONG(name, val); \
67 Z_ADDREF_P(name);
68
69#ifdef PHP_WIN32
70#define S_IRUSR S_IREAD
71#define S_IWUSR S_IWRITE
72#define S_IXUSR S_IEXEC
73#define S_IRGRP S_IREAD
74#define S_IWGRP S_IWRITE
75#define S_IXGRP S_IEXEC
76#define S_IROTH S_IREAD
77#define S_IWOTH S_IWRITE
78#define S_IXOTH S_IEXEC
79
80#undef getgid
81#define getgroups(a, b) 0
82#define getgid() 1
83#define getuid() 1
84#endif
85
86#ifdef PHP_WIN32
87typedef unsigned int php_stat_len;
88#else
89typedef int php_stat_len;
90#endif
91
92PHPAPI void php_clear_stat_cache(zend_bool clear_realpath_cache, const char *filename, int filename_len TSRMLS_DC);
93PHPAPI void php_stat(const char *filename, php_stat_len filename_length, int type, zval *return_value TSRMLS_DC);
94
95/* Switches for various filestat functions: */
96#define FS_PERMS 0
97#define FS_INODE 1
98#define FS_SIZE 2
99#define FS_OWNER 3
100#define FS_GROUP 4
101#define FS_ATIME 5
102#define FS_MTIME 6
103#define FS_CTIME 7
104#define FS_TYPE 8
105#define FS_IS_W 9
106#define FS_IS_R 10
107#define FS_IS_X 11
108#define FS_IS_FILE 12
109#define FS_IS_DIR 13
110#define FS_IS_LINK 14
111#define FS_EXISTS 15
112#define FS_LSTAT 16
113#define FS_STAT 17
114
115#endif /* PHP_FILESTAT_H */
116