From 862634ffa582e111e9a30e02f6e268e3cfb241ac Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Tue, 25 Feb 2003 01:39:06 +0000 Subject: Added locking to streams. Allow PHP to automatically release locks on files when terminating the stream. Fixed bugs in the handling of the 3rd optional parameter to flock(). --- main/php_streams.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'main/php_streams.h') diff --git a/main/php_streams.h b/main/php_streams.h index 194172c1c3..2bc6468cfc 100755 --- a/main/php_streams.h +++ b/main/php_streams.h @@ -326,6 +326,15 @@ PHPAPI int _php_stream_set_option(php_stream *stream, int option, int value, voi #define PHP_STREAM_OPTION_READ_TIMEOUT 4 #define PHP_STREAM_OPTION_SET_CHUNK_SIZE 5 +/* set or release lock on a stream */ +#define PHP_STREAM_OPTION_LOCKING 6 + +/* whether or not locking is supported */ +#define PHP_STREAM_LOCK_SUPPORTED 1 + +#define php_stream_supports_lock(stream) php_stream_set_option((stream), PHP_STREAM_OPTION_LOCKING, 0, (void *) PHP_STREAM_LOCK_SUPPORTED TSRMLS_CC) == 0 ? 1 : 0 +#define php_stream_lock(stream, mode) php_stream_set_option((stream), PHP_STREAM_OPTION_LOCKING, (mode), (void *) NULL TSRMLS_CC) + #define PHP_STREAM_OPTION_RETURN_OK 0 /* option set OK */ #define PHP_STREAM_OPTION_RETURN_ERR -1 /* problem setting option */ #define PHP_STREAM_OPTION_RETURN_NOTIMPL -2 /* underlying stream does not implement; streams can handle it instead */ -- cgit v1.2.1