From owner-svn-src-head@FreeBSD.ORG Mon Jun 1 20:42:28 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5082A1065675; Mon, 1 Jun 2009 20:42:28 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 249CC8FC08; Mon, 1 Jun 2009 20:42:28 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n51KgSNC091262; Mon, 1 Jun 2009 20:42:28 GMT (envelope-from dchagin@svn.freebsd.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n51KgSc5091261; Mon, 1 Jun 2009 20:42:28 GMT (envelope-from dchagin@svn.freebsd.org) Message-Id: <200906012042.n51KgSc5091261@svn.freebsd.org> From: Dmitry Chagin Date: Mon, 1 Jun 2009 20:42:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193262 - head/sys/compat/linux X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Jun 2009 20:42:28 -0000 Author: dchagin Date: Mon Jun 1 20:42:27 2009 New Revision: 193262 URL: http://svn.freebsd.org/changeset/base/193262 Log: Split linux_accept() syscall onto linux_accept_common() which should be used by linuxulator and linux_accept() itself. Approved by: kib (mentor) MFC after: 1 month Modified: head/sys/compat/linux/linux_socket.c Modified: head/sys/compat/linux/linux_socket.c ============================================================================== --- head/sys/compat/linux/linux_socket.c Mon Jun 1 20:41:33 2009 (r193261) +++ head/sys/compat/linux/linux_socket.c Mon Jun 1 20:42:27 2009 (r193262) @@ -763,14 +763,9 @@ linux_listen(struct thread *td, struct l return (listen(td, &bsd_args)); } -struct linux_accept_args { - int s; - l_uintptr_t addr; - l_uintptr_t namelen; -}; - static int -linux_accept(struct thread *td, struct linux_accept_args *args) +linux_accept_common(struct thread *td, int s, l_uintptr_t addr, + l_uintptr_t namelen) { struct accept_args /* { int s; @@ -779,19 +774,19 @@ linux_accept(struct thread *td, struct l } */ bsd_args; int error, fd; - bsd_args.s = args->s; + bsd_args.s = s; /* XXX: */ - bsd_args.name = (struct sockaddr * __restrict)PTRIN(args->addr); - bsd_args.anamelen = PTRIN(args->namelen);/* XXX */ + bsd_args.name = (struct sockaddr * __restrict)PTRIN(addr); + bsd_args.anamelen = PTRIN(namelen);/* XXX */ error = accept(td, &bsd_args); bsd_to_linux_sockaddr((struct sockaddr *)bsd_args.name); if (error) { - if (error == EFAULT && args->namelen != sizeof(struct sockaddr_in)) + if (error == EFAULT && namelen != sizeof(struct sockaddr_in)) return (EINVAL); return (error); } - if (args->addr) { - error = linux_sa_put(PTRIN(args->addr)); + if (addr) { + error = linux_sa_put(PTRIN(addr)); if (error) { (void)kern_close(td, td->td_retval[0]); return (error); @@ -809,6 +804,20 @@ linux_accept(struct thread *td, struct l return (0); } +struct linux_accept_args { + int s; + l_uintptr_t addr; + l_uintptr_t namelen; +}; + +static int +linux_accept(struct thread *td, struct linux_accept_args *args) +{ + + return (linux_accept_common(td, args->s, args->addr, + args->namelen)); +} + struct linux_getsockname_args { int s; l_uintptr_t addr;