PERFORCE change 139988 for review

Sam Leffler sam at FreeBSD.org
Sun Apr 13 19:51:31 UTC 2008


http://perforce.freebsd.org/chv.cgi?CH=139988

Change 139988 by sam at sam_ebb on 2008/04/13 19:50:59

	IFC @ 139987

Affected files ...

.. //depot/projects/vap/contrib/top/machine.h#4 integrate
.. //depot/projects/vap/include/unistd.h#8 integrate
.. //depot/projects/vap/lib/libc/gdtoa/Makefile.inc#3 integrate
.. //depot/projects/vap/lib/libc/gdtoa/_hdtoa.c#3 integrate
.. //depot/projects/vap/lib/libc/gdtoa/_hldtoa.c#1 branch
.. //depot/projects/vap/lib/libc/sparc64/fpu/fpu_qp.c#3 integrate
.. //depot/projects/vap/lib/libc/sparc64/fpu/fpu_sqrt.c#3 integrate
.. //depot/projects/vap/lib/libc/stdio/printf.3#3 integrate
.. //depot/projects/vap/lib/libc/stdlib/strfmon.c#3 integrate
.. //depot/projects/vap/sbin/fsck_ffs/fsck.h#3 integrate
.. //depot/projects/vap/sbin/fsck_ffs/fsck_ffs.8#3 integrate
.. //depot/projects/vap/sbin/fsck_ffs/fsutil.c#3 integrate
.. //depot/projects/vap/sbin/fsck_ffs/inode.c#3 integrate
.. //depot/projects/vap/sbin/fsck_ffs/main.c#5 integrate
.. //depot/projects/vap/sbin/geom/class/journal/gjournal.8#3 integrate
.. //depot/projects/vap/sbin/restore/dirs.c#4 integrate
.. //depot/projects/vap/sbin/restore/tape.c#3 integrate
.. //depot/projects/vap/sbin/route/route.c#4 integrate
.. //depot/projects/vap/share/man/man4/Makefile#11 integrate
.. //depot/projects/vap/share/man/man4/ddb.4#5 integrate
.. //depot/projects/vap/share/man/man4/k8temp.4#1 branch
.. //depot/projects/vap/share/man/man9/lock.9#10 integrate
.. //depot/projects/vap/sys/amd64/amd64/intr_machdep.c#8 integrate
.. //depot/projects/vap/sys/amd64/amd64/pmap.c#12 integrate
.. //depot/projects/vap/sys/amd64/conf/NOTES#10 integrate
.. //depot/projects/vap/sys/arm/arm/intr.c#7 integrate
.. //depot/projects/vap/sys/cddl/contrib/opensolaris/common/atomic/sparc64/atomic.S#1 branch
.. //depot/projects/vap/sys/cddl/contrib/opensolaris/uts/common/sys/asm_linkage.h#2 integrate
.. //depot/projects/vap/sys/conf/Makefile.mips#1 branch
.. //depot/projects/vap/sys/conf/files#30 edit
.. //depot/projects/vap/sys/conf/files.amd64#8 integrate
.. //depot/projects/vap/sys/conf/files.i386#8 integrate
.. //depot/projects/vap/sys/conf/files.mips#1 branch
.. //depot/projects/vap/sys/conf/files.pc98#7 integrate
.. //depot/projects/vap/sys/conf/ldscript.mips#1 branch
.. //depot/projects/vap/sys/conf/ldscript.mips.cfe#1 branch
.. //depot/projects/vap/sys/conf/options#19 integrate
.. //depot/projects/vap/sys/conf/options.mips#1 branch
.. //depot/projects/vap/sys/dev/acpi_support/acpi_asus.c#6 integrate
.. //depot/projects/vap/sys/dev/acpica/acpi_cpu.c#8 integrate
.. //depot/projects/vap/sys/dev/asmc/asmc.c#4 integrate
.. //depot/projects/vap/sys/dev/asmc/asmcvar.h#4 integrate
.. //depot/projects/vap/sys/dev/ata/ata-all.c#7 integrate
.. //depot/projects/vap/sys/dev/ata/ata-all.h#8 integrate
.. //depot/projects/vap/sys/dev/ata/ata-card.c#6 integrate
.. //depot/projects/vap/sys/dev/ata/ata-cbus.c#6 integrate
.. //depot/projects/vap/sys/dev/ata/ata-chipset.c#8 integrate
.. //depot/projects/vap/sys/dev/ata/ata-disk.c#8 integrate
.. //depot/projects/vap/sys/dev/ata/ata-disk.h#7 integrate
.. //depot/projects/vap/sys/dev/ata/ata-dma.c#7 integrate
.. //depot/projects/vap/sys/dev/ata/ata-isa.c#6 integrate
.. //depot/projects/vap/sys/dev/ata/ata-lowlevel.c#7 integrate
.. //depot/projects/vap/sys/dev/ata/ata-pci.c#6 integrate
.. //depot/projects/vap/sys/dev/ata/ata-pci.h#7 integrate
.. //depot/projects/vap/sys/dev/ata/ata-queue.c#6 integrate
.. //depot/projects/vap/sys/dev/ata/ata-raid.c#7 integrate
.. //depot/projects/vap/sys/dev/ata/ata-raid.h#6 integrate
.. //depot/projects/vap/sys/dev/ata/ata-usb.c#3 integrate
.. //depot/projects/vap/sys/dev/ata/ata_if.m#5 integrate
.. //depot/projects/vap/sys/dev/ata/atapi-cam.c#6 integrate
.. //depot/projects/vap/sys/dev/ata/atapi-cd.c#6 integrate
.. //depot/projects/vap/sys/dev/ata/atapi-cd.h#6 integrate
.. //depot/projects/vap/sys/dev/ata/atapi-fd.c#6 integrate
.. //depot/projects/vap/sys/dev/ata/atapi-fd.h#6 integrate
.. //depot/projects/vap/sys/dev/ata/atapi-tape.c#6 integrate
.. //depot/projects/vap/sys/dev/ata/atapi-tape.h#6 integrate
.. //depot/projects/vap/sys/dev/bce/if_bce.c#4 integrate
.. //depot/projects/vap/sys/dev/bce/if_bcefw.h#4 integrate
.. //depot/projects/vap/sys/dev/bce/if_bcereg.h#4 integrate
.. //depot/projects/vap/sys/dev/iicbus/lm90.c#1 add
.. //depot/projects/vap/sys/dev/k8temp/k8temp.c#1 branch
.. //depot/projects/vap/sys/dev/sound/pcm/dsp.c#6 integrate
.. //depot/projects/vap/sys/dev/usb/ehci_pci.c#8 integrate
.. //depot/projects/vap/sys/dev/usb/uhci_pci.c#7 integrate
.. //depot/projects/vap/sys/i386/conf/GENERIC.hints#6 edit
.. //depot/projects/vap/sys/i386/i386/intr_machdep.c#8 integrate
.. //depot/projects/vap/sys/i386/i386/mp_machdep.c#9 integrate
.. //depot/projects/vap/sys/i386/i386/pmap.c#11 integrate
.. //depot/projects/vap/sys/ia64/ia64/interrupt.c#8 integrate
.. //depot/projects/vap/sys/kern/kern_cpuset.c#6 integrate
.. //depot/projects/vap/sys/kern/kern_intr.c#10 integrate
.. //depot/projects/vap/sys/kern/kern_jail.c#9 integrate
.. //depot/projects/vap/sys/kern/kern_lock.c#12 integrate
.. //depot/projects/vap/sys/kern/subr_taskqueue.c#9 integrate
.. //depot/projects/vap/sys/kern/subr_witness.c#10 integrate
.. //depot/projects/vap/sys/modules/Makefile#19 integrate
.. //depot/projects/vap/sys/modules/zfs/Makefile#6 integrate
.. //depot/projects/vap/sys/nlm/nlm_prot_impl.c#3 integrate
.. //depot/projects/vap/sys/powerpc/powerpc/intr_machdep.c#10 integrate
.. //depot/projects/vap/sys/rpc/clnt_rc.c#2 integrate
.. //depot/projects/vap/sys/sparc64/sparc64/intr_machdep.c#9 integrate
.. //depot/projects/vap/sys/sun4v/sun4v/intr_machdep.c#5 integrate
.. //depot/projects/vap/sys/sys/ata.h#8 integrate
.. //depot/projects/vap/sys/sys/cpuset.h#6 integrate
.. //depot/projects/vap/sys/sys/interrupt.h#7 integrate
.. //depot/projects/vap/sys/sys/jail.h#6 integrate
.. //depot/projects/vap/sys/sys/rwlock.h#6 integrate
.. //depot/projects/vap/sys/ufs/ufs/dirhash.h#3 integrate
.. //depot/projects/vap/sys/ufs/ufs/ufs_dirhash.c#6 integrate
.. //depot/projects/vap/sys/ufs/ufs/ufs_lookup.c#7 integrate
.. //depot/projects/vap/tools/regression/lib/libc/stdio/test-printfloat.c#4 integrate
.. //depot/projects/vap/usr.bin/cpuset/cpuset.c#3 integrate
.. //depot/projects/vap/usr.bin/fstat/zfs.c#1 branch
.. //depot/projects/vap/usr.bin/top/machine.c#6 integrate
.. //depot/projects/vap/usr.bin/vmstat/vmstat.c#5 integrate
.. //depot/projects/vap/usr.sbin/config/main.c#4 integrate
.. //depot/projects/vap/usr.sbin/fifolog/Makefile#2 integrate
.. //depot/projects/vap/usr.sbin/fifolog/Makefile.inc#2 integrate
.. //depot/projects/vap/usr.sbin/fifolog/fifolog_create/Makefile#2 integrate
.. //depot/projects/vap/usr.sbin/fifolog/fifolog_create/fifolog.1#2 integrate
.. //depot/projects/vap/usr.sbin/fifolog/fifolog_reader/Makefile#3 integrate
.. //depot/projects/vap/usr.sbin/fifolog/fifolog_writer/Makefile#2 integrate
.. //depot/projects/vap/usr.sbin/fifolog/lib/Makefile#2 integrate
.. //depot/projects/vap/usr.sbin/pkg_install/add/perform.c#4 integrate
.. //depot/projects/vap/usr.sbin/pkg_install/delete/perform.c#3 integrate
.. //depot/projects/vap/usr.sbin/pkg_install/lib/lib.h#3 integrate
.. //depot/projects/vap/usr.sbin/pkg_install/lib/match.c#3 integrate
.. //depot/projects/vap/usr.sbin/rpc.lockd/lockd.c#5 integrate

