svn commit: r198408 - head/sys/kern

John Baldwin jhb at FreeBSD.org
Fri Oct 23 15:09:52 UTC 2009


Author: jhb
Date: Fri Oct 23 15:09:51 2009
New Revision: 198408
URL: http://svn.freebsd.org/changeset/base/198408

Log:
  Don't bother copying the name of a kproc or kthread out into a temporary
  array just to pass that array to printf().  kproc and kthread names are
  NUL-terminated and can be printed using printf() directly.
  
  Reviewed by:	bde

Modified:
  head/sys/kern/kern_shutdown.c

Modified: head/sys/kern/kern_shutdown.c
==============================================================================
--- head/sys/kern/kern_shutdown.c	Fri Oct 23 14:56:29 2009	(r198407)
+++ head/sys/kern/kern_shutdown.c	Fri Oct 23 15:09:51 2009	(r198408)
@@ -618,16 +618,14 @@ void
 kproc_shutdown(void *arg, int howto)
 {
 	struct proc *p;
-	char procname[MAXCOMLEN + 1];
 	int error;
 
 	if (panicstr)
 		return;
 
 	p = (struct proc *)arg;
-	strlcpy(procname, p->p_comm, sizeof(procname));
 	printf("Waiting (max %d seconds) for system process `%s' to stop...",
-	    kproc_shutdown_wait, procname);
+	    kproc_shutdown_wait, p->p_comm);
 	error = kproc_suspend(p, kproc_shutdown_wait * hz);
 
 	if (error == EWOULDBLOCK)
@@ -640,16 +638,14 @@ void
 kthread_shutdown(void *arg, int howto)
 {
 	struct thread *td;
-	char procname[MAXCOMLEN + 1];
 	int error;
 
 	if (panicstr)
 		return;
 
 	td = (struct thread *)arg;
-	strlcpy(procname, td->td_name, sizeof(procname));
 	printf("Waiting (max %d seconds) for system thread `%s' to stop...",
-	    kproc_shutdown_wait, procname);
+	    kproc_shutdown_wait, td->td_name);
 	error = kthread_suspend(td, kproc_shutdown_wait * hz);
 
 	if (error == EWOULDBLOCK)


More information about the svn-src-all mailing list