merge changes, add build glue.

This commit is contained in:
christos 2016-01-13 21:56:38 +00:00
parent 478e07dd80
commit 49e111a21f
14 changed files with 199 additions and 16 deletions

3
external/gpl2/libmalloc/Makefile vendored Normal file
View File

@ -0,0 +1,3 @@
# $NetBSD: Makefile,v 1.1 2016/01/13 21:56:38 christos Exp $
SUBDIR = lib
.include <bsd.subdir.mk>

3
external/gpl2/libmalloc/Makefile.inc vendored Normal file
View File

@ -0,0 +1,3 @@
# $NetBSD: Makefile.inc,v 1.1 2016/01/13 21:56:38 christos Exp $
DIST=${NETBSDSRCDIR}/external/gpl2/libmalloc/dist

View File

@ -1,4 +1,5 @@
/* $NetBSD: getpagesize.h,v 1.1.1.1 2016/01/13 21:42:18 christos Exp $ */
#include <sys/param.h>
/* $NetBSD: getpagesize.h,v 1.2 2016/01/13 21:56:38 christos Exp $ */
/* Emulate getpagesize on systems that lack it. */

View File

@ -1,4 +1,4 @@
/* $NetBSD: malloc.h,v 1.1.1.1 2016/01/13 21:42:18 christos Exp $ */
/* $NetBSD: malloc.h,v 1.2 2016/01/13 21:56:38 christos Exp $ */
/* Declarations for `malloc' and friends.
Copyright 1990, 1991, 1992, 1993, 1995 Free Software Foundation, Inc.
@ -64,8 +64,12 @@ extern "C"
#endif
#if defined (__cplusplus) || (defined (__STDC__) && __STDC__)
#ifndef __NetBSD__
#undef __P
#define __P(args) args
#else
#include <sys/cdefs.h>
#endif
#undef __ptr_t
#define __ptr_t void *
#else /* Not C++ or ANSI C. */

View File

