| 178 | } |
| 179 | |
| 180 | U32 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 | |
| 210 | U32 KUnixSocketObject::write(KThread* thread, U32 buffer, U32 len) { |
| 211 | this->pid = thread->process->id; // kind of a hack to do this here |
nothing calls this directly
no test coverage detected