From d497956625779949447c72d0b2cb951b3fb0f22f Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 12 Jan 2016 23:19:51 +0000 Subject: [PATCH] syscall_net: Fix bugs in socket() call At this point we can actually create and close sockets. Not yet tried doing anything with them! --- Kernel/syscall_net.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/Kernel/syscall_net.c b/Kernel/syscall_net.c index 48a30022..4aac477f 100644 --- a/Kernel/syscall_net.c +++ b/Kernel/syscall_net.c @@ -56,24 +56,20 @@ int netd_sock_read(inoptr ino, uint8_t flag) /* Wait to leave a state. This will eventually need interrupt locking etc */ static int sock_wait_leave(struct socket *s, uint8_t flag, uint8_t state) { - do { + while (s->s_state == state) /* FIXME: return EINPROGRESS not EINTR for SS_CONNECTING */ if (psleep_flags(s, flag)) return -1; - /* Protocol state check */ - } while (s->s_state == state); return 0; } /* Wait to enter a state. This will eventually need interrupt locking etc */ static int sock_wait_enter(struct socket *s, uint8_t flag, uint8_t state) { - do { + while (s->s_state != state) /* FIXME: return EINPROGRESS not EINTR for SS_CONNECTING */ if (psleep_flags(s, flag)) return -1; - /* Protocol state check */ - } while (s->s_state == state); return 0; } @@ -229,8 +225,8 @@ int sock_error(struct socket *s) struct sockinfo { uint8_t af; - uint8_t pf; uint8_t type; + uint8_t pf; uint8_t priv; }; @@ -321,7 +317,8 @@ arg_t _socket(void) } s++; } - return -EAFNOSUPPORT; + udata.u_error = EAFNOSUPPORT; + return -1; } #undef af @@ -465,8 +462,9 @@ arg_t _accept(void) #undef fd /******************************************* -getsockaddrs(fd, addr) Function 95 +getsockaddrs(fd, type, addr) Function 95 int fd; +int type; struct sockaddr_*in addr; ********************************************/ #define fd (int16_t)udata.u_argn -- 2.34.1