summaryrefslogtreecommitdiffstats
path: root/lib/libstand/stand.h
diff options
context:
space:
mode:
authormsmith <msmith@FreeBSD.org>1998-09-26 01:42:40 +0000
committermsmith <msmith@FreeBSD.org>1998-09-26 01:42:40 +0000
commitea783268e73e47b0c3012339d1e278e7045e2305 (patch)
tree622472325886767e4a3905d55b5180ea188a7e99 /lib/libstand/stand.h
parent73ca5cb35b01711ebbbdbdc1d00d3f320d0a852c (diff)
downloadFreeBSD-src-ea783268e73e47b0c3012339d1e278e7045e2305.zip
FreeBSD-src-ea783268e73e47b0c3012339d1e278e7045e2305.tar.gz
Replace the old and extremely icky Mach/NetBSD allocator with a similarly
compact and much better one donated by Matt Dillon. Implement a simple sbrk() which uses the existing setheap() api. Remove the custom allocator from the UFS code. It wasn't working quite right, and it shouldn't be needed with the new allocator. Fix a serious problem with changing the value of already-existent environment variables. Don't attempt to modify the supposedly-const argument to putenv() Fix an off-by-one sizing error in the zipfs code detected by the new allocator. Submitted by: zmalloc from Matt Dillon <dillon@backplane.com>
Diffstat (limited to 'lib/libstand/stand.h')
-rw-r--r--lib/libstand/stand.h21
1 files changed, 16 insertions, 5 deletions
diff --git a/lib/libstand/stand.h b/lib/libstand/stand.h
index e575ee4..fb9ce4a 100644
--- a/lib/libstand/stand.h
+++ b/lib/libstand/stand.h
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: stand.h,v 1.3 1998/09/18 22:58:00 msmith Exp $
+ * $Id: stand.h,v 1.4 1998/09/18 23:00:57 msmith Exp $
* From $NetBSD: stand.h,v 1.22 1997/06/26 19:17:40 drochner Exp $
*/
@@ -66,6 +66,9 @@
#include <sys/cdefs.h>
#include <sys/stat.h>
+#define CHK(fmt, args...) printf("%s(%d): " fmt "\n", __FUNCTION__, __LINE__ , ##args)
+#define PCHK(fmt, args...) {printf("%s(%d): " fmt "\n", __FUNCTION__, __LINE__ , ##args); getchar();}
+
#ifndef NULL
#define NULL 0
#endif
@@ -168,10 +171,18 @@ extern struct open_file files[];
#define toupper(c) ((c) - 'a' + 'A')
#define tolower(c) ((c) - 'A' + 'a')
-extern void setheap(void *, void *);
-extern void *malloc(size_t);
-extern void free(void *);
-extern char *sbrk(int junk);
+/* sbrk emulation */
+extern void setheap(void *base, void *top);
+extern char *sbrk(int incr);
+
+/* Matt Dillon's zalloc/zmalloc */
+extern void *malloc(size_t bytes);
+extern void free(void *ptr);
+/*#define free(p) {CHK("free %p", p); free(p);} */ /* use for catching guard violations */
+extern void *calloc(size_t n1, size_t n2);
+extern void *realloc(void *ptr, size_t size);
+extern void *reallocf(void *ptr, size_t size);
+extern void mallocstats(void);
/* disklabel support (undocumented, may be junk) */
struct disklabel;
OpenPOWER on IntegriCloud