Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Dec 2007 20:08:40 GMT
From:      Peter Wemm <peter@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 131803 for review
Message-ID:  <200712272008.lBRK8erV063622@repoman.freebsd.org>

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

Change 131803 by peter@peter_melody on 2007/12/27 20:08:23

	IFC @131796

Affected files ...

.. //depot/projects/hammer/bin/cp/cp.c#14 integrate
.. //depot/projects/hammer/bin/mv/mv.c#11 integrate
.. //depot/projects/hammer/games/fortune/datfiles/fortunes#74 integrate
.. //depot/projects/hammer/sbin/Makefile#47 integrate
.. //depot/projects/hammer/sbin/ddb/Makefile#1 branch
.. //depot/projects/hammer/sbin/ddb/ddb.8#1 branch
.. //depot/projects/hammer/sbin/ddb/ddb.c#1 branch
.. //depot/projects/hammer/sbin/ddb/ddb.h#1 branch
.. //depot/projects/hammer/sbin/ddb/ddb_script.c#1 branch
.. //depot/projects/hammer/sbin/savecore/savecore.8#9 integrate
.. //depot/projects/hammer/sbin/savecore/savecore.c#15 integrate
.. //depot/projects/hammer/share/colldef/Makefile#19 integrate
.. //depot/projects/hammer/share/colldef/README#2 integrate
.. //depot/projects/hammer/share/colldef/map.ISO8859-9#1 branch
.. //depot/projects/hammer/share/colldef/tr_TR.ISO8859-9.src#1 branch
.. //depot/projects/hammer/share/man/man4/Makefile#100 integrate
.. //depot/projects/hammer/share/man/man4/bge.4#25 integrate
.. //depot/projects/hammer/share/man/man4/ddb.4#12 integrate
.. //depot/projects/hammer/share/man/man4/textdump.4#1 branch
.. //depot/projects/hammer/share/mklocale/Makefile#17 integrate
.. //depot/projects/hammer/share/mklocale/tr_TR.ISO8859-9.src#1 branch
.. //depot/projects/hammer/share/timedef/tr_TR.ISO8859-9.src#2 integrate
.. //depot/projects/hammer/share/timedef/tr_TR.UTF-8.src#2 integrate
.. //depot/projects/hammer/sys/amd64/amd64/machdep.c#164 integrate
.. //depot/projects/hammer/sys/amd64/amd64/mp_watchdog.c#8 integrate
.. //depot/projects/hammer/sys/amd64/include/vmparam.h#26 integrate
.. //depot/projects/hammer/sys/arm/at91/uart_dev_at91usart.c#8 integrate
.. //depot/projects/hammer/sys/arm/include/vmparam.h#10 integrate
.. //depot/projects/hammer/sys/boot/powerpc/ofw/Makefile#2 integrate
.. //depot/projects/hammer/sys/cam/scsi/scsi_low.h#5 integrate
.. //depot/projects/hammer/sys/compat/ndis/subr_ntoskrnl.c#47 integrate
.. //depot/projects/hammer/sys/conf/NOTES#134 integrate
.. //depot/projects/hammer/sys/conf/files#169 integrate
.. //depot/projects/hammer/sys/conf/files.i386#88 integrate
.. //depot/projects/hammer/sys/conf/options#120 integrate
.. //depot/projects/hammer/sys/ddb/db_capture.c#1 branch
.. //depot/projects/hammer/sys/ddb/db_command.c#21 integrate
.. //depot/projects/hammer/sys/ddb/db_command.h#3 integrate
.. //depot/projects/hammer/sys/ddb/db_input.c#7 integrate
.. //depot/projects/hammer/sys/ddb/db_lex.c#4 integrate
.. //depot/projects/hammer/sys/ddb/db_lex.h#3 integrate
.. //depot/projects/hammer/sys/ddb/db_main.c#5 integrate
.. //depot/projects/hammer/sys/ddb/db_output.c#10 integrate
.. //depot/projects/hammer/sys/ddb/db_script.c#1 branch
.. //depot/projects/hammer/sys/ddb/db_textdump.c#1 branch
.. //depot/projects/hammer/sys/ddb/ddb.h#15 integrate
.. //depot/projects/hammer/sys/dev/acpica/Osd/OsdDebug.c#10 integrate
.. //depot/projects/hammer/sys/dev/acpica/acpi_thermal.c#31 integrate
.. //depot/projects/hammer/sys/dev/bge/if_bge.c#77 integrate
.. //depot/projects/hammer/sys/dev/bge/if_bgereg.h#40 integrate
.. //depot/projects/hammer/sys/dev/dcons/dcons_os.c#14 integrate
.. //depot/projects/hammer/sys/dev/ofw/ofw_console.c#22 integrate
.. //depot/projects/hammer/sys/dev/pci/pci_user.c#15 integrate
.. //depot/projects/hammer/sys/dev/sio/sio.c#58 integrate
.. //depot/projects/hammer/sys/dev/snp/snp.c#25 integrate
.. //depot/projects/hammer/sys/dev/syscons/syscons.c#42 integrate
.. //depot/projects/hammer/sys/dev/uart/uart_core.c#18 integrate
.. //depot/projects/hammer/sys/dev/usb/ums.c#24 integrate
.. //depot/projects/hammer/sys/fs/unionfs/union_subr.c#25 integrate
.. //depot/projects/hammer/sys/i386/conf/GENERIC.hints#10 integrate
.. //depot/projects/hammer/sys/i386/i386/machdep.c#84 integrate
.. //depot/projects/hammer/sys/i386/i386/mp_watchdog.c#6 integrate
.. //depot/projects/hammer/sys/i386/include/vmparam.h#13 integrate
.. //depot/projects/hammer/sys/ia64/ia64/machdep.c#66 integrate
.. //depot/projects/hammer/sys/ia64/include/vmparam.h#14 integrate
.. //depot/projects/hammer/sys/kern/kern_clock.c#44 integrate
.. //depot/projects/hammer/sys/kern/kern_shutdown.c#48 integrate
.. //depot/projects/hammer/sys/kern/subr_kdb.c#21 integrate
.. //depot/projects/hammer/sys/kern/subr_witness.c#67 integrate
.. //depot/projects/hammer/sys/kern/tty_cons.c#24 integrate
.. //depot/projects/hammer/sys/kern/vfs_bio.c#80 integrate
.. //depot/projects/hammer/sys/kern/vfs_mount.c#85 integrate
.. //depot/projects/hammer/sys/kern/vfs_subr.c#119 integrate
.. //depot/projects/hammer/sys/net/bpf.c#55 integrate
.. //depot/projects/hammer/sys/net/bpf_filter.c#8 integrate
.. //depot/projects/hammer/sys/net/if_enc.c#4 integrate
.. //depot/projects/hammer/sys/net/route.c#31 integrate
.. //depot/projects/hammer/sys/net/route.h#18 integrate
.. //depot/projects/hammer/sys/netgraph/ng_base.c#52 integrate
.. //depot/projects/hammer/sys/netgraph/ng_pppoe.c#25 integrate
.. //depot/projects/hammer/sys/netgraph/ng_pppoe.h#11 integrate
.. //depot/projects/hammer/sys/netinet/ip_dummynet.c#46 integrate
.. //depot/projects/hammer/sys/pc98/cbus/sio.c#12 integrate
.. //depot/projects/hammer/sys/pc98/pc98/machdep.c#21 integrate
.. //depot/projects/hammer/sys/powerpc/aim/machdep.c#2 integrate
.. //depot/projects/hammer/sys/powerpc/include/vmparam.h#9 integrate
.. //depot/projects/hammer/sys/powerpc/powermac/pswitch.c#5 integrate
.. //depot/projects/hammer/sys/security/audit/audit_pipe.c#8 integrate
.. //depot/projects/hammer/sys/security/mac_test/mac_test.c#46 integrate
.. //depot/projects/hammer/sys/sparc64/include/vmparam.h#7 integrate
.. //depot/projects/hammer/sys/sparc64/pci/psycho.c#38 integrate
.. //depot/projects/hammer/sys/sparc64/sparc64/machdep.c#52 integrate
.. //depot/projects/hammer/sys/sparc64/sparc64/pmap.c#49 integrate
.. //depot/projects/hammer/sys/sparc64/sparc64/trap.c#26 integrate
.. //depot/projects/hammer/sys/sparc64/sparc64/tsb.c#12 integrate
.. //depot/projects/hammer/sys/sun4v/include/vmparam.h#5 integrate
.. //depot/projects/hammer/sys/sun4v/sun4v/hvcons.c#3 integrate
.. //depot/projects/hammer/sys/sun4v/sun4v/machdep.c#5 integrate
.. //depot/projects/hammer/sys/sun4v/sun4v/trap.c#5 integrate
.. //depot/projects/hammer/sys/sys/copyright.h#8 integrate
.. //depot/projects/hammer/sys/sys/kdb.h#5 integrate
.. //depot/projects/hammer/sys/sys/kernel.h#23 integrate
.. //depot/projects/hammer/sys/sys/kerneldump.h#8 integrate
.. //depot/projects/hammer/sys/sys/mbuf.h#63 integrate
.. //depot/projects/hammer/sys/sys/param.h#100 integrate
.. //depot/projects/hammer/sys/sys/priv.h#7 integrate
.. //depot/projects/hammer/sys/vm/vm.h#8 integrate
.. //depot/projects/hammer/sys/vm/vm_object.h#27 integrate
.. //depot/projects/hammer/tools/tools/nanobsd/nanobsd.sh#15 integrate
.. //depot/projects/hammer/usr.bin/ipcrm/Makefile#2 integrate
.. //depot/projects/hammer/usr.bin/ipcrm/ipcrm.1#5 integrate
.. //depot/projects/hammer/usr.bin/ipcrm/ipcrm.c#4 integrate
.. //depot/projects/hammer/usr.bin/ipcs/Makefile#3 integrate
.. //depot/projects/hammer/usr.bin/ipcs/ipc.c#1 branch
.. //depot/projects/hammer/usr.bin/ipcs/ipc.h#1 branch
.. //depot/projects/hammer/usr.bin/ipcs/ipcs.c#12 integrate
.. //depot/projects/hammer/usr.sbin/config/config.y#16 integrate

