| 152 | } |
| 153 | |
| 154 | U32 KUnixSocketObject::internal_write(KThread* thread, const std::shared_ptr<KUnixSocketObject>& con, BOXEDWINE_CONDITION& cond, U32 buffer, U32 len) { |
| 155 | KMemory* memory = thread->memory; |
| 156 | |
| 157 | if (!memory->canRead(buffer, len)) { |
| 158 | return -K_EFAULT; |
| 159 | } |
| 160 | if (this->type == K_SOCK_DGRAM) { |
| 161 | if (!strcmp(this->destAddress.data, "/dev/log")) { |
| 162 | BString s = memory->readString(buffer); |
| 163 | printf("%s\n", s.c_str()); |
| 164 | } |
| 165 | return len; |
| 166 | } |
| 167 | if (this->outClosed || !con) { |
| 168 | return writePipeClosed(thread, false); |
| 169 | } |
| 170 | //printf("internal_write: %0.8X size=%d capacity=%d writeLen=%d", (int)&this->connection->recvBuffer, (int)this->connection->recvBuffer.size(), (int)this->connection->recvBuffer.capacity(), len); |
| 171 | |
| 172 | memory->performOnMemory(buffer, len, true, [con](U8* ram, U32 len) { |
| 173 | con->recvBuffer.put(ram, len); |
| 174 | return true; |
| 175 | }); |
| 176 | |
| 177 | return len; |
| 178 | } |
| 179 | |
| 180 | U32 KUnixSocketObject::writev(KThread* thread, U32 iov, S32 iovcnt) { |
| 181 | U32 len=0; |
no test coverage detected