| 53 | } |
| 54 | |
| 55 | static orbis::ErrorCode pipe_write(orbis::File *file, orbis::Uio *uio, |
| 56 | orbis::Thread *thread) { |
| 57 | auto pipe = static_cast<orbis::Pipe *>(file)->other; |
| 58 | ORBIS_LOG_ERROR(__FUNCTION__, thread->name.c_str(), thread->tid, file); |
| 59 | |
| 60 | std::size_t cnt = 0; |
| 61 | for (auto vec : std::span(uio->iov, uio->iovcnt)) { |
| 62 | auto offset = pipe->data.size(); |
| 63 | pipe->data.resize(offset + vec.len); |
| 64 | ORBIS_RET_ON_ERROR(orbis::ureadRaw(pipe->data.data(), vec.base, vec.len)); |
| 65 | cnt += vec.len; |
| 66 | } |
| 67 | |
| 68 | pipe->event->emit(orbis::kEvFiltRead); |
| 69 | pipe->cv.notify_one(file->mtx); |
| 70 | uio->resid -= cnt; |
| 71 | uio->offset += cnt; |
| 72 | |
| 73 | ORBIS_LOG_ERROR(__FUNCTION__, thread->name.c_str(), thread->tid, file, |
| 74 | uio->resid, uio->offset, file->nextOff, cnt); |
| 75 | thread->where(); |
| 76 | return {}; |
| 77 | } |
| 78 | |
| 79 | static orbis::FileOps pipe_ops = { |
| 80 | .read = pipe_read, |