Differences ...

==== //depot/projects/vap/contrib/top/machine.h#4 (text+ko) ====

@@ -1,5 +1,5 @@
 /*
- * $FreeBSD: src/contrib/top/machine.h,v 1.10 2008/01/18 01:43:13 peter Exp $
+ * $FreeBSD: src/contrib/top/machine.h,v 1.11 2008/04/11 11:39:26 ru Exp $
  */
 
 /*
@@ -44,7 +44,6 @@
     int    *memory;
     int    *swap;
     struct timeval boottime;
-    unsigned long cpumask;	/* bitfield of cpu states represented */
     int    ncpus;
 };
 

==== //depot/projects/vap/include/unistd.h#8 (text+ko) ====

@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)unistd.h	8.12 (Berkeley) 4/27/95
- * $FreeBSD: src/include/unistd.h,v 1.86 2008/04/01 10:49:06 kib Exp $
+ * $FreeBSD: src/include/unistd.h,v 1.87 2008/04/10 12:13:56 kib Exp $
  */
 
 #ifndef _UNISTD_H_
@@ -566,7 +566,7 @@
 int	fchownat(int, const char *, uid_t, gid_t, int);
 int	fexecve(int, char *const [], char *const []);
 int	linkat(int, const char *, int, const char *, int);
-ssize_t	readlinkat(int, const char *, char *, size_t);
+ssize_t	readlinkat(int, const char * __restrict, char * __restrict, size_t);
 int	symlinkat(const char *, int, const char *);
 int	unlinkat(int, const char *, int);
 #endif /* __BSD_VISIBLE */

