basic_functions.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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. | Authors: Andi Gutmans <andi@php.net> |
  14. | Zeev Suraski <zeev@php.net> |
  15. +----------------------------------------------------------------------+
  16. */
  17. #ifndef BASIC_FUNCTIONS_H
  18. #define BASIC_FUNCTIONS_H
  19. #include <sys/stat.h>
  20. #include <wchar.h>
  21. #include "php_filestat.h"
  22. #include "zend_highlight.h"
  23. #include "url_scanner_ex.h"
  24. #if defined(_WIN32) && !defined(__clang__)
  25. #include <intrin.h>
  26. #endif
  27. extern zend_module_entry basic_functions_module;
  28. #define basic_functions_module_ptr &basic_functions_module
  29. PHP_MINIT_FUNCTION(basic);
  30. PHP_MSHUTDOWN_FUNCTION(basic);
  31. PHP_RINIT_FUNCTION(basic);
  32. PHP_RSHUTDOWN_FUNCTION(basic);
  33. PHP_MINFO_FUNCTION(basic);
  34. ZEND_API void php_get_highlight_struct(zend_syntax_highlighter_ini *syntax_highlighter_ini);
  35. PHP_MINIT_FUNCTION(user_filters);
  36. PHP_RSHUTDOWN_FUNCTION(user_filters);
  37. PHP_RSHUTDOWN_FUNCTION(browscap);
  38. /* Left for BC (not binary safe!) */
  39. PHPAPI int _php_error_log(int opt_err, const char *message, const char *opt, const char *headers);
  40. PHPAPI int _php_error_log_ex(int opt_err, const char *message, size_t message_len, const char *opt, const char *headers);
  41. PHPAPI int php_prefix_varname(zval *result, zend_string *prefix, const char *var_name, size_t var_name_len, bool add_underscore);
  42. #define MT_N (624)
  43. /* Deprecated type aliases -- use the standard types instead */
  44. typedef uint32_t php_uint32;
  45. typedef int32_t php_int32;
  46. typedef struct _php_basic_globals {
  47. HashTable *user_shutdown_function_names;
  48. HashTable putenv_ht;
  49. zend_string *strtok_string;
  50. zend_string *ctype_string; /* current LC_CTYPE locale (or NULL for 'C') */
  51. bool locale_changed; /* locale was changed and has to be restored */
  52. char *strtok_last;
  53. char strtok_table[256];
  54. size_t strtok_len;
  55. zend_fcall_info user_compare_fci;
  56. zend_fcall_info_cache user_compare_fci_cache;
  57. zend_llist *user_tick_functions;
  58. zval active_ini_file_section;
  59. /* pageinfo.c */
  60. zend_long page_uid;
  61. zend_long page_gid;
  62. zend_long page_inode;
  63. time_t page_mtime;
  64. /* filestat.c && main/streams/streams.c */
  65. zend_string *CurrentStatFile, *CurrentLStatFile;
  66. php_stream_statbuf ssb, lssb;
  67. /* mt_rand.c */
  68. uint32_t state[MT_N+1]; /* state vector + 1 extra to not violate ANSI C */
  69. uint32_t *next; /* next random value is computed from here */
  70. int left; /* can *next++ this many times before reloading */
  71. bool mt_rand_is_seeded; /* Whether mt_rand() has been seeded */
  72. zend_long mt_rand_mode;
  73. /* syslog.c */
  74. char *syslog_device;
  75. /* var.c */
  76. unsigned serialize_lock; /* whether to use the locally supplied var_hash instead (__sleep/__wakeup) */
  77. struct {
  78. struct php_serialize_data *data;
  79. unsigned level;
  80. } serialize;
  81. struct {
  82. struct php_unserialize_data *data;
  83. unsigned level;
  84. } unserialize;
  85. /* url_scanner_ex.re */
  86. url_adapt_state_ex_t url_adapt_session_ex;
  87. HashTable url_adapt_session_hosts_ht;
  88. url_adapt_state_ex_t url_adapt_output_ex;
  89. HashTable url_adapt_output_hosts_ht;
  90. HashTable *user_filter_map;
  91. /* file.c */
  92. #if defined(_REENTRANT)
  93. mbstate_t mblen_state;
  94. #endif
  95. int umask;
  96. zend_long unserialize_max_depth;
  97. } php_basic_globals;
  98. #ifdef ZTS
  99. #define BG(v) ZEND_TSRMG(basic_globals_id, php_basic_globals *, v)
  100. PHPAPI extern int basic_globals_id;
  101. #else
  102. #define BG(v) (basic_globals.v)
  103. PHPAPI extern php_basic_globals basic_globals;
  104. #endif
  105. PHPAPI zend_string *php_getenv(const char *str, size_t str_len);
  106. PHPAPI double php_get_nan(void);
  107. PHPAPI double php_get_inf(void);
  108. typedef struct _php_shutdown_function_entry {
  109. zend_fcall_info fci;
  110. zend_fcall_info_cache fci_cache;
  111. } php_shutdown_function_entry;
  112. PHPAPI extern bool register_user_shutdown_function(const char *function_name, size_t function_len, php_shutdown_function_entry *shutdown_function_entry);
  113. PHPAPI extern bool remove_user_shutdown_function(const char *function_name, size_t function_len);
  114. PHPAPI extern bool append_user_shutdown_function(php_shutdown_function_entry *shutdown_function_entry);
  115. PHPAPI void php_call_shutdown_functions(void);
  116. PHPAPI void php_free_shutdown_functions(void);
  117. #endif /* BASIC_FUNCTIONS_H */