PERFORCE change 90577 for review
Robert Watson
rwatson at FreeBSD.org
Sat Jan 28 23:39:49 GMT 2006
http://perforce.freebsd.org/chv.cgi?CH=90577
Change 90577 by rwatson at rwatson_zoo on 2006/01/28 23:39:12
Integrate TrustedBSD base to pick up changes missed in previous
integrations due to a CVS->P4 importer problem, as well as new
changes:
- rwlocks
- ktr clear
- ddb show sleepqueue
- ddb show turnstile
- NFS server cred cleanup looped back from trustedbsd_mac
Affected files ...
.. //depot/projects/trustedbsd/base/etc/pf.conf#3 integrate
.. //depot/projects/trustedbsd/base/games/fortune/datfiles/fortunes#46 integrate
.. //depot/projects/trustedbsd/base/include/nl_types.h#6 integrate
.. //depot/projects/trustedbsd/base/include/stdio.h#14 integrate
.. //depot/projects/trustedbsd/base/lib/libc/stdlib/malloc.c#22 integrate
.. //depot/projects/trustedbsd/base/lib/libdisk/Makefile#16 integrate
.. //depot/projects/trustedbsd/base/lib/libdisk/libdisk.3#10 integrate
.. //depot/projects/trustedbsd/base/lib/libutil/pidfile.3#3 integrate
.. //depot/projects/trustedbsd/base/libexec/rtld-elf/ia64/reloc.c#13 integrate
.. //depot/projects/trustedbsd/base/libexec/rtld-elf/ia64/rtld_start.S#3 integrate
.. //depot/projects/trustedbsd/base/sbin/dhclient/dhclient-script#5 integrate
.. //depot/projects/trustedbsd/base/share/examples/cvsup/ports-supfile#10 integrate
.. //depot/projects/trustedbsd/base/share/man/man4/ng_pppoe.4#11 integrate
.. //depot/projects/trustedbsd/base/share/man/man5/rc.conf.5#53 integrate
.. //depot/projects/trustedbsd/base/sys/amd64/amd64/trap.c#22 integrate
.. //depot/projects/trustedbsd/base/sys/arm/arm/vm_machdep.c#12 integrate
.. //depot/projects/trustedbsd/base/sys/compat/linux/linux_stats.c#22 integrate
.. //depot/projects/trustedbsd/base/sys/conf/files#93 integrate
.. //depot/projects/trustedbsd/base/sys/conf/options#66 integrate
.. //depot/projects/trustedbsd/base/sys/dev/amr/amr.c#27 integrate
.. //depot/projects/trustedbsd/base/sys/dev/bktr/bktr_os.c#17 integrate
.. //depot/projects/trustedbsd/base/sys/dev/ce/ceddk.c#1 branch
.. //depot/projects/trustedbsd/base/sys/dev/ce/ceddk.h#1 branch
.. //depot/projects/trustedbsd/base/sys/dev/ce/if_ce.c#1 branch
.. //depot/projects/trustedbsd/base/sys/dev/ce/ng_ce.h#1 branch
.. //depot/projects/trustedbsd/base/sys/dev/ce/tau32-ddk.c#1 branch
.. //depot/projects/trustedbsd/base/sys/dev/ce/tau32-ddk.h#1 branch
.. //depot/projects/trustedbsd/base/sys/dev/ed/if_ed.c#28 integrate
.. //depot/projects/trustedbsd/base/sys/dev/ed/if_ed_3c503.c#4 integrate
.. //depot/projects/trustedbsd/base/sys/dev/ed/if_ed_cbus.c#14 integrate
.. //depot/projects/trustedbsd/base/sys/dev/ed/if_ed_hpp.c#4 integrate
.. //depot/projects/trustedbsd/base/sys/dev/ed/if_ed_isa.c#13 integrate
.. //depot/projects/trustedbsd/base/sys/dev/ed/if_ed_novell.c#4 integrate
.. //depot/projects/trustedbsd/base/sys/dev/ed/if_ed_sic.c#4 integrate
.. //depot/projects/trustedbsd/base/sys/dev/ed/if_ed_wd80x3.c#4 integrate
.. //depot/projects/trustedbsd/base/sys/dev/ed/if_edvar.h#10 integrate
.. //depot/projects/trustedbsd/base/sys/dev/em/if_em.c#47 integrate
.. //depot/projects/trustedbsd/base/sys/dev/isp/isp_freebsd.h#18 integrate
.. //depot/projects/trustedbsd/base/sys/dev/md/md.c#47 integrate
.. //depot/projects/trustedbsd/base/sys/dev/sound/pci/solo.c#12 integrate
.. //depot/projects/trustedbsd/base/sys/i386/i386/trap.c#45 integrate
.. //depot/projects/trustedbsd/base/sys/ia64/include/elf.h#8 integrate
.. //depot/projects/trustedbsd/base/sys/kern/kern_alq.c#10 integrate
.. //depot/projects/trustedbsd/base/sys/kern/kern_ktr.c#22 integrate
.. //depot/projects/trustedbsd/base/sys/kern/kern_mutex.c#43 integrate
.. //depot/projects/trustedbsd/base/sys/kern/kern_rwlock.c#1 branch
.. //depot/projects/trustedbsd/base/sys/kern/subr_lock.c#2 integrate
.. //depot/projects/trustedbsd/base/sys/kern/subr_sleepqueue.c#14 integrate
.. //depot/projects/trustedbsd/base/sys/kern/subr_turnstile.c#13 integrate
.. //depot/projects/trustedbsd/base/sys/kern/tty_pts.c#2 integrate
.. //depot/projects/trustedbsd/base/sys/kern/vfs_aio.c#48 integrate
.. //depot/projects/trustedbsd/base/sys/kern/vfs_subr.c#70 integrate
.. //depot/projects/trustedbsd/base/sys/modules/bktr/bktr/Makefile#7 integrate
.. //depot/projects/trustedbsd/base/sys/netgraph/ng_pppoe.c#20 integrate
.. //depot/projects/trustedbsd/base/sys/netgraph/ng_pppoe.h#10 integrate
.. //depot/projects/trustedbsd/base/sys/nfsserver/nfs.h#12 integrate
.. //depot/projects/trustedbsd/base/sys/nfsserver/nfs_serv.c#37 integrate
.. //depot/projects/trustedbsd/base/sys/nfsserver/nfs_srvsock.c#17 integrate
.. //depot/projects/trustedbsd/base/sys/nfsserver/nfs_syscalls.c#22 integrate
.. //depot/projects/trustedbsd/base/sys/sparc64/central/central.c#8 integrate
.. //depot/projects/trustedbsd/base/sys/sparc64/ebus/ebus.c#18 integrate
.. //depot/projects/trustedbsd/base/sys/sparc64/fhc/fhc_central.c#8 integrate
.. //depot/projects/trustedbsd/base/sys/sparc64/fhc/fhc_nexus.c#8 integrate
.. //depot/projects/trustedbsd/base/sys/sparc64/pci/psycho.c#31 integrate
.. //depot/projects/trustedbsd/base/sys/sparc64/sbus/dma_sbus.c#3 integrate
.. //depot/projects/trustedbsd/base/sys/sparc64/sbus/sbus.c#21 integrate
.. //depot/projects/trustedbsd/base/sys/sys/_rwlock.h#1 branch
.. //depot/projects/trustedbsd/base/sys/sys/lock.h#14 integrate
.. //depot/projects/trustedbsd/base/sys/sys/proc.h#70 integrate
.. //depot/projects/trustedbsd/base/sys/sys/rwlock.h#1 branch
.. //depot/projects/trustedbsd/base/sys/sys/turnstile.h#8 integrate
.. //depot/projects/trustedbsd/base/sys/vm/swap_pager.c#42 integrate
.. //depot/projects/trustedbsd/base/sys/vm/uma_core.c#41 integrate
.. //depot/projects/trustedbsd/base/sys/vm/vm_fault.c#41 integrate
.. //depot/projects/trustedbsd/base/sys/vm/vm_map.c#46 integrate
.. //depot/projects/trustedbsd/base/sys/vm/vm_object.c#57 integrate
.. //depot/projects/trustedbsd/base/sys/vm/vm_pageout.c#38 integrate
.. //depot/projects/trustedbsd/base/sys/vm/vm_pageq.c#16 integrate
.. //depot/projects/trustedbsd/base/tools/tools/netrate/juggle/juggle.c#2 integrate
.. //depot/projects/trustedbsd/base/usr.bin/Makefile#45 integrate
.. //depot/projects/trustedbsd/base/usr.bin/calendar/calendars/calendar.freebsd#45 integrate
.. //depot/projects/trustedbsd/base/usr.bin/ee/ee.c#6 integrate
.. //depot/projects/trustedbsd/base/usr.bin/elfdump/elfdump.c#8 integrate
.. //depot/projects/trustedbsd/base/usr.bin/fetch/fetch.c#22 integrate
.. //depot/projects/trustedbsd/base/usr.bin/fstat/fstat.c#19 integrate
.. //depot/projects/trustedbsd/base/usr.bin/gprof/powerpc.h#1 branch
.. //depot/projects/trustedbsd/base/usr.bin/ktrdump/ktrdump.c#10 integrate
.. //depot/projects/trustedbsd/base/usr.bin/mail/mail.1#12 integrate
.. //depot/projects/trustedbsd/base/usr.bin/mktemp/mktemp.1#7 integrate
.. //depot/projects/trustedbsd/base/usr.bin/netstat/Makefile#11 integrate
.. //depot/projects/trustedbsd/base/usr.bin/netstat/ipsec.c#5 integrate
.. //depot/projects/trustedbsd/base/usr.bin/netstat/main.c#17 integrate
.. //depot/projects/trustedbsd/base/usr.bin/netstat/netstat.h#13 integrate
.. //depot/projects/trustedbsd/base/usr.bin/netstat/pfkey.c#1 branch
.. //depot/projects/trustedbsd/base/usr.bin/su/su.1#11 integrate
.. //depot/projects/trustedbsd/base/usr.bin/su/su.c#23 integrate
.. //depot/projects/trustedbsd/base/usr.bin/tar/bsdtar.1#10 integrate
.. //depot/projects/trustedbsd/base/usr.bin/truss/alpha-fbsd.c#9 integrate
.. //depot/projects/trustedbsd/base/usr.bin/truss/amd64-fbsd.c#2 integrate
.. //depot/projects/trustedbsd/base/usr.bin/truss/extern.h#8 integrate
.. //depot/projects/trustedbsd/base/usr.bin/truss/i386-fbsd.c#10 integrate
.. //depot/projects/trustedbsd/base/usr.bin/truss/i386-linux.c#10 integrate
.. //depot/projects/trustedbsd/base/usr.bin/truss/ia64-fbsd.c#8 integrate
.. //depot/projects/trustedbsd/base/usr.bin/truss/main.c#14 integrate
.. //depot/projects/trustedbsd/base/usr.bin/truss/powerpc-fbsd.c#1 branch
.. //depot/projects/trustedbsd/base/usr.bin/truss/sparc64-fbsd.c#6 integrate
.. //depot/projects/trustedbsd/base/usr.bin/truss/syscall.h#7 integrate
.. //depot/projects/trustedbsd/base/usr.bin/truss/syscalls.c#22 integrate
.. //depot/projects/trustedbsd/base/usr.bin/truss/truss.1#7 integrate
.. //depot/projects/trustedbsd/base/usr.bin/truss/truss.h#2 integrate
.. //depot/projects/trustedbsd/base/usr.bin/wall/ttymsg.c#4 integrate
.. //depot/projects/trustedbsd/base/usr.bin/whois/whois.1#8 integrate
.. //depot/projects/trustedbsd/base/usr.bin/whois/whois.c#16 integrate
.. //depot/projects/trustedbsd/base/usr.bin/xargs/strnsubst.c#6 integrate
.. //depot/projects/trustedbsd/base/usr.bin/xargs/xargs.1#16 integrate
.. //depot/projects/trustedbsd/base/usr.bin/xargs/xargs.c#22 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/adduser/adduser.sh#12 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/arp/arp.8#9 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/arp/arp.c#19 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/bsnmpd/modules/Makefile#2 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/bsnmpd/modules/snmp_hostres/BEGEMOT-HOSTRES-MIB.txt#1 branch
.. //depot/projects/trustedbsd/base/usr.sbin/bsnmpd/modules/snmp_hostres/Makefile#1 branch
.. //depot/projects/trustedbsd/base/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_begemot.c#1 branch
.. //depot/projects/trustedbsd/base/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_device_tbl.c#1 branch
.. //depot/projects/trustedbsd/base/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_diskstorage_tbl.c#1 branch
.. //depot/projects/trustedbsd/base/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_fs_tbl.c#1 branch
.. //depot/projects/trustedbsd/base/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_network_tbl.c#1 branch
.. //depot/projects/trustedbsd/base/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_partition_tbl.c#1 branch
.. //depot/projects/trustedbsd/base/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_printer_tbl.c#1 branch
.. //depot/projects/trustedbsd/base/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_processor_tbl.c#1 branch
.. //depot/projects/trustedbsd/base/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_scalars.c#1 branch
.. //depot/projects/trustedbsd/base/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c#1 branch
.. //depot/projects/trustedbsd/base/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.h#1 branch
.. //depot/projects/trustedbsd/base/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_storage_tbl.c#1 branch
.. //depot/projects/trustedbsd/base/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_swinstalled_tbl.c#1 branch
.. //depot/projects/trustedbsd/base/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_swrun_tbl.c#1 branch
.. //depot/projects/trustedbsd/base/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_tree.def#1 branch
.. //depot/projects/trustedbsd/base/usr.sbin/bsnmpd/modules/snmp_hostres/snmp_hostres.3#1 branch
.. //depot/projects/trustedbsd/base/usr.sbin/btxld/Makefile#4 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/btxld/btxld.c#7 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/config/config.h#9 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/config/config.y#12 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/config/main.c#13 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/config/mkmakefile.c#10 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/config/mkoptions.c#6 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/cron/crontab/crontab.c#4 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/inetd/Makefile#4 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/inetd/inetd.8#12 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/inetd/inetd.c#19 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/inetd/inetd.h#5 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/kbdcontrol/kbdcontrol.1#5 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/kbdmap/kbdmap.c#4 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/kldxref/ef_obj.c#3 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/mixer/mixer.c#8 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/newsyslog/newsyslog.c#25 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/pkg_install/add/add.h#4 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/pkg_install/add/extract.c#10 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/pkg_install/add/main.c#14 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/pkg_install/add/perform.c#8 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/pkg_install/add/pkg_add.1#15 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/pkg_install/create/perform.c#14 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/pkg_install/create/pkg_create.1#13 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/pkg_install/create/pl.c#6 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/pkg_install/info/info.h#7 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/pkg_install/info/main.c#12 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/pkg_install/info/perform.c#7 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/pkg_install/info/pkg_info.1#11 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/pkg_install/info/show.c#12 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/pkg_install/lib/lib.h#12 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/pkg_install/lib/plist.c#10 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/pkg_install/lib/url.c#4 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/portsnap/phttpget/phttpget.c#4 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/portsnap/portsnap/portsnap.8#2 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/portsnap/portsnap/portsnap.sh#2 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/powerd/Makefile#4 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/powerd/powerd.c#6 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/sysinstall/anonFTP.c#5 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/sysinstall/disks.c#20 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/sysinstall/dispatch.c#8 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/sysinstall/install.c#30 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/sysinstall/label.c#24 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/sysinstall/media.c#7 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/sysinstall/menus.c#45 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/sysinstall/sysinstall.8#18 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/sysinstall/sysinstall.h#29 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/sysinstall/tcpip.c#10 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/traceroute6/traceroute6.8#7 integrate
Differences ...
==== //depot/projects/trustedbsd/base/etc/pf.conf#3 (text+ko) ====
@@ -1,4 +1,4 @@
-# $FreeBSD: src/etc/pf.conf,v 1.2 2004/09/14 01:07:18 mlaier Exp $
+# $FreeBSD: src/etc/pf.conf,v 1.3 2006/01/27 17:16:20 mlaier Exp $
# $OpenBSD: pf.conf,v 1.21 2003/09/02 20:38:44 david Exp $
#
# See pf.conf(5) and /usr/share/examples/pf for syntax and examples.
@@ -72,6 +72,10 @@
#pass in on $ext_if proto { tcp, udp } from any to <foo> port 80 keep state
# pass incoming ports for ftp-proxy
+#pass in on $ext_if inet proto tcp from any to $ext_if port > 49151 keep state
+
+# Alternate rule to pass incoming ports for ftp-proxy
+# NOTE: Please see pf.conf(5) BUGS section before using user/group rules.
#pass in on $ext_if inet proto tcp from any to $ext_if user proxy keep state
# assign packets to a queue.
==== //depot/projects/trustedbsd/base/games/fortune/datfiles/fortunes#46 (text+ko) ====
@@ -1,5 +1,5 @@
This fortune brought to you by:
-$FreeBSD: src/games/fortune/datfiles/fortunes,v 1.203 2006/01/21 14:16:01 matteo Exp $
+$FreeBSD: src/games/fortune/datfiles/fortunes,v 1.205 2006/01/28 09:19:20 dds Exp $
%
=======================================================================
@@ -29939,6 +29939,11 @@
what is essential is invisible to the eye.
-- The Fox, 'The Little Prince"
%
+It is perfectly permissible for every system call to fail with [ENOTADUCK]
+unless the first five bytes of the caller's address space contain the
+word "quack".
+ -- Garrett Wollman
+%
It is possible by ingenuity and at the expense of clarity... {to do almost
anything in any language}. However, the fact that it is possible to push
a pea up a mountain with your nose does not mean that this is a sensible
@@ -35390,6 +35395,10 @@
%
Never delay the ending of a meeting or the beginning of a cocktail hour.
%
+Never do programs contain so few bugs as when no debugging tools
+are available.
+ -- Niklaus Wirth
+%
Never do today what you can put off until tomorrow.
%
Never drink Coca-Cola in a moving elevator. The elevator's motion coupled
==== //depot/projects/trustedbsd/base/include/nl_types.h#6 (text+ko) ====
@@ -35,7 +35,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: src/include/nl_types.h,v 1.11 2005/02/27 16:20:53 phantom Exp $
+ * $FreeBSD: src/include/nl_types.h,v 1.12 2006/01/26 20:53:40 stefanf Exp $
*/
#ifndef _NL_TYPES_H_
@@ -97,8 +97,7 @@
__BEGIN_DECLS
nl_catd catopen(const char *, int);
-char *catgets(nl_catd, int, int, const char *)
- __attribute__((__format_arg__(4)));
+char *catgets(nl_catd, int, int, const char *) __format_arg(4);
int catclose(nl_catd);
__END_DECLS
==== //depot/projects/trustedbsd/base/include/stdio.h#14 (text+ko) ====
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)stdio.h 8.5 (Berkeley) 4/29/95
- * $FreeBSD: src/include/stdio.h,v 1.56 2004/06/20 10:01:30 tjr Exp $
+ * $FreeBSD: src/include/stdio.h,v 1.57 2006/01/26 20:53:40 stefanf Exp $
*/
#ifndef _STDIO_H_
@@ -328,12 +328,7 @@
int asprintf(char **, const char *, ...) __printflike(2, 3);
char *ctermid_r(char *);
char *fgetln(FILE *, size_t *);
-#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ >= 3
-#define __ATTR_FORMAT_ARG __attribute__((__format_arg__(2)))
-#else
-#define __ATTR_FORMAT_ARG
-#endif
-__const char *fmtcheck(const char *, const char *) __ATTR_FORMAT_ARG;
+__const char *fmtcheck(const char *, const char *) __format_arg(2);
int fpurge(FILE *);
void setbuffer(FILE *, char *, int);
int setlinebuf(FILE *);
==== //depot/projects/trustedbsd/base/lib/libc/stdlib/malloc.c#22 (text+ko) ====
@@ -133,10 +133,19 @@
/******************************************************************************/
-#define MALLOC_DEBUG
+/*
+ * In order to disable various extra features that may have negative
+ * performance impacts, (assertions, expanded statistics, redzones), define
+ * NO_MALLOC_EXTRAS.
+ */
+/* #define NO_MALLOC_EXTRAS */
+
+#ifndef NO_MALLOC_EXTRAS
+# define MALLOC_DEBUG
+#endif
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/malloc.c,v 1.106 2006/01/26 08:11:23 jasone Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/stdlib/malloc.c,v 1.110 2006/01/27 07:46:22 jasone Exp $");
#include "libc_private.h"
#ifdef MALLOC_DEBUG
@@ -176,13 +185,16 @@
* Calculate statistics that can be used to get an idea of how well caching is
* working.
*/
-#define MALLOC_STATS
-#define MALLOC_STATS_ARENAS
+#ifndef NO_MALLOC_EXTRAS
+# define MALLOC_STATS
+#endif
/*
* Include redzones before/after every region, and check for buffer overflows.
*/
-#define MALLOC_REDZONES
+#ifndef NO_MALLOC_EXTRAS
+# define MALLOC_REDZONES
+#endif
#ifdef MALLOC_REDZONES
# define MALLOC_RED_2POW 4
# define MALLOC_RED ((size_t)(1 << MALLOC_RED_2POW))
@@ -298,10 +310,10 @@
uint64_t nrequests;
/*
- * Number of best-fit allocations that were successfully serviced by
+ * Number of exact-fit allocations that were successfully serviced by
* this bin.
*/
- uint64_t nfit;
+ uint64_t nserviced;
/* High-water marks for this bin. */
unsigned long highcached;
@@ -311,7 +323,7 @@
* during normal operation, so is maintained here in order to allow
* calculating the high water mark.
*/
- unsigned nregions;
+ unsigned long curcached;
};
typedef struct arena_stats_s arena_stats_t;
@@ -349,11 +361,8 @@
/* Frag statistics. */
struct {
- /*
- * Number of times a region is cached in the "frag" field of
- * the arena.
- */
- uint64_t ncached;
+ /* Number of times the "frag" field of the arena is refilled. */
+ uint64_t nrefills;
/*
* Number of times a region is requested from the "frag" field
@@ -377,16 +386,10 @@
uint64_t nrequests;
/*
- * Number of best-fit allocations that were successfully
+ * Number of allocation requests that were successfully
* serviced by large_regions.
*/
- uint64_t nfit;
-
- /*
- * Number of allocation requests that were successfully serviced
- * large_regions, but that a bin could have serviced.
- */
- uint64_t noverfit;
+ uint64_t nserviced;
/*
* High-water mark for large_regions (number of nodes in tree).
@@ -1176,7 +1179,7 @@
stats_arenas->split.nserviced += arena->stats.split.nserviced;
/* Frag. */
- stats_arenas->frag.ncached += arena->stats.frag.ncached;
+ stats_arenas->frag.nrefills += arena->stats.frag.nrefills;
stats_arenas->frag.nrequests += arena->stats.frag.nrequests;
stats_arenas->frag.nserviced += arena->stats.frag.nserviced;
@@ -1184,18 +1187,20 @@
for (i = 0; i < NBINS; i++) {
stats_arenas->bins[i].nrequests +=
arena->stats.bins[i].nrequests;
- stats_arenas->bins[i].nfit += arena->stats.bins[i].nfit;
+ stats_arenas->bins[i].nserviced +=
+ arena->stats.bins[i].nserviced;
if (arena->stats.bins[i].highcached
> stats_arenas->bins[i].highcached) {
stats_arenas->bins[i].highcached
= arena->stats.bins[i].highcached;
}
+ stats_arenas->bins[i].curcached
+ += arena->stats.bins[i].curcached;
}
/* large and large_regions. */
stats_arenas->large.nrequests += arena->stats.large.nrequests;
- stats_arenas->large.nfit += arena->stats.large.nfit;
- stats_arenas->large.noverfit += arena->stats.large.noverfit;
+ stats_arenas->large.nserviced += arena->stats.large.nserviced;
if (arena->stats.large.highcached > stats_arenas->large.highcached)
stats_arenas->large.highcached = arena->stats.large.highcached;
stats_arenas->large.curcached += arena->stats.large.curcached;
@@ -1227,28 +1232,29 @@
stats_arenas->split.nserviced);
malloc_printf("cached frag usage:\n");
- malloc_printf(" %13s%13s%13s\n", "ncached", "nrequests", "nserviced");
- malloc_printf(" %13llu%13llu%13llu\n", stats_arenas->frag.ncached,
+ malloc_printf(" %13s%13s%13s\n", "nrefills", "nrequests", "nserviced");
+ malloc_printf(" %13llu%13llu%13llu\n", stats_arenas->frag.nrefills,
stats_arenas->frag.nrequests, stats_arenas->frag.nserviced);
malloc_printf("bins:\n");
- malloc_printf(" %4s%7s%13s%13s%11s\n", "bin",
- "size", "nrequests", "nfit", "highcached");
+ malloc_printf(" %4s%7s%13s%13s%11s%11s\n", "bin",
+ "size", "nrequests", "nserviced", "highcached", "curcached");
for (i = 0; i < NBINS; i++) {
malloc_printf(
- " %4u%7u%13llu%13llu%11lu\n",
+ " %4u%7u%13llu%13llu%11lu%11lu\n",
i, ((i + bin_shift) << opt_quantum_2pow),
- stats_arenas->bins[i].nrequests, stats_arenas->bins[i].nfit,
- stats_arenas->bins[i].highcached);
+ stats_arenas->bins[i].nrequests,
+ stats_arenas->bins[i].nserviced,
+ stats_arenas->bins[i].highcached,
+ stats_arenas->bins[i].curcached);
}
malloc_printf("large:\n");
- malloc_printf(" %13s%13s%13s%13s%13s\n", "nrequests", "nfit",
- "noverfit", "highcached", "curcached");
- malloc_printf(" %13llu%13llu%13llu%13lu%13lu\n",
- stats_arenas->large.nrequests, stats_arenas->large.nfit,
- stats_arenas->large.noverfit, stats_arenas->large.highcached,
- stats_arenas->large.curcached);
+ malloc_printf(" %13s%13s%13s%13s\n", "nrequests", "nserviced",
+ "highcached", "curcached");
+ malloc_printf(" %13llu%13llu%13lu%13lu\n",
+ stats_arenas->large.nrequests, stats_arenas->large.nserviced,
+ stats_arenas->large.highcached, stats_arenas->large.curcached);
malloc_printf("huge\n");
malloc_printf(" %13s\n", "nrequests");
@@ -1630,16 +1636,14 @@
static unsigned
arena_bins_search(arena_t *arena, size_t size)
{
- unsigned ret, minbin, i;
+ unsigned minbin, i;
int bit;
assert(QUANTUM_CEILING(size) == size);
assert((size >> opt_quantum_2pow) >= bin_shift);
- if (size > bin_maxsize) {
- ret = UINT_MAX;
- goto RETURN;
- }
+ if (size > bin_maxsize)
+ return (UINT_MAX);
minbin = (size >> opt_quantum_2pow) - bin_shift;
assert(minbin < NBINS);
@@ -1648,14 +1652,11 @@
& (UINT_MAX << (minbin % (sizeof(int) << 3))));
if (bit != 0) {
/* Usable allocation found. */
- ret = (i * (sizeof(int) << 3)) + bit - 1;
- goto RETURN;
+ return ((i * (sizeof(int) << 3)) + bit - 1);
}
}
- ret = UINT_MAX;
-RETURN:
- return (ret);
+ return (UINT_MAX);
}
static __inline void
@@ -1715,7 +1716,7 @@
qr_remove(reg, next.u.s.link);
#ifdef MALLOC_STATS
- arena->stats.bins[bin].nregions--;
+ arena->stats.bins[bin].curcached--;
#endif
if (qr_next(&tbin->regions, next.u.s.link) == &tbin->regions)
arena_mask_unset(arena, bin);
@@ -2066,12 +2067,12 @@
qr_new(reg, next.u.s.link);
qr_before_insert(&tbin->regions, reg, next.u.s.link);
#ifdef MALLOC_STATS
- arena->stats.bins[bin].nregions++;
+ arena->stats.bins[bin].curcached++;
- if (arena->stats.bins[bin].nregions
+ if (arena->stats.bins[bin].curcached
> arena->stats.bins[bin].highcached) {
arena->stats.bins[bin].highcached
- = arena->stats.bins[bin].nregions;
+ = arena->stats.bins[bin].curcached;
}
#endif
}
@@ -2096,12 +2097,12 @@
qr_new(reg, next.u.s.link);
qr_after_insert(&tbin->regions, reg, next.u.s.link);
#ifdef MALLOC_STATS
- arena->stats.bins[bin].nregions++;
+ arena->stats.bins[bin].curcached++;
- if (arena->stats.bins[bin].nregions
+ if (arena->stats.bins[bin].curcached
> arena->stats.bins[bin].highcached) {
arena->stats.bins[bin].highcached
- = arena->stats.bins[bin].nregions;
+ = arena->stats.bins[bin].curcached;
}
#endif
}
@@ -2123,7 +2124,7 @@
== ((bin + bin_shift) << opt_quantum_2pow));
qr_remove(ret, next.u.s.link);
#ifdef MALLOC_STATS
- arena->stats.bins[bin].nregions--;
+ arena->stats.bins[bin].curcached--;
#endif
if (qr_next(&tbin->regions, next.u.s.link) == &tbin->regions)
arena_mask_unset(arena, bin);
@@ -2479,7 +2480,7 @@
frag = node->reg;
#ifdef MALLOC_STATS
- arena->stats.frag.ncached++;
+ arena->stats.frag.nrefills++;
#endif
assert(region_next_free_get(&frag->sep));
region_next_free_unset(&frag->sep);
@@ -2499,7 +2500,7 @@
/* Use the smallest available region. */
arena->frag = arena_bin_pop(arena, bin);
#ifdef MALLOC_STATS
- arena->stats.frag.ncached++;
+ arena->stats.frag.nrefills++;
#endif
total_size =
region_next_size_get(&arena->frag->sep);
@@ -2651,139 +2652,103 @@
static region_t *
arena_split_reg_alloc(arena_t *arena, size_t size, bool fit)
{
- region_t *ret;
+
+ if (arena->split == NULL)
+ return (NULL);
- if (arena->split != NULL) {
#ifdef MALLOC_STATS
- arena->stats.split.nrequests++;
+ arena->stats.split.nrequests++;
#endif
+ if (region_next_size_get(&arena->split->sep) >= size) {
+ region_t *ret;
- if (region_next_size_get(&arena->split->sep) >= size) {
- if (fit) {
- size_t total_size;
+ if (fit) {
+ size_t total_size;
- /*
- * Use split, but try to use the beginning for
- * smaller regions, and the end for larger
- * regions. This reduces fragmentation in some
- * pathological use cases. It tends to group
- * short-lived (smaller) regions, which
- * increases the effectiveness of coalescing.
- */
+ /*
+ * Use split, but try to use the beginning for smaller
+ * regions, and the end for larger regions. This
+ * reduces fragmentation in some pathological use
+ * cases. It tends to group short-lived (smaller)
+ * regions, which increases the effectiveness of
+ * coalescing.
+ */
- total_size =
- region_next_size_get(&arena->split->sep);
- assert(size % quantum == 0);
+ total_size = region_next_size_get(&arena->split->sep);
+ assert(size % quantum == 0);
- if (total_size - size >= QUANTUM_CEILING(
- sizeof(region_small_sizer_t))) {
- if (size <= bin_maxsize) {
- region_t *next;
-
- /*
- * Carve space from the
- * beginning of split.
- */
-
- /* ret. */
- ret = arena->split;
- region_next_size_set(&ret->sep,
- size);
- assert(region_next_free_get(
- &ret->sep) == false);
-
- /* next. */
- next = (region_t *)&((char *)
- ret)[size];
- region_next_size_set(&next->sep,
- total_size - size);
- assert(size >=
- QUANTUM_CEILING(sizeof(
- region_small_sizer_t)));
- region_prev_free_unset(
- &next->sep);
- region_next_free_unset(
- &next->sep);
-
- /* Update split. */
- arena->split = next;
- } else {
- region_t *prev;
- size_t prev_size;
-
- /*
- * Carve space from the end of
- * split.
- */
-
- /* prev. */
- prev_size = total_size - size;
- prev = arena->split;
- region_next_size_set(&prev->sep,
- prev_size);
- assert(prev_size >=
- QUANTUM_CEILING(sizeof(
- region_small_sizer_t)));
- assert(region_next_free_get(
- &prev->sep) == false);
-
- /* ret. */
- ret = (region_t *)&((char *)
- prev)[prev_size];
- region_next_size_set(&ret->sep,
- size);
- region_prev_free_unset(
- &ret->sep);
- region_next_free_unset(
- &ret->sep);
-
-#ifdef MALLOC_DEBUG
- {
+ if (total_size - size >=
+ QUANTUM_CEILING(sizeof(region_small_sizer_t))) {
+ if (size <= bin_maxsize) {
region_t *next;
- /* next. */
- next = (region_t *)&((char *) ret)
- [region_next_size_get(&ret->sep)];
- assert(region_prev_free_get(&next->sep)
- == false);
- }
-#endif
- }
-#ifdef MALLOC_STATS
- arena->stats.nsplit++;
-#endif
- } else {
/*
- * split is close enough to the right
- * size that there isn't enough room to
- * create a neighboring region.
+ * Carve space from the beginning of
+ * split.
*/
/* ret. */
ret = arena->split;
- arena->split = NULL;
+ region_next_size_set(&ret->sep, size);
assert(region_next_free_get(&ret->sep)
== false);
+ /* next. */
+ next = (region_t *)&((char *)ret)[size];
+ region_next_size_set(&next->sep,
+ total_size - size);
+ assert(size >= QUANTUM_CEILING(sizeof(
+ region_small_sizer_t)));
+ region_prev_free_unset(&next->sep);
+ region_next_free_unset(&next->sep);
+
+ /* Update split. */
+ arena->split = next;
+ } else {
+ region_t *prev;
+ size_t prev_size;
+
+ /* Carve space from the end of split. */
+
+ /* prev. */
+ prev_size = total_size - size;
+ prev = arena->split;
+ region_next_size_set(&prev->sep,
+ prev_size);
+ assert(prev_size >=
+ QUANTUM_CEILING(sizeof(
+ region_small_sizer_t)));
+ assert(region_next_free_get(
+ &prev->sep) == false);
+
+ /* ret. */
+ ret = (region_t *)&((char *)
+ prev)[prev_size];
+ region_next_size_set(&ret->sep, size);
+ region_prev_free_unset(&ret->sep);
+ region_next_free_unset(&ret->sep);
+
#ifdef MALLOC_DEBUG
{
- region_t *next;
+ region_t *next;
- /* next. */
- next = (region_t *)&((char *)
- ret)[region_next_size_get(
- &ret->sep)];
- assert(region_prev_free_get(
- &next->sep) == false);
+ /* next. */
+ next = (region_t *)&((char *)ret)
+ [region_next_size_get(&ret->sep)];
+ assert(region_prev_free_get(&next->sep)
+ == false);
}
#endif
}
-
#ifdef MALLOC_STATS
- arena->stats.split.nserviced++;
+ arena->stats.nsplit++;
#endif
} else {
- /* Don't fit to the allocation size. */
+ /*
+ * Split is close enough to the right size that
+ * there isn't enough room to create a
+ * neighboring region.
+ */
/* ret. */
ret = arena->split;
@@ -2796,35 +2761,59 @@
region_t *next;
/* next. */
- next = (region_t *) &((char *) ret)
- [region_next_size_get(&ret->sep)];
+ next = (region_t *)&((char *)
+ ret)[region_next_size_get(
+ &ret->sep)];
assert(region_prev_free_get(&next->sep)
== false);
}
#endif
}
- region_next_contig_set(&ret->sep);
- goto RETURN;
- } else if (size <= bin_maxsize) {
- region_t *reg;
+#ifdef MALLOC_STATS
+ arena->stats.split.nserviced++;
+#endif
+ } else {
+ /* Don't fit to the allocation size. */
+
+ /* ret. */
+ ret = arena->split;
+ arena->split = NULL;
+ assert(region_next_free_get(&ret->sep) == false);
+
+#ifdef MALLOC_DEBUG
+ {
+ region_t *next;
+
+ /* next. */
+ next = (region_t *) &((char *) ret)
+ [region_next_size_get(&ret->sep)];
+ assert(region_prev_free_get(&next->sep)
+ == false);
+ }
+#endif
+ }
+ region_next_contig_set(&ret->sep);
+ return (ret);
+ }
+ /* If we get here, split has failed to service the request. */
+
+ if (size <= bin_maxsize) {
+ region_t *reg;
- /*
- * The split region is too small to service a small
- * request. Clear split.
- */
+ /*
+ * The split region is too small to service a small request.
+ * Clear split.
+ */
- reg = arena->split;
- region_next_contig_set(®->sep);
+ reg = arena->split;
+ region_next_contig_set(®->sep);
- arena->split = NULL;
+ arena->split = NULL;
- arena_delay_cache(arena, reg);
- }
+ arena_delay_cache(arena, reg);
}
- ret = NULL;
-RETURN:
- return (ret);
+ return (NULL);
}
/*
@@ -2884,7 +2873,6 @@
} else
arena_mru_cache(arena, next, next_size);
}
-
#ifdef MALLOC_STATS
arena->stats.nsplit++;
#endif
@@ -2911,19 +2899,17 @@
ret = arena_bin_pop(arena, bin);
assert(region_next_size_get(&ret->sep) >= size);
#ifdef MALLOC_STATS
- arena->stats.bins[bin].nfit++;
+ arena->stats.bins[bin].nserviced++;
#endif
- goto RETURN;
+ return (ret);
}
/* Look at frag to see whether it's large enough. */
ret = arena_frag_reg_alloc(arena, size, fit);
if (ret != NULL)
- goto RETURN;
+ return (ret);
- ret = NULL;
-RETURN:
- return (ret);
+ return (NULL);
}
/* Look in large_regions for a large enough region. */
@@ -2943,10 +2929,8 @@
region_next_size_set(&key.sep, size);
node = RB_NFIND(region_tree_s, &arena->large_regions,
&key.next.u.l.node);
- if (node == NULL) {
- ret = NULL;
- goto RETURN;
- }
+ if (node == NULL)
+ return (NULL);
/* Cached large region found. */
ret = node->reg;
@@ -2967,13 +2951,9 @@
arena_reg_fit(arena, size, ret, false);
#ifdef MALLOC_STATS
- if (size > bin_maxsize)
- arena->stats.large.nfit++;
- else
- arena->stats.large.noverfit++;
+ arena->stats.large.nserviced++;
#endif
-RETURN:
return (ret);
}
@@ -2985,10 +2965,8 @@
chunk_node_t *chunk;
chunk = chunk_alloc(chunk_size);
- if (chunk == NULL) {
- ret = NULL;
- goto RETURN;
- }
+ if (chunk == NULL)
+ return (NULL);
#ifdef MALLOC_DEBUG
{
@@ -3042,7 +3020,6 @@
if (fit)
arena_reg_fit(arena, size, ret, (arena->split == NULL));
-RETURN:
return (ret);
}
@@ -3063,16 +3040,16 @@
if (size <= bin_maxsize) {
ret = arena_bin_reg_alloc(arena, size, fit);
if (ret != NULL)
- goto RETURN;
+ return (ret);
}
ret = arena_large_reg_alloc(arena, size, fit);
if (ret != NULL)
- goto RETURN;
+ return (ret);
ret = arena_split_reg_alloc(arena, size, fit);
if (ret != NULL)
- goto RETURN;
+ return (ret);
/*
* Only try allocating from frag here if size is large, since
@@ -3082,16 +3059,14 @@
if (size > bin_maxsize) {
ret = arena_frag_reg_alloc(arena, size, fit);
if (ret != NULL)
- goto RETURN;
+ return (ret);
}
ret = arena_chunk_reg_alloc(arena, size, fit);
if (ret != NULL)
- goto RETURN;
+ return (ret);
- ret = NULL;
-RETURN:
- return (ret);
+ return (NULL);
}
static void *
@@ -3109,8 +3084,7 @@
quantum_size = region_ceiling(size);
if (quantum_size < size) {
/* size is large enough to cause size_t wrap-around. */
- ret = NULL;
>>> TRUNCATED FOR MAIL (1000 lines) <<<
To Unsubscribe: send mail to majordomo at trustedbsd.org
with "unsubscribe trustedbsd-cvs" in the body of the message
More information about the trustedbsd-cvs
mailing list