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()
395stream->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
546 bool old_eof = stream->eof; in _php_stream_fill_read_buffer()
548 if (stream->readfilters.head) { in _php_stream_fill_read_buffer()
549 size_t to_read_now = MIN(size, stream->chunk_size); in _php_stream_fill_read_buffer()
555 chunk_buf = emalloc(stream->chunk_size); in _php_stream_fill_read_buffer()
557 while (!stream->eof && (stream->writepos - stream->readpos < (zend_off_t)to_read_now)) { in _php_stream_fill_read_buffer()
565 justread = stream->ops->read(stream, chunk_buf, stream->chunk_size); in _php_stream_fill_read_buffer()
566 if (justread < 0 && stream->writepos == stream->readpos) { in _php_stream_fill_read_buffer()
571 bucket = php_stream_bucket_new(stream, chunk_buf, justread, 0, 0); in _php_stream_fill_read_buffer()
576 flags = stream->eof ? PSFS_FLAG_FLUSH_CLOSE : PSFS_FLAG_NORMAL; in _php_stream_fill_read_buffer()
578 flags = stream->eof ? PSFS_FLAG_FLUSH_CLOSE : PSFS_FLAG_FLUSH_INC; in _php_stream_fill_read_buffer()
582 for (filter = stream->readfilters.head; filter; filter = filter->next) { in _php_stream_fill_read_buffer()
583 status = filter->fops->filter(stream, filter, brig_inp, brig_outp, NULL, flags); in _php_stream_fill_read_buffer()
606 if (stream->readbuf && stream->readbuflen - stream->writepos < bucket->buflen) { in _php_stream_fill_read_buffer()
607 if (stream->writepos > stream->readpos) { in _php_stream_fill_read_buffer()
608 … memmove(stream->readbuf, stream->readbuf + stream->readpos, stream->writepos - stream->readpos); in _php_stream_fill_read_buffer()
610 stream->writepos -= stream->readpos; in _php_stream_fill_read_buffer()
611 stream->readpos = 0; in _php_stream_fill_read_buffer()
614 if (stream->readbuflen - stream->writepos < bucket->buflen) { in _php_stream_fill_read_buffer()
615 stream->readbuflen += bucket->buflen; in _php_stream_fill_read_buffer()
616 stream->readbuf = perealloc(stream->readbuf, stream->readbuflen, in _php_stream_fill_read_buffer()
617 stream->is_persistent); in _php_stream_fill_read_buffer()
620 memcpy(stream->readbuf + stream->writepos, bucket->buf, bucket->buflen); in _php_stream_fill_read_buffer()
622 stream->writepos += bucket->buflen; in _php_stream_fill_read_buffer()
638 stream->eof = 1; in _php_stream_fill_read_buffer()
664 if (stream->writepos - stream->readpos < (zend_off_t)size) { in _php_stream_fill_read_buffer()
668 if (stream->readbuf && stream->readbuflen - stream->writepos < stream->chunk_size) { in _php_stream_fill_read_buffer()
669 if (stream->writepos > stream->readpos) { in _php_stream_fill_read_buffer()
670 … memmove(stream->readbuf, stream->readbuf + stream->readpos, stream->writepos - stream->readpos); in _php_stream_fill_read_buffer()
672 stream->writepos -= stream->readpos; in _php_stream_fill_read_buffer()
673 stream->readpos = 0; in _php_stream_fill_read_buffer()
678 if (stream->readbuflen - stream->writepos < stream->chunk_size) { in _php_stream_fill_read_buffer()
679 stream->readbuflen += stream->chunk_size; in _php_stream_fill_read_buffer()
680 stream->readbuf = perealloc(stream->readbuf, stream->readbuflen, in _php_stream_fill_read_buffer()
681 stream->is_persistent); in _php_stream_fill_read_buffer()
684 justread = stream->ops->read(stream, (char*)stream->readbuf + stream->writepos, in _php_stream_fill_read_buffer()
685 stream->readbuflen - stream->writepos in _php_stream_fill_read_buffer()
691 stream->writepos += justread; in _php_stream_fill_read_buffer()
699 if (old_eof != stream->eof) { in _php_stream_fill_read_buffer()
701 php_stream_notify_completed(PHP_STREAM_CONTEXT(stream)); in _php_stream_fill_read_buffer()
706 PHPAPI ssize_t _php_stream_read(php_stream *stream, char *buf, size_t size) in _php_stream_read() argument
716 if (stream->writepos > stream->readpos) { in _php_stream_read()
718 toread = stream->writepos - stream->readpos; in _php_stream_read()
723 memcpy(buf, stream->readbuf + stream->readpos, toread); in _php_stream_read()
724 stream->readpos += toread; in _php_stream_read()
728 stream->has_buffered_data = 1; in _php_stream_read()
736 …if (!stream->readfilters.head && ((stream->flags & PHP_STREAM_FLAG_NO_BUFFER) || stream->chunk_siz… in _php_stream_read()
737 toread = stream->ops->read(stream, buf, size); in _php_stream_read()
747 if (php_stream_fill_read_buffer(stream, size) != SUCCESS) { in _php_stream_read()
754 toread = stream->writepos - stream->readpos; in _php_stream_read()
760 memcpy(buf, stream->readbuf + stream->readpos, toread); in _php_stream_read()
761 stream->readpos += toread; in _php_stream_read()
768 stream->has_buffered_data = 1; in _php_stream_read()
775 if ((stream->wrapper != &php_plain_files_wrapper) && in _php_stream_read()
776 (stream->ops != &php_stream_memory_ops) && in _php_stream_read()
777 (stream->ops != &php_stream_temp_ops)) { in _php_stream_read()
783 stream->position += didread; in _php_stream_read()
784 stream->has_buffered_data = 0; in _php_stream_read()
792 PHPAPI zend_string *php_stream_read_to_str(php_stream *stream, size_t len) in php_stream_read_to_str() argument
795 ssize_t read = php_stream_read(stream, ZSTR_VAL(str), len); in php_stream_read_to_str()
810 PHPAPI bool _php_stream_eof(php_stream *stream) in _php_stream_eof() argument
813 if (stream->writepos - stream->readpos > 0) { in _php_stream_eof()
818 if (!stream->eof && PHP_STREAM_OPTION_RETURN_ERR == in _php_stream_eof()
819 php_stream_set_option(stream, PHP_STREAM_OPTION_CHECK_LIVENESS, in _php_stream_eof()
821 stream->eof = 1; in _php_stream_eof()
824 return stream->eof; in _php_stream_eof()
827 PHPAPI int _php_stream_putc(php_stream *stream, int c) in _php_stream_putc() argument
831 if (php_stream_write(stream, (char*)&buf, 1) > 0) { in _php_stream_putc()
837 PHPAPI int _php_stream_getc(php_stream *stream) in _php_stream_getc() argument
841 if (php_stream_read(stream, &buf, 1) > 0) { in _php_stream_getc()
847 PHPAPI bool _php_stream_puts(php_stream *stream, const char *buf) in _php_stream_puts() argument
853 …if (len > 0 && php_stream_write(stream, buf, len) > 0 && php_stream_write(stream, newline, 1) > 0)… in _php_stream_puts()
859 PHPAPI int _php_stream_stat(php_stream *stream, php_stream_statbuf *ssb) in _php_stream_stat() argument
864 if (stream->wrapper && stream->wrapper->wops->stream_stat != NULL) { in _php_stream_stat()
865 return stream->wrapper->wops->stream_stat(stream->wrapper, stream, ssb); in _php_stream_stat()
872 if (stream->ops->stat == NULL) { in _php_stream_stat()
876 return (stream->ops->stat)(stream, ssb); in _php_stream_stat()
879 PHPAPI const char *php_stream_locate_eol(php_stream *stream, zend_string *buf) in php_stream_locate_eol() argument
886 readptr = (char*)stream->readbuf + stream->readpos; in php_stream_locate_eol()
887 avail = stream->writepos - stream->readpos; in php_stream_locate_eol()
894 if (stream->flags & PHP_STREAM_FLAG_DETECT_EOL) { in php_stream_locate_eol()
900 stream->flags ^= PHP_STREAM_FLAG_DETECT_EOL; in php_stream_locate_eol()
901 stream->flags |= PHP_STREAM_FLAG_EOL_MAC; in php_stream_locate_eol()
905 stream->flags ^= PHP_STREAM_FLAG_DETECT_EOL; in php_stream_locate_eol()
908 } else if (stream->flags & PHP_STREAM_FLAG_EOL_MAC) { in php_stream_locate_eol()
921 PHPAPI char *_php_stream_get_line(php_stream *stream, char *buf, size_t maxlen, in _php_stream_get_line() argument
950 avail = stream->writepos - stream->readpos; in _php_stream_get_line()
958 readptr = (char*)stream->readbuf + stream->readpos; in _php_stream_get_line()
959 eol = php_stream_locate_eol(stream, NULL); in _php_stream_get_line()
988 stream->position += cpysz; in _php_stream_get_line()
989 stream->readpos += cpysz; in _php_stream_get_line()
997 } else if (stream->eof) { in _php_stream_get_line()
1004 toread = stream->chunk_size; in _php_stream_get_line()
1007 if (toread > stream->chunk_size) { in _php_stream_get_line()
1008 toread = stream->chunk_size; in _php_stream_get_line()
1012 php_stream_fill_read_buffer(stream, toread); in _php_stream_get_line()
1014 if (stream->writepos - stream->readpos == 0) { in _php_stream_get_line()
1035 #define STREAM_BUFFERED_AMOUNT(stream) \ argument
1036 ((size_t)(((stream)->writepos) - (stream)->readpos))
1038 static const char *_php_stream_search_delim(php_stream *stream, in _php_stream_search_delim() argument
1047 seek_len = MIN(STREAM_BUFFERED_AMOUNT(stream), maxlen); in _php_stream_search_delim()
1053 return memchr(&stream->readbuf[stream->readpos + skiplen], in _php_stream_search_delim()
1056 return php_memnstr((char*)&stream->readbuf[stream->readpos + skiplen], in _php_stream_search_delim()
1058 (char*)&stream->readbuf[stream->readpos + seek_len]); in _php_stream_search_delim()
1062 PHPAPI zend_string *php_stream_get_record(php_stream *stream, size_t maxlen, const char *delim, siz… in php_stream_get_record() argument
1076 stream, maxlen, 0, delim, delim_len); in php_stream_get_record()
1079 buffered_len = STREAM_BUFFERED_AMOUNT(stream); in php_stream_get_record()
1085 to_read_now = MIN(maxlen - buffered_len, stream->chunk_size); in php_stream_get_record()
1087 php_stream_fill_read_buffer(stream, buffered_len + to_read_now); in php_stream_get_record()
1089 just_read = STREAM_BUFFERED_AMOUNT(stream) - buffered_len; in php_stream_get_record()
1105 stream, maxlen, in php_stream_get_record()
1118 tent_ret_len = found_delim - (char*)&stream->readbuf[stream->readpos]; in php_stream_get_record()
1119 } else if (!has_delim && STREAM_BUFFERED_AMOUNT(stream) >= maxlen) { in php_stream_get_record()
1126 if (STREAM_BUFFERED_AMOUNT(stream) < maxlen && !stream->eof) { in php_stream_get_record()
1128 } else if (STREAM_BUFFERED_AMOUNT(stream) == 0 && stream->eof) { in php_stream_get_record()
1133 tent_ret_len = MIN(STREAM_BUFFERED_AMOUNT(stream), maxlen); in php_stream_get_record()
1140 ZSTR_LEN(ret_buf) = php_stream_read(stream, ZSTR_VAL(ret_buf), tent_ret_len); in php_stream_get_record()
1143 stream->readpos += delim_len; in php_stream_get_record()
1144 stream->position += delim_len; in php_stream_get_record()
1151 static ssize_t _php_stream_write_buffer(php_stream *stream, const char *buf, size_t count) in _php_stream_write_buffer() argument
1159 …if (stream->ops->seek && (stream->flags & PHP_STREAM_FLAG_NO_SEEK) == 0 && stream->readpos != stre… in _php_stream_write_buffer()
1160 stream->readpos = stream->writepos = 0; in _php_stream_write_buffer()
1162 stream->ops->seek(stream, stream->position, SEEK_SET, &stream->position); in _php_stream_write_buffer()
1165 bool old_eof = stream->eof; in _php_stream_write_buffer()
1169 if (php_stream_is(stream, PHP_STREAM_IS_USERSPACE)) { in _php_stream_write_buffer()
1171 chunk_size = stream->chunk_size; in _php_stream_write_buffer()
1175 ssize_t justwrote = stream->ops->write(stream, buf, MIN(chunk_size, count)); in _php_stream_write_buffer()
1190 stream->position += justwrote; in _php_stream_write_buffer()
1196 if (old_eof != stream->eof) { in _php_stream_write_buffer()
1197 php_stream_notify_completed(PHP_STREAM_CONTEXT(stream)); in _php_stream_write_buffer()
1207 static ssize_t _php_stream_write_filtered(php_stream *stream, const char *buf, size_t count, int fl… in _php_stream_write_filtered() argument
1217 bucket = php_stream_bucket_new(stream, (char *)buf, count, 0, 0); in _php_stream_write_filtered()
1221 for (filter = stream->writefilters.head; filter; filter = filter->next) { in _php_stream_write_filtered()
1224 status = filter->fops->filter(stream, filter, brig_inp, brig_outp, in _php_stream_write_filtered()
1225 filter == stream->writefilters.head ? &consumed : NULL, flags); in _php_stream_write_filtered()
1245 if (_php_stream_write_buffer(stream, bucket->buf, bucket->buflen) < 0) { in _php_stream_write_filtered()
1271 PHPAPI int _php_stream_flush(php_stream *stream, int closing) in _php_stream_flush() argument
1275 if (stream->writefilters.head) { in _php_stream_flush()
1276 …_php_stream_write_filtered(stream, NULL, 0, closing ? PSFS_FLAG_FLUSH_CLOSE : PSFS_FLAG_FLUSH_INC … in _php_stream_flush()
1279 stream->flags &= ~PHP_STREAM_FLAG_WAS_WRITTEN; in _php_stream_flush()
1281 if (stream->ops->flush) { in _php_stream_flush()
1282 ret = stream->ops->flush(stream); in _php_stream_flush()
1288 PHPAPI ssize_t _php_stream_write(php_stream *stream, const char *buf, size_t count) in _php_stream_write() argument
1297 if (stream->ops->write == NULL) { in _php_stream_write()
1302 if (stream->writefilters.head) { in _php_stream_write()
1303 bytes = _php_stream_write_filtered(stream, buf, count, PSFS_FLAG_NORMAL); in _php_stream_write()
1305 bytes = _php_stream_write_buffer(stream, buf, count); in _php_stream_write()
1309 stream->flags |= PHP_STREAM_FLAG_WAS_WRITTEN; in _php_stream_write()
1315 PHPAPI ssize_t _php_stream_printf(php_stream *stream, const char *fmt, ...) in _php_stream_printf() argument
1329 count = php_stream_write(stream, buf, count); in _php_stream_printf()
1335 PHPAPI zend_off_t _php_stream_tell(php_stream *stream) in _php_stream_tell() argument
1337 return stream->position; in _php_stream_tell()
1340 PHPAPI int _php_stream_seek(php_stream *stream, zend_off_t offset, int whence) in _php_stream_seek() argument
1342 if (stream->fclose_stdiocast == PHP_STREAM_FCLOSE_FOPENCOOKIE) { in _php_stream_seek()
1344 if (!stream->fclose_stdiocast_flush_in_progress) { in _php_stream_seek()
1345 stream->fclose_stdiocast_flush_in_progress = 1; in _php_stream_seek()
1347 fflush(stream->stdiocast); in _php_stream_seek()
1348 stream->fclose_stdiocast_flush_in_progress = 0; in _php_stream_seek()
1353 if ((stream->flags & PHP_STREAM_FLAG_NO_BUFFER) == 0) { in _php_stream_seek()
1356 if (offset > 0 && offset <= stream->writepos - stream->readpos) { in _php_stream_seek()
1357 stream->readpos += offset; /* if offset = ..., then readpos = writepos */ in _php_stream_seek()
1358 stream->position += offset; in _php_stream_seek()
1359 stream->eof = 0; in _php_stream_seek()
1364 if (offset > stream->position && in _php_stream_seek()
1365 offset <= stream->position + stream->writepos - stream->readpos) { in _php_stream_seek()
1366 stream->readpos += offset - stream->position; in _php_stream_seek()
1367 stream->position = offset; in _php_stream_seek()
1368 stream->eof = 0; in _php_stream_seek()
1376 if (stream->ops->seek && (stream->flags & PHP_STREAM_FLAG_NO_SEEK) == 0) { in _php_stream_seek()
1379 if (stream->writefilters.head) { in _php_stream_seek()
1380 _php_stream_flush(stream, 0); in _php_stream_seek()
1385 ZEND_ASSERT(stream->position >= 0); in _php_stream_seek()
1386 if (UNEXPECTED(offset > ZEND_LONG_MAX - stream->position)) { in _php_stream_seek()
1389 offset = stream->position + offset; in _php_stream_seek()
1394 ret = stream->ops->seek(stream, offset, whence, &stream->position); in _php_stream_seek()
1396 if (((stream->flags & PHP_STREAM_FLAG_NO_SEEK) == 0) || ret == 0) { in _php_stream_seek()
1398 stream->eof = 0; in _php_stream_seek()
1402 stream->readpos = stream->writepos = 0; in _php_stream_seek()
1415 if ((didread = php_stream_read(stream, tmp, MIN(offset, sizeof(tmp)))) <= 0) { in _php_stream_seek()
1420 stream->eof = 0; in _php_stream_seek()
1429 PHPAPI int _php_stream_set_option(php_stream *stream, int option, int value, void *ptrparam) in _php_stream_set_option() argument
1433 if (stream->ops->set_option) { in _php_stream_set_option()
1434 ret = stream->ops->set_option(stream, option, value, ptrparam); in _php_stream_set_option()
1441 ret = stream->chunk_size > INT_MAX ? INT_MAX : (int)stream->chunk_size; in _php_stream_set_option()
1442 stream->chunk_size = value; in _php_stream_set_option()
1448 stream->flags |= PHP_STREAM_FLAG_NO_BUFFER; in _php_stream_set_option()
1449 } else if (stream->flags & PHP_STREAM_FLAG_NO_BUFFER) { in _php_stream_set_option()
1450 stream->flags ^= PHP_STREAM_FLAG_NO_BUFFER; in _php_stream_set_option()
1463 PHPAPI int _php_stream_sync(php_stream *stream, bool data_only) in _php_stream_sync() argument
1469 return php_stream_set_option(stream, PHP_STREAM_OPTION_SYNC_API, op, NULL); in _php_stream_sync()
1472 PHPAPI int _php_stream_truncate_set_size(php_stream *stream, size_t newsize) in _php_stream_truncate_set_size() argument
1474 …return php_stream_set_option(stream, PHP_STREAM_OPTION_TRUNCATE_API, PHP_STREAM_TRUNCATE_SET_SIZE,… in _php_stream_truncate_set_size()
1477 PHPAPI ssize_t _php_stream_passthru(php_stream * stream STREAMS_DC) in _php_stream_passthru()
1483 if (php_stream_mmap_possible(stream)) { in _php_stream_passthru()
1487 …p = php_stream_mmap_range(stream, php_stream_tell(stream), PHP_STREAM_MMAP_ALL, PHP_STREAM_MAP_MOD… in _php_stream_passthru()
1497 php_stream_mmap_unmap_ex(stream, mapped); in _php_stream_passthru()
1503 while ((b = php_stream_read(stream, buf, sizeof(buf))) > 0) { in _php_stream_passthru()
1823 php_stream *stream = (php_stream*)rsrc->ptr; in stream_resource_regular_dtor() local
1825 FG(pclose_ret) = php_stream_free(stream, PHP_STREAM_FREE_CLOSE | PHP_STREAM_FREE_RSRC_DTOR); in stream_resource_regular_dtor()
1830 php_stream *stream = (php_stream*)rsrc->ptr; in stream_resource_persistent_dtor() local
1831 FG(pclose_ret) = php_stream_free(stream, PHP_STREAM_FREE_CLOSE | PHP_STREAM_FREE_RSRC_DTOR); in stream_resource_persistent_dtor()
2137 php_stream *stream = NULL; local
2150 stream = wrapper->wops->dir_opener(wrapper,
2154 if (stream) {
2155 stream->wrapper = wrapper;
2156 stream->flags |= PHP_STREAM_FLAG_NO_BUFFER | PHP_STREAM_FLAG_IS_DIR;
2161 if (stream == NULL && (options & REPORT_ERRORS)) {
2166 return stream;
2186 php_stream *stream = NULL; local
2242 stream = wrapper->wops->stream_opener(wrapper,
2249 if (stream && (options & STREAM_OPEN_PERSISTENT) && !stream->is_persistent) {
2252 php_stream_close(stream);
2253 stream = NULL;
2256 if (stream) {
2257 stream->wrapper = wrapper;
2261 if (stream) {
2266 if (stream->orig_path) {
2267 pefree(stream->orig_path, persistent);
2270 stream->orig_path = copy_of_path;
2272 stream->open_filename = __zend_orig_filename ? __zend_orig_filename : __zend_filename;
2273 stream->open_lineno = __zend_orig_lineno ? __zend_orig_lineno : __zend_lineno;
2277 if (stream != NULL && (options & STREAM_MUST_SEEK)) {
2280 switch(php_stream_make_seekable_rel(stream, &newstream,
2287 return stream;
2298 php_stream_close(stream);
2299 stream = NULL;
2312 …if (stream && stream->ops->seek && (stream->flags & PHP_STREAM_FLAG_NO_SEEK) == 0 && strchr(mode, …
2316 if (0 == stream->ops->seek(stream, 0, SEEK_CUR, &newpos)) {
2317 stream->position = newpos;
2321 if (stream == NULL && (options & REPORT_ERRORS)) {
2330 if (stream == NULL && copy_of_path != NULL) {
2337 return stream;
2342 PHPAPI php_stream_context *php_stream_context_set(php_stream *stream, php_stream_context *context) argument
2344 php_stream_context *oldcontext = PHP_STREAM_CONTEXT(stream);
2347 stream->ctx = context->res;
2350 stream->ctx = NULL;
2451 php_stream *stream; local
2461 stream = php_stream_opendir(dirname, REPORT_ERRORS, context);
2462 if (!stream) {
2466 while (php_stream_readdir(stream, &sdp)) {
2473 php_stream_closedir(stream);
2487 php_stream_closedir(stream);
2492 php_stream_closedir(stream);