From owner-svn-src-head@FreeBSD.ORG Fri May 30 14:30:53 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 B8BB0BE0; Fri, 30 May 2014 14:30:53 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A61C12B83; Fri, 30 May 2014 14:30:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s4UEUrRi091999; Fri, 30 May 2014 14:30:53 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s4UEUrIu091997; Fri, 30 May 2014 14:30:53 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201405301430.s4UEUrIu091997@svn.freebsd.org> From: Hans Petter Selasky Date: Fri, 30 May 2014 14:30:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r266887 - head/sys/boot/usb 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.18 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: Fri, 30 May 2014 14:30:53 -0000 Author: hselasky Date: Fri May 30 14:30:52 2014 New Revision: 266887 URL: http://svnweb.freebsd.org/changeset/base/266887 Log: Resolve issue with resolving malloc() and free() functions at linking time. Sponsored by: DARPA, AFRL Modified: head/sys/boot/usb/bsd_kernel.h head/sys/boot/usb/bsd_usbloader_test.c Modified: head/sys/boot/usb/bsd_kernel.h ============================================================================== --- head/sys/boot/usb/bsd_kernel.h Fri May 30 14:05:31 2014 (r266886) +++ head/sys/boot/usb/bsd_kernel.h Fri May 30 14:30:52 2014 (r266887) @@ -430,7 +430,6 @@ size_t strlen(const char *s); /* MALLOC API */ -#ifndef HAVE_MALLOC #undef malloc #define malloc(s,x,f) usb_malloc(s) void *usb_malloc(size_t); @@ -438,15 +437,6 @@ void *usb_malloc(size_t); #undef free #define free(p,x) usb_free(p) void usb_free(void *); -#else -#undef malloc -void *malloc(size_t); -#define malloc(s,x,f) malloc(s) - -#undef free -void free(void *); -#define free(p,x) free(p) -#endif #define strdup(p,x) usb_strdup(p) char *usb_strdup(const char *str); Modified: head/sys/boot/usb/bsd_usbloader_test.c ============================================================================== --- head/sys/boot/usb/bsd_usbloader_test.c Fri May 30 14:05:31 2014 (r266886) +++ head/sys/boot/usb/bsd_usbloader_test.c Fri May 30 14:30:52 2014 (r266887) @@ -26,6 +26,7 @@ #include #include +#include #include extern int usleep(int); @@ -36,6 +37,18 @@ extern void usb_uninit(void); #define hz 1000 +void * +usb_malloc(size_t size) +{ + return (malloc(size)); +} + +void +usb_free(void *ptr) +{ + free(ptr); +} + void DELAY(unsigned int delay) {