PERFORCE change 38729 for review
Marcel Moolenaar
marcel at FreeBSD.org
Sat Sep 27 17:22:53 PDT 2003
http://perforce.freebsd.org/chv.cgi?CH=38729
Change 38729 by marcel at marcel_nfs on 2003/09/27 17:22:10
IFC @38726
Affected files ...
.. //depot/projects/ia64/UPDATING#54 integrate
.. //depot/projects/ia64/etc/Makefile#35 integrate
.. //depot/projects/ia64/etc/defaults/devfs.rules#2 integrate
.. //depot/projects/ia64/etc/rc.d/ipfilter#11 integrate
.. //depot/projects/ia64/gnu/usr.bin/groff/tmac/mdoc.local#18 integrate
.. //depot/projects/ia64/lib/Makefile#38 integrate
.. //depot/projects/ia64/lib/libc/stdlib/malloc.c#19 integrate
.. //depot/projects/ia64/lib/libdisk/libdisk.h#15 integrate
.. //depot/projects/ia64/lib/libkiconv/Makefile#1 branch
.. //depot/projects/ia64/lib/libkiconv/kiconv.3#1 branch
.. //depot/projects/ia64/lib/libkiconv/quirks.c#1 branch
.. //depot/projects/ia64/lib/libkiconv/quirks.h#1 branch
.. //depot/projects/ia64/lib/libkiconv/xlat16_iconv.c#1 branch
.. //depot/projects/ia64/lib/libkiconv/xlat16_sysctl.c#1 branch
.. //depot/projects/ia64/lib/libkvm/kvm_getprocs.3#4 integrate
.. //depot/projects/ia64/lib/libkvm/kvm_proc.c#20 integrate
.. //depot/projects/ia64/lib/libpthread/Makefile#13 integrate
.. //depot/projects/ia64/lib/libpthread/arch/alpha/include/atomic_ops.h#3 integrate
.. //depot/projects/ia64/lib/libpthread/arch/alpha/include/pthread_md.h#3 integrate
.. //depot/projects/ia64/lib/libthr/Makefile#5 integrate
.. //depot/projects/ia64/release/i386/fixit_crunch.conf#7 integrate
.. //depot/projects/ia64/release/ia64/boot_crunch.conf#5 integrate
.. //depot/projects/ia64/release/pc98/fixit-small_crunch.conf#4 integrate
.. //depot/projects/ia64/release/pc98/fixit_crunch.conf#7 integrate
.. //depot/projects/ia64/rescue/rescue/Makefile#12 integrate
.. //depot/projects/ia64/sbin/devd/devd.8#9 integrate
.. //depot/projects/ia64/sbin/ipfw/ipfw.8#27 integrate
.. //depot/projects/ia64/sbin/mount_cd9660/Makefile#3 integrate
.. //depot/projects/ia64/sbin/mount_cd9660/mount_cd9660.8#6 integrate
.. //depot/projects/ia64/sbin/mount_cd9660/mount_cd9660.c#5 integrate
.. //depot/projects/ia64/sbin/mount_msdosfs/Makefile#6 integrate
.. //depot/projects/ia64/sbin/mount_msdosfs/iso22dos#2 delete
.. //depot/projects/ia64/sbin/mount_msdosfs/iso72dos#2 delete
.. //depot/projects/ia64/sbin/mount_msdosfs/koi2dos#2 delete
.. //depot/projects/ia64/sbin/mount_msdosfs/koi8u2dos#2 delete
.. //depot/projects/ia64/sbin/mount_msdosfs/mount_msdosfs.8#7 integrate
.. //depot/projects/ia64/sbin/mount_msdosfs/mount_msdosfs.c#5 integrate
.. //depot/projects/ia64/sbin/mount_ntfs/Makefile#3 integrate
.. //depot/projects/ia64/sbin/mount_ntfs/mount_ntfs.8#6 integrate
.. //depot/projects/ia64/sbin/mount_ntfs/mount_ntfs.c#4 integrate
.. //depot/projects/ia64/sbin/rcorder/rcorder.c#4 integrate
.. //depot/projects/ia64/sbin/route/route.8#4 integrate
.. //depot/projects/ia64/share/man/man4/amr.4#5 integrate
.. //depot/projects/ia64/share/man/man4/iir.4#5 integrate
.. //depot/projects/ia64/share/man/man9/Makefile#32 integrate
.. //depot/projects/ia64/share/man/man9/disk.9#1 branch
.. //depot/projects/ia64/share/man/man9/style.9#23 integrate
.. //depot/projects/ia64/share/mk/bsd.libnames.mk#19 integrate
.. //depot/projects/ia64/share/mk/sys.mk#11 integrate
.. //depot/projects/ia64/sys/alpha/alpha/promcons.c#9 integrate
.. //depot/projects/ia64/sys/alpha/tlsb/zs_tlsb.c#9 integrate
.. //depot/projects/ia64/sys/amd64/amd64/pmap.c#26 integrate
.. //depot/projects/ia64/sys/amd64/include/pmap.h#6 integrate
.. //depot/projects/ia64/sys/conf/NOTES#71 integrate
.. //depot/projects/ia64/sys/conf/files#103 integrate
.. //depot/projects/ia64/sys/conf/options#68 integrate
.. //depot/projects/ia64/sys/dev/acpica/Osd/OsdSynch.c#9 integrate
.. //depot/projects/ia64/sys/dev/acpica/acpi.c#43 integrate
.. //depot/projects/ia64/sys/dev/acpica/acpi_acad.c#9 integrate
.. //depot/projects/ia64/sys/dev/acpica/acpi_cmbat.c#15 integrate
.. //depot/projects/ia64/sys/dev/acpica/acpi_ec.c#19 integrate
.. //depot/projects/ia64/sys/dev/acpica/acpi_resource.c#12 integrate
.. //depot/projects/ia64/sys/dev/acpica/acpi_thermal.c#12 integrate
.. //depot/projects/ia64/sys/dev/adlink/adlink.c#6 integrate
.. //depot/projects/ia64/sys/dev/asr/asr.c#20 integrate
.. //depot/projects/ia64/sys/dev/ata/ata-all.c#43 integrate
.. //depot/projects/ia64/sys/dev/digi/digi.c#16 integrate
.. //depot/projects/ia64/sys/dev/fb/fb.c#12 integrate
.. //depot/projects/ia64/sys/dev/fb/fbreg.h#9 integrate
.. //depot/projects/ia64/sys/dev/gfb/gfb_pci.c#9 integrate
.. //depot/projects/ia64/sys/dev/iir/iir.c#9 integrate
.. //depot/projects/ia64/sys/dev/iir/iir.h#4 integrate
.. //depot/projects/ia64/sys/dev/iir/iir_ctrl.c#10 integrate
.. //depot/projects/ia64/sys/dev/iir/iir_pci.c#11 integrate
.. //depot/projects/ia64/sys/dev/isp/isp_freebsd.c#18 integrate
.. //depot/projects/ia64/sys/dev/kbd/kbd.c#9 integrate
.. //depot/projects/ia64/sys/dev/kbd/kbdreg.h#2 integrate
.. //depot/projects/ia64/sys/dev/md/md.c#34 integrate
.. //depot/projects/ia64/sys/dev/null/null.c#14 integrate
.. //depot/projects/ia64/sys/dev/ofw/ofw_console.c#11 integrate
.. //depot/projects/ia64/sys/dev/ofw/openfirmio.c#7 integrate
.. //depot/projects/ia64/sys/dev/sab/sab.c#15 integrate
.. //depot/projects/ia64/sys/dev/sio/sio.c#54 integrate
.. //depot/projects/ia64/sys/dev/syscons/syscons.c#23 integrate
.. //depot/projects/ia64/sys/dev/uart/uart_tty.c#3 integrate
.. //depot/projects/ia64/sys/dev/zs/zs.c#13 integrate
.. //depot/projects/ia64/sys/fs/fdescfs/fdesc_vnops.c#15 integrate
.. //depot/projects/ia64/sys/fs/msdosfs/direntry.h#3 integrate
.. //depot/projects/ia64/sys/fs/msdosfs/msdosfs_conv.c#5 integrate
.. //depot/projects/ia64/sys/fs/msdosfs/msdosfs_iconv.c#1 branch
.. //depot/projects/ia64/sys/fs/msdosfs/msdosfs_lookup.c#4 integrate
.. //depot/projects/ia64/sys/fs/msdosfs/msdosfs_vfsops.c#21 integrate
.. //depot/projects/ia64/sys/fs/msdosfs/msdosfs_vnops.c#22 integrate
.. //depot/projects/ia64/sys/fs/msdosfs/msdosfsmount.h#6 integrate
.. //depot/projects/ia64/sys/fs/ntfs/ntfs.h#3 integrate
.. //depot/projects/ia64/sys/fs/ntfs/ntfs_iconv.c#1 branch
.. //depot/projects/ia64/sys/fs/ntfs/ntfs_subr.c#13 integrate
.. //depot/projects/ia64/sys/fs/ntfs/ntfs_subr.h#3 integrate
.. //depot/projects/ia64/sys/fs/ntfs/ntfs_vfsops.c#16 integrate
.. //depot/projects/ia64/sys/fs/ntfs/ntfs_vnops.c#13 integrate
.. //depot/projects/ia64/sys/fs/ntfs/ntfsmount.h#2 integrate
.. //depot/projects/ia64/sys/fs/smbfs/smbfs_vfsops.c#18 integrate
.. //depot/projects/ia64/sys/fs/smbfs/smbfs_vnops.c#19 integrate
.. //depot/projects/ia64/sys/geom/geom_ctl.c#15 integrate
.. //depot/projects/ia64/sys/geom/geom_io.c#30 integrate
.. //depot/projects/ia64/sys/i386/bios/smapi.c#4 integrate
.. //depot/projects/ia64/sys/i386/i386/elan-mmcr.c#13 integrate
.. //depot/projects/ia64/sys/i386/i386/pmap.c#66 integrate
.. //depot/projects/ia64/sys/i386/isa/cy.c#10 integrate
.. //depot/projects/ia64/sys/i386/isa/pcvt/pcvt_drv.c#10 integrate
.. //depot/projects/ia64/sys/ia64/ia64/ssc.c#8 integrate
.. //depot/projects/ia64/sys/isa/vga_isa.c#8 integrate
.. //depot/projects/ia64/sys/isofs/cd9660/cd9660_iconv.c#1 branch
.. //depot/projects/ia64/sys/isofs/cd9660/cd9660_lookup.c#8 integrate
.. //depot/projects/ia64/sys/isofs/cd9660/cd9660_mount.h#2 integrate
.. //depot/projects/ia64/sys/isofs/cd9660/cd9660_rrip.c#6 integrate
.. //depot/projects/ia64/sys/isofs/cd9660/cd9660_util.c#4 integrate
.. //depot/projects/ia64/sys/isofs/cd9660/cd9660_vfsops.c#21 integrate
.. //depot/projects/ia64/sys/isofs/cd9660/cd9660_vnops.c#17 integrate
.. //depot/projects/ia64/sys/isofs/cd9660/iso.h#5 integrate
.. //depot/projects/ia64/sys/kern/kern_conf.c#23 integrate
.. //depot/projects/ia64/sys/kern/kern_exec.c#54 integrate
.. //depot/projects/ia64/sys/kern/kern_sig.c#66 integrate
.. //depot/projects/ia64/sys/kern/subr_devstat.c#10 integrate
.. //depot/projects/ia64/sys/kern/subr_xxx.c#9 delete
.. //depot/projects/ia64/sys/kern/sys_generic.c#27 integrate
.. //depot/projects/ia64/sys/kern/tty_cons.c#16 integrate
.. //depot/projects/ia64/sys/kern/tty_pty.c#15 integrate
.. //depot/projects/ia64/sys/kern/tty_tty.c#10 integrate
.. //depot/projects/ia64/sys/kern/vfs_default.c#27 integrate
.. //depot/projects/ia64/sys/kern/vfs_mount.c#21 integrate
.. //depot/projects/ia64/sys/libkern/iconv.c#7 integrate
.. //depot/projects/ia64/sys/libkern/iconv_converter_if.m#2 integrate
.. //depot/projects/ia64/sys/libkern/iconv_xlat.c#5 integrate
.. //depot/projects/ia64/sys/libkern/iconv_xlat16.c#1 branch
.. //depot/projects/ia64/sys/modules/Makefile#64 integrate
.. //depot/projects/ia64/sys/modules/cd9660/Makefile#3 integrate
.. //depot/projects/ia64/sys/modules/cd9660_iconv/Makefile#1 branch
.. //depot/projects/ia64/sys/modules/libiconv/Makefile#3 integrate
.. //depot/projects/ia64/sys/modules/msdosfs/Makefile#4 integrate
.. //depot/projects/ia64/sys/modules/msdosfs_iconv/Makefile#1 branch
.. //depot/projects/ia64/sys/modules/ntfs/Makefile#3 integrate
.. //depot/projects/ia64/sys/modules/ntfs_iconv/Makefile#1 branch
.. //depot/projects/ia64/sys/net/if_tun.c#18 integrate
.. //depot/projects/ia64/sys/net/if_tunvar.h#2 integrate
.. //depot/projects/ia64/sys/net80211/ieee80211_ioctl.c#6 integrate
.. //depot/projects/ia64/sys/net80211/ieee80211_ioctl.h#3 integrate
.. //depot/projects/ia64/sys/net80211/ieee80211_node.c#8 integrate
.. //depot/projects/ia64/sys/net80211/ieee80211_node.h#6 integrate
.. //depot/projects/ia64/sys/net80211/ieee80211_proto.c#4 integrate
.. //depot/projects/ia64/sys/net80211/ieee80211_var.h#6 integrate
.. //depot/projects/ia64/sys/netncp/ncp_mod.c#7 integrate
.. //depot/projects/ia64/sys/netsmb/smb_dev.c#13 integrate
.. //depot/projects/ia64/sys/opencrypto/cryptodev.c#13 integrate
.. //depot/projects/ia64/sys/pc98/pc98/pc98gdc.c#7 integrate
.. //depot/projects/ia64/sys/pc98/pc98/sio.c#27 integrate
.. //depot/projects/ia64/sys/powerpc/include/cpu.h#11 integrate
.. //depot/projects/ia64/sys/powerpc/powerpc/clock.c#10 integrate
.. //depot/projects/ia64/sys/powerpc/powerpc/cpu.c#2 integrate
.. //depot/projects/ia64/sys/sys/conf.h#23 integrate
.. //depot/projects/ia64/sys/sys/cons.h#5 integrate
.. //depot/projects/ia64/sys/sys/iconv.h#5 integrate
.. //depot/projects/ia64/sys/sys/param.h#44 integrate
.. //depot/projects/ia64/sys/sys/signalvar.h#15 integrate
.. //depot/projects/ia64/sys/sys/systm.h#29 integrate
.. //depot/projects/ia64/sys/vm/uma_dbg.c#11 integrate
.. //depot/projects/ia64/sys/vm/vm_map.c#65 integrate
.. //depot/projects/ia64/sys/vm/vm_map.h#27 integrate
.. //depot/projects/ia64/sys/vm/vm_mmap.c#25 integrate
.. //depot/projects/ia64/usr.bin/killall/killall.c#10 integrate
.. //depot/projects/ia64/usr.sbin/sysinstall/config.c#16 integrate
Differences ...
==== //depot/projects/ia64/UPDATING#54 (text+ko) ====
@@ -17,6 +17,10 @@
developers choose to disable these features on build machines
to maximize performance.
+20030926:
+ kiconv(3) has been added. mount_msdosfs(8), mount_ntfs(8) and
+ mount_cd9660(8) need to be in sync with kernel.
+
20030925:
Configuring a system to use IPFILTER now requires that PFIL_HOOKS
also be explicitly configured. Previously this dependency was
@@ -1375,4 +1379,4 @@
Contact Warner Losh if you have any questions about your use of
this document.
-$FreeBSD: src/UPDATING,v 1.268 2003/09/25 16:12:12 sam Exp $
+$FreeBSD: src/UPDATING,v 1.269 2003/09/27 14:12:39 fjoe Exp $
==== //depot/projects/ia64/etc/Makefile#35 (text+ko) ====
@@ -1,5 +1,5 @@
# from: @(#)Makefile 5.11 (Berkeley) 5/21/91
-# $FreeBSD: src/etc/Makefile,v 1.318 2003/09/18 16:35:43 markm Exp $
+# $FreeBSD: src/etc/Makefile,v 1.319 2003/09/27 17:33:03 markm Exp $
.if !defined(NO_SENDMAIL)
SUBDIR= sendmail
@@ -11,7 +11,7 @@
hosts hosts.allow hosts.equiv hosts.lpd \
inetd.conf login.access login.conf \
mac.conf motd netconfig network.subr networks newsyslog.conf \
- phones printcap profile protocols \
+ phones profile protocols \
rc rc.firewall rc.firewall6 rc.sendmail rc.shutdown \
rc.subr remote rpc services \
shells sysctl.conf syslog.conf usbd.conf \
@@ -79,6 +79,11 @@
.if !defined(NO_I4B)
cd ${.CURDIR}/isdn; ${MAKE} install
.endif
+.if !defined(NO_LPR)
+ cd ${.CURDIR}; \
+ ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
+ printcap ${DESTDIR}/etc
+.endif
.if !defined(NO_SENDMAIL)
cd ${.CURDIR}/sendmail; ${MAKE} distribution
.endif
==== //depot/projects/ia64/etc/defaults/devfs.rules#2 (text+ko) ====
@@ -13,7 +13,7 @@
# references must include a dollar sign '$' in-front of the
# name to be expanded properly.
#
-# $FreeBSD: src/etc/defaults/devfs.rules,v 1.1 2003/08/20 06:15:18 mtm Exp $
+# $FreeBSD: src/etc/defaults/devfs.rules,v 1.2 2003/09/26 10:32:21 phk Exp $
#
# Very basic and secure ruleset: Hide everything.
@@ -28,6 +28,7 @@
[devfsrules_unhide_basic=2]
add path null unhide
add path zero unhide
+add path crypto unhide
add path random unhide
add path urandom unhide
==== //depot/projects/ia64/etc/rc.d/ipfilter#11 (text+ko) ====
@@ -1,7 +1,7 @@
#!/bin/sh
#
# $NetBSD: ipfilter,v 1.10 2001/02/28 17:03:50 lukem Exp $
-# $FreeBSD: src/etc/rc.d/ipfilter,v 1.11 2003/07/30 18:53:59 mtm Exp $
+# $FreeBSD: src/etc/rc.d/ipfilter,v 1.12 2003/09/27 13:50:47 mux Exp $
#
# PROVIDE: ipfilter
@@ -40,7 +40,7 @@
case ${OSTYPE} in
FreeBSD)
# load ipfilter kernel module if needed
- if ! sysctl net.inet.ipf.fr_pass > /dev/null 2>&1; then
+ if ! kldstat -v | grep "IP Filter" > /dev/null 2>&1; then
if kldload ipl; then
info 'IP-filter module loaded.'
else
@@ -79,12 +79,15 @@
echo "Enabling ipfilter."
case ${OSTYPE} in
FreeBSD)
- ${ipfilter_program:-/sbin/ipf} -EFa
+ if [ `sysctl -n net.inet.ipf.fr_running` -eq 0 ]; then
+ ${ipfilter_program:-/sbin/ipf} -E
+ fi
+ ${ipfilter_program:-/sbin/ipf} -Fa
if [ -r "${ipfilter_rules}" ]; then
${ipfilter_program:-/sbin/ipf} \
-f "${ipfilter_rules}" ${ipfilter_flags}
fi
- ${ipfilter_program:-/sbin/ipf} -6 -EFa
+ ${ipfilter_program:-/sbin/ipf} -6 -Fa
if [ -r "${ipv6_ipfilter_rules}" ]; then
${ipfilter_program:-/sbin/ipf} -6 \
-f "${ipv6_ipfilter_rules}" ${ipfilter_flags}
@@ -104,17 +107,21 @@
ipfilter_stop()
{
- case ${OSTYPE} in
- FreeBSD)
- echo "Saving firewall state tables"
- ${ipfs_program:-/sbin/ipfs} -W ${ipfs_flags}
- ;;
- NetBSD)
- ;;
- esac
- # XXX - The following command is not effective for 'lkm's
- echo "Disabling ipfilter."
- /sbin/ipf -D
+ # XXX - The ipf -D command is not effective for 'lkm's
+ if [ `sysctl -n net.inet.ipf.fr_running` -eq 1 ]; then
+ case ${OSTYPE} in
+ FreeBSD)
+ echo "Saving firewall state tables"
+ ${ipfs_program:-/sbin/ipfs} -W ${ipfs_flags}
+ echo "Disabling ipfilter."
+ ${ipfilter_program:-/sbin/ipf} -D
+ ;;
+ NetBSD)
+ echo "Disabling ipfilter."
+ /sbin/ipf -D
+ ;;
+ esac
+ fi
}
ipfilter_reload()
@@ -157,7 +164,7 @@
case ${OSTYPE} in
FreeBSD)
# Don't resync if ipfilter is not loaded
- [ sysctl net.inet.ipf.fr_pass > /dev/null 2>&1 ] && return
+ [ kldstat -v | grep "IP Filter" > /dev/null 2>&1 ] && return
;;
esac
${ipfilter_program:-/sbin/ipf} -y ${ipfilter_flags}
==== //depot/projects/ia64/gnu/usr.bin/groff/tmac/mdoc.local#18 (text+ko) ====
@@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/gnu/usr.bin/groff/tmac/mdoc.local,v 1.30 2003/09/20 21:32:26 ru Exp $
+.\" $FreeBSD: src/gnu/usr.bin/groff/tmac/mdoc.local,v 1.31 2003/09/26 20:26:20 fjoe Exp $
.\"
.\" %beginstrip%
.
@@ -43,6 +43,7 @@
.ds doc-str-Lb-libfetch File Transfer Library (libfetch, \-lfetch)
.ds doc-str-Lb-libgeom Userland API Library for kernel GEOM subsystem (libgeom, \-lgeom)
.ds doc-str-Lb-libipx IPX Address Conversion Support Library (libipx, \-lipx)
+.ds doc-str-Lb-libkiconv Kernel side iconv library (libkiconv, \-lkiconv)
.ds doc-str-Lb-libmd Message Digest (MD4, MD5, etc.) Support Library (libmd, \-lmd)
.ds doc-str-Lb-libnetgraph Netgraph User Library (libnetgraph, \-lnetgraph)
.ds doc-str-Lb-libpam PAM Library (libpam, \-lpam)
==== //depot/projects/ia64/lib/Makefile#38 (text+ko) ====
@@ -1,5 +1,5 @@
# @(#)Makefile 8.1 (Berkeley) 6/4/93
-# $FreeBSD: src/lib/Makefile,v 1.171 2003/08/29 10:35:00 phk Exp $
+# $FreeBSD: src/lib/Makefile,v 1.172 2003/09/26 20:26:20 fjoe Exp $
# To satisfy shared library or ELF linkage when only the libraries being
# built are visible:
@@ -26,7 +26,7 @@
${_compat} libalias ${_libatm} ${_libbind} libbz2 libc ${_libc_r} \
libcalendar libcam libcompat libdevinfo libdevstat ${_libdisk} \
libedit libexpat libfetch libform libftpio libgeom ${_libio} libipsec \
- libipx libisc libmenu ${_libmilter} ${_libmp} ${_libncp} \
+ libipx libisc libkiconv libmenu ${_libmilter} ${_libmp} ${_libncp} \
libnetgraph libopie libpam libpanel libpcap ${_libpthread} \
${_libsm} ${_libsmb} ${_libsmdb} ${_libsmutil} \
libstand libtelnet ${_libthr} libufs libugidfw ${_libusbhid} \
==== //depot/projects/ia64/lib/libc/stdlib/malloc.c#19 (text+ko) ====
@@ -9,17 +9,17 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/malloc.c,v 1.77 2003/07/29 11:16:14 phk Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/stdlib/malloc.c,v 1.79 2003/09/27 18:58:26 phk Exp $");
/*
- * Defining EXTRA_SANITY will enable extra checks which are related
+ * Defining MALLOC_EXTRA_SANITY will enable extra checks which are related
* to internal conditions and consistency in malloc.c. This has a
* noticeable runtime performance hit, and generally will not do you
* any good unless you fiddle with the internals of malloc or want
* to catch random pointer corruption as early as possible.
*/
-#ifndef MALLOC_EXTRA_SANITY
-#undef MALLOC_EXTRA_SANITY
+#ifndef MALLOC_MALLOC_EXTRA_SANITY
+#undef MALLOC_MALLOC_EXTRA_SANITY
#endif
/*
@@ -76,8 +76,8 @@
# include "libc_private.h"
# include "spinlock.h"
static spinlock_t thread_lock = _SPINLOCK_INITIALIZER;
-# define THREAD_LOCK() if (__isthreaded) _SPINLOCK(&thread_lock);
-# define THREAD_UNLOCK() if (__isthreaded) _SPINUNLOCK(&thread_lock);
+# define _MALLOC_LOCK() if (__isthreaded) _SPINLOCK(&thread_lock);
+# define _MALLOC_UNLOCK() if (__isthreaded) _SPINUNLOCK(&thread_lock);
#endif /* __FreeBSD__ */
#if defined(__sparc__) && defined(sun)
@@ -184,12 +184,12 @@
#define pageround(foo) (((foo) + (malloc_pagemask))&(~(malloc_pagemask)))
#define ptr2index(foo) (((u_long)(foo) >> malloc_pageshift)-malloc_origo)
-#ifndef THREAD_LOCK
-#define THREAD_LOCK()
+#ifndef _MALLOC_LOCK
+#define _MALLOC_LOCK()
#endif
-#ifndef THREAD_UNLOCK
-#define THREAD_UNLOCK()
+#ifndef _MALLOC_UNLOCK
+#define _MALLOC_UNLOCK()
#endif
#ifndef MMAP_FD
@@ -331,22 +331,22 @@
result = (caddr_t)pageround((u_long)sbrk(0));
tail = result + (pages << malloc_pageshift);
if (tail < result)
- return 0;
+ return (NULL);
if (brk(tail)) {
-#ifdef EXTRA_SANITY
- wrterror("(ES): map_pages fails\n");
-#endif /* EXTRA_SANITY */
- return 0;
+#ifdef MALLOC_EXTRA_SANITY
+ wrterror("(ES): map_pages fails.\n");
+#endif /* MALLOC_EXTRA_SANITY */
+ return (NULL);
}
last_index = ptr2index(tail) - 1;
malloc_brk = tail;
if ((last_index+1) >= malloc_ninfo && !extend_pgdir(last_index))
- return 0;;
+ return (NULL);
- return result;
+ return (result);
}
/*
@@ -383,8 +383,8 @@
/* Get new pages */
new = (struct pginfo**) MMAP(i * malloc_pagesize);
- if (new == (struct pginfo **)-1)
- return 0;
+ if (new == MAP_FAILED)
+ return (0);
/* Copy the old stuff */
memcpy(new, page_dir,
@@ -399,7 +399,7 @@
/* Now free the old stuff */
munmap(old, oldlen);
- return 1;
+ return (1);
}
/*
@@ -421,9 +421,9 @@
malloc_pageshift++;
#endif
-#ifdef EXTRA_SANITY
+#ifdef MALLOC_EXTRA_SANITY
malloc_junk = 1;
-#endif /* EXTRA_SANITY */
+#endif /* MALLOC_EXTRA_SANITY */
for (i = 0; i < 3; i++) {
if (i == 0) {
@@ -439,7 +439,7 @@
} else {
p = _malloc_options;
}
- for (; p && *p; p++) {
+ for (; p != NULL && *p != '\0'; p++) {
switch (*p) {
case '>': malloc_cache <<= 1; break;
case '<': malloc_cache >>= 1; break;
@@ -464,7 +464,7 @@
default:
j = malloc_abort;
malloc_abort = 0;
- wrtwarning("unknown char in MALLOC_OPTIONS\n");
+ wrtwarning("unknown char in MALLOC_OPTIONS.\n");
malloc_abort = j;
break;
}
@@ -498,7 +498,7 @@
page_dir = (struct pginfo **) MMAP(malloc_pagesize);
if (page_dir == (struct pginfo **) -1)
- wrterror("mmap(2) failed, check limits\n");
+ wrterror("mmap(2) failed, check limits.\n");
/*
* We need a maximum of malloc_pageshift buckets, steal these from the
@@ -509,6 +509,9 @@
malloc_ninfo = malloc_pagesize / sizeof *page_dir;
+ /* Been here, done that */
+ malloc_started++;
+
/* Recalculate the cache size in bytes, and make sure it's nonzero */
if (!malloc_cache)
@@ -521,9 +524,6 @@
* We can sbrk(2) further back when we keep this on a low address.
*/
px = (struct pgfree *) imalloc (sizeof *px);
-
- /* Been here, done that */
- malloc_started++;
}
/*
@@ -532,41 +532,41 @@
static void *
malloc_pages(size_t size)
{
- void *p, *delay_free = 0;
+ void *p, *delay_free = NULL;
size_t i;
struct pgfree *pf;
u_long index;
size = pageround(size);
- p = 0;
+ p = NULL;
/* Look for free pages before asking for more */
for(pf = free_list.next; pf; pf = pf->next) {
-#ifdef EXTRA_SANITY
+#ifdef MALLOC_EXTRA_SANITY
if (pf->size & malloc_pagemask)
- wrterror("(ES): junk length entry on free_list\n");
+ wrterror("(ES): junk length entry on free_list.\n");
if (!pf->size)
- wrterror("(ES): zero length entry on free_list\n");
+ wrterror("(ES): zero length entry on free_list.\n");
if (pf->page == pf->end)
- wrterror("(ES): zero entry on free_list\n");
+ wrterror("(ES): zero entry on free_list.\n");
if (pf->page > pf->end)
- wrterror("(ES): sick entry on free_list\n");
+ wrterror("(ES): sick entry on free_list.\n");
if ((void*)pf->page >= (void*)sbrk(0))
- wrterror("(ES): entry on free_list past brk\n");
+ wrterror("(ES): entry on free_list past brk.\n");
if (page_dir[ptr2index(pf->page)] != MALLOC_FREE)
- wrterror("(ES): non-free first page on free-list\n");
+ wrterror("(ES): non-free first page on free-list.\n");
if (page_dir[ptr2index(pf->end)-1] != MALLOC_FREE)
- wrterror("(ES): non-free last page on free-list\n");
-#endif /* EXTRA_SANITY */
+ wrterror("(ES): non-free last page on free-list.\n");
+#endif /* MALLOC_EXTRA_SANITY */
if (pf->size < size)
continue;
if (pf->size == size) {
p = pf->page;
- if (pf->next)
+ if (pf->next != NULL)
pf->next->prev = pf->prev;
pf->prev->next = pf->next;
delay_free = pf;
@@ -579,18 +579,18 @@
break;
}
-#ifdef EXTRA_SANITY
- if (p && page_dir[ptr2index(p)] != MALLOC_FREE)
- wrterror("(ES): allocated non-free page on free-list\n");
-#endif /* EXTRA_SANITY */
+#ifdef MALLOC_EXTRA_SANITY
+ if (p != NULL && page_dir[ptr2index(p)] != MALLOC_FREE)
+ wrterror("(ES): allocated non-free page on free-list.\n");
+#endif /* MALLOC_EXTRA_SANITY */
size >>= malloc_pageshift;
/* Map new pages */
- if (!p)
+ if (p == NULL)
p = map_pages(size);
- if (p) {
+ if (p != NULL) {
index = ptr2index(p);
page_dir[index] = MALLOC_FIRST;
@@ -602,13 +602,13 @@
}
if (delay_free) {
- if (!px)
+ if (px == NULL)
px = delay_free;
else
ifree(delay_free);
}
- return p;
+ return (p);
}
/*
@@ -624,8 +624,8 @@
/* Allocate a new bucket */
pp = malloc_pages(malloc_pagesize);
- if (!pp)
- return 0;
+ if (pp == NULL)
+ return (0);
/* Find length of admin structure */
l = offsetof(struct pginfo, bits[0]);
@@ -637,9 +637,9 @@
bp = (struct pginfo *)pp;
} else {
bp = (struct pginfo *)imalloc(l);
- if (!bp) {
+ if (bp == NULL) {
ifree(pp);
- return 0;
+ return (0);
}
}
@@ -678,7 +678,7 @@
/* MALLOC_UNLOCK */
- return 1;
+ return (1);
}
/*
@@ -704,8 +704,8 @@
j++;
/* If it's empty, make a page more of that size chunks */
- if (!page_dir[j] && !malloc_make_chunks(j))
- return 0;
+ if (page_dir[j] == NULL && !malloc_make_chunks(j))
+ return (NULL);
bp = page_dir[j];
@@ -725,7 +725,7 @@
/* If there are no more free, remove from free-list */
if (!--bp->free) {
page_dir[j] = bp->next;
- bp->next = 0;
+ bp->next = NULL;
}
/* Adjust to the real offset of that chunk */
@@ -735,7 +735,7 @@
if (malloc_junk)
memset((u_char*)bp->page + k, SOME_JUNK, bp->size);
- return (u_char *)bp->page + k;
+ return ((u_char *)bp->page + k);
}
/*
@@ -746,22 +746,28 @@
{
void *result;
+ if (!malloc_started)
+ malloc_init();
+
if (suicide)
abort();
if ((size + malloc_pagesize) < size) /* Check for overflow */
- result = 0;
+ result = NULL;
else if ((size + malloc_pagesize) >= (uintptr_t)page_dir)
- result = 0;
+ result = NULL;
else if (size <= malloc_maxsize)
- result = malloc_bytes(size);
+ result = malloc_bytes(size);
else
- result = malloc_pages(size);
+ result = malloc_pages(size);
+
+ if (malloc_abort && result == NULL)
+ wrterror("allocation failed.\n");
- if (malloc_zero && result)
+ if (malloc_zero && result != NULL)
memset(result, 0, size);
- return result;
+ return (result);
}
/*
@@ -778,16 +784,21 @@
if (suicide)
abort();
+ if (!malloc_started) {
+ wrtwarning("malloc() has never been called.\n");
+ return (NULL);
+ }
+
index = ptr2index(ptr);
if (index < malloc_pageshift) {
- wrtwarning("junk pointer, too low to make sense\n");
- return 0;
+ wrtwarning("junk pointer, too low to make sense.\n");
+ return (NULL);
}
if (index > last_index) {
- wrtwarning("junk pointer, too high to make sense\n");
- return 0;
+ wrtwarning("junk pointer, too high to make sense.\n");
+ return (NULL);
}
mp = &page_dir[index];
@@ -796,26 +807,28 @@
/* Check the pointer */
if ((u_long)ptr & malloc_pagemask) {
- wrtwarning("modified (page-) pointer\n");
- return 0;
+ wrtwarning("modified (page-) pointer.\n");
+ return (NULL);
}
/* Find the size in bytes */
- for (osize = malloc_pagesize; *++mp == MALLOC_FOLLOW;)
+ for (osize = malloc_pagesize; *(++mp) == MALLOC_FOLLOW;)
osize += malloc_pagesize;
- if (!malloc_realloc && /* unless we have to, */
+ if (!malloc_realloc && /* Unless we have to, */
size <= osize && /* .. or are too small, */
size > (osize - malloc_pagesize)) { /* .. or can free a page, */
- return ptr; /* don't do anything. */
+ if (malloc_junk)
+ memset((char *)ptr + size, SOME_JUNK, osize-size);
+ return (ptr); /* ..don't do anything else. */
}
} else if (*mp >= MALLOC_MAGIC) { /* Chunk allocation */
/* Check the pointer for sane values */
if (((u_long)ptr & ((*mp)->size-1))) {
- wrtwarning("modified (chunk-) pointer\n");
- return 0;
+ wrtwarning("modified (chunk-) pointer.\n");
+ return (NULL);
}
/* Find the chunk index in the page */
@@ -823,27 +836,29 @@
/* Verify that it isn't a free chunk already */
if ((*mp)->bits[i/MALLOC_BITS] & (1<<(i%MALLOC_BITS))) {
- wrtwarning("chunk is already free\n");
- return 0;
+ wrtwarning("chunk is already free.\n");
+ return (NULL);
}
osize = (*mp)->size;
if (!malloc_realloc && /* Unless we have to, */
- size < osize && /* ..or are too small, */
+ size <= osize && /* ..or are too small, */
(size > osize/2 || /* ..or could use a smaller size, */
osize == malloc_minsize)) { /* ..(if there is one) */
- return ptr; /* ..Don't do anything */
+ if (malloc_junk)
+ memset((char *)ptr + size, SOME_JUNK, osize-size);
+ return (ptr); /* ..don't do anything else. */
}
} else {
- wrtwarning("pointer to wrong page\n");
- return 0;
+ wrtwarning("pointer to wrong page.\n");
+ return (NULL);
}
p = imalloc(size);
- if (p) {
+ if (p != NULL) {
/* copy the lesser of the two sizes, and free the old one */
if (!size || !osize)
;
@@ -853,7 +868,7 @@
memcpy(p, ptr, size);
ifree(ptr);
}
- return p;
+ return (p);
}
/*
@@ -864,22 +879,22 @@
free_pages(void *ptr, u_long index, struct pginfo const *info)
{
u_long i;
- struct pgfree *pf, *pt=0;
+ struct pgfree *pf, *pt=NULL;
u_long l;
void *tail;
if (info == MALLOC_FREE) {
- wrtwarning("page is already free\n");
+ wrtwarning("page is already free.\n");
return;
}
if (info != MALLOC_FIRST) {
- wrtwarning("pointer to wrong page\n");
+ wrtwarning("pointer to wrong page.\n");
return;
}
if ((u_long)ptr & malloc_pagemask) {
- wrtwarning("modified (page-) pointer\n");
+ wrtwarning("modified (page-) pointer.\n");
return;
}
@@ -899,26 +914,27 @@
tail = (char *)ptr+l;
/* add to free-list */
- if (!px)
- px = imalloc(sizeof *pt); /* This cannot fail... */
+ if (px == NULL)
+ px = imalloc(sizeof *px); /* This cannot fail... */
px->page = ptr;
px->end = tail;
px->size = l;
- if (!free_list.next) {
+ if (free_list.next == NULL) {
/* Nothing on free list, put this at head */
px->next = free_list.next;
px->prev = &free_list;
free_list.next = px;
pf = px;
- px = 0;
+ px = NULL;
} else {
/* Find the right spot, leave pf pointing to the modified entry. */
tail = (char *)ptr+l;
- for(pf = free_list.next; pf->end < ptr && pf->next; pf = pf->next)
+ for(pf = free_list.next; pf->end < ptr && pf->next != NULL;
+ pf = pf->next)
; /* Race ahead here */
if (pf->page > tail) {
@@ -928,38 +944,38 @@
pf->prev = px;
px->prev->next = px;
pf = px;
- px = 0;
+ px = NULL;
} else if (pf->end == ptr ) {
/* Append to the previous entry */
pf->end = (char *)pf->end + l;
pf->size += l;
- if (pf->next && pf->end == pf->next->page ) {
+ if (pf->next != NULL && pf->end == pf->next->page ) {
/* And collapse the next too. */
pt = pf->next;
pf->end = pt->end;
pf->size += pt->size;
pf->next = pt->next;
- if (pf->next)
+ if (pf->next != NULL)
pf->next->prev = pf;
}
} else if (pf->page == tail) {
/* Prepend to entry */
pf->size += l;
pf->page = ptr;
- } else if (!pf->next) {
+ } else if (pf->next == NULL) {
/* Append at tail of chain */
- px->next = 0;
+ px->next = NULL;
px->prev = pf;
pf->next = px;
pf = px;
- px = 0;
+ px = NULL;
} else {
- wrterror("freelist is destroyed\n");
+ wrterror("freelist is destroyed.\n");
}
}
/* Return something to OS ? */
- if (!pf->next && /* If we're the last one, */
+ if (pf->next == NULL && /* If we're the last one, */
pf->size > malloc_cache && /* ..and the cache is full, */
pf->end == malloc_brk && /* ..and none behind us, */
malloc_brk == sbrk(0)) { /* ..and it's OK to do... */
@@ -983,7 +999,7 @@
/* XXX: We could realloc/shrink the pagedir here I guess. */
}
- if (pt)
+ if (pt != NULL)
ifree(pt);
}
@@ -1002,12 +1018,12 @@
i = ((u_long)ptr & malloc_pagemask) >> info->shift;
if (((u_long)ptr & (info->size-1))) {
- wrtwarning("modified (chunk-) pointer\n");
+ wrtwarning("modified (chunk-) pointer.\n");
return;
}
if (info->bits[i/MALLOC_BITS] & (1<<(i%MALLOC_BITS))) {
- wrtwarning("chunk is already free\n");
+ wrtwarning("chunk is already free.\n");
return;
}
@@ -1038,10 +1054,10 @@
/* Find & remove this page in the queue */
while (*mp != info) {
mp = &((*mp)->next);
-#ifdef EXTRA_SANITY
+#ifdef MALLOC_EXTRA_SANITY
if (!*mp)
- wrterror("(ES): Not on queue\n");
-#endif /* EXTRA_SANITY */
+ wrterror("(ES): Not on queue.\n");
+#endif /* MALLOC_EXTRA_SANITY */
}
*mp = info->next;
@@ -1060,11 +1076,11 @@
u_long index;
/* This is legal */
- if (!ptr)
+ if (ptr == NULL)
return;
if (!malloc_started) {
- wrtwarning("malloc() has never been called\n");
+ wrtwarning("malloc() has never been called.\n");
return;
}
@@ -1075,12 +1091,12 @@
index = ptr2index(ptr);
if (index < malloc_pageshift) {
- wrtwarning("junk pointer, too low to make sense\n");
+ wrtwarning("junk pointer, too low to make sense.\n");
return;
}
if (index > last_index) {
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list