--- //depot/vendor/freebsd/src/sys/alpha/alpha/trap.c	2005/04/12 23:21:05
+++ //depot/user/rwatson/uprintf/src/sys/alpha/alpha/trap.c	2005/09/18 20:04:39
@@ -1046,12 +1046,14 @@
 	 * If we're supposed to be noisy, squawk now.
 	 */
 	if (doprint) {
+		mtx_lock(&Giant);
 		uprintf(
 		"pid %d (%s): unaligned access: va=0x%lx pc=0x%lx ra=0x%lx op=",
 		    p->p_pid, p->p_comm, va, td->td_frame->tf_regs[FRAME_PC],
 		    td->td_frame->tf_regs[FRAME_RA]);
 		uprintf(type,opcode);
 		uprintf("\n");
+		mtx_unlock(&Giant);
 	}
 
 	/*
--- //depot/vendor/freebsd/src/sys/alpha/osf1/osf1_ioctl.c	2005/01/05 20:11:19
+++ //depot/user/rwatson/uprintf/src/sys/alpha/osf1/osf1_ioctl.c	2005/09/18 20:04:39
@@ -110,9 +110,11 @@
 		break;
 	}
 #ifdef IOCTL_DEBUG
+		mtx_lock(&Giant);
 		uprintf(
 		    "OSF/1 IOCTL: group = %c, cmd = %d, len = %d, dir = %s\n",
 		    group, cmd, len, dirstr);
+		mtx_unlock(&Giant);
 #endif
 
 	a.fd = uap->fd;
--- //depot/vendor/freebsd/src/sys/alpha/osf1/osf1_misc.c	2005/07/07 19:20:48
+++ //depot/user/rwatson/uprintf/src/sys/alpha/osf1/osf1_misc.c	2005/09/18 20:04:39
@@ -209,8 +209,10 @@
 		rpb_size = (unsigned long)&hwrpb->rpb_tbhint -
 		    (unsigned long)hwrpb;
 		if(uap->nbytes < rpb_size){
+			mtx_lock(&Giant);
 			uprintf("nbytes = %ld, sizeof(struct rpb) = %ld\n",
 			    uap->nbytes, rpb_size);
+			mtx_unlock(&Giant);
 			error = EINVAL;
 		}
 		else {
@@ -254,7 +256,9 @@
 		break;
 	}
 	default:
+		mtx_lock(&Giant);
 		uprintf("osf1_setsysinfo called with op=%ld\n", uap->op);
+		mtx_unlock(&Giant);
 		/*error = EINVAL;*/
 	}
 	return (error);
