| 117 | } |
| 118 | |
| 119 | U32 kaccept(KThread* thread, U32 socket, U32 address, U32 len, U32 flags) { |
| 120 | KFileDescriptorPtr fd = thread->process->getFileDescriptor(socket); |
| 121 | |
| 122 | if (!fd) { |
| 123 | return -K_EBADF; |
| 124 | } |
| 125 | if (IS_NOT_SOCKET(fd)) { |
| 126 | return -K_ENOTSOCK; |
| 127 | } |
| 128 | std::shared_ptr<KSocketObject> s = std::dynamic_pointer_cast<KSocketObject>(fd->kobject); |
| 129 | if (!s->listening) { |
| 130 | return -K_EINVAL; |
| 131 | } |
| 132 | return s->accept(thread, fd, address, len, flags); |
| 133 | } |
| 134 | |
| 135 | U32 kgetsockname(KThread* thread, U32 socket, U32 address, U32 plen) { |
| 136 | KFileDescriptorPtr fd = thread->process->getFileDescriptor(socket); |
no test coverage detected