Lines Matching refs:fd

47 #define php_stream_fopen_from_fd_int(fd, mode, persistent_id)	_php_stream_fopen_from_fd_int((fd), (…  argument
48 #define php_stream_fopen_from_fd_int_rel(fd, mode, persistent_id) _php_stream_fopen_from_fd_int((f… argument
114 int fd; /* underlying file descriptor */ member
138 #define PHP_STDIOP_GET_FD(anfd, data) anfd = (data)->file ? fileno((data)->file) : (data)->fd
143 int fd; in do_fstat() local
146 PHP_STDIOP_GET_FD(fd, d); in do_fstat()
147 r = fstat(fd, &d->sb); in do_fstat()
155 static php_stream *_php_stream_fopen_from_fd_int(int fd, const char *mode, const char *persistent_i… in _php_stream_fopen_from_fd_int() argument
166 self->fd = fd; in _php_stream_fopen_from_fd_int()
182 self->fd = fileno(file); in _php_stream_fopen_from_file_int()
189 int fd = php_open_temporary_fd(dir, pfx, opened_path TSRMLS_CC); in _php_stream_fopen_temporary_file() local
191 if (fd != -1) { in _php_stream_fopen_temporary_file()
192 php_stream *stream = php_stream_fopen_from_fd_int_rel(fd, "r+b", NULL); in _php_stream_fopen_temporary_file()
196 close(fd); in _php_stream_fopen_temporary_file()
208 int fd = php_open_temporary_fd(NULL, "php", &opened_path TSRMLS_CC); in _php_stream_fopen_tmpfile() local
210 if (fd != -1) { in _php_stream_fopen_tmpfile()
211 php_stream *stream = php_stream_fopen_from_fd_int_rel(fd, "r+b", NULL); in _php_stream_fopen_tmpfile()
222 close(fd); in _php_stream_fopen_tmpfile()
231 PHPAPI php_stream *_php_stream_fopen_from_fd(int fd, const char *mode, const char *persistent_id ST… in _php_stream_fopen_from_fd() argument
233 php_stream *stream = php_stream_fopen_from_fd_int_rel(fd, mode, persistent_id); in _php_stream_fopen_from_fd()
240 if (self->fd >= 0) { in _php_stream_fopen_from_fd()
245 zend_uintptr_t handle = _get_osfhandle(self->fd); in _php_stream_fopen_from_fd()
256 stream->position = lseek(self->fd, 0, SEEK_CUR); in _php_stream_fopen_from_fd()
279 if (self->fd >= 0) { in _php_stream_fopen_from_file()
284 zend_uintptr_t handle = _get_osfhandle(self->fd); in _php_stream_fopen_from_file()
313 self->fd = fileno(file); in _php_stream_fopen_from_pipe()
327 if (data->fd >= 0) { in php_stdiop_write()
328 int bytes_written = write(data->fd, buf, count); in php_stdiop_write()
351 if (data->fd >= 0) { in php_stdiop_read()
356 HANDLE ph = (HANDLE)_get_osfhandle(data->fd); in php_stdiop_read()
380 ret = read(data->fd, buf, count); in php_stdiop_read()
386 ret = read(data->fd, buf, count); in php_stdiop_read()
443 } else if (data->fd != -1) { in php_stdiop_close()
444 ret = close(data->fd); in php_stdiop_close()
445 data->fd = -1; in php_stdiop_close()
458 data->fd = -1; in php_stdiop_close()
495 if (data->fd >= 0) { in php_stdiop_seek()
498 result = lseek(data->fd, offset, whence); in php_stdiop_seek()
514 int fd; in php_stdiop_cast() local
531 data->file = fdopen(data->fd, fixed_mode); in php_stdiop_cast()
538 data->fd = -1; in php_stdiop_cast()
543 PHP_STDIOP_GET_FD(fd, data); in php_stdiop_cast()
544 if (fd < 0) { in php_stdiop_cast()
548 *(int*)ret = fd; in php_stdiop_cast()
553 PHP_STDIOP_GET_FD(fd, data); in php_stdiop_cast()
555 if (fd < 0) { in php_stdiop_cast()
562 *(int*)ret = fd; in php_stdiop_cast()
586 int fd; in php_stdiop_set_option() local
593 PHP_STDIOP_GET_FD(fd, data); in php_stdiop_set_option()
597 if (fd == -1) in php_stdiop_set_option()
600 flags = fcntl(fd, F_GETFL, 0); in php_stdiop_set_option()
607 if (-1 == fcntl(fd, F_SETFL, flags)) in php_stdiop_set_option()
641 if (fd == -1) { in php_stdiop_set_option()
649 if (!flock(fd, value)) { in php_stdiop_set_option()
665 return fd == -1 ? PHP_STREAM_OPTION_RETURN_ERR : PHP_STREAM_OPTION_RETURN_OK; in php_stdiop_set_option()
699 range->mapped = (char*)mmap(NULL, range->length, prot, flags, fd, range->offset); in php_stdiop_set_option()
722 HANDLE hfile = (HANDLE)_get_osfhandle(fd); in php_stdiop_set_option()
817 return fd == -1 ? PHP_STREAM_OPTION_RETURN_ERR : PHP_STREAM_OPTION_RETURN_OK; in php_stdiop_set_option()
824 … return ftruncate(fd, new_size) == 0 ? PHP_STREAM_OPTION_RETURN_OK : PHP_STREAM_OPTION_RETURN_ERR; in php_stdiop_set_option()
928 int fd; in _php_stream_fopen() local
967 fd = open(realpath, open_flags, 0666); in _php_stream_fopen()
969 if (fd != -1) { in _php_stream_fopen()
972 ret = php_stream_fopen_from_fd_int_rel(fd, mode, persistent_id); in _php_stream_fopen()
974 ret = php_stream_fopen_from_fd_rel(fd, mode, persistent_id); in _php_stream_fopen()
1012 close(fd); in _php_stream_fopen()