Lines Matching refs:fd

98 	int fd;  member
143 if (data->fd != -1) { in ps_files_close()
147 flock(data->fd, LOCK_UN); in ps_files_close()
149 close(data->fd); in ps_files_close()
150 data->fd = -1; in ps_files_close()
162 if (data->fd < 0 || !data->lastkey || strcmp(key, data->lastkey)) { in ps_files_open()
184 data->fd = VCWD_OPEN_MODE(buf, O_CREAT | O_RDWR | O_BINARY | O_NOFOLLOW, data->filemode); in ps_files_open()
191 data->fd = VCWD_OPEN_MODE(buf, O_CREAT | O_RDWR | O_BINARY, data->filemode); in ps_files_open()
194 if (data->fd != -1) { in ps_files_open()
204 …if (zend_fstat(data->fd, &sbuf) || (sbuf.st_uid != 0 && sbuf.st_uid != getuid() && sbuf.st_uid != … in ps_files_open()
205 close(data->fd); in ps_files_open()
206 data->fd = -1; in ps_files_open()
212 ret = flock(data->fd, LOCK_EX); in ps_files_open()
219 if (fcntl(data->fd, F_SETFD, FD_CLOEXEC)) { in ps_files_open()
220 …php_error_docref(NULL, E_WARNING, "fcntl(%d, F_SETFD, FD_CLOEXEC) failed: %s (%d)", data->fd, stre… in ps_files_open()
237 if (data->fd < 0) { in ps_files_write()
243 php_ignore_value(ftruncate(data->fd, 0)); in ps_files_write()
247 n = pwrite(data->fd, ZSTR_VAL(val), ZSTR_LEN(val), 0); in ps_files_write()
249 lseek(data->fd, 0, SEEK_SET); in ps_files_write()
257 wrote = _write(data->fd, buf, to_write); in ps_files_write()
266 n = write(data->fd, ZSTR_VAL(val), ZSTR_LEN(val)); in ps_files_write()
419 data->fd = -1; in PS_OPEN_FUNC()
480 if (data->fd < 0) { in PS_READ_FUNC()
484 if (zend_fstat(data->fd, &sbuf)) { in PS_READ_FUNC()
498 n = pread(data->fd, ZSTR_VAL(*val), ZSTR_LEN(*val), 0); in PS_READ_FUNC()
500 lseek(data->fd, 0, SEEK_SET); in PS_READ_FUNC()
508 read_in = _read(data->fd, buf, to_read); in PS_READ_FUNC()
518 n = read(data->fd, ZSTR_VAL(*val), ZSTR_LEN(*val)); in PS_READ_FUNC()
608 if (data->fd != -1) { in PS_DESTROY_FUNC()