==== //depot/projects/vap/lib/libc/gdtoa/Makefile.inc#3 (text+ko) ====

@@ -1,9 +1,9 @@
-# $FreeBSD: src/lib/libc/gdtoa/Makefile.inc,v 1.9 2006/03/13 01:14:56 deischen Exp $
+# $FreeBSD: src/lib/libc/gdtoa/Makefile.inc,v 1.10 2008/04/12 03:11:36 das Exp $
 
 # netlib gdtoa sources
 .PATH: ${.CURDIR}/gdtoa
 
-MISRCS+=_hdtoa.c _ldtoa.c glue.c
+MISRCS+=_hdtoa.c _hldtoa.c _ldtoa.c glue.c
 GDTOASRCS+=dmisc.c dtoa.c gdtoa.c gethex.c gmisc.c \
 	hd_init.c hexnan.c misc.c smisc.c \
 	strtod.c strtodg.c strtof.c strtord.c sum.c ulp.c

==== //depot/projects/vap/lib/libc/gdtoa/_hdtoa.c#3 (text+ko) ====

@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2004, 2005 David Schultz <das at FreeBSD.ORG>
+ * Copyright (c) 2004-2008 David Schultz <das at FreeBSD.ORG>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -25,11 +25,13 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gdtoa/_hdtoa.c,v 1.5 2007/05/08 02:59:37 das Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gdtoa/_hdtoa.c,v 1.7 2008/04/12 14:53:52 das Exp $");
 
 #include <float.h>
 #include <limits.h>
 #include <math.h>
+
+#include "../stdio/floatio.h"
 #include "fpmath.h"
 #include "gdtoaimp.h"
 
@@ -37,63 +39,10 @@
 #define	INFSTR	"Infinity"
 #define	NANSTR	"NaN"
 
-#define	DBL_ADJ		(DBL_MAX_EXP - 2 + ((DBL_MANT_DIG - 1) % 4))
-#define	LDBL_ADJ	(LDBL_MAX_EXP - 2 + ((LDBL_MANT_DIG - 1) % 4))
+#define	DBL_ADJ	(DBL_MAX_EXP - 2)
+#define	SIGFIGS	((DBL_MANT_DIG + 3) / 4 + 1)
 
-/*
- * Round up the given digit string.  If the digit string is fff...f,
- * this procedure sets it to 100...0 and returns 1 to indicate that
- * the exponent needs to be bumped.  Otherwise, 0 is returned.
- */
-static int
-roundup(char *s0, int ndigits)
-{
-	char *s;
-
-	for (s = s0 + ndigits - 1; *s == 0xf; s--) {
-		if (s == s0) {
-			*s = 1;
-			return (1);
-		}
-		*s = 0;
-	}
-	++*s;
-	return (0);
-}
-
-/*
- * Round the given digit string to ndigits digits according to the
- * current rounding mode.  Note that this could produce a string whose
- * value is not representable in the corresponding floating-point
- * type.  The exponent pointed to by decpt is adjusted if necessary.
- */
-static void
-dorounding(char *s0, int ndigits, int sign, int *decpt)
-{
-	int adjust = 0;	/* do we need to adjust the exponent? */
-
-	switch (FLT_ROUNDS) {
-	case 0:		/* toward zero */
-	default:	/* implementation-defined */
-		break;
-	case 1:		/* to nearest, halfway rounds to even */
-		if ((s0[ndigits] > 8) ||
-		    (s0[ndigits] == 8 && s0[ndigits + 1] & 1))
-			adjust = roundup(s0, ndigits);
-		break;
-	case 2:		/* toward +inf */
-		if (sign == 0)
-			adjust = roundup(s0, ndigits);
-		break;
-	case 3:		/* toward -inf */
-		if (sign != 0)
-			adjust = roundup(s0, ndigits);
-		break;
-	}
-
-	if (adjust)
-		*decpt += 4;
-}
+static const float one[] = { 1.0f, -1.0f };
 
 /*
  * This procedure converts a double-precision number in IEEE format
@@ -112,9 +61,9 @@
  *
  * Note that the C99 standard does not specify what the leading digit
  * should be for non-zero numbers.  For instance, 0x1.3p3 is the same
- * as 0x2.6p2 is the same as 0x4.cp3.  This implementation chooses the
- * first digit so that subsequent digits are aligned on nibble
- * boundaries (before rounding).
+ * as 0x2.6p2 is the same as 0x4.cp3.  This implementation always makes
+ * the leading digit a 1. This ensures that the exponent printed is the
+ * actual base-2 exponent, i.e., ilogb(d).
  *
  * Inputs:	d, xdigs, ndigits
  * Outputs:	decpt, sign, rve
@@ -123,10 +72,10 @@
 __hdtoa(double d, const char *xdigs, int ndigits, int *decpt, int *sign,
     char **rve)
 {
-	static const int sigfigs = (DBL_MANT_DIG + 3) / 4;
 	union IEEEd2bits u;
 	char *s, *s0;
 	int bufsize;
+	uint32_t manh, manl;
 
 	u.d = d;
 	*sign = u.bits.sign;
@@ -145,11 +94,9 @@
 	case FP_INFINITE:
 		*decpt = INT_MAX;
 		return (nrv_alloc(INFSTR, rve, sizeof(INFSTR) - 1));
-	case FP_NAN:
+	default:	/* FP_NAN or unrecognized */
 		*decpt = INT_MAX;
 		return (nrv_alloc(NANSTR, rve, sizeof(NANSTR) - 1));
