Date: Wed, 15 Jul 2015 11:27:35 +0000 (UTC) From: Ed Schouten <ed@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285598 - head/sys/compat/cloudabi Message-ID: <201507151127.t6FBRZHe022272@svnmir.geo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ed Date: Wed Jul 15 11:27:34 2015 New Revision: 285598 URL: https://svnweb.freebsd.org/changeset/base/285598 Log: Implement the trivial socket system calls: shutdown() and listen(). Modified: head/sys/compat/cloudabi/cloudabi_sock.c Modified: head/sys/compat/cloudabi/cloudabi_sock.c ============================================================================== --- head/sys/compat/cloudabi/cloudabi_sock.c Wed Jul 15 09:24:45 2015 (r285597) +++ head/sys/compat/cloudabi/cloudabi_sock.c Wed Jul 15 11:27:34 2015 (r285598) @@ -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, + }; + + 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); + } - /* Not implemented. */ - return (ENOSYS); + return (sys_shutdown(td, &shutdown_args)); } int
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201507151127.t6FBRZHe022272>