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
106 int fd; /* underlying file descriptor */ member
130 #define PHP_STDIOP_GET_FD(anfd, data) anfd = (data)->file ? fileno((data)->file) : (data)->fd
135 int fd; in do_fstat() local
138 PHP_STDIOP_GET_FD(fd, d); in do_fstat()
139 r = fstat(fd, &d->sb); in do_fstat()
147 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
158 self->fd = fd; in _php_stream_fopen_from_fd_int()
174 self->fd = fileno(file); in _php_stream_fopen_from_file_int()
181 int fd = php_open_temporary_fd(dir, pfx, opened_path TSRMLS_CC); in _php_stream_fopen_temporary_file() local
183 if (fd != -1) { in _php_stream_fopen_temporary_file()
184 php_stream *stream = php_stream_fopen_from_fd_int_rel(fd, "r+b", NULL); in _php_stream_fopen_temporary_file()
188 close(fd); in _php_stream_fopen_temporary_file()
200 int fd = php_open_temporary_fd(NULL, "php", &opened_path TSRMLS_CC); in _php_stream_fopen_tmpfile() local
202 if (fd != -1) { in _php_stream_fopen_tmpfile()
203 php_stream *stream = php_stream_fopen_from_fd_int_rel(fd, "r+b", NULL); in _php_stream_fopen_tmpfile()
214 close(fd); in _php_stream_fopen_tmpfile()
223 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
225 php_stream *stream = php_stream_fopen_from_fd_int_rel(fd, mode, persistent_id); in _php_stream_fopen_from_fd()
232 if (self->fd >= 0) { in _php_stream_fopen_from_fd()
237 zend_uintptr_t handle = _get_osfhandle(self->fd); in _php_stream_fopen_from_fd()
248 stream->position = lseek(self->fd, 0, SEEK_CUR); in _php_stream_fopen_from_fd()
271 if (self->fd >= 0) { in _php_stream_fopen_from_file()
276 zend_uintptr_t handle = _get_osfhandle(self->fd); in _php_stream_fopen_from_file()
305 self->fd = fileno(file); in _php_stream_fopen_from_pipe()
319 if (data->fd >= 0) { in php_stdiop_write()
320 int bytes_written = write(data->fd, buf, count); in php_stdiop_write()
343 if (data->fd >= 0) { in php_stdiop_read()
344 ret = read(data->fd, buf, count); in php_stdiop_read()
350 ret = read(data->fd, buf, count); in php_stdiop_read()
407 } else if (data->fd != -1) { in php_stdiop_close()
408 ret = close(data->fd); in php_stdiop_close()
409 data->fd = -1; in php_stdiop_close()
422 data->fd = -1; in php_stdiop_close()
459 if (data->fd >= 0) { in php_stdiop_seek()
462 result = lseek(data->fd, offset, whence); in php_stdiop_seek()
478 int fd; in php_stdiop_cast() local
495 data->file = fdopen(data->fd, fixed_mode); in php_stdiop_cast()
502 data->fd = -1; in php_stdiop_cast()
507 PHP_STDIOP_GET_FD(fd, data); in php_stdiop_cast()
508 if (fd < 0) { in php_stdiop_cast()
512 *(int*)ret = fd; in php_stdiop_cast()
517 PHP_STDIOP_GET_FD(fd, data); in php_stdiop_cast()
519 if (fd < 0) { in php_stdiop_cast()
526 *(int*)ret = fd; in php_stdiop_cast()
550 int fd; in php_stdiop_set_option() local
557 PHP_STDIOP_GET_FD(fd, data); in php_stdiop_set_option()
561 if (fd == -1) in php_stdiop_set_option()
564 flags = fcntl(fd, F_GETFL, 0); in php_stdiop_set_option()
571 if (-1 == fcntl(fd, F_SETFL, flags)) in php_stdiop_set_option()
608 if (fd == -1) { in php_stdiop_set_option()
616 if (!flock(fd, value)) { in php_stdiop_set_option()
632 return fd == -1 ? PHP_STREAM_OPTION_RETURN_ERR : PHP_STREAM_OPTION_RETURN_OK; in php_stdiop_set_option()
666 range->mapped = (char*)mmap(NULL, range->length, prot, flags, fd, range->offset); in php_stdiop_set_option()
689 HANDLE hfile = (HANDLE)_get_osfhandle(fd); in php_stdiop_set_option()
784 return fd == -1 ? PHP_STREAM_OPTION_RETURN_ERR : PHP_STREAM_OPTION_RETURN_OK; in php_stdiop_set_option()
791 … 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()