-	default:
-		abort();
 	}
 
 	/* FP_NORMAL or FP_SUBNORMAL */
@@ -158,162 +105,40 @@
 		ndigits = 1;
 
 	/*
-	 * For simplicity, we generate all the digits even if the
-	 * caller has requested fewer.
+	 * If ndigits < 0, we are expected to auto-size, so we allocate
+	 * enough space for all the digits.
 	 */
-	bufsize = (sigfigs > ndigits) ? sigfigs : ndigits;
+	bufsize = (ndigits > 0) ? ndigits : SIGFIGS;
 	s0 = rv_alloc(bufsize);
 
-	/*
-	 * We work from right to left, first adding any requested zero
-	 * padding, then the least significant portion of the
-	 * mantissa, followed by the most significant.  The buffer is
-	 * filled with the byte values 0x0 through 0xf, which are
-	 * converted to xdigs[0x0] through xdigs[0xf] after the
-	 * rounding phase.
-	 */
-	for (s = s0 + bufsize - 1; s > s0 + sigfigs - 1; s--)
-		*s = 0;
-	for (; s > s0 + sigfigs - (DBL_MANL_SIZE / 4) - 1 && s > s0; s--) {
-		*s = u.bits.manl & 0xf;
-		u.bits.manl >>= 4;
-	}
-	for (; s > s0; s--) {
-		*s = u.bits.manh & 0xf;
-		u.bits.manh >>= 4;
+	/* Round to the desired number of digits. */
+	if (SIGFIGS > ndigits && ndigits > 0) {
+		float redux = one[u.bits.sign];
+		int offset = 4 * ndigits + DBL_MAX_EXP - 4 - DBL_MANT_DIG;
+		u.bits.exp = offset;
+		u.d += redux;
+		u.d -= redux;
+		*decpt += u.bits.exp - offset;
 	}
 
-	/*
-	 * At this point, we have snarfed all the bits in the
-	 * mantissa, with the possible exception of the highest-order
-	 * (partial) nibble, which is dealt with by the next
-	 * statement.  We also tack on the implicit normalization bit.
-	 */
-	*s = u.bits.manh | (1U << ((DBL_MANT_DIG - 1) % 4));
-
-	/* If ndigits < 0, we are expected to auto-size the precision. */
-	if (ndigits < 0) {
-		for (ndigits = sigfigs; s0[ndigits - 1] == 0; ndigits--)
-			;
-	}
-
-	if (sigfigs > ndigits && s0[ndigits] != 0)
-		dorounding(s0, ndigits, u.bits.sign, decpt);
-
-	s = s0 + ndigits;
-	if (rve != NULL)
-		*rve = s;
-	*s-- = '\0';
-	for (; s >= s0; s--)
-		*s = xdigs[(unsigned int)*s];
-
-	return (s0);
-}
-
-#if (LDBL_MANT_DIG > DBL_MANT_DIG)
-
-/*
- * This is the long double version of __hdtoa().
- */
-char *
-__hldtoa(long double e, const char *xdigs, int ndigits, int *decpt, int *sign,
-    char **rve)
-{
-	static const int sigfigs = (LDBL_MANT_DIG + 3) / 4;
-	union IEEEl2bits u;
-	char *s, *s0;
-	int bufsize;
-
-	u.e = e;
-	*sign = u.bits.sign;
-
-	switch (fpclassify(e)) {
-	case FP_NORMAL:
-		*decpt = u.bits.exp - LDBL_ADJ;
-		break;
-	case FP_ZERO:
-		*decpt = 1;
-		return (nrv_alloc("0", rve, 1));
-	case FP_SUBNORMAL:
-		u.e *= 0x1p514L;
-		*decpt = u.bits.exp - (514 + LDBL_ADJ);
-		break;
-	case FP_INFINITE:
-		*decpt = INT_MAX;
-		return (nrv_alloc(INFSTR, rve, sizeof(INFSTR) - 1));
-	case FP_NAN:
-		*decpt = INT_MAX;
-		return (nrv_alloc(NANSTR, rve, sizeof(NANSTR) - 1));
-	default:
-		abort();
+	manh = u.bits.manh;
+	manl = u.bits.manl;
+	*s0 = '1';
+	for (s = s0 + 1; s < s0 + bufsize; s++) {
+		*s = xdigs[(manh >> (DBL_MANH_SIZE - 4)) & 0xf];
+		manh = (manh << 4) | (manl >> (DBL_MANL_SIZE - 4));
+		manl <<= 4;
 	}
 
-	/* FP_NORMAL or FP_SUBNORMAL */
-
-	if (ndigits == 0)		/* dtoa() compatibility */
-		ndigits = 1;
-
-	/*
-	 * For simplicity, we generate all the digits even if the
-	 * caller has requested fewer.
-	 */
-	bufsize = (sigfigs > ndigits) ? sigfigs : ndigits;
-	s0 = rv_alloc(bufsize);
-
-	/*
-	 * We work from right to left, first adding any requested zero
-	 * padding, then the least significant portion of the
-	 * mantissa, followed by the most significant.  The buffer is
-	 * filled with the byte values 0x0 through 0xf, which are
-	 * converted to xdigs[0x0] through xdigs[0xf] after the
-	 * rounding phase.
-	 */
-	for (s = s0 + bufsize - 1; s > s0 + sigfigs - 1; s--)
-		*s = 0;
-	for (; s > s0 + sigfigs - (LDBL_MANL_SIZE / 4) - 1 && s > s0; s--) {
-		*s = u.bits.manl & 0xf;
-		u.bits.manl >>= 4;
-	}
-	for (; s > s0; s--) {
-		*s = u.bits.manh & 0xf;
-		u.bits.manh >>= 4;
-	}
-
-	/*
-	 * At this point, we have snarfed all the bits in the
-	 * mantissa, with the possible exception of the highest-order
-	 * (partial) nibble, which is dealt with by the next
-	 * statement.  We also tack on the implicit normalization bit.
-	 */
-	*s = u.bits.manh | (1U << ((LDBL_MANT_DIG - 1) % 4));
-
 	/* If ndigits < 0, we are expected to auto-size the precision. */
 	if (ndigits < 0) {
-		for (ndigits = sigfigs; s0[ndigits - 1] == 0; ndigits--)
+		for (ndigits = SIGFIGS; s0[ndigits - 1] == '0'; ndigits--)
 			;
 	}
 
-	if (sigfigs > ndigits && s0[ndigits] != 0)
-		dorounding(s0, ndigits, u.bits.sign, decpt);
-
 	s = s0 + ndigits;
+	*s = '\0';
 	if (rve != NULL)
 		*rve = s;
-	*s-- = '\0';
-	for (; s >= s0; s--)
-		*s = xdigs[(unsigned int)*s];
-
 	return (s0);
 }
-
-#else	/* (LDBL_MANT_DIG == DBL_MANT_DIG) */
-
-char *
-__hldtoa(long double e, const char *xdigs, int ndigits, int *decpt, int *sign,
-    char **rve)
-{
-
-	return (__hdtoa((double)e, xdigs, ndigits, decpt, sign, rve));
-}
-
-#endif	/* (LDBL_MANT_DIG == DBL_MANT_DIG) */

==== //depot/projects/vap/lib/libc/sparc64/fpu/fpu_qp.c#3 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/sparc64/fpu/fpu_qp.c,v 1.8 2006/04/16 14:32:53 marius Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/sparc64/fpu/fpu_qp.c,v 1.9 2008/04/12 03:09:51 das Exp $");
 
 #include <sys/types.h>
 #include <machine/fsr.h>
@@ -41,6 +41,7 @@
 	struct fpemu fe; \
 	struct fpn *r; \
 	__asm __volatile("stx %%fsr, %0" : "=m" (fe.fe_fsr) :); \
+	fe.fe_cx = 0; \
 	fe.fe_f1.fp_sign = a[0] >> 31; \
 	fe.fe_f1.fp_sticky = 0; \
 	fe.fe_f1.fp_class = __fpu_qtof(&fe.fe_f1, a[0], a[1], a[2], a[3]); \
@@ -49,6 +50,8 @@
 	fe.fe_f2.fp_class = __fpu_qtof(&fe.fe_f2, b[0], b[1], b[2], b[3]); \
 	r = __fpu_ ## op(&fe); \
 	c[0] = __fpu_ftoq(&fe, r, c); \
+	fe.fe_fsr |= fe.fe_cx << FSR_AEXC_SHIFT; \
+	__asm __volatile("ldx %0, %%fsr" : : "m" (fe.fe_fsr)); \
 }
 
 #define	_QP_TTOQ(qname, fname, ntype, signpos, atype, ...) \
