Index: plain_wrapper.c =================================================================== RCS file: /repository/php-src/main/streams/plain_wrapper.c,v retrieving revision 1.42 diff -u -r1.42 plain_wrapper.c --- plain_wrapper.c 28 Oct 2004 05:05:20 -0000 1.42 +++ plain_wrapper.c 12 Feb 2005 23:31:17 -0000 @@ -745,6 +745,7 @@ php_stdiop_close, php_stdiop_flush, "STDIO", php_stdiop_seek, + NULL, /* tell */ php_stdiop_cast, php_stdiop_stat, php_stdiop_set_option @@ -787,6 +788,7 @@ php_plain_files_dirstream_close, NULL, "dir", php_plain_files_dirstream_rewind, + NULL, /* tell */ NULL, /* cast */ NULL, /* stat */ NULL /* set_option */ Index: streams.c =================================================================== RCS file: /repository/php-src/main/streams/streams.c,v retrieving revision 1.70 diff -u -r1.70 streams.c --- streams.c 15 Nov 2004 23:43:12 -0000 1.70 +++ streams.c 12 Feb 2005 23:31:32 -0000 @@ -1035,7 +1035,12 @@ PHPAPI off_t _php_stream_tell(php_stream *stream TSRMLS_DC) { - return stream->position; + if (stream->ops->tell) { + return stream->ops->tell(stream TSRMLS_CC); + } + else { + return stream->position; + } } PHPAPI int _php_stream_seek(php_stream *stream, off_t offset, int whence TSRMLS_DC) Index: userspace.c =================================================================== RCS file: /repository/php-src/main/streams/userspace.c,v retrieving revision 1.29 diff -u -r1.29 userspace.c --- userspace.c 8 Oct 2004 14:40:11 -0000 1.29 +++ userspace.c 12 Feb 2005 23:31:33 -0000 @@ -671,6 +671,37 @@ return call_result; } +static int php_userstreamop_tell(php_stream *stream TSRMLS_DC) +{ + zval func_name; + zval *retval = NULL; + int call_result; + php_userstream_data_t *us = (php_userstream_data_t *)stream->abstract; + + assert(us != NULL); + + ZVAL_STRINGL(&func_name, USERSTREAM_TELL, sizeof(USERSTREAM_TELL)-1, 0); + + call_result = call_user_function_ex(NULL, + &us->object, + &func_name, + &retval, + 0, NULL, 0, NULL TSRMLS_CC); + + if (call_result != SUCCESS || retval == NULL || Z_TYPE_P(retval) != IS_LONG) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_TELL " is not implemented!", us->wrapper->classname); + call_result = -1; + } + else { + call_result = Z_LVAL_P(retval); + } + + if (retval) + zval_ptr_dtor(&retval); + + return call_result; +} + static int php_userstreamop_seek(php_stream *stream, off_t offset, int whence, off_t *newoffs TSRMLS_DC) { zval func_name; @@ -1302,6 +1333,7 @@ php_userstreamop_close, php_userstreamop_flush, "user-space", php_userstreamop_seek, + php_userstreamop_tell, NULL, /* cast */ php_userstreamop_stat, php_userstreamop_set_option, Index: xp_socket.c =================================================================== RCS file: /repository/php-src/main/streams/xp_socket.c,v retrieving revision 1.30 diff -u -r1.30 xp_socket.c --- xp_socket.c 17 Sep 2004 14:36:55 -0000 1.30 +++ xp_socket.c 12 Feb 2005 23:31:37 -0000 @@ -414,6 +414,7 @@ php_sockop_close, php_sockop_flush, "generic_socket", NULL, /* seek */ + NULL, /* tell */ php_sockop_cast, php_sockop_stat, php_sockop_set_option, @@ -425,6 +426,7 @@ php_sockop_close, php_sockop_flush, "tcp_socket", NULL, /* seek */ + NULL, /* tell */ php_sockop_cast, php_sockop_stat, php_tcp_sockop_set_option, @@ -435,6 +437,7 @@ php_sockop_close, php_sockop_flush, "udp_socket", NULL, /* seek */ + NULL, /* tell */ php_sockop_cast, php_sockop_stat, php_tcp_sockop_set_option, @@ -446,6 +449,7 @@ php_sockop_close, php_sockop_flush, "unix_socket", NULL, /* seek */ + NULL, /* tell */ php_sockop_cast, php_sockop_stat, php_tcp_sockop_set_option, @@ -455,6 +459,7 @@ php_sockop_close, php_sockop_flush, "udg_socket", NULL, /* seek */ + NULL, /* tell */ php_sockop_cast, php_sockop_stat, php_tcp_sockop_set_option,