--- //depot/vendor/freebsd/src/sys/alpha/osf1/osf1_signal.c	2005/02/13 17:40:42
+++ //depot/user/rwatson/uprintf/src/sys/alpha/osf1/osf1_signal.c	2005/09/18 20:04:39
@@ -145,9 +145,12 @@
 {
 
 	bsa->sa_handler = osa->osa_handler;
-	if (osf1_sigdbg)
+	if (osf1_sigdbg) {
+		mtx_lock(&Giant);
 		uprintf("%s(%d): handler @0x%lx \n", __FILE__, __LINE__,
 			(unsigned long)osa->osa_handler);
+		mtx_unlock(&Giant);
+	}
 	osf1_to_bsd_sigset(&osa->osa_mask, &bsa->sa_mask);
 	bsa->sa_flags = 0;
 	if ((osa->osa_flags & OSF1_SA_ONSTACK) != 0)
@@ -225,9 +228,12 @@
 	struct sigaction *nbsap;
 	int error;
 
-	if (osf1_sigdbg && uap->sigtramp)
+	if (osf1_sigdbg && uap->sigtramp) {
+		mtx_lock(&Giant);
 		uprintf("osf1_sigaction: trampoline handler at %p\n",
 		    uap->sigtramp);
+		mtx_unlock(&Giant);
+	}
 	td->td_md.osf_sigtramp = uap->sigtramp;
 	if (uap->nsa != NULL) {
 		if ((error = copyin(uap->nsa, &osa, sizeof(osa))) != 0)
@@ -315,8 +321,10 @@
 #endif
 			error = kern_sigaction(td, signum, &nbsa, &obsa, 0);
 			if (error != 0) {
+				mtx_lock(&Giant);
 				DPRINTF("signal: sigaction failed: %d\n",
 					 error);
+				mtx_unlock(&Giant);
 				td->td_retval[0] = -1;
 				return (error);
 			}
@@ -352,8 +360,11 @@
 			SIGEMPTYSET(sa.sa_mask);
 			sa.sa_flags = 0;
 			error = kern_sigaction(td, signum, &sa, NULL, 0);
-			if (error != 0)
+			if (error != 0) {
+				mtx_lock(&Giant);
 				DPRINTF(("sigignore: sigaction failed\n"));
+				mtx_unlock(&Giant);
+			}
 			return (error);
 		}
 
@@ -544,8 +555,11 @@
 	/*
 	 * Set up the registers to return to sigcode.
 	 */
-	if (osf1_sigdbg)
+	if (osf1_sigdbg) {
+		mtx_lock(&Giant);
 		uprintf("attempting to call osf1 sigtramp\n");
+		mtx_unlock(&Giant);
+	}
 	frame->tf_regs[FRAME_PC] = (u_int64_t)td->td_md.osf_sigtramp;
 	frame->tf_regs[FRAME_A0] = sig;
 	frame->tf_regs[FRAME_A1] = code;
@@ -627,7 +641,9 @@
 	} */ *uap;
 {
 
-/*	uprintf("osf1_osigstack: oss = %p, nss = %p",uap->oss, uap->nss);
-	uprintf(" stack ptr = %p\n",p->p_sigacts->ps_sigstk.ss_sp);*/
+/*	mtx_lock(&Giant);
+	uprintf("osf1_osigstack: oss = %p, nss = %p",uap->oss, uap->nss);
+	uprintf(" stack ptr = %p\n",p->p_sigacts->ps_sigstk.ss_sp);
+	mtx_unlock(&Giant); */
 	return(osigstack(td, (struct osigstack_args *)uap));
 }
--- //depot/vendor/freebsd/src/sys/amd64/amd64/trap.c	2005/08/27 16:05:28
+++ //depot/user/rwatson/uprintf/src/sys/amd64/amd64/trap.c	2005/09/18 20:04:39
@@ -486,11 +486,13 @@
 
 #ifdef DEBUG
 	if (type <= MAX_TRAP_MSG) {
+		mtx_lock(&Giant);
 		uprintf("fatal process exception: %s",
 			trap_msg[type]);
 		if ((type == T_PAGEFLT) || (type == T_PROTFLT))
 			uprintf(", fault VA = 0x%lx", frame.tf_addr);
 		uprintf("\n");
+		mtx_unlock(&Giant);
 	}
 #endif
 
--- //depot/vendor/freebsd/src/sys/compat/linux/linux_socket.c	2005/07/09 12:30:29
+++ //depot/user/rwatson/uprintf/src/sys/compat/linux/linux_socket.c	2005/09/18 20:04:39
@@ -1187,7 +1187,9 @@
 		return (linux_recvmsg(td, arg));
 	}
 
+	mtx_lock(&Giant);
 	uprintf("LINUX: 'socket' typ=%d not implemented\n", args->what);
+	mtx_unlock(&Giant);
 	return (ENOSYS);
 }
 #endif	/*!__alpha__*/