@@ -59,10 +62,13 @@
 	struct fpemu fe; \
 	union { atype a[2]; ntype n; } u = { .n = n }; \
 	__asm __volatile("stx %%fsr, %0" : "=m" (fe.fe_fsr) :); \
+	fe.fe_cx = 0; \
 	fe.fe_f1.fp_sign = (signpos >= 0) ? u.a[0] >> signpos : 0; \
 	fe.fe_f1.fp_sticky = 0; \
 	fe.fe_f1.fp_class = __fpu_ ## fname ## tof(&fe.fe_f1, __VA_ARGS__); \
 	c[0] = __fpu_ftoq(&fe, &fe.fe_f1, c); \
+	fe.fe_fsr |= fe.fe_cx << FSR_AEXC_SHIFT; \
+	__asm __volatile("ldx %0, %%fsr" : : "m" (fe.fe_fsr)); \
 }
 
 #define	_QP_QTOT(qname, fname, type, ...) \
@@ -73,10 +79,13 @@
 	struct fpemu fe; \
 	union { u_int a; type n; } u; \
 	__asm __volatile("stx %%fsr, %0" : "=m" (fe.fe_fsr) :); \
+	fe.fe_cx = 0; \
 	fe.fe_f1.fp_sign = c[0] >> 31; \
 	fe.fe_f1.fp_sticky = 0; \
 	fe.fe_f1.fp_class = __fpu_qtof(&fe.fe_f1, c[0], c[1], c[2], c[3]); \
 	u.a = __fpu_fto ## fname(&fe, &fe.fe_f1, ## __VA_ARGS__); \
+	fe.fe_fsr |= fe.fe_cx << FSR_AEXC_SHIFT; \
+	__asm __volatile("ldx %0, %%fsr" : : "m" (fe.fe_fsr)); \
 	return (u.n); \
 }
 
@@ -95,6 +104,7 @@
 { \
 	struct fpemu fe; \
 	__asm __volatile("stx %%fsr, %0" : "=m" (fe.fe_fsr) :); \
+	fe.fe_cx = 0; \
 	fe.fe_f1.fp_sign = a[0] >> 31; \
 	fe.fe_f1.fp_sticky = 0; \
 	fe.fe_f1.fp_class = __fpu_qtof(&fe.fe_f1, a[0], a[1], a[2], a[3]); \
@@ -102,6 +112,8 @@
 	fe.fe_f2.fp_sticky = 0; \
 	fe.fe_f2.fp_class = __fpu_qtof(&fe.fe_f2, b[0], b[1], b[2], b[3]); \
 	__fpu_compare(&fe, cmpe, 0); \
+	fe.fe_fsr |= fe.fe_cx << FSR_AEXC_SHIFT; \
+	__asm __volatile("ldx %0, %%fsr" : : "m" (fe.fe_fsr)); \
 	return (test(FSR_GET_FCC0(fe.fe_fsr))); \
 }
 
