From owner-svn-src-all@freebsd.org Wed Jul 15 11:27:36 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1F4629A2614; Wed, 15 Jul 2015 11:27:36 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0BDC91298; Wed, 15 Jul 2015 11:27:36 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svnmir.geo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6FBRZ0o022273; Wed, 15 Jul 2015 11:27:35 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by svnmir.geo.freebsd.org (8.14.9/8.14.9/Submit) id t6FBRZHe022272; Wed, 15 Jul 2015 11:27:35 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201507151127.t6FBRZHe022272@svnmir.geo.freebsd.org> X-Authentication-Warning: svnmir.geo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Wed, 15 Jul 2015 11:27:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285598 - head/sys/compat/cloudabi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Jul 2015 11:27:36 -0000 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 __FBSDID("$FreeBSD$"); +#include +#include + #include +#include 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