| 75 | #define IS_NOT_SOCKET(fd) (fd->kobject->type!=KTYPE_NATIVE_SOCKET && fd->kobject->type!=KTYPE_UNIX_SOCKET) |
| 76 | |
| 77 | U32 kbind(KThread* thread, U32 socket, U32 address, U32 len) { |
| 78 | KFileDescriptorPtr fd = thread->process->getFileDescriptor(socket); |
| 79 | |
| 80 | if (!fd) { |
| 81 | return -K_EBADF; |
| 82 | } |
| 83 | if (IS_NOT_SOCKET(fd)) { |
| 84 | return -K_ENOTSOCK; |
| 85 | } |
| 86 | std::shared_ptr<KSocketObject> s = std::dynamic_pointer_cast<KSocketObject>(fd->kobject); |
| 87 | return s->bind(thread, fd, address, len); |
| 88 | } |
| 89 | |
| 90 | U32 kconnect(KThread* thread, U32 socket, U32 address, U32 len) { |
| 91 | KFileDescriptorPtr fd = thread->process->getFileDescriptor(socket); |
no test coverage detected