socsvn commit: r272671 - soc2014/dpl/netmap-ipfw/extra
dpl at FreeBSD.org
dpl at FreeBSD.org
Tue Aug 19 18:59:55 UTC 2014
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 <stdio.h> // printf
+#include <sys/malloc.h> // M_* flags
#include <sys/socket.h> // IFNAMSIZ ?
#include <string.h> // 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.
More information about the svn-soc-all
mailing list