php_filestat.h 3.3 KB

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