--- //depot/vendor/freebsd/src/sys/compat/svr4/svr4_fcntl.c	2005/02/07 21:55:42
+++ //depot/user/rwatson/uprintf/src/sys/compat/svr4/svr4_fcntl.c	2005/09/18 20:04:39
@@ -377,8 +377,10 @@
 	free(newpath, M_TEMP);
 
 	if (error) {
-	  /*	        uprintf("svr4_open(%s, 0x%0x, 0%o): %d\n", uap->path,
-			uap->flags, uap->mode, error);*/
+	  /*	        mtx_lock(&Giant);
+			uprintf("svr4_open(%s, 0x%0x, 0%o): %d\n", uap->path,
+			    uap->flags, uap->mode, error);
+			mtx_unlock(&Giant);*/
 		return error;
 	}
 
--- //depot/vendor/freebsd/src/sys/compat/svr4/svr4_misc.c	2005/07/07 19:31:08
+++ //depot/user/rwatson/uprintf/src/sys/compat/svr4/svr4_misc.c	2005/09/18 20:04:39
@@ -485,7 +485,9 @@
 			panic("svr4_sys_getdents64: bad reclen");
 		off = *cookie++;	/* each entry points to the next */
 		if ((off >> 32) != 0) {
+			mtx_lock(&Giant);
 			uprintf("svr4_sys_getdents64: dir offset too large for emulated program");
+			mtx_unlock(&Giant);
 			error = EINVAL;
 			goto out;
 		}
--- //depot/vendor/freebsd/src/sys/compat/svr4/svr4_signal.c	2005/02/25 19:35:22
+++ //depot/user/rwatson/uprintf/src/sys/compat/svr4/svr4_signal.c	2005/09/18 20:04:39
@@ -238,8 +238,11 @@
 		bss->ss_flags |= SS_DISABLE;
 	if ((sss->ss_flags & SVR4_SS_ONSTACK) != 0)
 		bss->ss_flags |= SS_ONSTACK;
-	if ((sss->ss_flags & ~SVR4_SS_ALLBITS) != 0)
+	if ((sss->ss_flags & ~SVR4_SS_ALLBITS) != 0) {
+		mtx_lock(&Giant);
 	  /*XXX*/ uprintf("svr4_to_bsd_sigaltstack: extra bits ignored\n");
+		mtx_unlock(&Giant);
+	}
 }
 
 void
