From owner-svn-src-head@FreeBSD.ORG Sun Mar 4 14:55:38 2012 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 9444C1065670; Sun, 4 Mar 2012 14:55:38 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6936E8FC18; Sun, 4 Mar 2012 14:55:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q24EtcSb039404; Sun, 4 Mar 2012 14:55:38 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q24Etcmi039402; Sun, 4 Mar 2012 14:55:38 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201203041455.q24Etcmi039402@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 4 Mar 2012 14:55:38 +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: r232494 - head/sys/kern 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: Sun, 04 Mar 2012 14:55:38 -0000 Author: kib Date: Sun Mar 4 14:55:37 2012 New Revision: 232494 URL: http://svn.freebsd.org/changeset/base/232494 Log: Instead of incomplete handling of read(2)/write(2) return values that does not fit into registers, declare that we do not support this case using CTASSERT(), and remove endianess-unsafe code to split return value into td_retval. While there, change the style of the sysctl debug.iosize_max_clamp definition. Requested by: bde MFC after: 3 weeks Modified: head/sys/kern/sys_generic.c Modified: head/sys/kern/sys_generic.c ============================================================================== --- head/sys/kern/sys_generic.c Sun Mar 4 14:51:42 2012 (r232493) +++ head/sys/kern/sys_generic.c Sun Mar 4 14:55:37 2012 (r232494) @@ -75,8 +75,14 @@ __FBSDID("$FreeBSD$"); #include int iosize_max_clamp = 1; -SYSCTL_INT(_debug, OID_AUTO, iosize_max_clamp, CTLFLAG_RW, &iosize_max_clamp, 0, - "Clamp max i/o size to INT_MAX"); +SYSCTL_INT(_debug, OID_AUTO, iosize_max_clamp, CTLFLAG_RW, + &iosize_max_clamp, 0, "Clamp max i/o size to INT_MAX"); +/* + * Assert that the return value of read(2) and write(2) syscalls fits + * into a register. If not, an architecture will need to provide the + * usermode wrappers to reconstruct the result. + */ +CTASSERT(sizeof(register_t) >= sizeof(size_t)); static MALLOC_DEFINE(M_IOCTLOPS, "ioctlops", "ioctl data buffer"); static MALLOC_DEFINE(M_SELECT, "select", "select() buffer"); @@ -338,12 +344,7 @@ dofileread(td, fd, fp, auio, offset, fla ktrgenio(fd, UIO_READ, ktruio, error); } #endif -#if SSIZE_MAX > LONG_MAX - td->td_retval[1] = cnt >> (sizeof(register_t) * CHAR_BIT); - td->td_retval[0] = cnt; -#else td->td_retval[0] = cnt; -#endif return (error); } @@ -555,12 +556,7 @@ dofilewrite(td, fd, fp, auio, offset, fl ktrgenio(fd, UIO_WRITE, ktruio, error); } #endif -#if SSIZE_MAX > LONG_MAX - td->td_retval[1] = cnt >> (sizeof(register_t) * CHAR_BIT); - td->td_retval[0] = cnt; -#else td->td_retval[0] = cnt; -#endif return (error); }