Differences ...

==== //depot/projects/hammer/bin/cp/cp.c#14 (text+ko) ====

@@ -42,7 +42,7 @@
 #endif /* not lint */
 #endif
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/bin/cp/cp.c,v 1.57 2006/10/11 10:26:34 trhodes Exp $");
+__FBSDID("$FreeBSD: src/bin/cp/cp.c,v 1.59 2007/12/26 08:32:20 edwin Exp $");
 
 /*
  * Cp copies source files to target files.
@@ -210,10 +210,9 @@
 		/*
 		 * Case (1).  Target is not a directory.
 		 */
-		if (argc > 1) {
-			usage();
-			exit(1);
-		}
+		if (argc > 1)
+			errx(1, "%s is not a directory", to.p_path);
+
 		/*
 		 * Need to detect the case:
 		 *	cp -R dir foo

==== //depot/projects/hammer/bin/mv/mv.c#11 (text+ko) ====

@@ -42,7 +42,7 @@
 #endif /* not lint */
 #endif
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/bin/mv/mv.c,v 1.49 2007/12/17 09:02:42 dds Exp $");
+__FBSDID("$FreeBSD: src/bin/mv/mv.c,v 1.50 2007/12/27 11:33:42 dds Exp $");
 
 #include <sys/types.h>
 #include <sys/acl.h>
