php_streams_int.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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: Wez Furlong <wez@thebrainroom.com> |
  16. +----------------------------------------------------------------------+
  17. */
  18. /* $Id$ */
  19. #if ZEND_DEBUG
  20. #define emalloc_rel_orig(size) \
  21. ( __php_stream_call_depth == 0 \
  22. ? _emalloc((size) ZEND_FILE_LINE_CC ZEND_FILE_LINE_RELAY_CC) \
  23. : _emalloc((size) ZEND_FILE_LINE_CC ZEND_FILE_LINE_ORIG_RELAY_CC) )
  24. #define erealloc_rel_orig(ptr, size) \
  25. ( __php_stream_call_depth == 0 \
  26. ? _erealloc((ptr), (size), 0 ZEND_FILE_LINE_CC ZEND_FILE_LINE_RELAY_CC) \
  27. : _erealloc((ptr), (size), 0 ZEND_FILE_LINE_CC ZEND_FILE_LINE_ORIG_RELAY_CC) )
  28. #define pemalloc_rel_orig(size, persistent) ((persistent) ? malloc((size)) : emalloc_rel_orig((size)))
  29. #define perealloc_rel_orig(ptr, size, persistent) ((persistent) ? realloc((ptr), (size)) : erealloc_rel_orig((ptr), (size)))
  30. #else
  31. # define pemalloc_rel_orig(size, persistent) pemalloc((size), (persistent))
  32. # define perealloc_rel_orig(ptr, size, persistent) perealloc((ptr), (size), (persistent))
  33. # define emalloc_rel_orig(size) emalloc((size))
  34. #endif
  35. #define STREAM_DEBUG 0
  36. #define STREAM_WRAPPER_PLAIN_FILES ((php_stream_wrapper*)-1)
  37. #ifndef MAP_FAILED
  38. #define MAP_FAILED ((void *) -1)
  39. #endif
  40. #define CHUNK_SIZE 8192
  41. #ifdef PHP_WIN32
  42. # ifdef EWOULDBLOCK
  43. # undef EWOULDBLOCK
  44. # endif
  45. # define EWOULDBLOCK WSAEWOULDBLOCK
  46. #endif
  47. #ifndef S_ISREG
  48. #define S_ISREG(mode) (((mode)&S_IFMT) == S_IFREG)
  49. #endif
  50. /* This functions transforms the first char to 'w' if it's not 'r', 'a' or 'w'
  51. * and strips any subsequent chars except '+' and 'b'.
  52. * Use this to sanitize stream->mode if you call e.g. fdopen, fopencookie or
  53. * any other function that expects standard modes and you allow non-standard
  54. * ones. result should be a char[5]. */
  55. void php_stream_mode_sanitize_fdopen_fopencookie(php_stream *stream, char *result);
  56. void php_stream_tidy_wrapper_error_log(php_stream_wrapper *wrapper TSRMLS_DC);
  57. void php_stream_display_wrapper_errors(php_stream_wrapper *wrapper, const char *path, const char *caption TSRMLS_DC);