diff options
author | ed <ed@FreeBSD.org> | 2015-07-15 11:27:34 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2015-07-15 11:27:34 +0000 |
commit | 5452c70d20e68db6d162603729cc25986d19a99b (patch) | |
tree | 6c88dfe76f5edda22c442100bb7eef126656ec77 | |
parent | 8f7472a7ae17efc57162c187db10198c236606e1 (diff) | |
download | FreeBSD-src-5452c70d20e68db6d162603729cc25986d19a99b.zip FreeBSD-src-5452c70d20e68db6d162603729cc25986d19a99b.tar.gz |
Implement the trivial socket system calls: shutdown() and listen().
-rw-r--r-- | sys/compat/cloudabi/cloudabi_sock.c | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/sys/compat/cloudabi/cloudabi_sock.c b/sys/compat/cloudabi/cloudabi_sock.c index a332374..38aa4fe 100644 --- a/sys/compat/cloudabi/cloudabi_sock.c +++ b/sys/compat/cloudabi/cloudabi_sock.c @@ -26,7 +26,11 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); +#include <sys/socket.h> +#include <sys/sysproto.h> + #include <compat/cloudabi/cloudabi_proto.h> +#include <compat/cloudabi/cloudabi_syscalldefs.h> int cloudabi_sys_sock_accept(struct thread *td, @@ -59,18 +63,37 @@ int cloudabi_sys_sock_listen(struct thread *td, struct cloudabi_sys_sock_listen_args *uap) { + struct listen_args listen_args = { + .s = uap->s, + .backlog = uap->backlog, + }; - /* Not implemented. */ - return (ENOSYS); + return (sys_listen(td, &listen_args)); } int cloudabi_sys_sock_shutdown(struct thread *td, struct cloudabi_sys_sock_shutdown_args *uap) { + struct shutdown_args shutdown_args = { + .s = uap->fd, + }; - /* Not implemented. */ - return (ENOSYS); + switch (uap->how) { + case CLOUDABI_SHUT_RD: + shutdown_args.how = SHUT_RD; + break; + case CLOUDABI_SHUT_WR: + shutdown_args.how = SHUT_WR; + break; + case CLOUDABI_SHUT_RD | CLOUDABI_SHUT_WR: + shutdown_args.how = SHUT_RDWR; + break; + default: + return (EINVAL); + } + + return (sys_shutdown(td, &shutdown_args)); } int |