@@ -112,11 +124,14 @@
 	struct fpemu fe;
 	struct fpn *r;
 	__asm __volatile("stx %%fsr, %0" : "=m" (fe.fe_fsr) :);
+	fe.fe_cx = 0;
 	fe.fe_f1.fp_sign = a[0] >> 31;
 	fe.fe_f1.fp_sticky = 0;
 	fe.fe_f1.fp_class = __fpu_qtof(&fe.fe_f1, a[0], a[1], a[2], a[3]);
 	r = __fpu_sqrt(&fe);
 	c[0] = __fpu_ftoq(&fe, r, c);
+	fe.fe_fsr |= fe.fe_cx << FSR_AEXC_SHIFT;
+	__asm __volatile("ldx %0, %%fsr" : : "m" (fe.fe_fsr));
 }
 
 _QP_OP(add)

==== //depot/projects/vap/lib/libc/sparc64/fpu/fpu_sqrt.c#3 (text+ko) ====

@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/sparc64/fpu/fpu_sqrt.c,v 1.4 2007/01/09 00:28:05 imp Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/sparc64/fpu/fpu_sqrt.c,v 1.5 2008/04/12 03:10:13 das Exp $");
 
 /*
  * Perform an FPU square root (return sqrt(x)).
@@ -334,7 +334,7 @@
 	FPU_SUBC(d0, x0, t0);
 	if ((int)d0 >= 0) {
 		x0 = d0, x1 = d1, x2 = d2;
-		q |= bit;
+		q = bit;
 		y1 |= 1;		/* now t1, y1 are set in concrete */
 	}
 	ODD_DOUBLE;
@@ -366,12 +366,12 @@
 	FPU_SUBCS(d2, x2, t2);
 	FPU_SUBCS(d1, x1, t1);
 	FPU_SUBC(d0, x0, t0);
-	ODD_DOUBLE;
 	if ((int)d0 >= 0) {
-		x0 = d0, x1 = d1, x2 = d2;
-		q |= bit;
+		x0 = d0, x1 = d1, x2 = d2; x3 = d3;
+		q = bit;
 		y2 |= 1;
 	}
+	ODD_DOUBLE;
 	while ((bit >>= 1) != 0) {
 		EVEN_DOUBLE;
 		t3 = y3 | bit;
@@ -380,7 +380,7 @@
 		FPU_SUBCS(d1, x1, t1);
 		FPU_SUBC(d0, x0, t0);
 		if ((int)d0 >= 0) {
-			x0 = d0, x1 = d1, x2 = d2;
+			x0 = d0, x1 = d1, x2 = d2; x3 = d3;
 			q |= bit;
 			y3 |= bit << 1;
 		}

==== //depot/projects/vap/lib/libc/stdio/printf.3#3 (text+ko) ====

@@ -30,7 +30,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)printf.3	8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/stdio/printf.3,v 1.60 2007/01/09 00:28:07 imp Exp $
+.\" $FreeBSD: src/lib/libc/stdio/printf.3,v 1.61 2008/04/12 03:11:56 das Exp $
 .\"
 .Dd October 16, 2004
 .Dt PRINTF 3
@@ -549,13 +549,14 @@
 Note that there may be multiple valid ways to represent floating-point
 numbers in this hexadecimal format.
 For example,
-.Li 0x3.24p+0 , 0x6.48p-1
+.Li 0x1.92p+1 , 0x3.24p+0 , 0x6.48p-1 ,
 and
 .Li 0xc.9p-2
 are all equivalent.
-The format chosen depends on the internal representation of the
-number, but the implementation guarantees that the length of the
-mantissa will be minimized.
+.Fx 8.0
+and later always prints finite non-zero numbers using
+.Ql 1
+as the digit before the hexadecimal point.
 Zeroes are always represented with a mantissa of 0 (preceded by a
 .Ql -
 if appropriate) and an exponent of

==== //depot/projects/vap/lib/libc/stdlib/strfmon.c#3 (text+ko) ====

@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/strfmon.c,v 1.15 2005/09/12 19:52:42 stefanf Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/stdlib/strfmon.c,v 1.16 2008/04/13 08:05:08 delphij Exp $");
 
 #include <sys/types.h>
 #include <ctype.h>
@@ -535,12 +535,11 @@
 
 	/* make sure that we've enough space for result string */
 	bufsize = strlen(avalue)*2+1;
-	rslt = malloc(bufsize);
+	rslt = calloc(1, bufsize);
 	if (rslt == NULL) {
 		free(avalue);
 		return (NULL);
 	}
-	memset(rslt, 0, bufsize);
 	bufend = rslt + bufsize - 1;	/* reserve space for trailing '\0' */
 
 	/* skip spaces at beggining */

==== //depot/projects/vap/sbin/fsck_ffs/fsck.h#3 (text+ko) ====

@@ -57,7 +57,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)fsck.h	8.4 (Berkeley) 5/9/95
- * $FreeBSD: src/sbin/fsck_ffs/fsck.h,v 1.37 2006/10/31 22:06:56 pjd Exp $
+ * $FreeBSD: src/sbin/fsck_ffs/fsck.h,v 1.38 2008/04/10 23:49:23 delphij Exp $
  */
 
 #include <unistd.h>
@@ -270,6 +270,7 @@
 int	bkgrdflag;		/* use a snapshot to run on an active system */
 int	bflag;			/* location of alternate super block */
 int	debug;			/* output debugging info */
+char	catastrophicflag;	/* run in catastrophic mode */
 int	cvtlevel;		/* convert to newer file system format */
 int	bkgrdcheck;		/* determine if background check is possible */
 int	bkgrdsumadj;		/* whether the kernel have ability to adjust superblock summary */
@@ -335,6 +336,7 @@
 void		catch(int);
 void		catchquit(int);
 int		changeino(ino_t dir, const char *name, ino_t newnum);
