Lines Matching refs:fd
98 int fd; member
141 if (data->fd != -1) { in ps_files_close()
145 flock(data->fd, LOCK_UN); in ps_files_close()
147 close(data->fd); in ps_files_close()
148 data->fd = -1; in ps_files_close()
160 if (data->fd < 0 || !data->last_key || !zend_string_equals(key, data->last_key)) { in ps_files_open()
182 data->fd = VCWD_OPEN_MODE(buf, O_CREAT | O_RDWR | O_BINARY | O_NOFOLLOW, data->filemode); in ps_files_open()
189 data->fd = VCWD_OPEN_MODE(buf, O_CREAT | O_RDWR | O_BINARY, data->filemode); in ps_files_open()
192 if (data->fd != -1) { in ps_files_open()
202 …if (zend_fstat(data->fd, &sbuf) || (sbuf.st_uid != 0 && sbuf.st_uid != getuid() && sbuf.st_uid != … in ps_files_open()
203 close(data->fd); in ps_files_open()
204 data->fd = -1; in ps_files_open()
210 ret = flock(data->fd, LOCK_EX); in ps_files_open()
217 if (fcntl(data->fd, F_SETFD, FD_CLOEXEC)) { in ps_files_open()
218 …php_error_docref(NULL, E_WARNING, "fcntl(%d, F_SETFD, FD_CLOEXEC) failed: %s (%d)", data->fd, stre… in ps_files_open()
235 if (data->fd < 0) { in ps_files_write()
241 php_ignore_value(ftruncate(data->fd, 0)); in ps_files_write()
245 n = pwrite(data->fd, ZSTR_VAL(val), ZSTR_LEN(val), 0); in ps_files_write()
247 lseek(data->fd, 0, SEEK_SET); in ps_files_write()
255 wrote = _write(data->fd, buf, to_write); in ps_files_write()
264 n = write(data->fd, ZSTR_VAL(val), ZSTR_LEN(val)); in ps_files_write()
414 data->fd = -1; in PS_OPEN_FUNC()
474 if (data->fd < 0) { in PS_READ_FUNC()
478 if (zend_fstat(data->fd, &sbuf)) { in PS_READ_FUNC()
492 n = pread(data->fd, ZSTR_VAL(*val), ZSTR_LEN(*val), 0); in PS_READ_FUNC()
494 lseek(data->fd, 0, SEEK_SET); in PS_READ_FUNC()
502 read_in = _read(data->fd, buf, to_read); in PS_READ_FUNC()
512 n = read(data->fd, ZSTR_VAL(*val), ZSTR_LEN(*val)); in PS_READ_FUNC()
602 if (data->fd != -1) { in PS_DESTROY_FUNC()