Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Jun 2006 13:34:42 GMT
From:      Michael Bushkov <bushman@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 99810 for review
Message-ID:  <200606221334.k5MDYgwM065831@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=99810

Change 99810 by bushman@bushman_nss_ldap_cached on 2006/06/22 13:33:56

	IFC

Affected files ...

.. //depot/projects/soc2006/nss_ldap_cached/src/etc/rc.d/abi#2 integrate
.. //depot/projects/soc2006/nss_ldap_cached/src/etc/rc.d/ldconfig#2 integrate
.. //depot/projects/soc2006/nss_ldap_cached/src/etc/rc.subr#2 integrate
.. //depot/projects/soc2006/nss_ldap_cached/src/lib/libc/stdlib/malloc.c#2 integrate
.. //depot/projects/soc2006/nss_ldap_cached/src/lib/libc/sys/mincore.2#2 integrate
.. //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/asf/asf.c#3 integrate

Differences ...

==== //depot/projects/soc2006/nss_ldap_cached/src/etc/rc.d/abi#2 (text+ko) ====

@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $FreeBSD: src/etc/rc.d/abi,v 1.8 2006/02/19 08:18:48 dougb Exp $
+# $FreeBSD: src/etc/rc.d/abi,v 1.9 2006/06/21 09:53:25 yar Exp $
 #
 
 # PROVIDE: abi
@@ -16,17 +16,15 @@
 sysv_start()
 {
 	echo -n ' sysvipc'
-	kldload sysvmsg >/dev/null 2>&1
-	kldload sysvsem >/dev/null 2>&1
-	kldload sysvshm >/dev/null 2>&1
+	load_kld sysvmsg
+	load_kld sysvsem
+	load_kld sysvshm
 }
 
 linux_start()
 {
 	echo -n ' linux'
-	if ! kldstat -v | grep -E 'linux(aout|elf)' > /dev/null; then
-		kldload linux > /dev/null 2>&1
-	fi
+	load_kld -e 'linux(aout|elf)' linux
 	if [ -x /compat/linux/sbin/ldconfigDisabled ]; then
 		_tmpdir=`mktemp -d -t linux-ldconfig`
 		/compat/linux/sbin/ldconfig -C ${_tmpdir}/ld.so.cache
@@ -40,7 +38,7 @@
 svr4_start()
 {
 	echo -n ' svr4'
-	kldload svr4 > /dev/null 2>&1
+	load_kld -m svr4elf svr4
 }
 
 abi_prestart()

==== //depot/projects/soc2006/nss_ldap_cached/src/etc/rc.d/ldconfig#2 (text+ko) ====

@@ -1,7 +1,7 @@
 #!/bin/sh
 #
 # $NetBSD: ldconfig,v 1.5 2002/03/22 04:33:58 thorpej Exp $
-# $FreeBSD: src/etc/rc.d/ldconfig,v 1.15 2006/01/08 10:15:30 dougb Exp $
+# $FreeBSD: src/etc/rc.d/ldconfig,v 1.16 2006/06/21 10:22:44 flz Exp $
 #
 
 # PROVIDE: ldconfig
@@ -17,6 +17,8 @@
 
 ldconfig_start()
 {
+	local _files
+
 	_ins=
 	ldconfig=${ldconfig_command}
 	checkyesno ldconfig_insecure && _ins="-i"
@@ -24,7 +26,10 @@
 		_LDC="/lib /usr/lib"
 		for i in ${ldconfig_local_dirs}; do
 			if [ -d "${i}" ]; then
-				ldconfig_paths="${ldconfig_paths} `find ${i} -type f`"
+				_files=`find ${i} -type f`
+				if [ -n "${_files}" ]; then
+					ldconfig_paths="${ldconfig_paths} `cat ${_files} | sort -u`"
+				fi
 			fi
 		done
 		for i in ${ldconfig_paths} /etc/ld-elf.so.conf; do
@@ -39,7 +44,10 @@
 		amd64)
 			for i in ${ldconfig_local32_dirs}; do
 				if [ -d "${i}" ]; then
-					ldconfig32_paths="${ldconfig32_paths} `find ${i} -type f`"
+					_files=`find ${i} -type f`
+					if [ -n "${_files}" ]; then
+						ldconfig32_paths="${ldconfig32_paths} `cat ${_files} | sort -u`"
+					fi
 				fi
 			done
 			echo '32-bit compatibility ldconfig path:' ${ldconfig32_paths}

==== //depot/projects/soc2006/nss_ldap_cached/src/etc/rc.subr#2 (text+ko) ====

@@ -1,5 +1,5 @@
 # $NetBSD: rc.subr,v 1.66 2006/04/01 10:05:50 he Exp $
-# $FreeBSD: src/etc/rc.subr,v 1.58 2006/05/18 16:04:56 flz Exp $
+# $FreeBSD: src/etc/rc.subr,v 1.59 2006/06/21 09:42:55 yar Exp $
 #
 # Copyright (c) 1997-2004 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1356,6 +1356,45 @@
 	/sbin/mdmfs $flags -s $1 md $2
 }
 
