MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / writev

Method writev

source/kernel/kunixsocket.cpp:180–208  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

178}
179
180U32 KUnixSocketObject::writev(KThread* thread, U32 iov, S32 iovcnt) {
181 U32 len=0;
182 std::shared_ptr<KUnixSocketObject> con = this->connection.lock();
183 KMemory* memory = thread->memory;
184
185 BOXEDWINE_CONDITION& cond = (con?con->lockCond:this->lockCond);
186 BOXEDWINE_CRITICAL_SECTION_WITH_CONDITION(cond);
187
188 for (S32 i=0;i<iovcnt;i++) {
189 U32 buf = memory->readd(iov + i * 8);
190 U32 toWrite = memory->readd(iov + i * 8 + 4);
191 S32 result;
192
193 if (toWrite) {
194 result = this->internal_write(thread, con, cond, buf, toWrite);
195 if (result < 0) {
196 if (i > 0) {
197 return len;
198 }
199 return result;
200 }
201 len += result;
202 }
203 }
204 if (con) {
205 BOXEDWINE_CONDITION_SIGNAL_ALL(cond);
206 }
207 return len;
208}
209
210U32 KUnixSocketObject::write(KThread* thread, U32 buffer, U32 len) {
211 this->pid = thread->process->id; // kind of a hack to do this here

Callers

nothing calls this directly

Calls 3

internal_writeMethod · 0.95
lockMethod · 0.45
readdMethod · 0.45

Tested by

no test coverage detected