Back to index

php5  5.3.10
php_streams_int.h
Go to the documentation of this file.
00001 /*
00002   +----------------------------------------------------------------------+
00003   | PHP Version 5                                                        |
00004   +----------------------------------------------------------------------+
00005   | Copyright (c) 1997-2012 The PHP Group                                |
00006   +----------------------------------------------------------------------+
00007   | This source file is subject to version 3.01 of the PHP license,      |
00008   | that is bundled with this package in the file LICENSE, and is        |
00009   | available through the world-wide-web at the following url:           |
00010   | http://www.php.net/license/3_01.txt                                  |
00011   | If you did not receive a copy of the PHP license and are unable to   |
00012   | obtain it through the world-wide-web, please send a note to          |
00013   | license@php.net so we can mail you a copy immediately.               |
00014   +----------------------------------------------------------------------+
00015   | Author: Wez Furlong <wez@thebrainroom.com>                           |
00016   +----------------------------------------------------------------------+
00017 */
00018 
00019 /* $Id: php_streams_int.h 321634 2012-01-01 13:15:04Z felipe $ */
00020 
00021 
00022 #if ZEND_DEBUG
00023 
00024 #define emalloc_rel_orig(size)     \
00025               ( __php_stream_call_depth == 0 \
00026               ? _emalloc((size) ZEND_FILE_LINE_CC ZEND_FILE_LINE_RELAY_CC) \
00027               : _emalloc((size) ZEND_FILE_LINE_CC ZEND_FILE_LINE_ORIG_RELAY_CC) )
00028 
00029 #define erealloc_rel_orig(ptr, size)      \
00030               ( __php_stream_call_depth == 0 \
00031               ? _erealloc((ptr), (size), 0 ZEND_FILE_LINE_CC ZEND_FILE_LINE_RELAY_CC) \
00032               : _erealloc((ptr), (size), 0 ZEND_FILE_LINE_CC ZEND_FILE_LINE_ORIG_RELAY_CC) )
00033 
00034 #define pemalloc_rel_orig(size, persistent)      ((persistent) ? malloc((size)) : emalloc_rel_orig((size)))
00035 #define perealloc_rel_orig(ptr, size, persistent)       ((persistent) ? realloc((ptr), (size)) : erealloc_rel_orig((ptr), (size)))
00036 #else
00037 # define pemalloc_rel_orig(size, persistent)                          pemalloc((size), (persistent))
00038 # define perealloc_rel_orig(ptr, size, persistent)                    perealloc((ptr), (size), (persistent))
00039 # define emalloc_rel_orig(size)                                                     emalloc((size))
00040 #endif
00041 
00042 #define STREAM_DEBUG 0
00043 #define STREAM_WRAPPER_PLAIN_FILES ((php_stream_wrapper*)-1)
00044 
00045 #ifndef MAP_FAILED
00046 #define MAP_FAILED ((void *) -1)
00047 #endif
00048 
00049 #define CHUNK_SIZE   8192
00050 
00051 #ifdef PHP_WIN32
00052 # ifdef EWOULDBLOCK 
00053 #  undef EWOULDBLOCK
00054 # endif
00055 # define EWOULDBLOCK WSAEWOULDBLOCK
00056 #endif
00057 
00058 #ifndef S_ISREG
00059 #define S_ISREG(mode)       (((mode)&S_IFMT) == S_IFREG)
00060 #endif
00061 
00062 /* This functions transforms the first char to 'w' if it's not 'r', 'a' or 'w'
00063  * and strips any subsequent chars except '+' and 'b'.
00064  * Use this to sanitize stream->mode if you call e.g. fdopen, fopencookie or
00065  * any other function that expects standard modes and you allow non-standard
00066  * ones. result should be a char[5]. */
00067 void php_stream_mode_sanitize_fdopen_fopencookie(php_stream *stream, char *result);
00068 
00069 void php_stream_tidy_wrapper_error_log(php_stream_wrapper *wrapper TSRMLS_DC);
00070 void php_stream_display_wrapper_errors(php_stream_wrapper *wrapper, const char *path, const char *caption TSRMLS_DC);
00071