pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/shells/pdksh/files Merge assorted bugfixes to pdksh-5....
details: https://anonhg.NetBSD.org/pkgsrc/rev/d9c4a3fa60ef
branches: trunk
changeset: 543009:d9c4a3fa60ef
user: tnn <tnn%pkgsrc.org@localhost>
date: Sat May 31 16:47:36 2008 +0000
description:
Merge assorted bugfixes to pdksh-5.2.14, taken as diff between
PDKSH-5_2_14 and NetBSD-current HEAD as of 2008-05-31.
- Fixes rare segfault seen on Solaris.
- add strlcpy and strlcat fallback implementations from libnbcompat
- regenerate configure (using autoconf-2.12, ugh)
diffstat:
shells/pdksh/files/Makefile.in | 11 +-
shells/pdksh/files/alloc.c | 837 ++++-----------------------------------
shells/pdksh/files/c_ksh.c | 86 ++-
shells/pdksh/files/c_sh.c | 37 +-
shells/pdksh/files/c_test.c | 68 +-
shells/pdksh/files/c_test.h | 4 +-
shells/pdksh/files/c_ulimit.c | 19 +-
shells/pdksh/files/conf-end.h | 4 +-
shells/pdksh/files/config.h.in | 5 +
shells/pdksh/files/configure | 200 ++++----
shells/pdksh/files/configure.in | 2 +-
shells/pdksh/files/edit.c | 138 +++++-
shells/pdksh/files/edit.h | 5 +-
shells/pdksh/files/emacs-gen.sh | 1 +
shells/pdksh/files/emacs.c | 313 +++++++-------
shells/pdksh/files/eval.c | 90 +++-
shells/pdksh/files/exec.c | 196 ++++++---
shells/pdksh/files/expand.h | 6 +-
shells/pdksh/files/expr.c | 30 +-
shells/pdksh/files/history.c | 123 +++--
shells/pdksh/files/io.c | 41 +-
shells/pdksh/files/jobs.c | 136 ++---
shells/pdksh/files/ksh.Man | 494 +++++++++++++---------
shells/pdksh/files/ksh_dir.h | 4 +-
shells/pdksh/files/ksh_limval.h | 4 +-
shells/pdksh/files/ksh_stat.h | 4 +-
shells/pdksh/files/ksh_time.h | 4 +-
shells/pdksh/files/ksh_times.h | 2 +
shells/pdksh/files/ksh_wait.h | 4 +-
shells/pdksh/files/lex.c | 36 +-
shells/pdksh/files/lex.h | 11 +-
shells/pdksh/files/mail.c | 10 +-
shells/pdksh/files/main.c | 76 ++-
shells/pdksh/files/misc.c | 133 +++--
shells/pdksh/files/missing.c | 77 +++
shells/pdksh/files/mkman | 2 +-
shells/pdksh/files/path.c | 90 +--
shells/pdksh/files/proto.h | 408 +++++++++---------
shells/pdksh/files/sh.h | 40 +-
shells/pdksh/files/shf.c | 20 +-
shells/pdksh/files/shf.h | 4 +-
shells/pdksh/files/sigact.c | 14 +-
shells/pdksh/files/sigact.h | 12 +-
shells/pdksh/files/siglist.in | 1 +
shells/pdksh/files/siglist.sh | 12 +-
shells/pdksh/files/syn.c | 21 +-
shells/pdksh/files/table.c | 14 +-
shells/pdksh/files/table.h | 2 +-
shells/pdksh/files/trap.c | 53 +-
shells/pdksh/files/tree.c | 24 +-
shells/pdksh/files/tree.h | 6 +-
shells/pdksh/files/tty.c | 21 +-
shells/pdksh/files/tty.h | 4 +-
shells/pdksh/files/var.c | 92 ++-
shells/pdksh/files/version.c | 10 +-
shells/pdksh/files/vi.c | 188 +++++---
56 files changed, 2117 insertions(+), 2132 deletions(-)
diffs (truncated from 9674 to 300 lines):
diff -r f1b67f6d02a4 -r d9c4a3fa60ef shells/pdksh/files/Makefile.in
--- a/shells/pdksh/files/Makefile.in Sat May 31 15:08:01 2008 +0000
+++ b/shells/pdksh/files/Makefile.in Sat May 31 16:47:36 2008 +0000
@@ -16,7 +16,7 @@
LIBS = @LIBS@
CPPFLAGS = @CPPFLAGS@
-CFLAGS = @CFLAGS@
+CFLAGS = @CFLAGS@ "-D__RCSID(str)=void empty_nothingness()" "-D__UNCONST(a)=((void *)(unsigned long)(const void *)(a))"
LDSTATIC = @LDSTATIC@
LDFLAGS = @LDFLAGS@
@@ -70,7 +70,14 @@
os2/emacs.out os2/kshrc.ksh os2/make.sed os2/os2.c os2/os2siglist.out \
os2/README.os2 os2/NEWS.os2 os2/os2bugs os2/th.cmd os2/config.cache
-all: $(SHELL_PROG)$(exe_suffix) $(SHELL_PROG).1
+all: check_cdefs real_all
+
+check_cdefs: .PHONY
+ if [ ! -e /usr/include/sys/cdefs.h ]; then \
+ mkdir sys && touch sys/cdefs.h; \
+ fi
+
+real_all: $(SHELL_PROG)$(exe_suffix) $(SHELL_PROG).1
# This shouldn't be first - some makes don't know about PRECIOUS and assume it
# is the default target.
diff -r f1b67f6d02a4 -r d9c4a3fa60ef shells/pdksh/files/alloc.c
--- a/shells/pdksh/files/alloc.c Sat May 31 15:08:01 2008 +0000
+++ b/shells/pdksh/files/alloc.c Sat May 31 16:47:36 2008 +0000
@@ -1,776 +1,127 @@
+/* $NetBSD: alloc.c,v 1.2 2008/05/31 16:47:36 tnn Exp $ */
+
+/*
+ * Copyright (c) 2002 Marc Espie.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OPENBSD PROJECT AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OPENBSD
+ * PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
/*
* area-based allocation built on malloc/free
*/
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: alloc.c,v 1.2 2008/05/31 16:47:36 tnn Exp $");
#include "sh.h"
-#ifdef TEST_ALLOC
-# define shellf printf
-# ifndef DEBUG_ALLOC
-# define DEBUG_ALLOC
-# endif /* DEBUG_ALLOC */
-#endif /* TEST_ALLOC */
-
-#ifdef MEM_DEBUG
-
-/*
- * Special versions of alloc routines if doing mem_debug
- */
-Area *
-_chmem_ainit(ap, file, line)
- Area *ap;
- const char *file;
- int line;
-{
- ap->freelist = (struct Block *) _chmem_newpool("ainit", (char *) 0, -1,
- file, line);
- if (!ap->freelist)
- aerror(ap, "ainit failed (ie, newpool)");
- return ap;
-}
-
-/* free all object in Area */
-void
-_chmem_afreeall(ap, file, line)
- Area *ap;
- const char *file;
- int line;
-{
- _chmem_delpool((Chmem_poolp) ap->freelist, 0, file, line);
- /* Kind of ugly, but it works */
- _chmem_ainit(ap, file, line);
-}
-
-/* allocate object from Area */
-void *
-_chmem_alloc(size, ap, file, line)
- size_t size;
- Area *ap;
- const char *file;
- int line;
-{
- return _chmem_mallocp((Chmem_poolp) ap->freelist, size, file, line);
-}
-
-/* change size of object -- like realloc */
-void *
-_chmem_aresize(ptr, size, ap, file, line)
- void *ptr;
- size_t size;
- Area *ap;
- const char *file;
- int line;
-{
- if (!ptr)
- /* Done as realloc(0, size) is not portable */
- return _chmem_mallocp((Chmem_poolp) ap->freelist, size,
- file, line);
- else
- return _chmem_reallocp((Chmem_poolp) ap->freelist, ptr, size,
- file, line);
-}
-
-void
-_chmem_afree(ptr, ap, file, line)
- void *ptr;
- Area *ap;
- const char *file;
- int line;
-{
- return _chmem_freep((Chmem_poolp) ap->freelist, ptr, file, line);
-}
-
-#else /* MEM_DEBUG */
-
-# if DEBUG_ALLOC
-void acheck ARGS((Area *ap));
-# define ACHECK(ap) acheck(ap)
-# else /* DEBUG_ALLOC */
-# define ACHECK(ap)
-# endif /* DEBUG_ALLOC */
-
-#define ICELLS 200 /* number of Cells in small Block */
-
-typedef union Cell Cell;
-typedef struct Block Block;
-
-/*
- * The Cells in a Block are organized as a set of objects.
- * Each object (pointed to by dp) begins with the block it is in
- * (dp-2)->block, then has a size in (dp-1)->size, which is
- * followed with "size" data Cells. Free objects are
- * linked together via dp->next.
- */
-
-#define NOBJECT_FIELDS 2 /* the block and size `fields' */
-
-union Cell {
- size_t size;
- Cell *next;
- Block *block;
- struct {int _;} junk; /* alignment */
- double djunk; /* alignment */
+struct link {
+ struct link *prev;
+ struct link *next;
};
-struct Block {
- Block *next; /* list of Blocks in Area */
- Block *prev; /* previous block in list */
- Cell *freelist; /* object free list */
- Cell *last; /* &b.cell[size] */
- Cell cell [1]; /* [size] Cells for allocation */
-};
-
-static Block aempty = {&aempty, &aempty, aempty.cell, aempty.cell};
-
-static void ablockfree ARGS((Block *bp, Area *ap));
-static void *asplit ARGS((Area *ap, Block *bp, Cell *fp, Cell *fpp, int cells));
-
-/* create empty Area */
Area *
-ainit(ap)
- register Area *ap;
+ainit(Area *ap)
{
- ap->freelist = &aempty;
- ACHECK(ap);
+ ap->freelist = NULL;
return ap;
}
-/* free all object in Area */
void
-afreeall(ap)
- register Area *ap;
+afreeall(Area *ap)
{
- register Block *bp;
- register Block *tmp;
-
- ACHECK(ap);
- bp = ap->freelist;
- if (bp != NULL && bp != &aempty) {
- do {
- tmp = bp;
- bp = bp->next;
- free((void*)tmp);
- } while (bp != ap->freelist);
- ap->freelist = &aempty;
- }
- ACHECK(ap);
-}
-
-/* allocate object from Area */
-void *
-alloc(size, ap)
- size_t size;
- register Area *ap;
-{
- int cells, acells;
- Block *bp = 0;
- Cell *fp = 0, *fpp = 0;
-
- ACHECK(ap);
- if (size <= 0)
- aerror(ap, "allocate bad size");
- cells = (unsigned)(size + sizeof(Cell) - 1) / sizeof(Cell);
-
- /* allocate at least this many cells */
- acells = cells + NOBJECT_FIELDS;
+ struct link *l, *l2;
- /*
- * Only attempt to track small objects - let malloc deal
- * with larger objects. (this way we don't have to deal with
- * coalescing memory, or with releasing it to the system)
- */
- if (cells <= ICELLS) {
- /* find free Cell large enough */
- for (bp = ap->freelist; ; bp = bp->next) {
- for (fpp = NULL, fp = bp->freelist;
- fp != bp->last; fpp = fp, fp = fp->next)
- {
- if ((fp-1)->size >= cells)
- goto Found;
- }
- /* wrapped around Block list, create new Block */
- if (bp->next == ap->freelist) {
- bp = 0;
- break;
- }
- }
- /* Not much free space left? Allocate a big object this time */
- acells += ICELLS;
+ for (l = ap->freelist; l != NULL; l = l2) {
+ l2 = l->next;
+ free(l);
}
- if (bp == 0) {
- bp = (Block*) malloc(offsetof(Block, cell[acells]));
- if (bp == NULL)
- aerror(ap, "cannot allocate");
- if (ap->freelist == &aempty) {
- ap->freelist = bp->next = bp->prev = bp;
- } else {
- bp->next = ap->freelist->next;
- ap->freelist->next->prev = bp;
- ap->freelist->next = bp;
- bp->prev = ap->freelist;
- }
- bp->last = bp->cell + acells;
- /* initial free list */
- fp = bp->freelist = bp->cell + NOBJECT_FIELDS;
- (fp-1)->size = acells - NOBJECT_FIELDS;
- (fp-2)->block = bp;
- fp->next = bp->last;
- fpp = NULL;
- }
-
- Found:
- return asplit(ap, bp, fp, fpp, cells);
-}
-
-/* Do the work of splitting an object into allocated and (possibly) unallocated
- * objects. Returns the `allocated' object.
- */
-static void *
-asplit(ap, bp, fp, fpp, cells)
Home |
Main Index |
Thread Index |
Old Index