+void		check_cgmagic(int cg, struct cg *cgp);
 int		chkrange(ufs2_daddr_t blk, int cnt);
 void		ckfini(int markclean);
 int		ckinode(union dinode *dp, struct inodesc *);

==== //depot/projects/vap/sbin/fsck_ffs/fsck_ffs.8#3 (text+ko) ====

@@ -27,9 +27,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)fsck.8	8.4 (Berkeley) 5/9/95
-.\" $FreeBSD: src/sbin/fsck_ffs/fsck_ffs.8,v 1.34 2005/09/20 08:02:38 delphij Exp $
+.\" $FreeBSD: src/sbin/fsck_ffs/fsck_ffs.8,v 1.35 2008/04/10 23:49:23 delphij Exp $
 .\"
-.Dd April 24, 2001
+.Dd April 10, 2008
 .Dt FSCK_FFS 8
 .Os
 .Sh NAME
@@ -38,7 +38,7 @@
 .Nd file system consistency check and interactive repair
 .Sh SYNOPSIS
 .Nm
-.Op Fl BFpfny
+.Op Fl BCFpfny
 .Op Fl b Ar block
 .Op Fl c Ar level
 .Op Fl m Ar mode
@@ -175,6 +175,26 @@
 the super block for the file system.
 An alternate super block is usually located at block 32 for UFS1,
 and block 160 for UFS2.
+.It Fl C
+Run
+.Nm
+in 'catastrophic recovery' mode, which will enable certain aggressive
+operations that can make
+.Nm
+to survive with file systems that has very serious data damage, which
+is an useful last resort when on disk data damage is very serious
+and causes
+.Nm
+to crash otherwise.  Be
+.Em very careful
+using this flag, is dangerous if there are data transmission hazards
+because a false positive cylinder group magic number mismatch could
+cause
+.Em irrevertible data loss!
+.Pp
+This option implies the
+.Fl f
+flag.
 .It Fl c
 Convert the file system to the specified level.
 Note that the level of a file system can only be raised.

==== //depot/projects/vap/sbin/fsck_ffs/fsutil.c#3 (text+ko) ====

@@ -33,7 +33,7 @@
 #endif /* not lint */
 #endif
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sbin/fsck_ffs/fsutil.c,v 1.26 2006/10/31 22:06:56 pjd Exp $");
+__FBSDID("$FreeBSD: src/sbin/fsck_ffs/fsutil.c,v 1.27 2008/04/10 23:49:23 delphij Exp $");
 
 #include <sys/param.h>
 #include <sys/time.h>
@@ -418,6 +418,35 @@
 }
 
 /*
+ * Check cg's magic number.  If catastrophic mode is enabled and the cg's
+ * magic number is bad, offer an option to clear the whole cg.
+ */
+void
+check_cgmagic(int cg, struct cg *cgp)
+{
+
+	if (!cg_chkmagic(cgp)) {
+	    pwarn("CG %d: BAD MAGIC NUMBER\n", cg);
+	    if (catastrophicflag) {
+		if (reply("CLEAR CG")) {
+			memset(cgp, 0, (size_t)sblock.fs_cgsize);
+			cgp->cg_initediblk = sblock.fs_ipg;
+			cgp->cg_old_niblk = sblock.fs_ipg;
+			cgp->cg_old_ncyl = sblock.fs_old_cpg;
+			cgp->cg_cgx = cg;
+			cgp->cg_niblk = sblock.fs_ipg;
+			cgp->cg_ndblk = sblock.fs_size - cgbase(&sblock, cg);
+			cgp->cg_magic = CG_MAGIC;
+			cgdirty();
+			printf("PLEASE RERUN FSCK.\n");
+			rerun = 1;
+		}
+	    } else
+		printf("YOU MAY NEED TO RERUN FSCK WITH -C IF IT CRASHED.\n");
+	}
+}
+
+/*
  * allocate a data block with the specified number of fragments
  */
 ufs2_daddr_t
@@ -441,8 +470,7 @@
 			}
 			cg = dtog(&sblock, i + j);
 			getblk(&cgblk, cgtod(&sblock, cg), sblock.fs_cgsize);