--- //depot/vendor/freebsd/src/sys/compat/svr4/svr4_stream.c	2005/07/13 15:15:34
+++ //depot/user/rwatson/uprintf/src/sys/compat/svr4/svr4_stream.c	2005/09/18 20:04:39
@@ -378,6 +378,8 @@
 {
 	size_t i;
 
+	GIANT_REQUIRED;
+
 	uprintf("\n\t");
 	for (i = 0; i < len; i++) {
 		uprintf("%x ", buf[i]);
@@ -395,6 +397,8 @@
 	int len;
 	int error;
 
+	GIANT_REQUIRED;
+
 	len = ioc->len;
 	if (len > 1024)
 		len = 1024;
@@ -430,6 +434,8 @@
 	int maxlen = str->maxlen;
 	int len = str->len;
 
+	GIANT_REQUIRED;
+
 	if (maxlen > 8192)
 		maxlen = 8192;
 
@@ -473,6 +479,8 @@
 	struct svr4_strbuf	buf;
 	int error;
 
+	GIANT_REQUIRED;
+
 	uprintf("%s(%d", str, fd);
 	if (ctl != NULL) {
 		if ((error = copyin(ctl, &buf, sizeof(buf))) != 0)
@@ -1407,8 +1415,12 @@
 		return error;
 
 #ifdef DEBUG_SVR4
-	if ((error = show_ioc(">", &ioc)) != 0)
+	mtx_lock(&Giant);
+	if ((error = show_ioc(">", &ioc)) != 0) {
+		mtx_unlock(&Giant);
 		return error;
+	}
+	mtx_unlock(&Giant);
 #endif /* DEBUG_SVR4 */
 
 	switch (ioc.cmd & 0xff00) {
@@ -1429,8 +1441,12 @@
 	}
 
 #ifdef DEBUG_SVR4
-	if ((error = show_ioc("<", &ioc)) != 0)
+	mtx_lock(&Giant);
+	if ((error = show_ioc("<", &ioc)) != 0) {
+		mtx_lock(&Giant);
 		return error;
+	}
+	mtx_unlock(&Giant);
 #endif /* DEBUG_SVR4 */
 	return copyout(&ioc, dat, sizeof(ioc));
 }
@@ -1550,7 +1566,9 @@
 	case SVR4_I_PUSH:
 		DPRINTF(("I_PUSH %p\n", dat));
 #if defined(DEBUG_SVR4)
+		mtx_lock(&Giant);
 		show_strbuf((struct svr4_strbuf *)dat);
+		mtx_unlock(&Giant);
 #endif
 		return 0;
 
@@ -1743,8 +1761,10 @@
 	retval = td->td_retval;
 
 #ifdef DEBUG_SVR4
+	mtx_lock(&Giant);
 	show_msg(">putmsg", uap->fd, uap->ctl,
 		 uap->dat, uap->flags);
+	mtx_unlock(&Giant);
 #endif /* DEBUG_SVR4 */
 
 	FILE_LOCK_ASSERT(fp, MA_NOTOWNED);
@@ -1940,8 +1960,10 @@
 	memset(&sc, 0, sizeof(sc));
 
 #ifdef DEBUG_SVR4
+	mtx_lock(&Giant);
 	show_msg(">getmsg", uap->fd, uap->ctl,
 		 uap->dat, 0);
+	mtx_unlock(&Giant);
 #endif /* DEBUG_SVR4 */
 
 	if (uap->ctl != NULL) {
@@ -2249,8 +2271,10 @@
 	*retval = 0;
 
 #ifdef DEBUG_SVR4
+	mtx_lock(&Giant);
 	show_msg("<getmsg", uap->fd, uap->ctl,
 		 uap->dat, fl);
+	mtx_unlock(&Giant);
 #endif /* DEBUG_SVR4 */
 	return error;
 }
--- //depot/vendor/freebsd/src/sys/compat/svr4/svr4_termios.c	2005/01/05 22:36:13
+++ //depot/user/rwatson/uprintf/src/sys/compat/svr4/svr4_termios.c	2005/09/18 20:04:39
@@ -156,6 +156,9 @@
 	const struct termios *bt;
 {
 	int i;
+
+	GIANT_REQUIRED;
+
 	uprintf("BSD\niflag=%o oflag=%o cflag=%o lflag=%o\n",
 	    bt->c_iflag, bt->c_oflag, bt->c_cflag, bt->c_lflag);
 	uprintf("cc: ");
@@ -508,7 +511,9 @@
 		bsd_to_svr4_termios(&bt, &st);
 
 #ifdef DEBUG_SVR4
+		mtx_lock(&Giant);
 		print_bsd_termios(&bt);
+		mtx_unlock(&Giant);
 		print_svr4_termios(&st);
 #endif /* DEBUG_SVR4 */
 
@@ -576,7 +581,9 @@
 		}
 
 #ifdef DEBUG_SVR4
+		mtx_lock(&Giant);
 		print_bsd_termios(&bt);
+		mtx_unlock(&Giant);
 		print_svr4_termios(&st);
 #endif /* DEBUG_SVR4 */
 
--- //depot/vendor/freebsd/src/sys/compat/svr4/svr4_ttold.c	2005/01/05 22:36:13
+++ //depot/user/rwatson/uprintf/src/sys/compat/svr4/svr4_ttold.c	2005/09/18 20:04:39
@@ -69,6 +69,8 @@
 	struct svr4_sgttyb *ss;
 {
 
+	GIANT_REQUIRED;
+
 	uprintf("%s\nispeed=%o ospeed=%o ", str, ss->sg_ispeed, ss->sg_ospeed);
 	uprintf("erase=%o kill=%o flags=%o\n", ss->sg_erase, ss->sg_kill,
 	    ss->sg_flags);
@@ -79,6 +81,9 @@
 	const char *str;
 	struct svr4_tchars *st;
 {
+
+	GIANT_REQUIRED;
+
 	uprintf("%s\nintrc=%o quitc=%o ", str, st->t_intrc, st->t_quitc);
 	uprintf("startc=%o stopc=%o eofc=%o brkc=%o\n", st->t_startc,
 	    st->t_stopc, st->t_eofc, st->t_brkc);
@@ -89,6 +94,9 @@
 	const char *str;
 	struct svr4_ltchars *sl;
 {
+
+	GIANT_REQUIRED;
+
 	uprintf("%s\nsuspc=%o dsuspc=%o ", str, sl->t_suspc, sl->t_dsuspc);
 	uprintf("rprntc=%o flushc=%o werasc=%o lnextc=%o\n", sl->t_rprntc,
 	    sl->t_flushc, sl->t_werasc, sl->t_lnextc);
@@ -231,7 +239,9 @@
 
 			return copyout(&pid, data, sizeof(pid));
 #else
+			mtx_lock(&Giant);
 			uprintf("ioctl(TIOCGSID) for pid %d unsupported\n", td->td_proc->p_pid);
+			mtx_unlock(&Giant);
 			return EINVAL;
 #endif
 		}
@@ -248,7 +258,9 @@
 
 			bsd_sgttyb_to_svr4_sgttyb(&bs, &ss);
 #ifdef DEBUG_SVR4
+			mtx_lock(&Giant);
 			print_svr4_sgttyb("SVR4_TIOCGETP", &ss);
+			mtx_unlock(&Giant);
 #endif /* DEBUG_SVR4 */
 			return copyout(&ss, data, sizeof(ss));
 		}
@@ -264,7 +276,9 @@
 
 			svr4_sgttyb_to_bsd_sgttyb(&ss, &bs);
 #ifdef DEBUG_SVR4
+			mtx_lock(&Giant);
 			print_svr4_sgttyb("SVR4_TIOCSET{P,N}", &ss);
+			mtx_unlock(&Giant);
 #endif /* DEBUG_SVR4 */
 			cmd = (cmd == SVR4_TIOCSETP) ? TIOCSETP : TIOCSETN;
 			return fo_ioctl(fp, cmd, (caddr_t) &bs,
@@ -283,7 +297,9 @@
 
 			bsd_tchars_to_svr4_tchars(&bt, &st);
 #ifdef DEBUG_SVR4
+			mtx_lock(&Giant);
 			print_svr4_tchars("SVR4_TIOCGETC", &st);
+			mtx_unlock(&Giant);
 #endif /* DEBUG_SVR4 */
 			return copyout(&st, data, sizeof(st));
 		}
@@ -298,7 +314,9 @@
 
 			svr4_tchars_to_bsd_tchars(&st, &bt);
 #ifdef DEBUG_SVR4
+			mtx_lock(&Giant);
 			print_svr4_tchars("SVR4_TIOCSETC", &st);
+			mtx_unlock(&Giant);
 #endif /* DEBUG_SVR4 */
 			return fo_ioctl(fp, TIOCSETC, (caddr_t) &bt,
 			    td->td_ucred, td);
@@ -316,7 +334,9 @@
 
 			bsd_ltchars_to_svr4_ltchars(&bl, &sl);
 #ifdef DEBUG_SVR4
+			mtx_lock(&Giant);
 			print_svr4_ltchars("SVR4_TIOCGLTC", &sl);
+			mtx_unlock(&Giant);
 #endif /* DEBUG_SVR4 */
 			return copyout(&sl, data, sizeof(sl));
 		}
@@ -331,7 +351,9 @@
 
 			svr4_ltchars_to_bsd_ltchars(&sl, &bl);
 #ifdef DEBUG_SVR4
+			mtx_lock(&Giant);
 			print_svr4_ltchars("SVR4_TIOCSLTC", &sl);
+			mtx_unlock(&Giant);
 #endif /* DEBUG_SVR4 */
 			return fo_ioctl(fp, TIOCSLTC, (caddr_t) &bl,
 			    td->td_ucred, td);
--- //depot/vendor/freebsd/src/sys/compat/svr4/svr4_util.h	2005/02/07 21:55:42
+++ //depot/user/rwatson/uprintf/src/sys/compat/svr4/svr4_util.h	2005/09/18 20:04:39
@@ -42,7 +42,10 @@
 #include <sys/uio.h>
 
 #ifdef DEBUG_SVR4
-#define DPRINTF(a)	uprintf a;
+#define DPRINTF(a) do {							\
+	mtx_lock(&Giant);						\
+	uprintf a;							\
+} while (0)
 #else
 #define DPRINTF(a)
 #endif
--- //depot/vendor/freebsd/src/sys/gnu/fs/ext2fs/ext2_alloc.c	2005/06/15 02:37:20
+++ //depot/user/rwatson/uprintf/src/sys/gnu/fs/ext2fs/ext2_alloc.c	2005/09/18 20:04:39
@@ -165,6 +165,7 @@
 	}
 nospace:
 	ext2_fserr(fs, cred->cr_uid, "file system full");
