| 88 | } |
| 89 | |
| 90 | U32 kconnect(KThread* thread, U32 socket, U32 address, U32 len) { |
| 91 | KFileDescriptorPtr fd = thread->process->getFileDescriptor(socket); |
| 92 | |
| 93 | if (!fd) { |
| 94 | return -K_EBADF; |
| 95 | } |
| 96 | if (IS_NOT_SOCKET(fd)) { |
| 97 | return -K_ENOTSOCK; |
| 98 | } |
| 99 | std::shared_ptr<KSocketObject> s = std::dynamic_pointer_cast<KSocketObject>(fd->kobject); |
| 100 | if (s->connected) { |
| 101 | return -K_EISCONN; |
| 102 | } |
| 103 | return s->connect(thread, fd, address, len); |
| 104 | } |
| 105 | |
| 106 | U32 klisten(KThread* thread, U32 socket, U32 backlog) { |
| 107 | KFileDescriptorPtr fd = thread->process->getFileDescriptor(socket); |
no test coverage detected