@ -1,4 +1,4 @@
/* $NetBSD: mcheck.c,v 1.1.1.1 2016/01/13 21:42:18 christos Exp $ */
/* $NetBSD: mcheck.c,v 1.2 2016/01/13 21:56:38 christos Exp $ */
/* Standard debugging hooks for `malloc'.
Copyright 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
@ -25,6 +25,7 @@ Cambridge, MA 02139, USA.
#ifndef _MALLOC_INTERNAL
#define _MALLOC_INTERNAL
#include <malloc.h>
#include <stdlib.h>
#include <stdio.h>
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: mem-limits.h,v 1.1.1.1 2016/01/13 21:42:18 christos Exp $ */
/* $NetBSD: mem-limits.h,v 1.2 2016/01/13 21:56:38 christos Exp $ */
/* Includes for memory limit warnings.
Copyright (C) 1990, 1993, 1994 Free Software Foundation, Inc.
@ -41,7 +41,7 @@ Cambridge, MA 02139, USA. */
#include <sys/resource.h>
#endif
#ifdef __bsdi__
#if defined(__bsdi__) || defined(__NetBSD__)
#define BSD4_2
#endif
@ -173,7 +173,8 @@ get_lim_data ()
{
struct rlimit XXrlimit;
getrlimit (RLIMIT_DATA, &XXrlimit);
if (getrlimit (RLIMIT_DATA, &XXrlimit) == -1)
XXrlimit.rlim_cur = -1;
#ifdef RLIM_INFINITY
lim_data = XXrlimit.rlim_cur & RLIM_INFINITY; /* soft limit */
#else

View File

@ -1,4 +1,4 @@
/* $NetBSD: morecore.c,v 1.1.1.1 2016/01/13 21:42:18 christos Exp $ */
/* $NetBSD: morecore.c,v 1.2 2016/01/13 21:56:38 christos Exp $ */
/* Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@ -20,6 +20,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef _MALLOC_INTERNAL
#define _MALLOC_INTERNAL
#include <malloc.h>
#include <unistd.h>
#endif
#ifndef __GNU_LIBRARY__

View File

@ -1,4 +1,4 @@
/* $NetBSD: mtrace.c,v 1.1.1.1 2016/01/13 21:42:18 christos Exp $ */
/* $NetBSD: mtrace.c,v 1.2 2016/01/13 21:56:38 christos Exp $ */
/* More debugging hooks for `malloc'.
Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
@ -91,8 +91,7 @@ tr_freehook (ptr)
static __ptr_t tr_mallochook __P ((__malloc_size_t));
static __ptr_t
tr_mallochook (size)
__malloc_size_t size;
tr_mallochook (__malloc_size_t size)
{
__ptr_t hdr;
@ -112,9 +111,7 @@ tr_mallochook (size)
static __ptr_t tr_reallochook __P ((__ptr_t, __malloc_size_t));
static __ptr_t
tr_reallochook (ptr, size)
__ptr_t ptr;
__malloc_size_t size;
tr_reallochook (__ptr_t ptr, __malloc_size_t size)
{
__ptr_t hdr;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ralloc.c,v 1.1.1.1 2016/01/13 21:42:18 christos Exp $ */
/* $NetBSD: ralloc.c,v 1.2 2016/01/13 21:56:38 christos Exp $ */
/* Block-relocating memory allocator.
Copyright (C) 1993, 1995 Free Software Foundation, Inc.
@ -71,6 +71,7 @@ typedef size_t SIZE;
typedef void *POINTER;
#include <unistd.h>
#include <stdlib.h>
#include <malloc.h>
#include <string.h>
@ -1002,7 +1003,7 @@ r_alloc_init ()
#ifdef DEBUG
#include <assert.h>
int
void
r_alloc_check ()
{
int found = 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: valloc.c,v 1.1.1.1 2016/01/13 21:42:18 christos Exp $ */
/* $NetBSD: valloc.c,v 1.2 2016/01/13 21:56:38 christos Exp $ */
/* Allocate memory on a page boundary.
Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
@ -23,6 +23,7 @@ Cambridge, MA 02139, USA.
#if defined (__GNU_LIBRARY__) || defined (_LIBC)
#include <stddef.h>
#include <unistd.h>
#include <sys/cdefs.h>
extern size_t __getpagesize __P ((void));
#else

19
external/gpl2/libmalloc/lib/Makefile vendored Normal file
View File

@ -0,0 +1,19 @@
# $NetBSD: Makefile,v 1.1 2016/01/13 21:56:38 christos Exp $
NOLINT=
NOMAN= # defined
.include <bsd.init.mk>
LIB= gnumalloc
SRCS+= combined.c
#SRCS+= malloc.c free.c realloc.c
SRCS+= cfree.c calloc.c morecore.c
SRCS+= memalign.c valloc.c mcheck.c mtrace.c mstats.c vm-limit.c
SRCS+= ralloc.c
CPPFLAGS+= -I${DIST} -I${.CURDIR} -DSTDC_HEADERS -DHAVE_STDLIB_H
.PATH: ${DIST}
.include <bsd.lib.mk>

12
external/gpl2/libmalloc/lib/combined.c vendored Normal file
View File

@ -0,0 +1,12 @@
/*
* this file (combined.c) is malloc.c, free.c, and realloc.c, combined into
* one file, because the malloc.o in libc defined malloc, realloc, and free,
* and libc sometimes invokes realloc, which can greatly confuse things
* in the linking process...
*
* $Id: combined.c,v 1.1 2016/01/13 21:56:38 christos Exp $
*/
#include "malloc.c"
#include "free.c"
#include "realloc.c"

View File

@ -0,0 +1,5 @@
# $NetBSD: shlib_version,v 1.1 2016/01/13 21:56:38 christos Exp $
# Remember to update distrib/sets/lists/base/shl.* when changing
#
major=1
minor=0

134
external/gpl2/libmalloc/libmalloc2netbsd vendored Executable file
View File

@ -0,0 +1,134 @@
#! /bin/sh
#
# $NetBSD: libmalloc2netbsd,v 1.1 2016/01/13 21:56:38 christos Exp $
#
# Copyright (c) 2016 The NetBSD Foundation, Inc.
# All rights reserved.
#
# 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
#
# libmalloc2netbsd: convert an glibc source tree into a
# netbsd libmalloc source tree,
#
# Rough instructions for importing new libmalloc release:
#
# $ cd /some/where/temporary
# $ tar xpfz /malloc/release/tar/file
# $ sh /usr/src/external/gpl2/libmalloc/libmalloc2netbsd malloc `pwd`
# $ cd `pwd`/src/external/gpl2/libmalloc/dist
# $ cvs import -m "Import libmalloc YYYY-MM-DD" src/external/gpl2/libmalloc/dist FSF malloc-YYYY-MM-DD
# merge sources according to instructions given
# e.g. cvs -d cvs.netbsd.org:/cvsroot checkout -jlibmalloc-1-19 -jlibmalloc-1-19-1 src/gnu/dist/libmalloc
if [ $# -ne 2 ]; then echo "libmalloc2netbsd src dest"; exit 1; fi
r=$1
d=$2/src/external/gpl2/libmalloc/dist
case "$d" in
/*)
;;
*)
d=`/bin/pwd`/$d
;;
esac
case "$r" in
/*)
;;
*)
r=`/bin/pwd`/$r
;;
esac
echo preparing directory $d
rm -rf $d
mkdir -p $d
### Copy the files and directories
echo copying $r to $d
cd $r
pax -rw * $d
chmod -x $d/*
# cd to import directory
cd $d
#
### Remove the $'s around RCS tags
cleantags $d
### Add our NetBSD RCS Id
find $d -type f -name '*.[chly]' -print | while read c; do
sed 1q < $c | grep -q '\$NetBSD' || (
echo "/* \$NetBSD\$ */" >/tmp/libmalloc3n$$
echo "" >>/tmp/libmalloc3n$$
cat $c >> /tmp/libmalloc3n$$
mv /tmp/libmalloc3n$$ $c && echo added NetBSD RCS tag to $c
)
done
find $d -type f -name '*.cpp' -print | while read c; do
sed 1q < $c | grep -q '\$NetBSD' || (
echo "/* \$NetBSD\$ */" >/tmp/libmalloc3n$$
echo "" >>/tmp/libmalloc3n$$
cat $c >> /tmp/libmalloc3n$$
mv /tmp/libmalloc3n$$ $c && echo added NetBSD RCS tag to $c
)
done
find $d -type f -name '*.[0-9]' -print | while read m; do
sed 1q < $m | grep -q '\$NetBSD' || (
echo ".\\\" \$NetBSD\$" >/tmp/libmalloc2m$$
echo ".\\\"" >>/tmp/libmalloc2m$$
cat $m >> /tmp/libmalloc2m$$
mv /tmp/libmalloc2m$$ $m && echo added NetBSD RCS tag to $m
)
done
find $d -type f -name '*.texi' -print | while read t; do
sed "2 s/^/@c \$NetBSD\$\\
/" < $t > /tmp/libmalloc4t$$
mv /tmp/libmalloc4t$$ $t && echo added NetBSD RCS tag to $t
done
echo done
### Clean up any CVS directories that might be around.
echo "cleaning up CVS residue."
(
cd $d
find . -type d -name "CVS" -print | xargs rm -r
)
echo done
### Fixing file and directory permissions.
echo "Fixing file/directory permissions."
(
cd $d
find . -type f -print | xargs chmod u+rw,go+r
find . -type d -print | xargs chmod u+rwx,go+rx
)
echo done
exit 0