Lines Matching refs:fd
60 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()
157 if (data->fd < 0 || !data->lastkey || strcmp(key, data->lastkey)) { in ps_files_open()
178 data->fd = VCWD_OPEN_MODE(buf, O_CREAT | O_RDWR | O_BINARY | O_NOFOLLOW, data->filemode); in ps_files_open()
185 data->fd = VCWD_OPEN_MODE(buf, O_CREAT | O_RDWR | O_BINARY, data->filemode); in ps_files_open()
188 if (data->fd != -1) { in ps_files_open()
192 …if (fstat(data->fd, &sbuf) || (sbuf.st_uid != 0 && sbuf.st_uid != getuid() && sbuf.st_uid != geteu… in ps_files_open()
193 close(data->fd); in ps_files_open()
194 data->fd = -1; in ps_files_open()
198 flock(data->fd, LOCK_EX); in ps_files_open()
204 if (fcntl(data->fd, F_SETFD, FD_CLOEXEC)) { in ps_files_open()
205 …MLS_CC, E_WARNING, "fcntl(%d, F_SETFD, FD_CLOEXEC) failed: %s (%d)", data->fd, strerror(errno), er… in ps_files_open()
319 data->fd = -1; in PS_OPEN_FUNC()
357 if (data->fd < 0) { in PS_READ_FUNC()
361 if (fstat(data->fd, &sbuf)) { in PS_READ_FUNC()
375 n = pread(data->fd, *val, sbuf.st_size, 0); in PS_READ_FUNC()
377 lseek(data->fd, 0, SEEK_SET); in PS_READ_FUNC()
378 n = read(data->fd, *val, sbuf.st_size); in PS_READ_FUNC()
400 if (data->fd < 0) { in PS_WRITE_FUNC()
407 php_ignore_value(ftruncate(data->fd, 0)); in PS_WRITE_FUNC()
411 n = pwrite(data->fd, val, vallen, 0); in PS_WRITE_FUNC()
413 lseek(data->fd, 0, SEEK_SET); in PS_WRITE_FUNC()
414 n = write(data->fd, val, vallen); in PS_WRITE_FUNC()
438 if (data->fd != -1) { in PS_DESTROY_FUNC()