Date: Fri, 5 Mar 2004 16:00:45 -0800 (PST) From: Peter Wemm <peter@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 48246 for review Message-ID: <200403060000.i2600jkg032632@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=48246 Change 48246 by peter@peter_daintree on 2004/03/05 15:59:59 IFC @48245 Affected files ... .. //depot/projects/hammer/Makefile.inc1#40 integrate .. //depot/projects/hammer/UPDATING.64BTT#2 integrate .. //depot/projects/hammer/bin/dd/Makefile#4 integrate .. //depot/projects/hammer/bin/dd/args.c#4 integrate .. //depot/projects/hammer/bin/dd/dd.1#3 integrate .. //depot/projects/hammer/bin/dd/dd.c#4 integrate .. //depot/projects/hammer/bin/dd/dd.h#3 integrate .. //depot/projects/hammer/bin/dd/gen.c#1 branch .. //depot/projects/hammer/bin/dd/ref.ascii#1 branch .. //depot/projects/hammer/bin/dd/ref.ebcdic#1 branch .. //depot/projects/hammer/bin/dd/ref.ibm#1 branch .. //depot/projects/hammer/bin/dd/ref.lcase#1 branch .. //depot/projects/hammer/bin/dd/ref.oldascii#1 branch .. //depot/projects/hammer/bin/dd/ref.oldebcdic#1 branch .. //depot/projects/hammer/bin/dd/ref.oldibm#1 branch .. //depot/projects/hammer/bin/dd/ref.pareven#1 branch .. //depot/projects/hammer/bin/dd/ref.parnone#1 branch .. //depot/projects/hammer/bin/dd/ref.parodd#1 branch .. //depot/projects/hammer/bin/dd/ref.parset#1 branch .. //depot/projects/hammer/bin/dd/ref.swab#1 branch .. //depot/projects/hammer/bin/dd/ref.ucase#1 branch .. //depot/projects/hammer/etc/rc.d/Makefile#18 integrate .. //depot/projects/hammer/gnu/usr.bin/binutils/Makefile.inc0#8 integrate .. //depot/projects/hammer/gnu/usr.bin/binutils/gasp/Makefile#6 integrate .. //depot/projects/hammer/gnu/usr.bin/binutils/gdb/Makefile#9 integrate .. //depot/projects/hammer/share/man/man9/DEVICE_IDENTIFY.9#2 integrate .. //depot/projects/hammer/share/mk/bsd.cpu.mk#12 integrate .. //depot/projects/hammer/sys/compat/ndis/kern_ndis.c#7 integrate .. //depot/projects/hammer/sys/dev/aac/aac.c#19 integrate .. //depot/projects/hammer/sys/dev/acpica/acpi_cpu.c#14 integrate .. //depot/projects/hammer/sys/dev/acpica/acpi_thermal.c#12 integrate .. //depot/projects/hammer/sys/dev/adlink/adlink.c#6 integrate .. //depot/projects/hammer/sys/dev/md/md.c#23 integrate .. //depot/projects/hammer/sys/dev/pccbb/pccbb.c#22 integrate .. //depot/projects/hammer/sys/dev/random/harvest.c#5 integrate .. //depot/projects/hammer/sys/dev/utopia/utopia.c#4 integrate .. //depot/projects/hammer/sys/geom/bde/g_bde_work.c#10 integrate .. //depot/projects/hammer/sys/kern/kern_exec.c#19 integrate .. //depot/projects/hammer/sys/kern/kern_exit.c#19 integrate .. //depot/projects/hammer/sys/kern/kern_fork.c#26 integrate .. //depot/projects/hammer/sys/kern/kern_intr.c#22 integrate .. //depot/projects/hammer/sys/kern/kern_sig.c#35 integrate .. //depot/projects/hammer/sys/kern/kern_sysctl.c#11 integrate .. //depot/projects/hammer/sys/kern/sched_4bsd.c#15 integrate .. //depot/projects/hammer/sys/kern/subr_trap.c#18 integrate .. //depot/projects/hammer/sys/nfs4client/nfs4_vfsops.c#5 integrate .. //depot/projects/hammer/sys/opencrypto/crypto.c#8 integrate .. //depot/projects/hammer/sys/vm/vm_extern.h#9 integrate .. //depot/projects/hammer/sys/vm/vm_glue.c#23 integrate .. //depot/projects/hammer/sys/vm/vm_mmap.c#18 integrate Differences ... ==== //depot/projects/hammer/Makefile.inc1#40 (text+ko) ==== @@ -1,5 +1,5 @@ # -# $FreeBSD: src/Makefile.inc1,v 1.409 2004/03/04 18:41:35 gad Exp $ +# $FreeBSD: src/Makefile.inc1,v 1.410 2004/03/05 18:16:28 gad Exp $ # # Make command line options: # -DNO_DYNAMICROOT do not link /bin and /sbin dynamically @@ -373,8 +373,8 @@ @echo "* Note: This installation changes the type used for time_t." .endif @echo "* " - @echo "* This host (${THISHOST}) presently has a time_t of type ${CUR_TIMET}," - @echo "* and this installation will switch time_t to be type ${SRC_TIMET}." + @echo "* This host (${THISHOST}) has time_t defined as ${CUR_TIMET}," + @echo "* and this installation would change that to type ${SRC_TIMET}." .if ${NEWSPARC_TIMETYPE} != ${SRC_TIMET} @echo "* " @echo "* If that is *NOT* what you wanted, then you need to change the" ==== //depot/projects/hammer/UPDATING.64BTT#2 (text+ko) ==== @@ -28,7 +28,7 @@ # POSSIBILITY OF SUCH DAMAGE. # # -------+---------+---------+---------+---------+---------+---------+---------+ -# $FreeBSD: src/UPDATING.64BTT,v 1.2 2004/03/03 19:48:52 gad Exp $ +# $FreeBSD: src/UPDATING.64BTT,v 1.3 2004/03/05 23:10:49 gad Exp $ # -------+---------+---------+---------+---------+---------+---------+---------+ If you are in too much of a hurry to read this file, then this is not the @@ -120,7 +120,7 @@ ifconfig -a #- NFS 8a. See note below. shutdown now #- NFS 8b. NOT 'shutdown -r now' cd /usr/src #- NFS 8c. - ./installworld_oldk #- NFS 8d. See note below. + sh installworld_oldk #- NFS 8d. See note below. # - - End of this section for NFS-mounts - - # reboot #- 9. MUST go into single-user mode @@ -150,7 +150,7 @@ mount_nfs host:objdir /usr/obj #- NFS 15c. # - - End of this section for NFS-mounts - - # cd /usr/src #- 16. - ./installworld_newk #- 17. Might want to add -S + sh installworld_newk #- 17. Might want to add -S mergemaster #- 18. rm -f /var/db/dhclient.leases #- 19. If this host uses DHCP reboot #- 20. @@ -213,7 +213,7 @@ This will drop you into single-user mode, without rebooting. It will ask if you want to use /bin/sh for your shell. You do. -Notes on step NFS 8d: installworld_oldk +Notes on step NFS 8d: sh installworld_oldk Note that this script only installs *part* of the new world. You will still have to reboot into single-user mode and do the full installworld. @@ -247,7 +247,7 @@ If you use the 'mount' command for NFS mounts, it will turn around and directly execute /sbin/mount_nfs, and that is not desirable in this case. -Notes on step 17: ./installworld_newk +Notes on step 17: sh installworld_newk This script will do some setup work, and then ask you if want it to run 'make installworld'. Most people should just answer "y" (yes) to that ==== //depot/projects/hammer/bin/dd/Makefile#4 (text+ko) ==== @@ -1,5 +1,5 @@ # @(#)Makefile 8.1 (Berkeley) 5/31/93 -# $FreeBSD: src/bin/dd/Makefile,v 1.12 2003/06/13 07:04:01 markm Exp $ +# $FreeBSD: src/bin/dd/Makefile,v 1.14 2004/03/05 19:35:51 phk Exp $ PROG= dd SRCS= args.c conv.c conv_tab.c dd.c misc.c position.c @@ -7,3 +7,19 @@ MAINTAINER= green@FreeBSD.org .include <bsd.prog.mk> + +# +# Test the character conversion functions. We have to be explicit about +# which LC_LANG we use because the definition of upper and lower case +# depends on it. +test: ${PROG} + cc ${.CURDIR}/gen.c +.for conv in ascii ebcdic ibm oldascii oldebcdic oldibm \ + pareven parnone parodd parset \ + swab lcase ucase + @echo testing conv=${conv} + @./a.out | \ + /usr/bin/env -i LC_CTYPE=ASCII ./dd conv=${conv} 2>/dev/null | \ + /usr/bin/env -i LC_CTYPE=ASCII hexdump -C | \ + diff -IFreeBSD - ${.CURDIR}/ref.${conv} +.endfor ==== //depot/projects/hammer/bin/dd/args.c#4 (text+ko) ==== @@ -41,7 +41,7 @@ #endif #endif /* not lint */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/bin/dd/args.c,v 1.36 2003/03/15 13:34:48 ru Exp $"); +__FBSDID("$FreeBSD: src/bin/dd/args.c,v 1.37 2004/03/05 19:35:51 phk Exp $"); #include <sys/types.h> @@ -299,6 +299,10 @@ { "oldebcdic", C_EBCDIC, C_ASCII, a2e_32V }, { "oldibm", C_EBCDIC, C_ASCII, a2ibm_32V }, { "osync", C_OSYNC, C_BS, NULL }, + { "pareven", C_PAREVEN, C_PARODD|C_PARSET|C_PARNONE, NULL}, + { "parnone", C_PARNONE, C_PARODD|C_PARSET|C_PAREVEN, NULL}, + { "parodd", C_PARODD, C_PAREVEN|C_PARSET|C_PARNONE, NULL}, + { "parset", C_PARSET, C_PARODD|C_PAREVEN|C_PARNONE, NULL}, { "sparse", C_SPARSE, 0, NULL }, { "swab", C_SWAB, 0, NULL }, { "sync", C_SYNC, 0, NULL }, ==== //depot/projects/hammer/bin/dd/dd.1#3 (text+ko) ==== @@ -33,7 +33,7 @@ .\" SUCH DAMAGE. .\" .\" @(#)dd.1 8.2 (Berkeley) 1/13/94 -.\" $FreeBSD: src/bin/dd/dd.1,v 1.21 2002/11/26 17:55:40 ru Exp $ +.\" $FreeBSD: src/bin/dd/dd.1,v 1.22 2004/03/05 19:35:51 phk Exp $ .\" .Dd January 13, 1994 .Dt DD 1 @@ -231,6 +231,13 @@ systems. .It Cm lcase Transform uppercase characters into lowercase characters. +.It Cm pareven , parnone , parodd , parset +Output data with the specified parity. +The parity bit on input is stripped unless +.Tn EBCDIC +to +.Tn ASCII +conversions is also specified. .It Cm noerror Do not stop processing on an input error. When an input error occurs, a diagnostic message followed by the current @@ -355,6 +362,19 @@ in the same format as the standard completion message and .Nm will exit. +.Sh EXAMPLES +Check that a disk drive contains no bad blocks: +.Dl dd if=/dev/ad0 of=/dev/null bs=1m +.Pp +Do a refresh of a disk drive, in order to prevent presently +recoverable read errors from progressing into unrecoverable read errors: +.Dl dd if=/dev/ad0 of=/dev/ad0 bs=1m +.Pp +Remove parity bit from a file +.Dl dd if=file conv=parnone of=file.txt +.Pp +Check for (even) parity errors on a file: +.Dl dd if=file conv=pareven | cmp -x - file .Sh DIAGNOSTICS .Ex -std .Sh SEE ALSO ==== //depot/projects/hammer/bin/dd/dd.c#4 (text+ko) ==== @@ -47,7 +47,7 @@ #endif /* not lint */ #endif #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/bin/dd/dd.c,v 1.40 2003/05/01 16:58:54 obrien Exp $"); +__FBSDID("$FreeBSD: src/bin/dd/dd.c,v 1.41 2004/03/05 19:35:51 phk Exp $"); #include <sys/param.h> #include <sys/stat.h> @@ -104,6 +104,16 @@ exit(0); } +static int +parity(u_char c) +{ + int i; + + i = c ^ (c >> 1) ^ (c >> 2) ^ (c >> 3) ^ + (c >> 4) ^ (c >> 5) ^ (c >> 6) ^ (c >> 7); + return (i & 1); +} + static void setup(void) { @@ -176,29 +186,52 @@ if (ftruncate(out.fd, out.offset * out.dbsz) == -1) err(1, "truncating %s", out.name); - /* - * If converting case at the same time as another conversion, build a - * table that does both at once. If just converting case, use the - * built-in tables. - */ - if (ddflags & (C_LCASE | C_UCASE)) { - if (ddflags & (C_ASCII | C_EBCDIC)) { - if (ddflags & C_LCASE) { - for (cnt = 0; cnt <= 0377; ++cnt) - casetab[cnt] = tolower(ctab[cnt]); - } else { - for (cnt = 0; cnt <= 0377; ++cnt) - casetab[cnt] = toupper(ctab[cnt]); - } + if (ddflags & (C_LCASE | C_UCASE | C_ASCII | C_EBCDIC | C_PARITY)) { + if (ctab != NULL) { + for (cnt = 0; cnt <= 0377; ++cnt) + casetab[cnt] = ctab[cnt]; } else { - if (ddflags & C_LCASE) { - for (cnt = 0; cnt <= 0377; ++cnt) - casetab[cnt] = tolower((int)cnt); - } else { - for (cnt = 0; cnt <= 0377; ++cnt) - casetab[cnt] = toupper((int)cnt); - } + for (cnt = 0; cnt <= 0377; ++cnt) + casetab[cnt] = cnt; + } + if ((ddflags & C_PARITY) && !(ddflags & C_ASCII)) { + /* + * If the input is not EBCDIC, and we do parity + * processing, strip input parity. + */ + for (cnt = 200; cnt <= 0377; ++cnt) + casetab[cnt] = casetab[cnt & 0x7f]; + } + if (ddflags & C_LCASE) { + for (cnt = 0; cnt <= 0377; ++cnt) + casetab[cnt] = tolower(casetab[cnt]); + } else if (ddflags & C_UCASE) { + for (cnt = 0; cnt <= 0377; ++cnt) + casetab[cnt] = toupper(casetab[cnt]); + } + if ((ddflags & C_PARITY)) { + /* + * This should strictly speaking be a no-op, but I + * wonder what funny LANG settings could get us. + */ + for (cnt = 0; cnt <= 0377; ++cnt) + casetab[cnt] = casetab[cnt] & 0x7f; + } + if ((ddflags & C_PARSET)) { + for (cnt = 0; cnt <= 0377; ++cnt) + casetab[cnt] = casetab[cnt] | 0x80; + } + if ((ddflags & C_PAREVEN)) { + for (cnt = 0; cnt <= 0377; ++cnt) + if (parity(casetab[cnt])) + casetab[cnt] = casetab[cnt] | 0x80; + } + if ((ddflags & C_PARODD)) { + for (cnt = 0; cnt <= 0377; ++cnt) + if (!parity(casetab[cnt])) + casetab[cnt] = casetab[cnt] | 0x80; } + ctab = casetab; } ==== //depot/projects/hammer/bin/dd/dd.h#3 (text+ko) ==== @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * @(#)dd.h 8.3 (Berkeley) 4/2/94 - * $FreeBSD: src/bin/dd/dd.h,v 1.18 2003/02/27 18:04:54 markm Exp $ + * $FreeBSD: src/bin/dd/dd.h,v 1.19 2004/03/05 19:35:51 phk Exp $ */ /* Input/output stream state. */ @@ -95,3 +95,9 @@ #define C_UNBLOCK 0x80000 #define C_OSYNC 0x100000 #define C_SPARSE 0x200000 +#define C_PAREVEN 0x400000 +#define C_PARODD 0x800000 +#define C_PARSET 0x1000000 +#define C_PARNONE 0x2000000 + +#define C_PARITY (C_PAREVEN|C_PARODD|C_PARSET|C_PARNONE) ==== //depot/projects/hammer/etc/rc.d/Makefile#18 (text+ko) ==== @@ -1,5 +1,5 @@ # $NetBSD: Makefile,v 1.16 2001/01/14 15:37:22 minoura Exp $ -# $FreeBSD: src/etc/rc.d/Makefile,v 1.33 2004/03/05 05:48:58 bde Exp $ +# $FreeBSD: src/etc/rc.d/Makefile,v 1.34 2004/03/05 16:13:22 bde Exp $ FILES= DAEMON LOGIN NETWORKING SERVERS \ abi accounting addswap adjkerntz amd \ @@ -41,6 +41,4 @@ FILESDIR= /etc/rc.d FILESMODE= ${BINMODE} -NOPROG= noprog - .include <bsd.prog.mk> ==== //depot/projects/hammer/gnu/usr.bin/binutils/Makefile.inc0#8 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/gnu/usr.bin/binutils/Makefile.inc0,v 1.34 2004/03/04 20:36:18 ache Exp $ +# $FreeBSD: src/gnu/usr.bin/binutils/Makefile.inc0,v 1.35 2004/03/05 16:12:31 ache Exp $ # # This is included explicitly at the top of each sub-Makefile. We can't # use the normal "Makefile.inc" mechanism, because we need some of these @@ -24,8 +24,6 @@ .endif CFLAGS+= -I${.CURDIR} CFLAGS+= -I${.CURDIR}/${RELTOP}/libbfd/${TARGET_ARCH} -# to pick right getopt.h -CFLAGS+= -I${DESTDIR}/usr/include CFLAGS+= -I${SRCDIR}/include .if exists(${.CURDIR}/${TARGET_ARCH}) ==== //depot/projects/hammer/gnu/usr.bin/binutils/gasp/Makefile#6 (text+ko) ==== @@ -1,7 +1,4 @@ -# $FreeBSD: src/gnu/usr.bin/binutils/gasp/Makefile,v 1.16 2004/03/05 01:47:02 ache Exp $ - -# must be before -I${DESTDIR}/usr/include -CFLAGS+= -I${DESTDIR}/usr/include/gnu +# $FreeBSD: src/gnu/usr.bin/binutils/gasp/Makefile,v 1.17 2004/03/05 16:12:31 ache Exp $ .include "../Makefile.inc0" @@ -13,6 +10,7 @@ CFLAGS+= -DBFD_ASSEMBLER CFLAGS+= -I${.CURDIR}/../as/${TARGET_ARCH}-freebsd -I${.CURDIR}/../as CFLAGS+= -I${.CURDIR} +CFLAGS+= -I${DESTDIR}/usr/include/gnu CFLAGS+= -I${SRCDIR} -I${SRCDIR}/gas -I${SRCDIR}/gas/config DPADD= ${RELTOP}/libiberty/libiberty.a LDADD= ${DPADD} ==== //depot/projects/hammer/gnu/usr.bin/binutils/gdb/Makefile#9 (text+ko) ==== @@ -1,8 +1,5 @@ # ex:ts=8 -# $FreeBSD: src/gnu/usr.bin/binutils/gdb/Makefile,v 1.77 2004/03/05 01:47:03 ache Exp $ - -# must be before -I${DESTDIR}/usr/include -CFLAGS+= -I${DESTDIR}/usr/include/gnu +# $FreeBSD: src/gnu/usr.bin/binutils/gdb/Makefile,v 1.78 2004/03/05 16:12:31 ache Exp $ .include "../Makefile.inc0" @@ -61,6 +58,7 @@ CFLAGS+= -I${.CURDIR}/${TARGET_ARCH} CFLAGS+= -I${SRCDIR}/binutils -I${SRCDIR}/bfd CFLAGS+= -I${GDBDIR}/gdb -I${GDBDIR}/gdb/config +CFLAGS+= -I${DESTDIR}/usr/include/gnu CFLAGS+= -I$(.CURDIR) YFLAGS= ==== //depot/projects/hammer/share/man/man9/DEVICE_IDENTIFY.9#2 (text+ko) ==== @@ -26,7 +26,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $FreeBSD: src/share/man/man9/DEVICE_IDENTIFY.9,v 1.7 2002/03/16 18:07:07 schweikh Exp $ +.\" $FreeBSD: src/share/man/man9/DEVICE_IDENTIFY.9,v 1.9 2004/03/05 22:21:18 imp Exp $ .\" .Dd March 10, 2001 .Dt DEVICE_IDENTIFY 9 @@ -54,6 +54,13 @@ for each resource (refer to .Xr bus_set_resource 9 for more information). +.Pp +Since the device tree and the device driver tree are disjoint, the +.Nm +routine needs to take this into account. +If you load and unload your device driver that has the identify +routine, the child node has the potential for adding the same node +multiple times. .Sh EXAMPLES The following pseudo-code shows an example of a function that probes for a piece of hardware and registers it and its resource @@ -74,10 +81,6 @@ } } .Ed -.Sh RETURN VALUES -Zero is returned on success, -otherwise an appropriate error is returned (see -.Xr errno 2 ) . .Sh SEE ALSO .Xr BUS_ADD_CHILD 9 , .Xr bus_set_resource 9 , ==== //depot/projects/hammer/share/mk/bsd.cpu.mk#12 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/share/mk/bsd.cpu.mk,v 1.32 2004/01/31 02:17:11 bde Exp $ +# $FreeBSD: src/share/mk/bsd.cpu.mk,v 1.33 2004/03/05 15:59:33 bde Exp $ # Set default CPU compile flags and baseline CPUTYPE for each arch. The # compile flags must support the minimum CPU type for each architecture but @@ -11,7 +11,7 @@ . elif ${MACHINE_ARCH} == "alpha" _CPUCFLAGS = -mcpu=ev4 -mtune=ev5 MACHINE_CPU = ev4 -.elif ${MACHINE_ARCH} == "amd64" +. elif ${MACHINE_ARCH} == "amd64" MACHINE_CPU = amd64 sse2 sse . elif ${MACHINE_ARCH} == "ia64" _CPUCFLAGS = @@ -88,13 +88,13 @@ # unordered list to make it easy for client makefiles to test for the # presence of a CPU feature. -.if ${MACHINE_ARCH} == "i386" -. if ${CPUTYPE} == "athlon-mp" || ${CPUTYPE} == "athlon-xp" || \ +. if ${MACHINE_ARCH} == "i386" +. if ${CPUTYPE} == "athlon-mp" || ${CPUTYPE} == "athlon-xp" || \ ${CPUTYPE} == "athlon-4" MACHINE_CPU = athlon-xp k7 3dnow sse mmx k6 k5 i586 i486 i386 -. elif ${CPUTYPE} == "athlon" || ${CPUTYPE} == "athlon-tbird" +. elif ${CPUTYPE} == "athlon" || ${CPUTYPE} == "athlon-tbird" MACHINE_CPU = athlon k7 3dnow mmx k6 k5 i586 i486 i386 -. elif ${CPUTYPE} == "k6-3" || ${CPUTYPE} == "k6-2" +. elif ${CPUTYPE} == "k6-3" || ${CPUTYPE} == "k6-2" MACHINE_CPU = 3dnow mmx k6 k5 i586 i486 i386 . elif ${CPUTYPE} == "k6" MACHINE_CPU = mmx k6 k5 i586 i486 i386 ==== //depot/projects/hammer/sys/compat/ndis/kern_ndis.c#7 (text+ko) ==== @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/compat/ndis/kern_ndis.c,v 1.39 2004/02/14 20:57:32 wpaul Exp $"); +__FBSDID("$FreeBSD: src/sys/compat/ndis/kern_ndis.c,v 1.40 2004/03/05 22:42:16 jhb Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -244,7 +244,6 @@ } wakeup(die); - mtx_lock(&Giant); kthread_exit(0); } ==== //depot/projects/hammer/sys/dev/aac/aac.c#19 (text+ko) ==== @@ -28,7 +28,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/aac/aac.c,v 1.89 2004/02/25 05:41:44 scottl Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/aac/aac.c,v 1.90 2004/03/05 22:42:16 jhb Exp $"); /* * Driver for the Adaptec 'FSA' family of PCI/SCSI RAID adapters. @@ -814,7 +814,6 @@ AAC_LOCK_RELEASE(&sc->aac_io_lock); wakeup(sc->aac_dev); - mtx_lock(&Giant); kthread_exit(0); } ==== //depot/projects/hammer/sys/dev/acpica/acpi_cpu.c#14 (text+ko) ==== @@ -26,7 +26,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_cpu.c,v 1.30 2004/03/04 05:17:52 njl Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_cpu.c,v 1.31 2004/03/05 18:08:23 njl Exp $"); #include "opt_acpi.h" #include <sys/param.h> @@ -709,7 +709,8 @@ SYSCTL_ADD_PROC(&acpi_cpu_sysctl_ctx, SYSCTL_CHILDREN(acpi_cpu_sysctl_tree), OID_AUTO, "cx_history", CTLTYPE_STRING | CTLFLAG_RD, - NULL, 0, acpi_cpu_history_sysctl, "A", ""); + NULL, 0, acpi_cpu_history_sysctl, "A", + "count of full sleeps for Cx state / short sleeps"); #ifdef notyet /* Signal platform that we can handle _CST notification. */ ==== //depot/projects/hammer/sys/dev/acpica/acpi_thermal.c#12 (text+ko) ==== @@ -26,7 +26,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_thermal.c,v 1.39 2004/03/03 18:34:42 njl Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_thermal.c,v 1.40 2004/03/05 18:06:31 njl Exp $"); #include "opt_acpi.h" #include <sys/param.h> @@ -449,7 +449,7 @@ } /* Handle user override of active mode */ - if (sc->tz_requested > newactive) + if (sc->tz_requested != TZ_ACTIVE_NONE && sc->tz_requested < newactive) newactive = sc->tz_requested; /* update temperature-related flags */ ==== //depot/projects/hammer/sys/dev/adlink/adlink.c#6 (text+ko) ==== @@ -28,7 +28,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/adlink/adlink.c,v 1.7 2004/02/21 21:10:40 phk Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/adlink/adlink.c,v 1.8 2004/03/05 22:41:22 jhb Exp $"); #ifdef _KERNEL #include <sys/param.h> @@ -221,6 +221,7 @@ sc = arg; idx = 0; + mtx_lock(&Giant); for (;;) { while (sc->stat[idx] == 0) msleep(sc, NULL, PRIBIO, "loran", 1); @@ -234,6 +235,7 @@ idx++; idx %= NRING; } + mtx_unlock(&Giant); kthread_exit(0); } ==== //depot/projects/hammer/sys/dev/md/md.c#23 (text+ko) ==== @@ -6,7 +6,7 @@ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- * - * $FreeBSD: src/sys/dev/md/md.c,v 1.113 2004/03/02 20:13:23 phk Exp $ + * $FreeBSD: src/sys/dev/md/md.c,v 1.114 2004/03/05 22:42:16 jhb Exp $ * */ @@ -638,8 +638,8 @@ mtx_unlock(&sc->queue_mtx); sc->procp = NULL; wakeup(&sc->procp); - if (!hasgiant) - mtx_lock(&Giant); + if (hasgiant) + mtx_unlock(&Giant); kthread_exit(0); } msleep(sc, &sc->queue_mtx, PRIBIO | PDROP, "mdwait", 0); ==== //depot/projects/hammer/sys/dev/pccbb/pccbb.c#22 (text+ko) ==== @@ -73,7 +73,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/pccbb/pccbb.c,v 1.101 2004/01/04 22:10:00 imp Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/pccbb/pccbb.c,v 1.102 2004/03/05 22:42:17 jhb Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -1053,7 +1053,6 @@ mtx_unlock(&sc->mtx); } sc->flags &= ~CBB_KTHREAD_RUNNING; - mtx_lock(&Giant); /* kthread_exit drops */ kthread_exit(0); } ==== //depot/projects/hammer/sys/dev/random/harvest.c#5 (text+ko) ==== @@ -26,7 +26,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/random/harvest.c,v 1.21 2003/11/17 23:02:21 markm Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/random/harvest.c,v 1.22 2004/03/05 22:42:17 jhb Exp $"); #include <sys/param.h> #include <sys/kthread.h> @@ -128,7 +128,6 @@ random_set_wakeup_exit(void *control) { wakeup(control); - mtx_lock(&Giant); kthread_exit(0); /* NOTREACHED */ } ==== //depot/projects/hammer/sys/dev/utopia/utopia.c#4 (text+ko) ==== @@ -28,7 +28,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/utopia/utopia.c,v 1.4 2003/07/30 08:35:58 harti Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/utopia/utopia.c,v 1.5 2004/03/05 22:42:17 jhb Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -1512,7 +1512,6 @@ } wakeup_one(&utopia_list); UTP_RUNLOCK_LIST(); - mtx_lock(&Giant); kthread_exit(0); } ==== //depot/projects/hammer/sys/geom/bde/g_bde_work.c#10 (text+ko) ==== @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/geom/bde/g_bde_work.c,v 1.23 2004/02/08 10:19:18 phk Exp $ + * $FreeBSD: src/sys/geom/bde/g_bde_work.c,v 1.24 2004/03/05 22:42:17 jhb Exp $ * * This source file contains the state-engine which makes things happen in the * right order. @@ -663,7 +663,6 @@ mtx_unlock(&sc->worklist_mutex); sc->dead = 2; wakeup(sc); - mtx_lock(&Giant); kthread_exit(0); } ==== //depot/projects/hammer/sys/kern/kern_exec.c#19 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/kern_exec.c,v 1.236 2004/02/18 00:54:17 peter Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/kern_exec.c,v 1.237 2004/03/05 22:38:26 jhb Exp $"); #include "opt_ktrace.h" #include "opt_mac.h" @@ -253,12 +253,14 @@ * that might allow a local user to illicitly obtain elevated * privileges. */ + mtx_lock(&Giant); PROC_LOCK(p); KASSERT((p->p_flag & P_INEXEC) == 0, ("%s(): process already has P_INEXEC flag", __func__)); if (p->p_flag & P_SA || p->p_numthreads > 1) { if (thread_single(SINGLE_EXIT)) { PROC_UNLOCK(p); + mtx_unlock(&Giant); return (ERESTART); /* Try again later. */ } /* @@ -269,6 +271,7 @@ td->td_mailbox = NULL; thread_single_end(); } + mtx_unlock(&Giant); p->p_flag |= P_INEXEC; PROC_UNLOCK(p); ==== //depot/projects/hammer/sys/kern/kern_exit.c#19 (text+ko) ==== @@ -39,7 +39,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/kern_exit.c,v 1.223 2004/02/27 18:39:09 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/kern_exit.c,v 1.224 2004/03/05 22:39:53 jhb Exp $"); #include "opt_compat.h" #include "opt_ktrace.h" @@ -97,7 +97,6 @@ sys_exit(struct thread *td, struct sys_exit_args *uap) { - mtx_lock(&Giant); exit1(td, W_EXITCODE(uap->rval, 0)); /* NOTREACHED */ } @@ -121,7 +120,12 @@ #endif struct plimit *plim; - GIANT_REQUIRED; + /* + * Drop Giant if caller has it. Eventually we should warn about + * being called with Giant held. + */ + while (mtx_owned(&Giant)) + mtx_unlock(&Giant); p = td->td_proc; if (p == initproc) { @@ -133,6 +137,7 @@ /* * MUST abort all other threads before proceeding past here. */ + mtx_lock(&Giant); PROC_LOCK(p); if (p->p_flag & P_SA || p->p_numthreads > 1) { /* @@ -167,6 +172,7 @@ p->p_flag &= ~P_SA; thread_single_end(); /* Don't need this any more. */ } + mtx_unlock(&Giant); /* * With this state set: * Any thread entering the kernel from userspace will thread_exit() @@ -197,17 +203,23 @@ } #ifdef PGINPROF + mtx_lock(&Giant); vmsizmon(); + mtx_unlock(&Giant); #endif - STOPEVENT(p, S_EXIT, rv); + PROC_LOCK(p); + _STOPEVENT(p, S_EXIT, rv); wakeup(&p->p_stype); /* Wakeup anyone in procfs' PIOCWAIT */ + PROC_UNLOCK(p); /* * Check if any loadable modules need anything done at process exit. * e.g. SYSV IPC stuff * XXX what if one of these generates an error? */ + mtx_lock(&Giant); EVENTHANDLER_INVOKE(process_exit, p); + mtx_unlock(&Giant); MALLOC(p->p_ru, struct rusage *, sizeof(struct rusage), M_ZOMBIE, M_WAITOK); @@ -238,6 +250,7 @@ * Reset any sigio structures pointing to us as a result of * F_SETOWN with our pid. */ + mtx_lock(&Giant); /* XXX: not sure if needed */ funsetownlst(&p->p_sigiolst); /* @@ -245,6 +258,7 @@ * This may block! */ fdfree(td); + mtx_unlock(&Giant); /* * Remove ourself from our leader's peer list and wake our leader. @@ -259,6 +273,7 @@ } mtx_unlock(&ppeers_lock); + mtx_lock(&Giant); /* The next two chunks should probably be moved to vmspace_exit. */ vm = p->p_vmspace; /* @@ -345,6 +360,7 @@ fixjobc(p, p->p_pgrp, 0); sx_xunlock(&proctree_lock); (void)acct_process(td); + mtx_unlock(&Giant); #ifdef KTRACE /* * release trace file @@ -368,7 +384,9 @@ */ if ((vtmp = p->p_textvp) != NULL) { p->p_textvp = NULL; + mtx_lock(&Giant); vrele(vtmp); + mtx_unlock(&Giant); } /* @@ -424,6 +442,7 @@ * Save exit status and final rusage info, adding in child rusage * info and self times. */ + mtx_lock(&Giant); PROC_LOCK(p); p->p_xstat = rv; *p->p_ru = p->p_stats->p_ru; @@ -436,6 +455,7 @@ * Notify interested parties of our demise. */ KNOTE(&p->p_klist, NOTE_EXIT); + mtx_unlock(&Giant); /* * Just delete all entries in the p_klist. At this point we won't * report any more events, and there are nasty race conditions that @@ -580,7 +600,6 @@ } if (uap->options &~ (WUNTRACED|WNOHANG|WCONTINUED|WLINUXCLONE)) return (EINVAL); - mtx_lock(&Giant); loop: nfound = 0; sx_xlock(&proctree_lock); @@ -649,7 +668,6 @@ wakeup(t); PROC_UNLOCK(t); sx_xunlock(&proctree_lock); - mtx_unlock(&Giant); return (0); } @@ -669,6 +687,7 @@ * all other writes to this proc are visible now, so * no more locking is needed for p. */ + mtx_lock(&Giant); PROC_LOCK(p); p->p_xstat = 0; /* XXX: why? */ PROC_UNLOCK(p); @@ -677,6 +696,7 @@ PROC_UNLOCK(q); FREE(p->p_ru, M_ZOMBIE); p->p_ru = NULL; + mtx_unlock(&Giant); /* * Decrement the count of procs running with this uid. @@ -696,6 +716,7 @@ /* * do any thread-system specific cleanups */ + mtx_lock(&Giant); thread_wait(p); /* @@ -704,6 +725,7 @@ * release while still running in process context. */ vm_waitproc(p); + mtx_unlock(&Giant); #ifdef MAC mac_destroy_proc(p); #endif @@ -713,7 +735,6 @@ sx_xlock(&allproc_lock); nprocs--; sx_xunlock(&allproc_lock); - mtx_unlock(&Giant); return (0); } mtx_lock_spin(&sched_lock); @@ -740,7 +761,6 @@ PROC_UNLOCK(p); error = 0; } - mtx_unlock(&Giant); return (error); } mtx_unlock_spin(&sched_lock); @@ -757,30 +777,25 @@ } else error = 0; - mtx_unlock(&Giant); return (error); } PROC_UNLOCK(p); } if (nfound == 0) { sx_xunlock(&proctree_lock); - mtx_unlock(&Giant); return (ECHILD); } if (uap->options & WNOHANG) { sx_xunlock(&proctree_lock); td->td_retval[0] = 0; - mtx_unlock(&Giant); return (0); } PROC_LOCK(q); sx_xunlock(&proctree_lock); error = msleep(q, &q->p_mtx, PWAIT | PCATCH, "wait", 0); PROC_UNLOCK(q); - if (error) { - mtx_unlock(&Giant); - return (error); - } + if (error) + return (error); goto loop; } ==== //depot/projects/hammer/sys/kern/kern_fork.c#26 (text+ko) ==== @@ -39,7 +39,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/kern_fork.c,v 1.216 2004/03/04 09:56:29 bde Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/kern_fork.c,v 1.217 2004/03/05 22:37:32 jhb Exp $"); #include "opt_ktrace.h" #include "opt_mac.h" @@ -217,14 +217,15 @@ return (EINVAL); p1 = td->td_proc; - mtx_lock(&Giant); /* * Here we don't create a new process, but we divorce * certain parts of a process from itself. >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200403060000.i2600jkg032632>