+	GIANT_REQUIRED;	/* uprintf */
 	uprintf("\n%s: write failed, file system is full\n", fs->fs_fsmnt);
 	return (ENOSPC);
 }
@@ -411,6 +412,7 @@
 	return (0);
 noinodes:
 	ext2_fserr(fs, cred->cr_uid, "out of inodes");
+	GIANT_REQUIRED;	/* uprintf */
 	uprintf("\n%s: create/symlink failed, no inodes free\n", fs->fs_fsmnt);
 	return (ENOSPC);
 }
--- //depot/vendor/freebsd/src/sys/i386/i386/trap.c	2005/07/13 11:35:17
+++ //depot/user/rwatson/uprintf/src/sys/i386/i386/trap.c	2005/09/18 20:04:39
@@ -648,11 +648,13 @@
 
 #ifdef DEBUG
 	if (type <= MAX_TRAP_MSG) {
+		mtx_lock(&Giant);
 		uprintf("fatal process exception: %s",
 			trap_msg[type]);
 		if ((type == T_PAGEFLT) || (type == T_PROTFLT))
 			uprintf(", fault VA = 0x%lx", (u_long)eva);
 		uprintf("\n");
+		mtx_unlock(&Giant);
 	}
 #endif
 
--- //depot/vendor/freebsd/src/sys/i386/i386/vm86.c	2004/11/27 06:55:50
+++ //depot/user/rwatson/uprintf/src/sys/i386/i386/vm86.c	2005/09/18 20:04:39
@@ -193,7 +193,9 @@
 			vmf->vmf_eflags |= PSL_VIF;
 			vmf->vmf_ip += inc_ip;
 			if ((vmf->vmf_eflags & PSL_VIP) == 0) {
+				mtx_lock(&Giant);
 				uprintf("fatal sti\n");
+				mtx_unlock(&Giant);
 				return (SIGKILL);
 			}
 			break;
