From owner-svn-soc-all@FreeBSD.ORG Tue Aug 19 18:59:55 2014 Return-Path: Delivered-To: svn-soc-all@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 1E064E5B for ; Tue, 19 Aug 2014 18:59:55 +0000 (UTC) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0A50233BE for ; Tue, 19 Aug 2014 18:59:55 +0000 (UTC) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7JIxs7Q032045 for ; Tue, 19 Aug 2014 18:59:54 GMT (envelope-from dpl@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.14.9/8.14.9/Submit) id s7JIxsCs032014 for svn-soc-all@FreeBSD.org; Tue, 19 Aug 2014 18:59:54 GMT (envelope-from dpl@FreeBSD.org) Date: Tue, 19 Aug 2014 18:59:54 GMT Message-Id: <201408191859.s7JIxsCs032014@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to dpl@FreeBSD.org using -f From: dpl@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r272671 - soc2014/dpl/netmap-ipfw/extra MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Aug 2014 18:59:55 -0000 Author: dpl Date: Tue Aug 19 18:59:53 2014 New Revision: 272671 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=272671 Log: Respect allocating memory initialized to zero. Modified: soc2014/dpl/netmap-ipfw/extra/missing.c soc2014/dpl/netmap-ipfw/extra/missing.h Modified: soc2014/dpl/netmap-ipfw/extra/missing.c ============================================================================== --- soc2014/dpl/netmap-ipfw/extra/missing.c Tue Aug 19 17:54:15 2014 (r272670) +++ soc2014/dpl/netmap-ipfw/extra/missing.c Tue Aug 19 18:59:53 2014 (r272671) @@ -450,8 +450,10 @@ } void * -kern_malloc(int sz) +kern_malloc(int sz, int flags) { + if (flags & M_ZERO) + return calloc(1, sz); return malloc(sz); } Modified: soc2014/dpl/netmap-ipfw/extra/missing.h ============================================================================== --- soc2014/dpl/netmap-ipfw/extra/missing.h Tue Aug 19 17:54:15 2014 (r272670) +++ soc2014/dpl/netmap-ipfw/extra/missing.h Tue Aug 19 18:59:53 2014 (r272671) @@ -54,6 +54,7 @@ #endif #include // printf +#include // M_* flags #include // IFNAMSIZ ? #include // strncmp #ifdef NEED_KERNEL @@ -70,9 +71,10 @@ #define MALLOC_DECLARE(x) /* nothing */ // XXX kernel malloc/free -extern void *kern_malloc(int); +extern void *kern_malloc(int, int); extern void kern_free(void *); -#define malloc(_size, type, flags) kern_malloc(_size) +#define malloc(_size, type, _flags) \ + kern_malloc(_size, _flags) #define free(_var, type) kern_free(_var) /* inet_ntoa_r() differs in userspace and kernel.