Module Name: src
Committed By: christos
Date: Tue Jan 22 19:28:01 UTC 2013
Modified Files:
src/bin/csh: alloc.c csh.1 extern.h init.c
Log Message:
Remove alloc builtin, it did not work anyway since most modern malloc
implementation use a combination of sbrk/mmap.
To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/bin/csh/alloc.c
cvs rdiff -u -r1.50 -r1.51 src/bin/csh/csh.1
cvs rdiff -u -r1.25 -r1.26 src/bin/csh/extern.h
cvs rdiff -u -r1.10 -r1.11 src/bin/csh/init.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/bin/csh/alloc.c
diff -u src/bin/csh/alloc.c:1.12 src/bin/csh/alloc.c:1.13
--- src/bin/csh/alloc.c:1.12 Thu Aug 7 05:05:03 2003
+++ src/bin/csh/alloc.c Tue Jan 22 14:28:00 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: alloc.c,v 1.12 2003/08/07 09:05:03 agc Exp $ */
+/* $NetBSD: alloc.c,v 1.13 2013/01/22 19:28:00 christos Exp $ */
/*-
* Copyright (c) 1983, 1991, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)alloc.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: alloc.c,v 1.12 2003/08/07 09:05:03 agc Exp $");
+__RCSID("$NetBSD: alloc.c,v 1.13 2013/01/22 19:28:00 christos Exp $");
#endif
#endif /* not lint */
@@ -47,16 +47,11 @@ __RCSID("$NetBSD: alloc.c,v 1.12 2003/08
#include "csh.h"
#include "extern.h"
-char *memtop = NULL; /* PWP: top of current memory */
-char *membot = NULL; /* PWP: bottom of allocatable memory */
-
ptr_t
Malloc(size_t n)
{
ptr_t ptr;
- if (membot == NULL)
- memtop = membot = sbrk(0);
if ((ptr = malloc(n)) == (ptr_t) 0) {
child++;
stderror(ERR_NOMEM);
@@ -69,8 +64,6 @@ Realloc(ptr_t p, size_t n)
{
ptr_t ptr;
- if (membot == NULL)
- memtop = membot = sbrk(0);
if ((ptr = realloc(p, n)) == (ptr_t) 0) {
child++;
stderror(ERR_NOMEM);
@@ -83,8 +76,6 @@ Calloc(size_t s, size_t n)
{
ptr_t ptr;
- if (membot == NULL)
- memtop = membot = sbrk(0);
if ((ptr = calloc(s, n)) == (ptr_t) 0) {
child++;
stderror(ERR_NOMEM);
@@ -98,20 +89,3 @@ Free(ptr_t p)
if (p)
free(p);
}
-
-/*
- * mstats - print out statistics about malloc
- *
- * Prints two lines of numbers, one showing the length of the free list
- * for each size category, the second showing the number of mallocs -
- * frees for each size category.
- */
-void
-/*ARGSUSED*/
-showall(Char **v, struct command *t)
-{
- memtop = (char *)sbrk(0);
- (void)fprintf(cshout, "Allocated memory from 0x%lx to 0x%lx (%ld).\n",
- (unsigned long)membot, (unsigned long)memtop,
- (unsigned long)(memtop - membot));
-}
Index: src/bin/csh/csh.1
diff -u src/bin/csh/csh.1:1.50 src/bin/csh/csh.1:1.51
--- src/bin/csh/csh.1:1.50 Thu Mar 22 03:58:16 2012
+++ src/bin/csh/csh.1 Tue Jan 22 14:28:00 2013
@@ -1,4 +1,4 @@
-.\" $NetBSD: csh.1,v 1.50 2012/03/22 07:58:16 wiz Exp $
+.\" $NetBSD: csh.1,v 1.51 2013/01/22 19:28:00 christos Exp $
.\"
.\" Copyright (c) 1980, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -1095,15 +1095,6 @@ is not allowed to be
or
.Ar unalias .
.Pp
-.It Ic alloc
-Shows the amount of dynamic memory acquired, broken down into used and
-free memory.
-With an argument shows the number of free and used blocks in each size
-category.
-The categories start at size 8 and double at each step.
-This command's output may vary across system types, since
-systems other than the VAX may use a different memory allocator.
-.Pp
.It Ic bg
.It Ic bg \&% Ns Ar job ...
Puts the current or specified jobs into the background, continuing them
Index: src/bin/csh/extern.h
diff -u src/bin/csh/extern.h:1.25 src/bin/csh/extern.h:1.26
--- src/bin/csh/extern.h:1.25 Thu Dec 27 16:19:20 2012
+++ src/bin/csh/extern.h Tue Jan 22 14:28:00 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.h,v 1.25 2012/12/27 21:19:20 christos Exp $ */
+/* $NetBSD: extern.h,v 1.26 2013/01/22 19:28:00 christos Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -301,7 +301,6 @@ void Free(ptr_t);
ptr_t Malloc(size_t);
ptr_t Realloc(ptr_t, size_t);
ptr_t Calloc(size_t, size_t);
-void showall(Char **, struct command *);
/*
* str.c:
Index: src/bin/csh/init.c
diff -u src/bin/csh/init.c:1.10 src/bin/csh/init.c:1.11
--- src/bin/csh/init.c:1.10 Thu Aug 7 05:05:06 2003
+++ src/bin/csh/init.c Tue Jan 22 14:28:00 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: init.c,v 1.10 2003/08/07 09:05:06 agc Exp $ */
+/* $NetBSD: init.c,v 1.11 2013/01/22 19:28:00 christos Exp $ */
/*-
* Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)init.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: init.c,v 1.10 2003/08/07 09:05:06 agc Exp $");
+__RCSID("$NetBSD: init.c,v 1.11 2013/01/22 19:28:00 christos Exp $");
#endif
#endif /* not lint */
@@ -49,7 +49,6 @@ struct biltins bfunc[] =
{
{ "@", dolet, 0, INF },
{ "alias", doalias, 0, INF },
- { "alloc", showall, 0, 1 },
{ "bg", dobg, 0, INF },
{ "break", dobreak, 0, 0 },
{ "breaksw", doswbrk, 0, 0 },