--- //depot/vendor/freebsd/src/sys/ia64/ia64/unaligned.c	2005/01/27 06:05:25
+++ //depot/user/rwatson/uprintf/src/sys/ia64/ia64/unaligned.c	2005/09/18 20:04:39
@@ -263,9 +263,11 @@
 	    ((tf->tf_special.psr & IA64_PSR_RI) == IA64_PSR_RI_1) ? 1 : 2;
 
 	if (ia64_unaligned_print) {
+		mtx_lock(&Giant);
 		uprintf("pid %d (%s): unaligned access: va=0x%lx, pc=0x%lx\n",
 		    td->td_proc->p_pid, td->td_proc->p_comm,
 		    tf->tf_special.ifa, tf->tf_special.iip + slot);
+		mtx_unlock(&Giant);
 	}
 
 	/*
--- //depot/vendor/freebsd/src/sys/kern/imgact_elf.c	2005/09/15 15:05:17
+++ //depot/user/rwatson/uprintf/src/sys/kern/imgact_elf.c	2005/09/18 20:04:39
@@ -380,7 +380,9 @@
 	 */
 	if ((off_t)filsz + offset > object->un_pager.vnp.vnp_size ||
 	    filsz > memsz) {
+		mtx_lock(&Giant);
 		uprintf("elf_load_section: truncated ELF file\n");
+		mtx_unlock(&Giant);
 		return (ENOEXEC);
 	}
 
