From owner-svn-src-all@FreeBSD.ORG Sun Nov 30 13:18:35 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D5AA61065676; Sun, 30 Nov 2008 13:18:35 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C04A98FC14; Sun, 30 Nov 2008 13:18:35 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAUDIZio091093; Sun, 30 Nov 2008 13:18:35 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAUDIZHr091092; Sun, 30 Nov 2008 13:18:35 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200811301318.mAUDIZHr091092@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 30 Nov 2008 13:18:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185474 - head/share/man/man9 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Nov 2008 13:18:36 -0000 Author: kib Date: Sun Nov 30 13:18:35 2008 New Revision: 185474 URL: http://svn.freebsd.org/changeset/base/185474 Log: Clarify the reason to not use the volatile string as an argument to CTR macros. Note the logging of file and line. Reviewed by: dchagin MFC after: 3 days Modified: head/share/man/man9/ktr.9 Modified: head/share/man/man9/ktr.9 ============================================================================== --- head/share/man/man9/ktr.9 Sun Nov 30 12:21:46 2008 (r185473) +++ head/share/man/man9/ktr.9 Sun Nov 30 13:18:35 2008 (r185474) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 27, 2005 +.Dd November 30, 2008 .Dt KTR 9 .Os .Sh NAME @@ -84,9 +84,16 @@ Following the .Fa format string are zero to five arguments referenced by .Fa format . +Each event is logged with a file name and source line number of the +originating CTR call, and a timestamp in addition to the log message. +.Pp +The event is stored in the circular buffer with supplied arguments as is, +and formatting is done at the dump time. +Do not use pointers to the objects with limited lifetime, for instance, +strings, because the pointer may become invalid when buffer is printed. +.Pp Note that the different macros differ only in the number of arguments each one takes, as indicated by its name. -Each event is logged with a timestamp in addition to the log message. .Pp The .Va ktr_entries @@ -121,13 +128,11 @@ mi_switch() * Pick a new current process and record its start time. */ ... - CTR3(KTR_PROC, "mi_switch: old proc %p (pid %d, %s)", p, p->p_pid, - p->p_comm); + CTR3(KTR_PROC, "mi_switch: old proc %p (pid %d)", p, p->p_pid); ... cpu_switch(); ... - CTR3(KTR_PROC, "mi_switch: new proc %p (pid %d, %s)", p, p->p_pid, - p->p_comm); + CTR3(KTR_PROC, "mi_switch: new proc %p (pid %d)", p, p->p_pid); ... } .Ed