@@ -65,6 +65,9 @@
 #include <sysexits.h>
 #include <unistd.h>
 
+/* Exit code for a failed exec. */
+#define EXEC_FAILED 127
+
 int fflg, iflg, nflg, vflg;
 
 int	copy(char *, char *);
@@ -198,6 +201,11 @@
 			}
 		}
 	}
+	/*
+	 * Rename on FreeBSD will fail with EISDIR and ENOTDIR, before failing
+	 * with EXDEV.  Therefore, copy() doesn't have to perform the checks
+	 * specified in the Step 3 of the POSIX mv specification.
+	 */
 	if (!rename(from, to)) {
 		if (vflg)
 			printf("%s -> %s\n", from, to);
@@ -219,7 +227,7 @@
 		if (!S_ISLNK(sb.st_mode)) {
 			/* Can't mv(1) a mount point. */
 			if (realpath(from, path) == NULL) {
-				warnx("cannot resolve %s: %s", from, path);
+				warn("cannot resolve %s: %s", from, path);
 				return (1);
 			}
 			if (!statfs(path, &sfs) &&
@@ -252,9 +260,9 @@
 	struct timeval tval[2];
 	static u_int blen;
 	static char *bp;
+	acl_t acl;
 	mode_t oldmode;
 	int nread, from_fd, to_fd;
-	acl_t acl;
 
 	if ((from_fd = open(from, O_RDONLY, 0)) < 0) {
 		warn("%s", from);
@@ -305,7 +313,7 @@
 	}
 	/*
 	 * POSIX 1003.2c states that if _POSIX_ACL_EXTENDED is in effect
-	 * for dest_file, then it's ACLs shall reflect the ACLs of the
+	 * for dest_file, then its ACLs shall reflect the ACLs of the
 	 * source_file.
 	 */
 	if (fpathconf(to_fd, _PC_ACL_EXTENDED) == 1 &&
@@ -356,112 +364,78 @@
 copy(char *from, char *to)
 {
 	struct stat sb;
-	enum clean {CLEAN_SOURCE, CLEAN_DEST, CLEAN_ODEST, CLEAN_MAX};
-	char *cleanup[CLEAN_MAX];
 	int pid, status;
-	volatile int i, rval;
 
-	rval = 0;
-	for (i = 0; i < CLEAN_MAX; i++)
-		cleanup[i] = NULL;
-	/*
-	 * If "to" exists and is a directory, get it out of the way.
-	 * When the copy succeeds, delete it.
-	 */
-	if (stat(to, &sb) == 0 && S_ISDIR(sb.st_mode)) {
-		if (asprintf(&cleanup[CLEAN_ODEST], "%s.XXXXXX", to) == -1) {
-			warnx("asprintf failed");
-			return (1);
-
+	if (lstat(to, &sb) == 0) {
+		/* Destination path exists. */
+		if (S_ISDIR(sb.st_mode)) {
+			if (rmdir(to) != 0) {
+				warn("rmdir %s", to);
+				return (1);
+			}
+		} else {
+			if (unlink(to) != 0) {
+				warn("unlink %s", to);
+				return (1);
+			}
 		}
-		if (rename(to, cleanup[CLEAN_ODEST]) < 0) {
-			warn("rename of existing target from %s to %s failed",
-			    to, cleanup[CLEAN_ODEST]);
-			free(cleanup[CLEAN_ODEST]);
-			return (1);
-		}
+	} else if (errno != ENOENT) {
+		warn("%s", to);
+		return (1);
 	}
+
 	/* Copy source to destination. */
-	cleanup[CLEAN_DEST] = to;
-	if ((pid = fork()) == 0) {
+	if (!(pid = vfork())) {
 		execl(_PATH_CP, "mv", vflg ? "-PRpv" : "-PRp", "--", from, to,
 		    (char *)NULL);
-		warn("%s", _PATH_CP);
-		_exit(1);
+		_exit(EXEC_FAILED);
 	}
 	if (waitpid(pid, &status, 0) == -1) {
-		warn("%s: waitpid", _PATH_CP);
-		rval = 1;
-		goto done;
+		warn("%s %s %s: waitpid", _PATH_CP, from, to);
+		return (1);
 	}
 	if (!WIFEXITED(status)) {
-		warnx("%s: did not terminate normally", _PATH_CP);
-		rval = 1;
-		goto done;
+		warnx("%s %s %s: did not terminate normally",
+		    _PATH_CP, from, to);
+		return (1);
+	}
+	switch (WEXITSTATUS(status)) {
+	case 0:
+		break;
+	case EXEC_FAILED:
+		warnx("%s %s %s: exec failed", _PATH_CP, from, to);
+		return (1);
+	default:
+		warnx("%s %s %s: terminated with %d (non-zero) status",
+		    _PATH_CP, from, to, WEXITSTATUS(status));
+		return (1);
+	}
+
+	/* Delete the source. */
+	if (!(pid = vfork())) {
+		execl(_PATH_RM, "mv", "-rf", "--", from, (char *)NULL);
+		_exit(EXEC_FAILED);
+	}
+	if (waitpid(pid, &status, 0) == -1) {
+		warn("%s %s: waitpid", _PATH_RM, from);
+		return (1);
 	}
-	if (WEXITSTATUS(status)) {
-		warnx("%s: terminated with %d (non-zero) status",
-		    _PATH_CP, WEXITSTATUS(status));
-		rval = 1;
-		goto done;
+	if (!WIFEXITED(status)) {
+		warnx("%s %s: did not terminate normally", _PATH_RM, from);
+		return (1);
 	}
-	/*
-	 * The copy succeeded.  From now on the destination is where users
-	 * will find their files.
-	 */
-	cleanup[CLEAN_DEST] = NULL;
-	cleanup[CLEAN_SOURCE] = from;
-done:
-	/* Clean what needs to be cleaned. */
-	for (i = 0; i < CLEAN_MAX; i++) {
-		if (cleanup[i] == NULL)
-			continue;
-		if (!(pid = vfork())) {
-			execl(_PATH_RM, "mv", "-rf", "--", cleanup[i],
-			    (char *)NULL);
-			_exit(EX_OSERR);
-		}
-		if (waitpid(pid, &status, 0) == -1) {
-			warn("%s %s: waitpid", _PATH_RM, cleanup[i]);
-			rval = 1;
-			continue;
-		}
-		if (!WIFEXITED(status)) {
-			warnx("%s %s: did not terminate normally",
-			    _PATH_RM, cleanup[i]);
-			rval = 1;
-			continue;
-		}
-		switch (WEXITSTATUS(status)) {
-		case 0:
-			break;
-		case EX_OSERR:
-			warnx("Failed to exec %s %s", _PATH_RM, cleanup[i]);
-			rval = 1;
-			continue;
-		default:
-			warnx("%s %s: terminated with %d (non-zero) status",
-			    _PATH_RM, cleanup[i], WEXITSTATUS(status));
-			rval = 1;
-			continue;
-		}
-		/*
-		 * If the copy failed, and we just deleted the copy's trash,
-		 * try to salvage the original destination,
-		 */
-		if (i == CLEAN_DEST && cleanup[CLEAN_ODEST]) {
-			if (rename(cleanup[CLEAN_ODEST], to) < 0) {
-				warn("rename back renamed existing target from %s to %s failed",
-				    cleanup[CLEAN_ODEST], to);
-				rval = 1;
-			}
-			free(cleanup[CLEAN_ODEST]);
-			cleanup[CLEAN_ODEST] = NULL;
-		}
+	switch (WEXITSTATUS(status)) {
+	case 0:
+		break;
+	case EXEC_FAILED:
+		warnx("%s %s: exec failed", _PATH_RM, from);
+		return (1);
+	default:
+		warnx("%s %s: terminated with %d (non-zero) status",
+		    _PATH_RM, from, WEXITSTATUS(status));
+		return (1);
 	}
-	if (cleanup[CLEAN_ODEST])
-		free(cleanup[CLEAN_ODEST]);
-	return (rval);
+	return (0);
 }
 
 void

==== //depot/projects/hammer/games/fortune/datfiles/fortunes#74 (text+ko) ====

@@ -1,5 +1,5 @@
 This fortune brought to you by:
-$FreeBSD: src/games/fortune/datfiles/fortunes,v 1.252 2007/12/23 16:31:05 wilko Exp $
+$FreeBSD: src/games/fortune/datfiles/fortunes,v 1.253 2007/12/25 16:36:52 schweikh Exp $
 %
 =======================================================================
 ||								     ||
@@ -53846,7 +53846,7 @@
 ...we must be wary of granting too much power to natural selection
 by viewing all basic capacities of our brain as direct adaptations.
 I do not doubt that natural selection acted in building our oversized
-brains -- and I am equally confidant that our brains became large as
+brains -- and I am equally confident that our brains became large as
 an adaptation for definite roles (probably a complex set of interacting
 functions).  But these assumptions do not lead to the notion, often
 uncritically embraced by strict Darwinians, that all major capacities
@@ -53863,7 +53863,7 @@
 We must finish once and for all with the neutrality of chess.  We must
 condemn once and for all the formula 'chess for the sake of chess,' like
 the formula 'art for art's sake.'  We must organize shock-brigades of
-chess-play ers, and begin the immediate realization of a Five-Year Plan
+chess-players, and begin the immediate realization of a Five-Year Plan
 for chess.
 		-- Nikolai V. Krylenko, People's Commissar for Justice
 		   (of RFSFR, later of USSR), speaking at a 1932 Congress

==== //depot/projects/hammer/sbin/Makefile#47 (text+ko) ====

@@ -1,5 +1,5 @@
 #	@(#)Makefile	8.5 (Berkeley) 3/31/94
-# $FreeBSD: src/sbin/Makefile,v 1.168 2007/07/24 15:35:00 scottl Exp $
+# $FreeBSD: src/sbin/Makefile,v 1.169 2007/12/26 09:38:21 rwatson Exp $
 
 .include <bsd.own.mk>
 
@@ -15,6 +15,7 @@
 	clri \
 	comcontrol \
 	conscontrol \
+	ddb \
 	${_devd} \
 	devfs \
 	dhclient \

==== //depot/projects/hammer/sbin/savecore/savecore.8#9 (text+ko) ====

@@ -26,7 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     From: @(#)savecore.8	8.1 (Berkeley) 6/5/93
-.\" $FreeBSD: src/sbin/savecore/savecore.8,v 1.25 2005/06/14 11:24:56 ru Exp $
+.\" $FreeBSD: src/sbin/savecore/savecore.8,v 1.26 2007/12/26 11:42:10 rwatson Exp $
 .\"
 .Dd February 24, 2005
 .Dt SAVECORE 8
@@ -102,6 +102,12 @@
 .Ar directory Ns Pa /vmcore.#
 and information about the core in
 .Ar directory Ns Pa /info.#
+For kernel textdumps generated with the
+.Xr textdump 4
+facility, output will be stored in the
+.Xr tar 5
+format and named
+.Ar director Ns Pa /textdump.tar.#
 The ``#'' is the number from the first line of the file
 .Ar directory Ns Pa /bounds ,
 and it is incremented and stored back into the file each time
@@ -137,6 +143,8 @@
 .Sh SEE ALSO
 .Xr gzip 1 ,
 .Xr getbootfile 3 ,
+.Xr textdump 4 ,
+.Xr tar 4 ,
 .Xr dumpon 8 ,
 .Xr syslogd 8
 .Sh HISTORY
@@ -144,5 +152,8 @@
 .Nm
 utility appeared in
 .Bx 4.1 .
+.Pp
+Support for kernel textdumps appeared in
+.Fx 8.0 .
 .Sh BUGS
 The minfree code does not consider the effect of compression or sparse files.

==== //depot/projects/hammer/sbin/savecore/savecore.c#15 (text+ko) ====

@@ -65,7 +65,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sbin/savecore/savecore.c,v 1.78 2007/05/28 09:48:25 kevlo Exp $");
+__FBSDID("$FreeBSD: src/sbin/savecore/savecore.c,v 1.79 2007/12/26 11:42:10 rwatson Exp $");
 
 #include <sys/param.h>
 #include <sys/disk.h>
@@ -226,21 +226,155 @@
 #define BLOCKSIZE (1<<12)
 #define BLOCKMASK (~(BLOCKSIZE-1))
 
+static int
+DoRegularFile(int fd, off_t dumpsize, char *buf, const char *device,
+    const char *filename, FILE *fp)
+{
+	int he, hs, nr, nw, wl;
+	off_t dmpcnt;
+
+	dmpcnt = 0;
+	he = 0;
+	while (dumpsize > 0) {
+		wl = BUFFERSIZE;
+		if (wl > dumpsize)
+			wl = dumpsize;
+		nr = read(fd, buf, wl);
+		if (nr != wl) {
+			if (nr == 0)
+				syslog(LOG_WARNING,
+				    "WARNING: EOF on dump device");
+			else
+				syslog(LOG_ERR, "read error on %s: %m", device);
+			nerr++;
+			return (-1);
+		}
+		if (compress) {
+			nw = fwrite(buf, 1, wl, fp);
+		} else {
+			for (nw = 0; nw < nr; nw = he) {
+				/* find a contiguous block of zeroes */
+				for (hs = nw; hs < nr; hs += BLOCKSIZE) {
+					for (he = hs; he < nr && buf[he] == 0;
+					    ++he)
+						/* nothing */ ;
+					/* is the hole long enough to matter? */
+					if (he >= hs + BLOCKSIZE)
+						break;
+				}
+			
+				/* back down to a block boundary */
+				he &= BLOCKMASK;
+
+				/*
+				 * 1) Don't go beyond the end of the buffer.
+				 * 2) If the end of the buffer is less than
+				 *    BLOCKSIZE bytes away, we're at the end
+				 *    of the file, so just grab what's left.
+				 */
+				if (hs + BLOCKSIZE > nr)
+					hs = he = nr;
+
+				/*
+				 * At this point, we have a partial ordering:
+				 *     nw <= hs <= he <= nr
+				 * If hs > nw, buf[nw..hs] contains non-zero data.
+				 * If he > hs, buf[hs..he] is all zeroes.
+				 */
+				if (hs > nw)
+					if (fwrite(buf + nw, hs - nw, 1, fp)
+					    != 1)
+					break;
+				if (he > hs)
+					if (fseeko(fp, he - hs, SEEK_CUR) == -1)
+						break;
+			}
+		}
+		if (nw != wl) {
+			syslog(LOG_ERR,
+			    "write error on %s file: %m", filename);
+			syslog(LOG_WARNING,
+			    "WARNING: vmcore may be incomplete");
+			nerr++;
+			return (-1);
+		}
+		if (verbose) {
+			dmpcnt += wl;
+			printf("%llu\r", (unsigned long long)dmpcnt);
+			fflush(stdout);
+		}
+		dumpsize -= wl;
+	}
+	return (0);
+}
+
+/*
+ * Specialized version of dump-reading logic for use with textdumps, which
+ * are written backwards from the end of the partition, and must be reversed
+ * before being written to the file.  Textdumps are small, so do a bit less
+ * work to optimize/sparsify.
+ */
+static int
+DoTextdumpFile(int fd, off_t dumpsize, off_t lasthd, char *buf,
+    const char *device, const char *filename, FILE *fp)
+{
+	int nr, nw, wl;
+	off_t dmpcnt, totsize;
+
+	totsize = dumpsize;
+	dmpcnt = 0;
+	wl = 512;
+	if ((dumpsize % wl) != 0) {
+		syslog(LOG_ERR, "textdump uneven multiple of 512 on %s",
+		    device);
+		nerr++;
+		return (-1);
+	}
+	while (dumpsize > 0) {
+		nr = pread(fd, buf, wl, lasthd - (totsize - dumpsize) - wl);
+		if (nr != wl) {
+			if (nr == 0)
+				syslog(LOG_WARNING,
+				    "WARNING: EOF on dump device");
+			else
+				syslog(LOG_ERR, "read error on %s: %m", device);
+			nerr++;
+			return (-1);
+		}
+		nw = fwrite(buf, 1, wl, fp);
+		if (nw != wl) {
+			syslog(LOG_ERR,
+			    "write error on %s file: %m", filename);
+			syslog(LOG_WARNING,
+			    "WARNING: textdump may be incomplete");
+			nerr++;
+			return (-1);
+		}
+		if (verbose) {
+			dmpcnt += wl;
+			printf("%llu\r", (unsigned long long)dmpcnt);
+			fflush(stdout);
+		}
+		dumpsize -= wl;
+	}
+	return (0);
+}
+
 static void
 DoFile(const char *savedir, const char *device)
 {
+	static char filename[PATH_MAX];
 	static char *buf = NULL;
 	struct kerneldumpheader kdhf, kdhl;
-	off_t mediasize, dumpsize, firsthd, lasthd, dmpcnt;
+	off_t mediasize, dumpsize, firsthd, lasthd;
 	FILE *info, *fp;
 	mode_t oumask;
-	int fd, fdinfo, error, wl;
-	int nr, nw, hs, he = 0;
+	int fd, fdinfo, error;
 	int bounds, status;
 	u_int sectorsize;
+	int istextdump;
 
 	bounds = getbounds();
-	dmpcnt = 0;
 	mediasize = 0;
 	status = STATUS_UNKNOWN;
 
@@ -284,7 +418,13 @@
 		    (long long)lasthd, device);
 		goto closefd;
 	}
-	if (memcmp(kdhl.magic, KERNELDUMPMAGIC, sizeof kdhl.magic)) {
+	istextdump = 0;
+	if (memcmp(kdhl.magic, TEXTDUMPMAGIC, sizeof kdhl.magic)) {
+		if (verbose)
+			printf("textdump magic on last dump header on %s\n",
+			    device);
+		istextdump = 1;
+	} else if (memcmp(kdhl.magic, KERNELDUMPMAGIC, sizeof kdhl.magic)) {
 		if (verbose)
 			printf("magic mismatch on last dump header on %s\n",
 			    device);
@@ -391,14 +531,16 @@
 	}
 	oumask = umask(S_IRWXG|S_IRWXO); /* Restrict access to the core file.*/
 	if (compress) {
-		sprintf(buf, "vmcore.%d.gz", bounds);
-		fp = zopen(buf, "w");
+		sprintf(filename, "%s.%d.gz", istextdump ? "textdump.tar" :
+		    "vmcore", bounds);
+		fp = zopen(filename, "w");
 	} else {
-		sprintf(buf, "vmcore.%d", bounds);
-		fp = fopen(buf, "w");
+		sprintf(filename, "%s.%d", istextdump ? "textdump.tar" :
+		    "vmcore", bounds);
+		fp = fopen(filename, "w");
 	}
 	if (fp == NULL) {
-		syslog(LOG_ERR, "%s: %m", buf);
+		syslog(LOG_ERR, "%s: %m", filename);
 		close(fdinfo);
 		nerr++;
 		goto closefd;
@@ -420,83 +562,22 @@
 	fclose(info);
 
 	syslog(LOG_NOTICE, "writing %score to %s",
-	    compress ? "compressed " : "", buf);
+	    compress ? "compressed " : "", filename);
 
-	while (dumpsize > 0) {
-		wl = BUFFERSIZE;
-		if (wl > dumpsize)
-			wl = dumpsize;
-		nr = read(fd, buf, wl);
-		if (nr != wl) {
-			if (nr == 0)
-				syslog(LOG_WARNING,
-				    "WARNING: EOF on dump device");
-			else
-				syslog(LOG_ERR, "read error on %s: %m", device);
-			nerr++;
+	if (istextdump) {
+		if (DoTextdumpFile(fd, dumpsize, lasthd, buf, device,
+		    filename, fp) < 0)
 			goto closeall;
-		}
-		if (compress) {
-			nw = fwrite(buf, 1, wl, fp);
-		} else {
-			for (nw = 0; nw < nr; nw = he) {
-				/* find a contiguous block of zeroes */
-				for (hs = nw; hs < nr; hs += BLOCKSIZE) {
-					for (he = hs; he < nr && buf[he] == 0;
-					    ++he)
-						/* nothing */ ;
-					/* is the hole long enough to matter? */
-					if (he >= hs + BLOCKSIZE)
-						break;
-				}
-			
-				/* back down to a block boundary */
-				he &= BLOCKMASK;
-
-				/*
-				 * 1) Don't go beyond the end of the buffer.
-				 * 2) If the end of the buffer is less than
-				 *    BLOCKSIZE bytes away, we're at the end
-				 *    of the file, so just grab what's left.
-				 */
-				if (hs + BLOCKSIZE > nr)
-					hs = he = nr;
-
-				/*
-				 * At this point, we have a partial ordering:
-				 *     nw <= hs <= he <= nr
-				 * If hs > nw, buf[nw..hs] contains non-zero data.
-				 * If he > hs, buf[hs..he] is all zeroes.
-				 */
-				if (hs > nw)
-					if (fwrite(buf + nw, hs - nw, 1, fp)
-					    != 1)
-					break;
-				if (he > hs)
-					if (fseeko(fp, he - hs, SEEK_CUR) == -1)
-						break;
-			}
-		}
-		if (nw != wl) {
-			syslog(LOG_ERR,
-			    "write error on vmcore.%d file: %m", bounds);
-			syslog(LOG_WARNING,
-			    "WARNING: vmcore may be incomplete");
-			nerr++;
+	} else {
+		if (DoRegularFile(fd, dumpsize, buf, device, filename, fp)
+		    < 0)
 			goto closeall;
-		}
-		if (verbose) {
-			dmpcnt += wl;
-			printf("%llu\r", (unsigned long long)dmpcnt);
-			fflush(stdout);
-		}
-		dumpsize -= wl;
 	}
 	if (verbose)
 		printf("\n");
 
 	if (fclose(fp) < 0) {
-		syslog(LOG_ERR, "error on vmcore.%d: %m", bounds);
+		syslog(LOG_ERR, "error on %s: %m", filename);
 		nerr++;
 		goto closeall;
 	}

==== //depot/projects/hammer/share/colldef/Makefile#19 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/share/colldef/Makefile,v 1.71 2006/11/09 18:10:33 des Exp $
+# $FreeBSD: src/share/colldef/Makefile,v 1.72 2007/12/24 10:30:08 ache Exp $
 
 LOCALES=	bg_BG.CP1251 \
 		be_BY.CP1131 \
@@ -34,6 +34,7 @@
 		sr_YU.ISO8859-5 \
 		sv_SE.ISO8859-1 \
 		sv_SE.ISO8859-15 \
+		tr_TR.ISO8859-9 \
 		uk_UA.CP1251 \
 		uk_UA.ISO8859-5 \
 		uk_UA.KOI8-U
@@ -58,7 +59,7 @@
 CLEANFILES=	${FILES}
 
 ENCODINGS=	Big5 Big5HKSCS CP949 eucCN eucJP eucKR GB18030 GB2312 GBK \
-		ISO8859-1 ISO8859-2 ISO8859-9 ISO8859-15 SJIS US-ASCII UTF-8
+		ISO8859-1 ISO8859-2 ISO8859-15 SJIS US-ASCII UTF-8
 
 ISO8859-1_Big5=	is_IS:zh_TW
 ISO8859-1_ISO8859-1= ${ISO8859-15_ISO8859-15} pt_PT:pt_BR
@@ -79,7 +80,6 @@
 US-ASCII_GB18030= la_LN:zh_CN
 US-ASCII_GB2312= la_LN:zh_CN
 US-ASCII_GBK=	la_LN:zh_CN
-US-ASCII_ISO8859-9= la_LN:tr_TR
 US-ASCII_SJIS=	la_LN:ja_JP
 
 ASCIILINKS=	en_AU en_CA en_GB en_NZ en_US

==== //depot/projects/hammer/share/colldef/README#2 (text+ko) ====

@@ -1,5 +1,6 @@
-$FreeBSD: src/share/colldef/README,v 1.2 2002/04/08 09:28:22 ache Exp $
+$FreeBSD: src/share/colldef/README,v 1.3 2007/12/25 21:21:26 ache Exp $
 
 WARNING: For the compatibility sake try to keep collating table backward 
 compatible with ASCII, i.e.  add other symbols to the existent ASCII order.
 
+For mnemonic names see ftp://std.dkuug.dk/i18n/charmaps/

==== //depot/projects/hammer/share/man/man4/Makefile#100 (text+ko) ====

@@ -1,5 +1,5 @@
 #	@(#)Makefile	8.1 (Berkeley) 6/18/93
-# $FreeBSD: src/share/man/man4/Makefile,v 1.400 2007/12/15 00:56:15 scottl Exp $
+# $FreeBSD: src/share/man/man4/Makefile,v 1.401 2007/12/26 11:35:06 rwatson Exp $
 
 MAN=	aac.4 \
 	acpi.4 \
@@ -355,6 +355,7 @@
 	tcp.4 \
 	tdfx.4 \
 	termios.4 \
+	textdump.4 \
 	ti.4 \
 	tl.4 \
 	trm.4 \

==== //depot/projects/hammer/share/man/man4/bge.4#25 (text+ko) ====

@@ -29,14 +29,14 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 .\" THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $FreeBSD: src/share/man/man4/bge.4,v 1.32 2007/05/22 19:35:34 jkim Exp $
+.\" $FreeBSD: src/share/man/man4/bge.4,v 1.33 2007/12/25 19:53:26 remko Exp $
 .\"
-.Dd May 22, 2007
+.Dd December 25, 2007
 .Dt BGE 4
 .Os
 .Sh NAME
 .Nm bge
-.Nd "Broadcom BCM570x/5714/5721/5750/5751/5752/5789 PCI Gigabit Ethernet adapter driver"
+.Nd "Broadcom BCM570x/5714/5721/5722/5750/5751/5752/5789 PCI Gigabit Ethernet adapter driver"
 .Sh SYNOPSIS
 To compile this driver into the kernel,
 place the following lines in your
@@ -56,7 +56,7 @@
 The
 .Nm
 driver provides support for various NICs based on the Broadcom BCM570x,
-5714, 5721, 5750, 5751, 5752 and 5789 families of Gigabit Ethernet
+5714, 5721, 5722, 5750, 5751, 5752 and 5789 families of Gigabit Ethernet
 controller chips.
 .Pp
 All of these NICs are capable of 10, 100 and 1000Mbps speeds over CAT5

==== //depot/projects/hammer/share/man/man4/ddb.4#12 (text+ko) ====

@@ -1,6 +1,7 @@
 .\"
 .\" Mach Operating System
 .\" Copyright (c) 1991,1990 Carnegie Mellon University
+.\" Copyright (c) 2007 Robert N. M. Watson
 .\" All Rights Reserved.
 .\"
 .\" Permission to use, copy, modify and distribute this software and its
@@ -57,9 +58,9 @@
 .\" 	Created.
 .\" 	[90/08/30            dbg]
 .\"
-.\" $FreeBSD: src/share/man/man4/ddb.4,v 1.42 2007/08/09 20:14:35 njl Exp $
+.\" $FreeBSD: src/share/man/man4/ddb.4,v 1.47 2007/12/26 12:18:21 rwatson Exp $
 .\"
-.Dd August 6, 2007
+.Dd December 26, 2007
 .Dt DDB 4
 .Os
 .Sh NAME
@@ -593,6 +594,74 @@
 .It Ic help
 Print a short summary of the available commands and command
 abbreviations.
+.Pp
+.It Ic capture on
+.It Ic capture off
+.It Ic capture reset
+.It Ic capture status
+.Nm
+supports a basic output capture facility, which can be used to retrieve the
+results of debugging commands from userpsace using
+.Xr sysctl 2 .
+.Ic capture on
+enables output capture;
+.Ic capture off
+disables capture.
+.Ic capture reset
+will clear the capture buffer and disable capture.
+.Ic capture status
+will report current buffer use, buffer size, and disposition of output
+capture.
+.Pp
+Userspace processes may inspect and manage
+.Nm
+capture state using
+.Xr sysctl 8 :
+.Pp
+.Dv debug.ddb.capture.bufsize
+may be used to query or set the current capture buffer size.
+.Pp
+.Dv debug.ddb.capture.maxbufsize
+may be used to query the compile-time limit on the capture buffer size.
+.Pp
+.Dv debug.ddb.capture.bytes
+may be used to query the number of bytes of output currently in the capture
+buffer.
+.Pp
+.Dv debug.ddb.capture.data
+returns the contents of the buffer as a string to an appropriately privileged
+process.
+.Pp
+This facility is particularly useful in concert with the scripting and
+.Xr textdump 4
+facilities, allowing scripted debugging output to be captured and
+committed to disk as part of a textdump for later analysis.
+The contents of the capture buffer may also be inspected in a kernel core dump
+using
+.Xr kgdb 1 .
+.Pp
+.It Ic run
+.It Ic script
+.It Ic scripts
+.It Ic unscript
+Run, define, list, and delete scripts.
+See the
+.Sx SCRIPTING
+section for more information on the scripting facility.
+.Pp
+.It Ic textdump set
+.It Ic textdump status
+.It Ic textdump unset
+The
+.Ic textdump set
+command may be used to force the next kernel core dump to be a textdump
+rather than a traditional memory dump or minidump.
+.Ic textdump status
+reports whether a textdump has been scheduled.
+.Ic textdump unset
+cancels a request to perform a textdump as the next kernel core dump.
+More information may be found in
+.Xr textdump 4 .
 .El
 .Sh VARIABLES
 The debugger accesses registers and variables as
@@ -695,6 +764,131 @@
 .Ql \&:
 and modifiers as described above.
 .El
+.Sh SCRIPTING
+.Nm
+supports a basic scripting facility to allow automating tasks or responses to
+specific events.
+Each script consists of a list of DDB commands to be executed sequentially,
+and is assigned a unique name.
+Certain script names have special meaning, and will be automatically run on
+various
+.Nm
+events if scripts by those names have been defined.
+.Pp
+The
+.Ic script
+command may be used to define a script by name.
+Scripts consist of a series of
+.Nm
+commands separated with the
+.Ic ;
+character.
+For example:
+.Bd -literal -offset indent
+script kdb.enter.panic=bt; show pcpu
+script lockinfo=show alllocks; show lockedvnods
+.Ed
+.Pp
+The
+.Ic scripts
+command lists currently defined scripts.
+.Pp
+The

>>> TRUNCATED FOR MAIL (1000 lines) <<<



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