@@ -698,8 +700,10 @@
 
 	brand_info = __elfN(get_brandinfo)(hdr, interp);
 	if (brand_info == NULL) {
+		mtx_lock(&Giant);
 		uprintf("ELF binary type \"%u\" not known.\n",
 		    hdr->e_ident[EI_OSABI]);
+		mtx_unlock(&Giant);
 		error = ENOEXEC;
 		goto fail;
 	}
@@ -840,7 +844,9 @@
 		error = __elfN(load_file)(imgp->proc, interp, &addr,
 		    &imgp->entry_addr, sv->sv_pagesize);
 		if (error != 0) {
+			mtx_lock(&Giant);
 			uprintf("ELF interpreter %s not found\n", interp);
+			mtx_unlock(&Giant);
 			goto fail;
 		}
 	}
--- //depot/vendor/freebsd/src/sys/kern/subr_prf.c	2005/09/04 18:05:25
+++ //depot/user/rwatson/uprintf/src/sys/kern/subr_prf.c	2005/09/18 20:04:39
@@ -129,6 +129,10 @@
 	struct putchar_arg pca;
 	int retval;
 
+	GIANT_REQUIRED;
+
+	WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "uprintf");
+
 	if (td == NULL || td == PCPU_GET(idlethread))
 		return (0);
 
@@ -165,6 +169,10 @@
 	struct putchar_arg pca;
 	struct session *sess = NULL;
 
+	GIANT_REQUIRED;
+
+	WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "tprintf");
+
 	if (pri != -1)
 		flags |= TOLOG;
 	if (p != NULL) {
--- //depot/vendor/freebsd/src/sys/nfsclient/nfs_socket.c	2005/07/27 15:10:31
+++ //depot/user/rwatson/uprintf/src/sys/nfsclient/nfs_socket.c	2005/09/18 20:04:39
@@ -1060,8 +1060,11 @@
 	 * If there was a successful reply and a tprintf msg.
 	 * tprintf a response.
 	 */
-	if (!error)
+	if (!error) {
+		mtx_lock(&Giant);
 		nfs_up(rep, nmp, rep->r_td, "is alive again", NFSSTA_TIMEO);
+		mtx_unlock(&Giant);
+	}
 	mrep = rep->r_mrep;
 	md = rep->r_md;
 	dpos = rep->r_dpos;
@@ -1182,6 +1185,7 @@
 
 	getmicrouptime(&now);
 	s = splnet();
+	mtx_lock(&Giant);	/* nfs_down -> tprintf */
 	mtx_lock(&nfs_reqq_mtx);
 	TAILQ_FOREACH(rep, &nfs_reqq, r_chain) {
 		nmp = rep->r_nmp;
@@ -1294,6 +1298,7 @@
 		}
 	}
 	mtx_unlock(&nfs_reqq_mtx);
+	mtx_unlock(&Giant);	/* nfs_down -> tprintf */
 	splx(s);
 	callout_reset(&nfs_callout, nfs_ticks, nfs_timer, NULL);
 }