-			if (!cg_chkmagic(cgp))
-				pfatal("CG %d: BAD MAGIC NUMBER\n", cg);
+			check_cgmagic(cg, cgp);
 			baseblk = dtogd(&sblock, i + j);
 			for (k = 0; k < frags; k++) {
 				setbmap(i + j + k);

==== //depot/projects/vap/sbin/fsck_ffs/inode.c#3 (text+ko) ====

@@ -33,7 +33,7 @@
 #endif /* not lint */
 #endif
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sbin/fsck_ffs/inode.c,v 1.38 2006/10/31 22:06:56 pjd Exp $");
+__FBSDID("$FreeBSD: src/sbin/fsck_ffs/inode.c,v 1.39 2008/04/10 23:49:23 delphij Exp $");
 
 #include <sys/param.h>
 #include <sys/stdint.h>
@@ -617,8 +617,7 @@
 		return (0);
 	cg = ino_to_cg(&sblock, ino);
 	getblk(&cgblk, cgtod(&sblock, cg), sblock.fs_cgsize);
-	if (!cg_chkmagic(cgp))
-		pfatal("CG %d: BAD MAGIC NUMBER\n", cg);
+	check_cgmagic(cg, cgp);
 	setbit(cg_inosused(cgp), ino % sblock.fs_ipg);
 	cgp->cg_cs.cs_nifree--;
 	switch (type & IFMT) {

==== //depot/projects/vap/sbin/fsck_ffs/main.c#5 (text+ko) ====

@@ -39,7 +39,7 @@
 #endif /* not lint */
 #endif
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sbin/fsck_ffs/main.c,v 1.50 2008/04/04 01:50:58 rodrigc Exp $");
+__FBSDID("$FreeBSD: src/sbin/fsck_ffs/main.c,v 1.51 2008/04/10 23:49:23 delphij Exp $");
 
 #include <sys/param.h>
 #include <sys/stat.h>
@@ -81,7 +81,8 @@
 
 	sync();
 	skipclean = 1;
-	while ((ch = getopt(argc, argv, "b:Bc:dfFm:npy")) != -1) {
+	catastrophicflag = 0;
+	while ((ch = getopt(argc, argv, "b:Bc:CdfFm:npy")) != -1) {
 		switch (ch) {
 		case 'b':
 			skipclean = 0;
@@ -105,6 +106,10 @@
 			debug++;
 			break;
 
+		case 'C':
+			catastrophicflag = 1;
+			/* FALLTHROUGH */
+
 		case 'f':
 			skipclean = 0;
 			break;

==== //depot/projects/vap/sbin/geom/class/journal/gjournal.8#3 (text+ko) ====

@@ -22,9 +22,9 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $FreeBSD: src/sbin/geom/class/journal/gjournal.8,v 1.3 2007/11/15 06:31:18 ru Exp $
+.\" $FreeBSD: src/sbin/geom/class/journal/gjournal.8,v 1.5 2008/04/13 11:05:59 remko Exp $
 .\"
-.Dd November 14, 2007
+.Dd April 13, 2008
 .Dt GJOURNAL 8
 .Os
 .Sh NAME
@@ -219,7 +219,7 @@
 .Bd -literal -offset indent
 umount /dev/da0s1d
 gjournal label da0s1d da0s1e && \e
-    tunefs -J enable -n disable && \e
+    tunefs -J enable -n disable da01sd.journal && \e
     mount -o async /dev/da0s1d.journal /mnt || \e
     mount /dev/da0s1d /mnt
 .Ed

==== //depot/projects/vap/sbin/restore/dirs.c#4 (text+ko) ====

@@ -37,7 +37,7 @@
 static char sccsid[] = "@(#)dirs.c	8.7 (Berkeley) 5/1/95";
 #endif
 static const char rcsid[] =
-  "$FreeBSD: src/sbin/restore/dirs.c,v 1.32 2008/04/03 20:37:38 imp Exp $";
+  "$FreeBSD: src/sbin/restore/dirs.c,v 1.33 2008/04/11 21:48:13 mckusick Exp $";
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -558,6 +558,7 @@
 	char *cp, *buf;
 	const char *tmpdir;
 	int bufsize;
+	uid_t myuid;
 
 	vprintf(stdout, "Set directory mode, owner, and times.\n");
 	if ((tmpdir = getenv("TMPDIR")) == NULL || tmpdir[0] == '\0')
@@ -578,6 +579,7 @@
 	}
 	clearerr(mf);
 	bufsize = 0;
+	myuid = getuid();
 	for (;;) {
 		(void) fread((char *)&node, 1, sizeof(struct modeinfo), mf);
 		if (feof(mf))
@@ -624,7 +626,10 @@
 					    "extended attributes for ", cp);
 				}
 			}
-			(void) chown(cp, node.uid, node.gid);
+			if (myuid != 0)
+				(void) chown(cp, myuid, node.gid);
+			else
+				(void) chown(cp, node.uid, node.gid);
 			(void) chmod(cp, node.mode);
 			utimes(cp, node.ctimep);
 			utimes(cp, node.mtimep);

==== //depot/projects/vap/sbin/restore/tape.c#3 (text+ko) ====

@@ -39,7 +39,7 @@
 #endif /* not lint */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sbin/restore/tape.c,v 1.49 2007/03/06 08:13:20 mckusick Exp $");
+__FBSDID("$FreeBSD: src/sbin/restore/tape.c,v 1.51 2008/04/11 21:51:53 mckusick Exp $");
 
 #include <sys/param.h>
 #include <sys/file.h>
@@ -582,7 +582,9 @@
 	ctimep[1].tv_sec = curfile.birthtime_sec;
 	ctimep[1].tv_usec = curfile.birthtime_nsec / 1000;
 	extsize = curfile.extsize;
-	uid = curfile.uid;
+	uid = getuid();
+	if (uid == 0)
+		uid = curfile.uid;
 	gid = curfile.gid;
 	mode = curfile.mode;
 	flags = curfile.file_flags;
@@ -1377,7 +1379,7 @@
 	}
 	if (checksum((int *)buf) == FAIL)
 		return (FAIL);
-	if (_time64_to_time(buf->c_date) != dumpdate)
+	if (dumpdate != 0 && _time64_to_time(buf->c_date) != dumpdate)
 		fprintf(stderr, "Header with wrong dumpdate.\n");
 	if (Bcvt) {
 		swabst((u_char *)"8l4s1q8l2q17l", (u_char *)buf);

==== //depot/projects/vap/sbin/route/route.c#4 (text+ko) ====

@@ -38,7 +38,7 @@
 static char sccsid[] = "@(#)route.c	8.6 (Berkeley) 4/28/95";
 #endif
 static const char rcsid[] =
-  "$FreeBSD: src/sbin/route/route.c,v 1.84 2008/03/22 12:50:43 remko Exp $";
+  "$FreeBSD: src/sbin/route/route.c,v 1.85 2008/04/10 12:16:20 ru Exp $";
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -1187,7 +1187,7 @@
 #define NEXTADDR(w, u) \
 	if (rtm_addrs & (w)) {\
 	    l = SA_SIZE(&(u.sa)); memmove(cp, &(u), l); cp += l;\
-	    if (verbose) sodump(&(u),"u");\
+	    if (verbose) sodump(&(u),#u);\
 	}
 
 	errno = 0;

==== //depot/projects/vap/share/man/man4/Makefile#11 (text+ko) ====

@@ -1,5 +1,5 @@
 #	@(#)Makefile	8.1 (Berkeley) 6/18/93
-# $FreeBSD: src/share/man/man4/Makefile,v 1.413 2008/04/01 07:20:04 weongyo Exp $

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


More information about the p4-projects mailing list