From owner-svn-src-head@FreeBSD.ORG Thu Jan 16 13:45:42 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C35C71C1; Thu, 16 Jan 2014 13:45:42 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 956251E39; Thu, 16 Jan 2014 13:45:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0GDjgY9016548; Thu, 16 Jan 2014 13:45:42 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0GDjgqM016546; Thu, 16 Jan 2014 13:45:42 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201401161345.s0GDjgqM016546@svn.freebsd.org> From: Gleb Smirnoff Date: Thu, 16 Jan 2014 13:45:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260719 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Thu, 16 Jan 2014 13:45:42 -0000 Author: glebius Date: Thu Jan 16 13:45:41 2014 New Revision: 260719 URL: http://svnweb.freebsd.org/changeset/base/260719 Log: Simplify wait/nowait code, eventually killing last remnant of historical mbuf(9) allocator flag. Sponsored by: Nginx, Inc. Modified: head/sys/kern/uipc_socket.c head/sys/sys/mbuf.h Modified: head/sys/kern/uipc_socket.c ============================================================================== --- head/sys/kern/uipc_socket.c Thu Jan 16 13:44:47 2014 (r260718) +++ head/sys/kern/uipc_socket.c Thu Jan 16 13:45:41 2014 (r260719) @@ -1723,28 +1723,27 @@ dontblock: moff += len; else { if (mp != NULL) { - int copy_flag; - - if (flags & MSG_DONTWAIT) - copy_flag = M_NOWAIT; - else - copy_flag = M_WAIT; - if (copy_flag == M_WAITOK) + if (flags & MSG_DONTWAIT) { + *mp = m_copym(m, 0, len, + M_NOWAIT); + if (*mp == NULL) { + /* + * m_copym() couldn't + * allocate an mbuf. + * Adjust uio_resid back + * (it was adjusted + * down by len bytes, + * which we didn't end + * up "copying" over). + */ + uio->uio_resid += len; + break; + } + } else { SOCKBUF_UNLOCK(&so->so_rcv); - *mp = m_copym(m, 0, len, copy_flag); - if (copy_flag == M_WAITOK) + *mp = m_copym(m, 0, len, + M_WAITOK); SOCKBUF_LOCK(&so->so_rcv); - if (*mp == NULL) { - /* - * m_copym() couldn't - * allocate an mbuf. Adjust - * uio_resid back (it was - * adjusted down by len - * bytes, which we didn't end - * up "copying" over). - */ - uio->uio_resid += len; - break; } } m->m_data += len; Modified: head/sys/sys/mbuf.h ============================================================================== --- head/sys/sys/mbuf.h Thu Jan 16 13:44:47 2014 (r260718) +++ head/sys/sys/mbuf.h Thu Jan 16 13:45:41 2014 (r260719) @@ -466,14 +466,6 @@ struct mbuf { a non-initialized mbuf */ /* - * Compatibility with historic mbuf allocator. - */ -#define MBTOM(how) (how) -#define M_DONTWAIT M_NOWAIT -#define M_TRYWAIT M_WAITOK -#define M_WAIT M_WAITOK - -/* * String names of mbuf-related UMA(9) and malloc(9) types. Exposed to * !_KERNEL so that monitoring tools can look up the zones with * libmemstat(3).