php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
php_streams_int.h
Go to the documentation of this file.
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 | Author: Wez Furlong <wez@thebrainroom.com> |
14 +----------------------------------------------------------------------+
15*/
16
17/* internal header; not supposed to be installed; FIXME but unfortunately is */
18
19#if ZEND_DEBUG
20
21#define emalloc_rel_orig(size) \
22 ( __php_stream_call_depth == 0 \
23 ? _emalloc((size) ZEND_FILE_LINE_CC ZEND_FILE_LINE_RELAY_CC) \
24 : _emalloc((size) ZEND_FILE_LINE_CC ZEND_FILE_LINE_ORIG_RELAY_CC) )
25
26#define erealloc_rel_orig(ptr, size) \
27 ( __php_stream_call_depth == 0 \
28 ? _erealloc((ptr), (size), 0 ZEND_FILE_LINE_CC ZEND_FILE_LINE_RELAY_CC) \
29 : _erealloc((ptr), (size), 0 ZEND_FILE_LINE_CC ZEND_FILE_LINE_ORIG_RELAY_CC) )
30
31#define pemalloc_rel_orig(size, persistent) ((persistent) ? malloc((size)) : emalloc_rel_orig((size)))
32#define perealloc_rel_orig(ptr, size, persistent) ((persistent) ? realloc((ptr), (size)) : erealloc_rel_orig((ptr), (size)))
33#else
34# define pemalloc_rel_orig(size, persistent) pemalloc((size), (persistent))
35# define perealloc_rel_orig(ptr, size, persistent) perealloc((ptr), (size), (persistent))
36# define emalloc_rel_orig(size) emalloc((size))
37#endif
38
39#define STREAM_DEBUG 0
40#define STREAM_WRAPPER_PLAIN_FILES ((php_stream_wrapper*)-1)
41
42#ifndef MAP_FAILED
43#define MAP_FAILED ((void *) -1)
44#endif
45
46#define CHUNK_SIZE 8192
47
48#ifdef PHP_WIN32
49# ifdef EWOULDBLOCK
50# undef EWOULDBLOCK
51# endif
52# define EWOULDBLOCK WSAEWOULDBLOCK
53# ifdef EMSGSIZE
54# undef EMSGSIZE
55# endif
56# define EMSGSIZE WSAEMSGSIZE
57#endif
58
59/* This functions transforms the first char to 'w' if it's not 'r', 'a' or 'w'
60 * and strips any subsequent chars except '+' and 'b'.
61 * Use this to sanitize stream->mode if you call e.g. fdopen, fopencookie or
62 * any other function that expects standard modes and you allow non-standard
63 * ones. result should be a char[5]. */
struct _php_stream php_stream
Definition php_streams.h:96
void php_stream_mode_sanitize_fdopen_fopencookie(php_stream *stream, char *result)
Definition cast.c:151
bool result