From owner-freebsd-emulation@FreeBSD.ORG Mon May 11 14:00:09 2009 Return-Path: Delivered-To: freebsd-emulation@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C20101065670 for ; Mon, 11 May 2009 14:00:09 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id AFA008FC0A for ; Mon, 11 May 2009 14:00:09 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n4BE09oM023044 for ; Mon, 11 May 2009 14:00:09 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n4BE09Av023043; Mon, 11 May 2009 14:00:09 GMT (envelope-from gnats) Date: Mon, 11 May 2009 14:00:09 GMT Message-Id: <200905111400.n4BE09Av023043@freefall.freebsd.org> To: freebsd-emulation@FreeBSD.org From: dfilter@FreeBSD.ORG (dfilter service) Cc: Subject: Re: kern/134276: commit references a PR X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: dfilter service List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 May 2009 14:00:10 -0000 The following reply was made to PR kern/134276; it has been noted by GNATS. From: dfilter@FreeBSD.ORG (dfilter service) To: bug-followup@FreeBSD.org Cc: Subject: Re: kern/134276: commit references a PR Date: Mon, 11 May 2009 13:50:53 +0000 (UTC) Author: dchagin Date: Mon May 11 13:50:42 2009 New Revision: 191989 URL: http://svn.freebsd.org/changeset/base/191989 Log: Translate l_timeval arg to native struct timeval in linux_setsockopt()/linux_getsockopt() for SO_RCVTIMEO, SO_SNDTIMEO opts as l_timeval has MD members. Remove bogus __packed attribute from l_timeval struct on __amd64__. PR: kern/134276 Submitted by: Thomas Mueller Approved by: kib (mentor) MFC after: 2 weeks Modified: head/sys/amd64/linux32/linux.h head/sys/compat/linux/linux_socket.c Modified: head/sys/amd64/linux32/linux.h ============================================================================== --- head/sys/amd64/linux32/linux.h Mon May 11 13:42:40 2009 (r191988) +++ head/sys/amd64/linux32/linux.h Mon May 11 13:50:42 2009 (r191989) @@ -96,7 +96,7 @@ typedef struct { typedef struct { l_time_t tv_sec; l_suseconds_t tv_usec; -} __packed l_timeval; +} l_timeval; #define l_fd_set fd_set Modified: head/sys/compat/linux/linux_socket.c ============================================================================== --- head/sys/compat/linux/linux_socket.c Mon May 11 13:42:40 2009 (r191988) +++ head/sys/compat/linux/linux_socket.c Mon May 11 13:50:42 2009 (r191989) @@ -1278,6 +1278,8 @@ linux_setsockopt(struct thread *td, stru caddr_t val; int valsize; } */ bsd_args; + l_timeval linux_tv; + struct timeval tv; int error, name; bsd_args.s = args->s; @@ -1285,6 +1287,23 @@ linux_setsockopt(struct thread *td, stru switch (bsd_args.level) { case SOL_SOCKET: name = linux_to_bsd_so_sockopt(args->optname); + switch (name) { + case SO_RCVTIMEO: + /* FALLTHROUGH */ + case SO_SNDTIMEO: + error = copyin(PTRIN(args->optval), &linux_tv, + sizeof(linux_tv)); + if (error) + return (error); + tv.tv_sec = linux_tv.tv_sec; + tv.tv_usec = linux_tv.tv_usec; + return (kern_setsockopt(td, args->s, bsd_args.level, + name, &tv, UIO_SYSSPACE, sizeof(tv))); + /* NOTREACHED */ + break; + default: + break; + } break; case IPPROTO_IP: name = linux_to_bsd_ip_sockopt(args->optname); @@ -1333,6 +1352,9 @@ linux_getsockopt(struct thread *td, stru caddr_t val; int *avalsize; } */ bsd_args; + l_timeval linux_tv; + struct timeval tv; + socklen_t tv_len; int error, name; bsd_args.s = args->s; @@ -1340,6 +1362,24 @@ linux_getsockopt(struct thread *td, stru switch (bsd_args.level) { case SOL_SOCKET: name = linux_to_bsd_so_sockopt(args->optname); + switch (name) { + case SO_RCVTIMEO: + /* FALLTHROUGH */ + case SO_SNDTIMEO: + tv_len = sizeof(tv); + error = kern_getsockopt(td, args->s, bsd_args.level, + name, &tv, UIO_SYSSPACE, &tv_len); + if (error) + return (error); + linux_tv.tv_sec = tv.tv_sec; + linux_tv.tv_usec = tv.tv_usec; + return (copyout(&linux_tv, PTRIN(args->optval), + sizeof(linux_tv))); + /* NOTREACHED */ + break; + default: + break; + } break; case IPPROTO_IP: name = linux_to_bsd_ip_sockopt(args->optname); _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"