php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
mmap.c
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/* Memory Mapping interface for streams */
18#include "php.h"
19#include "php_streams_int.h"
20
21PHPAPI char *_php_stream_mmap_range(php_stream *stream, size_t offset, size_t length, php_stream_mmap_access_t mode, size_t *mapped_len)
22{
24
25 range.offset = offset;
26 range.length = length;
27 range.mode = mode;
28 range.mapped = NULL;
29
31 if (mapped_len) {
32 *mapped_len = range.length;
33 }
34 return range.mapped;
35 }
36 return NULL;
37}
38
43
45{
46 int ret = 1;
47
48 if (php_stream_seek(stream, readden, SEEK_CUR) != 0) {
49 ret = 0;
50 }
51 if (php_stream_mmap_unmap(stream) == 0) {
52 ret = 0;
53 }
54
55 return ret;
56}
const SEEK_CUR
Definition file.stub.php:16
zend_long offset
char * mode
#define NULL
Definition gdcache.h:45
PHPAPI int _php_stream_mmap_unmap_ex(php_stream *stream, zend_off_t readden)
Definition mmap.c:44
PHPAPI char * _php_stream_mmap_range(php_stream *stream, size_t offset, size_t length, php_stream_mmap_access_t mode, size_t *mapped_len)
Definition mmap.c:21
PHPAPI int _php_stream_mmap_unmap(php_stream *stream)
Definition mmap.c:39
#define PHPAPI
Definition php.h:71
#define php_stream_mmap_unmap(stream)
php_stream_mmap_access_t
#define php_stream_mmap_range(stream, offset, length, mode, mapped_len)
@ PHP_STREAM_MMAP_UNMAP
@ PHP_STREAM_MMAP_MAP_RANGE
struct _php_stream php_stream
Definition php_streams.h:96
#define php_stream_seek(stream, offset, whence)
#define php_stream_set_option(stream, option, value, ptrvalue)
#define PHP_STREAM_OPTION_RETURN_OK
#define PHP_STREAM_OPTION_MMAP_API
int32_t zend_off_t
Definition zend_long.h:44
zval * ret