From: Matthias Kruk Date: Wed, 2 Oct 2019 07:23:39 +0000 (+0900) Subject: Add sys_bind() syscall X-Git-Url: https://git.corax.cc/?a=commitdiff_plain;h=c9980170551ce9b81afc6168dfbc097b83a83e62;p=corax Add sys_bind() syscall --- diff --git a/include/corax/syscall.h b/include/corax/syscall.h index f0c62cd..1846df3 100644 --- a/include/corax/syscall.h +++ b/include/corax/syscall.h @@ -13,5 +13,6 @@ #define SYS_SHUTDOWN 9 #define SYS_SELECT 10 #define SYS_POLL 11 +#define SYS_BIND 12 #endif /* __CORAX_SYSCALL_H */ diff --git a/kernel/core/cxnet.c b/kernel/core/cxnet.c index b2bcd74..48104bc 100644 --- a/kernel/core/cxnet.c +++ b/kernel/core/cxnet.c @@ -75,6 +75,12 @@ int sys_poll(struct pollfd *fds, nfds_t nfds, int timeout) return(-ENOSYS); } +int sys_bind(int sockfd, const struct sockaddr *addr, + socklen_t addrlen) +{ + return(-ENOSYS); +} + int sys_cxnet(long arg0, long arg1, long arg2, long arg3, long arg4, long arg5, long arg6) { int ret_val; @@ -209,8 +215,20 @@ int sys_cxnet(long arg0, long arg1, long arg2, long arg3, long arg4, long arg5, break; + case SYS_BIND: +#if FEATURE(DEBUG_NET) + dbg_printf("sys_bind(0x%08x, %p, 0x%08x)\n", + arg1, arg2, arg3); +#endif /* FEATURE(DEBUG_NET) */ + + ret_val = sys_bind((int)arg1, (const struct sockaddr*)arg2, + (socklen_t)arg3); + + break; + default: ret_val = -ENOSYS; + break; } return(ret_val);