Lines Matching refs:fd

46 #define php_stream_fopen_from_fd_int(fd, mode, persistent_id)	_php_stream_fopen_from_fd_int((fd), (…  argument
47 #define php_stream_fopen_from_fd_int_rel(fd, mode, persistent_id) _php_stream_fopen_from_fd_int((f… argument
113 int fd; /* underlying file descriptor */ member
137 #define PHP_STDIOP_GET_FD(anfd, data) anfd = (data)->file ? fileno((data)->file) : (data)->fd
142 int fd; in do_fstat() local
145 PHP_STDIOP_GET_FD(fd, d); in do_fstat()
146 r = fstat(fd, &d->sb); in do_fstat()
154 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
165 self->fd = fd; in _php_stream_fopen_from_fd_int()
181 self->fd = fileno(file); in _php_stream_fopen_from_file_int()
188 int fd = php_open_temporary_fd(dir, pfx, opened_path TSRMLS_CC); in _php_stream_fopen_temporary_file() local
190 if (fd != -1) { in _php_stream_fopen_temporary_file()
191 php_stream *stream = php_stream_fopen_from_fd_int_rel(fd, "r+b", NULL); in _php_stream_fopen_temporary_file()
195 close(fd); in _php_stream_fopen_temporary_file()
207 int fd = php_open_temporary_fd(NULL, "php", &opened_path TSRMLS_CC); in _php_stream_fopen_tmpfile() local
209 if (fd != -1) { in _php_stream_fopen_tmpfile()
210 php_stream *stream = php_stream_fopen_from_fd_int_rel(fd, "r+b", NULL); in _php_stream_fopen_tmpfile()
221 close(fd); in _php_stream_fopen_tmpfile()
230 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
232 php_stream *stream = php_stream_fopen_from_fd_int_rel(fd, mode, persistent_id); in _php_stream_fopen_from_fd()
239 if (self->fd >= 0) { in _php_stream_fopen_from_fd()
244 zend_uintptr_t handle = _get_osfhandle(self->fd); in _php_stream_fopen_from_fd()
255 stream->position = lseek(self->fd, 0, SEEK_CUR); in _php_stream_fopen_from_fd()
278 if (self->fd >= 0) { in _php_stream_fopen_from_file()
283 zend_uintptr_t handle = _get_osfhandle(self->fd); in _php_stream_fopen_from_file()
312 self->fd = fileno(file); in _php_stream_fopen_from_pipe()
326 if (data->fd >= 0) { in php_stdiop_write()
327 int bytes_written = write(data->fd, buf, count); in php_stdiop_write()
350 if (data->fd >= 0) { in php_stdiop_read()
351 ret = read(data->fd, buf, count); in php_stdiop_read()
357 ret = read(data->fd, buf, count); in php_stdiop_read()
414 } else if (data->fd != -1) { in php_stdiop_close()
415 ret = close(data->fd); in php_stdiop_close()
416 data->fd = -1; in php_stdiop_close()
429 data->fd = -1; in php_stdiop_close()
466 if (data->fd >= 0) { in php_stdiop_seek()
469 result = lseek(data->fd, offset, whence); in php_stdiop_seek()
485 int fd; in php_stdiop_cast() local
502 data->file = fdopen(data->fd, fixed_mode); in php_stdiop_cast()
509 data->fd = -1; in php_stdiop_cast()
514 PHP_STDIOP_GET_FD(fd, data); in php_stdiop_cast()
515 if (fd < 0) { in php_stdiop_cast()
519 *(int*)ret = fd; in php_stdiop_cast()
524 PHP_STDIOP_GET_FD(fd, data); in php_stdiop_cast()
526 if (fd < 0) { in php_stdiop_cast()
533 *(int*)ret = fd; in php_stdiop_cast()
557 int fd; in php_stdiop_set_option() local
564 PHP_STDIOP_GET_FD(fd, data); in php_stdiop_set_option()
568 if (fd == -1) in php_stdiop_set_option()
571 flags = fcntl(fd, F_GETFL, 0); in php_stdiop_set_option()
578 if (-1 == fcntl(fd, F_SETFL, flags)) in php_stdiop_set_option()
612 if (fd == -1) { in php_stdiop_set_option()
620 if (!flock(fd, value)) { in php_stdiop_set_option()
636 return fd == -1 ? PHP_STREAM_OPTION_RETURN_ERR : PHP_STREAM_OPTION_RETURN_OK; in php_stdiop_set_option()
670 range->mapped = (char*)mmap(NULL, range->length, prot, flags, fd, range->offset); in php_stdiop_set_option()
693 HANDLE hfile = (HANDLE)_get_osfhandle(fd); in php_stdiop_set_option()
788 return fd == -1 ? PHP_STREAM_OPTION_RETURN_ERR : PHP_STREAM_OPTION_RETURN_OK; in php_stdiop_set_option()
795 … return ftruncate(fd, new_size) == 0 ? PHP_STREAM_OPTION_RETURN_OK : PHP_STREAM_OPTION_RETURN_ERR; in php_stdiop_set_option()
899 int fd; in _php_stream_fopen() local
938 fd = open(realpath, open_flags, 0666); in _php_stream_fopen()
940 if (fd != -1) { in _php_stream_fopen()
943 ret = php_stream_fopen_from_fd_int_rel(fd, mode, persistent_id); in _php_stream_fopen()
945 ret = php_stream_fopen_from_fd_rel(fd, mode, persistent_id); in _php_stream_fopen()
983 close(fd); in _php_stream_fopen()