+# Code common to scripts that need to load a kernel module
+# if it isn't in the kernel yet. Syntax:
+#   load_kld [-e regexp] [-m modname] filename
+# where -e or -m chooses the way to check if the module
+# is already loaded:
+#   regexp is egrep'd in the output from `kldstat -v',
+#   modname is passed to `kldstat -m'.
+# The default way is as though `-m filename' were specified.
+load_kld()
+{
+	local _loaded _mod _opt _re
+
+	while getopts "e:m:" _opt; do
+		case "$_opt" in
+		e) _re="$OPTARG" ;;
+		m) _mod="$OPTARG" ;;
+		esac
+	done
+	shift $(($OPTIND - 1))
+	_mod=${_mod:-$1}
+	_loaded=false
+	if [ -n "$_re" ]; then
+		if kldstat -v | egrep -q -e "$_re"; then
+			_loaded=true
+		fi
+	else
+		if kldstat -q -m "$_mod"; then
+			_loaded=true
+		fi
+	fi
+	if ! $_loaded; then
+		if ! kldload "$1"; then
+			warn "Unable to load kernel module $1"
+			return 1
+		fi
+	fi
+	return 0
+}
+
 # ltr str src dst
 #	Change every $src in $str to $dst.
 #	Useful when /usr is not yet mounted and we cannot use tr(1), sed(1) nor

==== //depot/projects/soc2006/nss_ldap_cached/src/lib/libc/stdlib/malloc.c#2 (text+ko) ====

@@ -185,7 +185,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/malloc.c,v 1.126 2006/05/10 00:07:45 jasone Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/stdlib/malloc.c,v 1.127 2006/06/20 20:38:25 jasone Exp $");
 
 #include "libc_private.h"
 #ifdef MALLOC_DEBUG
@@ -1318,6 +1318,7 @@
 chunk_dealloc(void *chunk, size_t size)
 {
 	size_t offset;
+	chunk_node_t key;
 	chunk_node_t *node;
 
 	assert(chunk != NULL);
@@ -1364,13 +1365,21 @@
 	 * if memory usage increases later on.
 	 */
 	for (offset = 0; offset < size; offset += chunk_size) {
-		node = base_chunk_node_alloc();
-		if (node == NULL)
-			break;
+		/*
+		 * It is possible for chunk to overlap existing entries in
+		 * old_chunks if it is a huge allocation, so take care to not
+		 * leak tree nodes.
+		 */
+		key.chunk = (void *)((uintptr_t)chunk + (uintptr_t)offset);
+		if (RB_FIND(chunk_tree_s, &old_chunks, &key) == NULL) {
+			node = base_chunk_node_alloc();
+			if (node == NULL)
+				break;
 
-		node->chunk = (void *)((uintptr_t)chunk + (uintptr_t)offset);
-		node->size = chunk_size;
-		RB_INSERT(chunk_tree_s, &old_chunks, node);
+			node->chunk = key.chunk;
+			node->size = chunk_size;
+			RB_INSERT(chunk_tree_s, &old_chunks, node);
+		}
 	}
 
 #ifdef USE_BRK
@@ -1621,6 +1630,9 @@
 		QUANTUM_CASE(31)
 		QUANTUM_CASE(32)
 
+#if (QUANTUM_2POW_MIN <= 3)
+		POW2_CASE(9)
+#endif
 		POW2_CASE(10)
 		POW2_CASE(11)
 		POW2_CASE(12) /* Handle up to 8 kB pages. */
@@ -2548,7 +2560,7 @@
 		return (NULL);
 	}
 
-	/* Insert node into chunks. */
+	/* Insert node into huge. */
 	node->chunk = ret;
 	node->size = csize;
 
@@ -2736,7 +2748,7 @@
 				}
 			}
 
-			/* Insert node into chunks. */
+			/* Insert node into huge. */
 			node->chunk = ret;
 			node->size = chunksize;
 

==== //depot/projects/soc2006/nss_ldap_cached/src/lib/libc/sys/mincore.2#2 (text+ko) ====

@@ -30,7 +30,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)mincore.2	8.1 (Berkeley) 6/9/93
-.\" $FreeBSD: src/lib/libc/sys/mincore.2,v 1.24 2003/09/08 19:57:16 ru Exp $
+.\" $FreeBSD: src/lib/libc/sys/mincore.2,v 1.25 2006/06/21 12:59:05 kib Exp $
 .\"
 .Dd January 17, 2003
 .Dt MINCORE 2
@@ -92,12 +92,12 @@
 .Fn mincore
 system call will fail if:
 .Bl -tag -width Er
-.It Bq Er EINVAL
+.It Bq Er ENOMEM
 The virtual address range specified by the
 .Fa addr
 and
 .Fa len
-arguments is not valid.
+arguments is not fully mapped.
 .It Bq Er EFAULT
 The
 .Fa vec

==== //depot/projects/soc2006/nss_ldap_cached/src/usr.sbin/asf/asf.c#3 (text+ko) ====

@@ -26,7 +26,7 @@
 /* $Id: asf.c,v 1.4 2003/05/04 02:55:20 grog Exp grog $ */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/usr.sbin/asf/asf.c,v 1.9 2006/06/18 11:14:40 yar Exp $");
+__FBSDID("$FreeBSD: src/usr.sbin/asf/asf.c,v 1.10 2006/06/19 17:12:25 yar Exp $");
 
 #include <sys/types.h>
 #include <sys/queue.h>
@@ -266,7 +266,7 @@
 	"\t-V\tuse kvm(3) to get the list of modules\n"
 	"\t-X\tappend suffix to list of possible module file name suffixes\n"
 	"\t-x\tclear list of possible module file name suffixes\n",
-	myname, strlen(myname), "");
+	myname, (int)strlen(myname), "");
     exit(2);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200606221334.k5MDYgwM065831>