Lines Matching refs:stream
69 php_stream *stream; in forget_persistent_resource_id_numbers() local
76 stream = (php_stream*)rsrc->ptr; in forget_persistent_resource_id_numbers()
79 fprintf(stderr, "forget_persistent: %s:%p\n", stream->ops->label, stream); in forget_persistent_resource_id_numbers()
82 stream->res = NULL; in forget_persistent_resource_id_numbers()
84 if (stream->ctx) { in forget_persistent_resource_id_numbers()
85 zend_list_delete(stream->ctx); in forget_persistent_resource_id_numbers()
86 stream->ctx = NULL; in forget_persistent_resource_id_numbers()
111 PHPAPI int php_stream_from_persistent_id(const char *persistent_id, php_stream **stream) in php_stream_from_persistent_id() argument
117 if (stream) { in php_stream_from_persistent_id()
123 *stream = (php_stream*)le->ptr; in php_stream_from_persistent_id()
127 (*stream)->res = regentry; in php_stream_from_persistent_id()
132 (*stream)->res = zend_register_resource(*stream, le_pstream); in php_stream_from_persistent_id()
286 ret->readfilters.stream = ret; in _php_stream_alloc()
287 ret->writefilters.stream = ret; in _php_stream_alloc()
365 PHPAPI int _php_stream_free(php_stream *stream, int close_options) /* {{{ */ in _php_stream_free() argument
384 context = PHP_STREAM_CONTEXT(stream); in _php_stream_free()
386 if ((stream->flags & PHP_STREAM_FLAG_NO_CLOSE) || in _php_stream_free()
387 …((stream->flags & PHP_STREAM_FLAG_NO_RSCR_DTOR_CLOSE) && (close_options & PHP_STREAM_FREE_RSRC_DTO… in _php_stream_free()
395 …stream->ops->label, stream, stream->orig_path, stream->in_free, _php_stream_pretty_free_options(cl… in _php_stream_free()
400 if (stream->in_free) { in _php_stream_free()
402 …if ((stream->in_free == 1) && (close_options & PHP_STREAM_FREE_IGNORE_ENCLOSING) && (stream->enclo… in _php_stream_free()
409 stream->in_free++; in _php_stream_free()
416 (stream->enclosing_stream != NULL)) { in _php_stream_free()
417 php_stream *enclosing_stream = stream->enclosing_stream; in _php_stream_free()
418 stream->enclosing_stream = NULL; in _php_stream_free()
431 if (stream->fclose_stdiocast == PHP_STREAM_FCLOSE_FOPENCOOKIE) { in _php_stream_free()
435 php_stream_auto_cleanup(stream); in _php_stream_free()
436 stream->in_free--; in _php_stream_free()
445 stream->ops->label, stream, stream->orig_path, preserve_handle, release_cast, in _php_stream_free()
449 if (stream->flags & PHP_STREAM_FLAG_WAS_WRITTEN || stream->writefilters.head) { in _php_stream_free()
451 _php_stream_flush(stream, 1); in _php_stream_free()
455 if ((close_options & PHP_STREAM_FREE_RSRC_DTOR) == 0 && stream->res) { in _php_stream_free()
457 zend_list_close(stream->res); in _php_stream_free()
460 zend_list_delete(stream->res); in _php_stream_free()
461 stream->res = NULL; in _php_stream_free()
466 if (release_cast && stream->fclose_stdiocast == PHP_STREAM_FCLOSE_FOPENCOOKIE) { in _php_stream_free()
474 stream->in_free = 0; in _php_stream_free()
475 return fclose(stream->stdiocast); in _php_stream_free()
478 ret = stream->ops->close(stream, preserve_handle ? 0 : 1); in _php_stream_free()
479 stream->abstract = NULL; in _php_stream_free()
482 if (release_cast && stream->fclose_stdiocast == PHP_STREAM_FCLOSE_FDOPEN && stream->stdiocast) { in _php_stream_free()
483 fclose(stream->stdiocast); in _php_stream_free()
484 stream->stdiocast = NULL; in _php_stream_free()
485 stream->fclose_stdiocast = PHP_STREAM_FCLOSE_NONE; in _php_stream_free()
490 while (stream->readfilters.head) { in _php_stream_free()
491 if (stream->readfilters.head->res != NULL) { in _php_stream_free()
492 zend_list_close(stream->readfilters.head->res); in _php_stream_free()
494 php_stream_filter_remove(stream->readfilters.head, 1); in _php_stream_free()
496 while (stream->writefilters.head) { in _php_stream_free()
497 if (stream->writefilters.head->res != NULL) { in _php_stream_free()
498 zend_list_close(stream->writefilters.head->res); in _php_stream_free()
500 php_stream_filter_remove(stream->writefilters.head, 1); in _php_stream_free()
503 if (stream->wrapper && stream->wrapper->wops && stream->wrapper->wops->stream_closer) { in _php_stream_free()
504 stream->wrapper->wops->stream_closer(stream->wrapper, stream); in _php_stream_free()
505 stream->wrapper = NULL; in _php_stream_free()
508 if (Z_TYPE(stream->wrapperdata) != IS_UNDEF) { in _php_stream_free()
509 zval_ptr_dtor(&stream->wrapperdata); in _php_stream_free()
510 ZVAL_UNDEF(&stream->wrapperdata); in _php_stream_free()
513 if (stream->readbuf) { in _php_stream_free()
514 pefree(stream->readbuf, stream->is_persistent); in _php_stream_free()
515 stream->readbuf = NULL; in _php_stream_free()
518 if (stream->is_persistent && (close_options & PHP_STREAM_FREE_PERSISTENT)) { in _php_stream_free()
520 zend_hash_apply_with_argument(&EG(persistent_list), _php_stream_free_persistent, stream); in _php_stream_free()
523 if (stream->orig_path) { in _php_stream_free()
524 pefree(stream->orig_path, stream->is_persistent); in _php_stream_free()
525 stream->orig_path = NULL; in _php_stream_free()
528 pefree(stream, stream->is_persistent); in _php_stream_free()
541 PHPAPI zend_result _php_stream_fill_read_buffer(php_stream *stream, size_t size) in _php_stream_fill_read_buffer() argument
545 if (stream->readfilters.head) { in _php_stream_fill_read_buffer()
546 size_t to_read_now = MIN(size, stream->chunk_size); in _php_stream_fill_read_buffer()
552 chunk_buf = emalloc(stream->chunk_size); in _php_stream_fill_read_buffer()
554 while (!stream->eof && (stream->writepos - stream->readpos < (zend_off_t)to_read_now)) { in _php_stream_fill_read_buffer()
562 justread = stream->ops->read(stream, chunk_buf, stream->chunk_size); in _php_stream_fill_read_buffer()
563 if (justread < 0 && stream->writepos == stream->readpos) { in _php_stream_fill_read_buffer()
567 bucket = php_stream_bucket_new(stream, chunk_buf, justread, 0, 0); in _php_stream_fill_read_buffer()
572 flags = stream->eof ? PSFS_FLAG_FLUSH_CLOSE : PSFS_FLAG_NORMAL; in _php_stream_fill_read_buffer()
574 flags = stream->eof ? PSFS_FLAG_FLUSH_CLOSE : PSFS_FLAG_FLUSH_INC; in _php_stream_fill_read_buffer()
578 for (filter = stream->readfilters.head; filter; filter = filter->next) { in _php_stream_fill_read_buffer()
579 status = filter->fops->filter(stream, filter, brig_inp, brig_outp, NULL, flags); in _php_stream_fill_read_buffer()
602 if (stream->readbuf && stream->readbuflen - stream->writepos < bucket->buflen) { in _php_stream_fill_read_buffer()
603 if (stream->writepos > stream->readpos) { in _php_stream_fill_read_buffer()
604 … memmove(stream->readbuf, stream->readbuf + stream->readpos, stream->writepos - stream->readpos); in _php_stream_fill_read_buffer()
606 stream->writepos -= stream->readpos; in _php_stream_fill_read_buffer()
607 stream->readpos = 0; in _php_stream_fill_read_buffer()
610 if (stream->readbuflen - stream->writepos < bucket->buflen) { in _php_stream_fill_read_buffer()
611 stream->readbuflen += bucket->buflen; in _php_stream_fill_read_buffer()
612 stream->readbuf = perealloc(stream->readbuf, stream->readbuflen, in _php_stream_fill_read_buffer()
613 stream->is_persistent); in _php_stream_fill_read_buffer()
616 memcpy(stream->readbuf + stream->writepos, bucket->buf, bucket->buflen); in _php_stream_fill_read_buffer()
618 stream->writepos += bucket->buflen; in _php_stream_fill_read_buffer()
634 stream->eof = 1; in _php_stream_fill_read_buffer()
660 if (stream->writepos - stream->readpos < (zend_off_t)size) { in _php_stream_fill_read_buffer()
664 if (stream->readbuf && stream->readbuflen - stream->writepos < stream->chunk_size) { in _php_stream_fill_read_buffer()
665 if (stream->writepos > stream->readpos) { in _php_stream_fill_read_buffer()
666 … memmove(stream->readbuf, stream->readbuf + stream->readpos, stream->writepos - stream->readpos); in _php_stream_fill_read_buffer()
668 stream->writepos -= stream->readpos; in _php_stream_fill_read_buffer()
669 stream->readpos = 0; in _php_stream_fill_read_buffer()
674 if (stream->readbuflen - stream->writepos < stream->chunk_size) { in _php_stream_fill_read_buffer()
675 stream->readbuflen += stream->chunk_size; in _php_stream_fill_read_buffer()
676 stream->readbuf = perealloc(stream->readbuf, stream->readbuflen, in _php_stream_fill_read_buffer()
677 stream->is_persistent); in _php_stream_fill_read_buffer()
680 justread = stream->ops->read(stream, (char*)stream->readbuf + stream->writepos, in _php_stream_fill_read_buffer()
681 stream->readbuflen - stream->writepos in _php_stream_fill_read_buffer()
686 stream->writepos += justread; in _php_stream_fill_read_buffer()
692 PHPAPI ssize_t _php_stream_read(php_stream *stream, char *buf, size_t size) in _php_stream_read() argument
702 if (stream->writepos > stream->readpos) { in _php_stream_read()
704 toread = stream->writepos - stream->readpos; in _php_stream_read()
709 memcpy(buf, stream->readbuf + stream->readpos, toread); in _php_stream_read()
710 stream->readpos += toread; in _php_stream_read()
721 …if (!stream->readfilters.head && ((stream->flags & PHP_STREAM_FLAG_NO_BUFFER) || stream->chunk_siz… in _php_stream_read()
722 toread = stream->ops->read(stream, buf, size); in _php_stream_read()
732 if (php_stream_fill_read_buffer(stream, size) != SUCCESS) { in _php_stream_read()
739 toread = stream->writepos - stream->readpos; in _php_stream_read()
745 memcpy(buf, stream->readbuf + stream->readpos, toread); in _php_stream_read()
746 stream->readpos += toread; in _php_stream_read()
759 if ((stream->wrapper != &php_plain_files_wrapper) && in _php_stream_read()
760 (stream->ops != &php_stream_memory_ops) && in _php_stream_read()
761 (stream->ops != &php_stream_temp_ops)) { in _php_stream_read()
767 stream->position += didread; in _php_stream_read()
775 PHPAPI zend_string *php_stream_read_to_str(php_stream *stream, size_t len) in php_stream_read_to_str() argument
778 ssize_t read = php_stream_read(stream, ZSTR_VAL(str), len); in php_stream_read_to_str()
793 PHPAPI bool _php_stream_eof(php_stream *stream) in _php_stream_eof() argument
796 if (stream->writepos - stream->readpos > 0) { in _php_stream_eof()
801 if (!stream->eof && PHP_STREAM_OPTION_RETURN_ERR == in _php_stream_eof()
802 php_stream_set_option(stream, PHP_STREAM_OPTION_CHECK_LIVENESS, in _php_stream_eof()
804 stream->eof = 1; in _php_stream_eof()
807 return stream->eof; in _php_stream_eof()
810 PHPAPI int _php_stream_putc(php_stream *stream, int c) in _php_stream_putc() argument
814 if (php_stream_write(stream, (char*)&buf, 1) > 0) { in _php_stream_putc()
820 PHPAPI int _php_stream_getc(php_stream *stream) in _php_stream_getc() argument
824 if (php_stream_read(stream, &buf, 1) > 0) { in _php_stream_getc()
830 PHPAPI bool _php_stream_puts(php_stream *stream, const char *buf) in _php_stream_puts() argument
836 …if (len > 0 && php_stream_write(stream, buf, len) > 0 && php_stream_write(stream, newline, 1) > 0)… in _php_stream_puts()
842 PHPAPI int _php_stream_stat(php_stream *stream, php_stream_statbuf *ssb) in _php_stream_stat() argument
847 if (stream->wrapper && stream->wrapper->wops->stream_stat != NULL) { in _php_stream_stat()
848 return stream->wrapper->wops->stream_stat(stream->wrapper, stream, ssb); in _php_stream_stat()
855 if (stream->ops->stat == NULL) { in _php_stream_stat()
859 return (stream->ops->stat)(stream, ssb); in _php_stream_stat()
862 PHPAPI const char *php_stream_locate_eol(php_stream *stream, zend_string *buf) in php_stream_locate_eol() argument
869 readptr = (char*)stream->readbuf + stream->readpos; in php_stream_locate_eol()
870 avail = stream->writepos - stream->readpos; in php_stream_locate_eol()
877 if (stream->flags & PHP_STREAM_FLAG_DETECT_EOL) { in php_stream_locate_eol()
883 stream->flags ^= PHP_STREAM_FLAG_DETECT_EOL; in php_stream_locate_eol()
884 stream->flags |= PHP_STREAM_FLAG_EOL_MAC; in php_stream_locate_eol()
888 stream->flags ^= PHP_STREAM_FLAG_DETECT_EOL; in php_stream_locate_eol()
891 } else if (stream->flags & PHP_STREAM_FLAG_EOL_MAC) { in php_stream_locate_eol()
904 PHPAPI char *_php_stream_get_line(php_stream *stream, char *buf, size_t maxlen, in _php_stream_get_line() argument
933 avail = stream->writepos - stream->readpos; in _php_stream_get_line()
941 readptr = (char*)stream->readbuf + stream->readpos; in _php_stream_get_line()
942 eol = php_stream_locate_eol(stream, NULL); in _php_stream_get_line()
971 stream->position += cpysz; in _php_stream_get_line()
972 stream->readpos += cpysz; in _php_stream_get_line()
980 } else if (stream->eof) { in _php_stream_get_line()
987 toread = stream->chunk_size; in _php_stream_get_line()
990 if (toread > stream->chunk_size) { in _php_stream_get_line()
991 toread = stream->chunk_size; in _php_stream_get_line()
995 php_stream_fill_read_buffer(stream, toread); in _php_stream_get_line()
997 if (stream->writepos - stream->readpos == 0) { in _php_stream_get_line()
1018 #define STREAM_BUFFERED_AMOUNT(stream) \ argument
1019 ((size_t)(((stream)->writepos) - (stream)->readpos))
1021 static const char *_php_stream_search_delim(php_stream *stream, in _php_stream_search_delim() argument
1030 seek_len = MIN(STREAM_BUFFERED_AMOUNT(stream), maxlen); in _php_stream_search_delim()
1036 return memchr(&stream->readbuf[stream->readpos + skiplen], in _php_stream_search_delim()
1039 return php_memnstr((char*)&stream->readbuf[stream->readpos + skiplen], in _php_stream_search_delim()
1041 (char*)&stream->readbuf[stream->readpos + seek_len]); in _php_stream_search_delim()
1045 PHPAPI zend_string *php_stream_get_record(php_stream *stream, size_t maxlen, const char *delim, siz… in php_stream_get_record() argument
1059 stream, maxlen, 0, delim, delim_len); in php_stream_get_record()
1062 buffered_len = STREAM_BUFFERED_AMOUNT(stream); in php_stream_get_record()
1068 to_read_now = MIN(maxlen - buffered_len, stream->chunk_size); in php_stream_get_record()
1070 php_stream_fill_read_buffer(stream, buffered_len + to_read_now); in php_stream_get_record()
1072 just_read = STREAM_BUFFERED_AMOUNT(stream) - buffered_len; in php_stream_get_record()
1088 stream, maxlen, in php_stream_get_record()
1101 tent_ret_len = found_delim - (char*)&stream->readbuf[stream->readpos]; in php_stream_get_record()
1102 } else if (!has_delim && STREAM_BUFFERED_AMOUNT(stream) >= maxlen) { in php_stream_get_record()
1109 if (STREAM_BUFFERED_AMOUNT(stream) < maxlen && !stream->eof) { in php_stream_get_record()
1111 } else if (STREAM_BUFFERED_AMOUNT(stream) == 0 && stream->eof) { in php_stream_get_record()
1116 tent_ret_len = MIN(STREAM_BUFFERED_AMOUNT(stream), maxlen); in php_stream_get_record()
1123 ZSTR_LEN(ret_buf) = php_stream_read(stream, ZSTR_VAL(ret_buf), tent_ret_len); in php_stream_get_record()
1126 stream->readpos += delim_len; in php_stream_get_record()
1127 stream->position += delim_len; in php_stream_get_record()
1134 static ssize_t _php_stream_write_buffer(php_stream *stream, const char *buf, size_t count) in _php_stream_write_buffer() argument
1141 …if (stream->ops->seek && (stream->flags & PHP_STREAM_FLAG_NO_SEEK) == 0 && stream->readpos != stre… in _php_stream_write_buffer()
1142 stream->readpos = stream->writepos = 0; in _php_stream_write_buffer()
1144 stream->ops->seek(stream, stream->position, SEEK_SET, &stream->position); in _php_stream_write_buffer()
1149 if (php_stream_is(stream, PHP_STREAM_IS_USERSPACE)) { in _php_stream_write_buffer()
1151 chunk_size = stream->chunk_size; in _php_stream_write_buffer()
1155 ssize_t justwrote = stream->ops->write(stream, buf, MIN(chunk_size, count)); in _php_stream_write_buffer()
1168 stream->position += justwrote; in _php_stream_write_buffer()
1179 static ssize_t _php_stream_write_filtered(php_stream *stream, const char *buf, size_t count, int fl… in _php_stream_write_filtered() argument
1189 bucket = php_stream_bucket_new(stream, (char *)buf, count, 0, 0); in _php_stream_write_filtered()
1193 for (filter = stream->writefilters.head; filter; filter = filter->next) { in _php_stream_write_filtered()
1196 status = filter->fops->filter(stream, filter, brig_inp, brig_outp, in _php_stream_write_filtered()
1197 filter == stream->writefilters.head ? &consumed : NULL, flags); in _php_stream_write_filtered()
1217 if (_php_stream_write_buffer(stream, bucket->buf, bucket->buflen) < 0) { in _php_stream_write_filtered()
1243 PHPAPI int _php_stream_flush(php_stream *stream, int closing) in _php_stream_flush() argument
1247 if (stream->writefilters.head) { in _php_stream_flush()
1248 …_php_stream_write_filtered(stream, NULL, 0, closing ? PSFS_FLAG_FLUSH_CLOSE : PSFS_FLAG_FLUSH_INC … in _php_stream_flush()
1251 stream->flags &= ~PHP_STREAM_FLAG_WAS_WRITTEN; in _php_stream_flush()
1253 if (stream->ops->flush) { in _php_stream_flush()
1254 ret = stream->ops->flush(stream); in _php_stream_flush()
1260 PHPAPI ssize_t _php_stream_write(php_stream *stream, const char *buf, size_t count) in _php_stream_write() argument
1269 if (stream->ops->write == NULL) { in _php_stream_write()
1274 if (stream->writefilters.head) { in _php_stream_write()
1275 bytes = _php_stream_write_filtered(stream, buf, count, PSFS_FLAG_NORMAL); in _php_stream_write()
1277 bytes = _php_stream_write_buffer(stream, buf, count); in _php_stream_write()
1281 stream->flags |= PHP_STREAM_FLAG_WAS_WRITTEN; in _php_stream_write()
1287 PHPAPI ssize_t _php_stream_printf(php_stream *stream, const char *fmt, ...) in _php_stream_printf() argument
1301 count = php_stream_write(stream, buf, count); in _php_stream_printf()
1307 PHPAPI zend_off_t _php_stream_tell(php_stream *stream) in _php_stream_tell() argument
1309 return stream->position; in _php_stream_tell()
1312 PHPAPI int _php_stream_seek(php_stream *stream, zend_off_t offset, int whence) in _php_stream_seek() argument
1314 if (stream->fclose_stdiocast == PHP_STREAM_FCLOSE_FOPENCOOKIE) { in _php_stream_seek()
1316 if (!stream->fclose_stdiocast_flush_in_progress) { in _php_stream_seek()
1317 stream->fclose_stdiocast_flush_in_progress = 1; in _php_stream_seek()
1319 fflush(stream->stdiocast); in _php_stream_seek()
1320 stream->fclose_stdiocast_flush_in_progress = 0; in _php_stream_seek()
1325 if ((stream->flags & PHP_STREAM_FLAG_NO_BUFFER) == 0) { in _php_stream_seek()
1328 if (offset > 0 && offset <= stream->writepos - stream->readpos) { in _php_stream_seek()
1329 stream->readpos += offset; /* if offset = ..., then readpos = writepos */ in _php_stream_seek()
1330 stream->position += offset; in _php_stream_seek()
1331 stream->eof = 0; in _php_stream_seek()
1336 if (offset > stream->position && in _php_stream_seek()
1337 offset <= stream->position + stream->writepos - stream->readpos) { in _php_stream_seek()
1338 stream->readpos += offset - stream->position; in _php_stream_seek()
1339 stream->position = offset; in _php_stream_seek()
1340 stream->eof = 0; in _php_stream_seek()
1348 if (stream->ops->seek && (stream->flags & PHP_STREAM_FLAG_NO_SEEK) == 0) { in _php_stream_seek()
1351 if (stream->writefilters.head) { in _php_stream_seek()
1352 _php_stream_flush(stream, 0); in _php_stream_seek()
1357 ZEND_ASSERT(stream->position >= 0); in _php_stream_seek()
1358 if (UNEXPECTED(offset > ZEND_LONG_MAX - stream->position)) { in _php_stream_seek()
1361 offset = stream->position + offset; in _php_stream_seek()
1366 ret = stream->ops->seek(stream, offset, whence, &stream->position); in _php_stream_seek()
1368 if (((stream->flags & PHP_STREAM_FLAG_NO_SEEK) == 0) || ret == 0) { in _php_stream_seek()
1370 stream->eof = 0; in _php_stream_seek()
1374 stream->readpos = stream->writepos = 0; in _php_stream_seek()
1387 if ((didread = php_stream_read(stream, tmp, MIN(offset, sizeof(tmp)))) <= 0) { in _php_stream_seek()
1392 stream->eof = 0; in _php_stream_seek()
1401 PHPAPI int _php_stream_set_option(php_stream *stream, int option, int value, void *ptrparam) in _php_stream_set_option() argument
1405 if (stream->ops->set_option) { in _php_stream_set_option()
1406 ret = stream->ops->set_option(stream, option, value, ptrparam); in _php_stream_set_option()
1413 ret = stream->chunk_size > INT_MAX ? INT_MAX : (int)stream->chunk_size; in _php_stream_set_option()
1414 stream->chunk_size = value; in _php_stream_set_option()
1420 stream->flags |= PHP_STREAM_FLAG_NO_BUFFER; in _php_stream_set_option()
1421 } else if (stream->flags & PHP_STREAM_FLAG_NO_BUFFER) { in _php_stream_set_option()
1422 stream->flags ^= PHP_STREAM_FLAG_NO_BUFFER; in _php_stream_set_option()
1435 PHPAPI int _php_stream_sync(php_stream *stream, bool data_only) in _php_stream_sync() argument
1441 return php_stream_set_option(stream, PHP_STREAM_OPTION_SYNC_API, op, NULL); in _php_stream_sync()
1444 PHPAPI int _php_stream_truncate_set_size(php_stream *stream, size_t newsize) in _php_stream_truncate_set_size() argument
1446 …return php_stream_set_option(stream, PHP_STREAM_OPTION_TRUNCATE_API, PHP_STREAM_TRUNCATE_SET_SIZE,… in _php_stream_truncate_set_size()
1449 PHPAPI ssize_t _php_stream_passthru(php_stream * stream STREAMS_DC) in _php_stream_passthru()
1455 if (php_stream_mmap_possible(stream)) { in _php_stream_passthru()
1459 …p = php_stream_mmap_range(stream, php_stream_tell(stream), PHP_STREAM_MMAP_ALL, PHP_STREAM_MAP_MOD… in _php_stream_passthru()
1469 php_stream_mmap_unmap_ex(stream, mapped); in _php_stream_passthru()
1475 while ((b = php_stream_read(stream, buf, sizeof(buf))) > 0) { in _php_stream_passthru()
1787 php_stream *stream = (php_stream*)rsrc->ptr; in stream_resource_regular_dtor() local
1789 FG(pclose_ret) = php_stream_free(stream, PHP_STREAM_FREE_CLOSE | PHP_STREAM_FREE_RSRC_DTOR); in stream_resource_regular_dtor()
1794 php_stream *stream = (php_stream*)rsrc->ptr; in stream_resource_persistent_dtor() local
1795 FG(pclose_ret) = php_stream_free(stream, PHP_STREAM_FREE_CLOSE | PHP_STREAM_FREE_RSRC_DTOR); in stream_resource_persistent_dtor()
2101 php_stream *stream = NULL; local
2114 stream = wrapper->wops->dir_opener(wrapper,
2118 if (stream) {
2119 stream->wrapper = wrapper;
2120 stream->flags |= PHP_STREAM_FLAG_NO_BUFFER | PHP_STREAM_FLAG_IS_DIR;
2125 if (stream == NULL && (options & REPORT_ERRORS)) {
2130 return stream;
2150 php_stream *stream = NULL; local
2206 stream = wrapper->wops->stream_opener(wrapper,
2213 if (stream && (options & STREAM_OPEN_PERSISTENT) && !stream->is_persistent) {
2216 php_stream_close(stream);
2217 stream = NULL;
2220 if (stream) {
2221 stream->wrapper = wrapper;
2225 if (stream) {
2230 if (stream->orig_path) {
2231 pefree(stream->orig_path, persistent);
2234 stream->orig_path = copy_of_path;
2236 stream->open_filename = __zend_orig_filename ? __zend_orig_filename : __zend_filename;
2237 stream->open_lineno = __zend_orig_lineno ? __zend_orig_lineno : __zend_lineno;
2241 if (stream != NULL && (options & STREAM_MUST_SEEK)) {
2244 switch(php_stream_make_seekable_rel(stream, &newstream,
2251 return stream;
2262 php_stream_close(stream);
2263 stream = NULL;
2276 …if (stream && stream->ops->seek && (stream->flags & PHP_STREAM_FLAG_NO_SEEK) == 0 && strchr(mode, …
2280 if (0 == stream->ops->seek(stream, 0, SEEK_CUR, &newpos)) {
2281 stream->position = newpos;
2285 if (stream == NULL && (options & REPORT_ERRORS)) {
2294 if (stream == NULL && copy_of_path != NULL) {
2301 return stream;
2306 PHPAPI php_stream_context *php_stream_context_set(php_stream *stream, php_stream_context *context) argument
2308 php_stream_context *oldcontext = PHP_STREAM_CONTEXT(stream);
2311 stream->ctx = context->res;
2314 stream->ctx = NULL;
2416 php_stream *stream; local
2426 stream = php_stream_opendir(dirname, REPORT_ERRORS, context);
2427 if (!stream) {
2431 while (php_stream_readdir(stream, &sdp)) {
2438 php_stream_closedir(stream);
2452 php_stream_closedir(stream);
2457 php_stream_closedir(stream);