Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/bin/csh Remove alloc builtin, it did not work anyway since m...



details:   https://anonhg.NetBSD.org/src/rev/458645534011
branches:  trunk
changeset: 784229:458645534011
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Jan 22 19:28:00 2013 +0000

description:
Remove alloc builtin, it did not work anyway since most modern malloc
implementation use a combination of sbrk/mmap.

diffstat:

 bin/csh/alloc.c  |  30 ++----------------------------
 bin/csh/csh.1    |  11 +----------
 bin/csh/extern.h |   3 +--
 bin/csh/init.c   |   5 ++---
 4 files changed, 6 insertions(+), 43 deletions(-)

diffs (142 lines):

diff -r 682e44b9d17d -r 458645534011 bin/csh/alloc.c
--- a/bin/csh/alloc.c   Tue Jan 22 15:52:17 2013 +0000
+++ b/bin/csh/alloc.c   Tue Jan 22 19:28:00 2013 +0000
@@ -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 @@
 #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 @@
 {
     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 @@
 {
     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 @@
     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));
-}
diff -r 682e44b9d17d -r 458645534011 bin/csh/csh.1
--- a/bin/csh/csh.1     Tue Jan 22 15:52:17 2013 +0000
+++ b/bin/csh/csh.1     Tue Jan 22 19:28:00 2013 +0000
@@ -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 @@
 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
diff -r 682e44b9d17d -r 458645534011 bin/csh/extern.h
--- a/bin/csh/extern.h  Tue Jan 22 15:52:17 2013 +0000
+++ b/bin/csh/extern.h  Tue Jan 22 19:28:00 2013 +0000
@@ -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 @@
 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:
diff -r 682e44b9d17d -r 458645534011 bin/csh/init.c
--- a/bin/csh/init.c    Tue Jan 22 15:52:17 2013 +0000
+++ b/bin/csh/init.c    Tue Jan 22 19:28:00 2013 +0000
@@ -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 @@
 {
     { "@",             dolet,          0, INF  },
     { "alias",                 doalias,        0, INF  },
-    { "alloc",                 showall,        0, 1    },
     { "bg",            dobg,           0, INF  },
     { "break",                 dobreak,        0, 0    },
     { "breaksw",       doswbrk,        0, 0    },



Home | Main Index | Thread Index | Old Index