@@ -1625,6 +1630,8 @@
 {
 	struct proc *p;
 
+	GIANT_REQUIRED;	/* tprintf */
+
 	p = td ? td->td_proc : NULL;
 	if (error) {
 		tprintf(p, LOG_INFO, "nfs server %s: %s, error %d\n", server,
@@ -1644,6 +1651,8 @@
 	int error, flags;
 {
 
+	GIANT_REQUIRED;	/* nfs_msg */
+
 	if (nmp == NULL)
 		return;
 	if ((flags & NFSSTA_TIMEO) && !(nmp->nm_state & NFSSTA_TIMEO)) {
@@ -1671,6 +1680,9 @@
 	const char *msg;
 	int flags;
 {
+
+	GIANT_REQUIRED;	/* nfs_msg */
+
 	if (nmp == NULL)
 		return;
 	if ((rep == NULL) || (rep->r_flags & R_TPRINTFMSG) != 0)
--- //depot/vendor/freebsd/src/sys/rpc/rpcclnt.c	2005/03/19 01:22:25
+++ //depot/user/rwatson/uprintf/src/sys/rpc/rpcclnt.c	2005/09/18 20:04:39
@@ -1254,9 +1254,12 @@
 	 * If there was a successful reply and a tprintf msg. tprintf a
 	 * response.
 	 */
-	if (!error && (task->r_flags & R_TPRINTFMSG))
+	if (!error && (task->r_flags & R_TPRINTFMSG)) {
+		mtx_lock(&Giant);
 		rpcclnt_msg(task->r_td, rpc->rc_prog->prog_name,
 			    "is alive again");
+		mtx_unlock(&Giant);
+	}
 
 	/* free request header (leaving mrest) */
 	mheadend->m_next = NULL;
@@ -1390,6 +1393,7 @@
 #else
 	s = splnet();
 #endif
+	mtx_lock(&Giant);	/* rpc_msg -> tprintf */
 	TAILQ_FOREACH(rep, &rpctask_q, r_chain) {
 		rpc = rep->r_rpcclnt;
 		if (rep->r_mrep || (rep->r_flags & R_SOFTTERM))
@@ -1474,6 +1478,7 @@
 			}
 		}
 	}
+	mtx_unlock(&Giant);	/* rpc_msg -> tprintf */
 	splx(s);
 
 #ifdef __OpenBSD__
@@ -1775,6 +1780,8 @@
 	tprintf_close(tpr);
 	RPC_RETURN(0);
 #else
+	GIANT_REQUIRED;
+
 	tprintf(p ? p->td_proc : NULL, LOG_INFO,
 		"nfs server %s: %s\n", server, msg);
 	RPC_RETURN(0);
--- //depot/vendor/freebsd/src/sys/ufs/ffs/ffs_alloc.c	2005/02/20 08:07:05
+++ //depot/user/rwatson/uprintf/src/sys/ufs/ffs/ffs_alloc.c	2005/09/18 20:04:39
@@ -201,7 +201,9 @@
 	}
 	UFS_UNLOCK(ump);
 	ffs_fserr(fs, ip->i_number, "filesystem full");
+	mtx_lock(&Giant);
 	uprintf("\n%s: write failed, filesystem is full\n", fs->fs_fsmnt);
+	mtx_unlock(&Giant);
 	return (ENOSPC);
 }
 
@@ -399,7 +401,9 @@
 	if (bp)
 		brelse(bp);
 	ffs_fserr(fs, ip->i_number, "filesystem full");
+	mtx_lock(&Giant);
 	uprintf("\n%s: write failed, filesystem is full\n", fs->fs_fsmnt);
+	mtx_unlock(&Giant);
 	return (ENOSPC);
 }
 
@@ -954,7 +958,9 @@
 noinodes:
 	UFS_UNLOCK(ump);
 	ffs_fserr(fs, pip->i_number, "out of inodes");
+	mtx_lock(&Giant);
 	uprintf("\n%s: create/symlink failed, no inodes free\n", fs->fs_fsmnt);
+	mtx_unlock(&Giant);
 	return (ENOSPC);
 }
 
