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

Method internal_write

source/kernel/kunixsocket.cpp:154–178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

152}
153
154U32 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
180U32 KUnixSocketObject::writev(KThread* thread, U32 iov, S32 iovcnt) {
181 U32 len=0;

Callers 2

writevMethod · 0.95
writeMethod · 0.95

Calls 5

performOnMemoryMethod · 0.80
canReadMethod · 0.45
readStringMethod · 0.45
c_strMethod · 0.45
putMethod · 0.45

Tested by

no test coverage detected