Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Jul 2011 20:06:15 +0000 (UTC)
From:      "Bjoern A. Zeeb" <bz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r224199 - in head: bin/ps lib/libkvm sys/compat/freebsd32 sys/kern sys/sys usr.bin/procstat usr.bin/top
Message-ID:  <201107182006.p6IK6FCJ037403@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bz
Date: Mon Jul 18 20:06:15 2011
New Revision: 224199
URL: http://svn.freebsd.org/changeset/base/224199

Log:
  Rename ki_ocomm to ki_tdname and OCOMMLEN to TDNAMLEN.
  Provide backward compatibility defines under BURN_BRIDGES.
  
  Suggested by:	jhb
  Reviewed by:	emaste
  Sponsored by:	Sandvine Incorporated
  Approved by:	re (kib)

Modified:
  head/bin/ps/keyword.c
  head/bin/ps/print.c
  head/lib/libkvm/kvm_proc.c
  head/sys/compat/freebsd32/freebsd32.h
  head/sys/kern/kern_proc.c
  head/sys/sys/user.h
  head/usr.bin/procstat/procstat_kstack.c
  head/usr.bin/procstat/procstat_threads.c
  head/usr.bin/top/machine.c

Modified: head/bin/ps/keyword.c
==============================================================================
--- head/bin/ps/keyword.c	Mon Jul 18 19:42:18 2011	(r224198)
+++ head/bin/ps/keyword.c	Mon Jul 18 20:06:15 2011	(r224199)
@@ -82,7 +82,7 @@ static VAR var[] = {
 	{"class", "CLASS", NULL, LJUST, loginclass, s_loginclass,
 		MAXLOGNAME-1, 0, CHAR, NULL, 0},
 	{"comm", "COMMAND", NULL, LJUST, ucomm, s_comm,
-		COMMLEN + OCOMMLEN + 1, 0, CHAR, NULL, 0},
+		COMMLEN + TDNAMLEN + 1, 0, CHAR, NULL, 0},
 	{"command", "COMMAND", NULL, COMM|LJUST|USER, command, NULL, 16, 0,
 		CHAR, NULL, 0},
 	{"cpu", "CPU", NULL, 0, kvar, NULL, 3, KOFF(ki_estcpu), UINT, "d",
@@ -212,7 +212,7 @@ static VAR var[] = {
 	{"tt", "TT ", NULL, 0, tname, NULL, 4, 0, CHAR, NULL, 0},
 	{"tty", "TTY", NULL, LJUST, longtname, NULL, 8, 0, CHAR, NULL, 0},
 	{"ucomm", "UCOMM", NULL, LJUST, ucomm, s_comm,
-		COMMLEN + OCOMMLEN + 1, 0, CHAR, NULL, 0},
+		COMMLEN + TDNAMLEN + 1, 0, CHAR, NULL, 0},
 	{"uid", "UID", NULL, 0, kvar, NULL, UIDLEN, KOFF(ki_uid), UINT,
 		UIDFMT, 0},
 	{"upr", "UPR", NULL, 0, upr, NULL, 3, 0, CHAR, NULL, 0},

Modified: head/bin/ps/print.c
==============================================================================
--- head/bin/ps/print.c	Mon Jul 18 19:42:18 2011	(r224198)
+++ head/bin/ps/print.c	Mon Jul 18 20:06:15 2011	(r224199)
@@ -136,7 +136,7 @@ command(KINFO *k, VARENT *ve)
 				(void)printf("%s", k->ki_d.prefix);
 			(void)printf("%s", k->ki_p->ki_comm);
 			if (showthreads && k->ki_p->ki_numthreads > 1)
-				(void)printf("/%s", k->ki_p->ki_ocomm);
+				(void)printf("/%s", k->ki_p->ki_tdname);
 		} else
 			(void)printf("%-*s", v->width, k->ki_p->ki_comm);
 		return;
@@ -190,7 +190,7 @@ command(KINFO *k, VARENT *ve)
 void
 ucomm(KINFO *k, VARENT *ve)
 {
-	char tmpbuff[COMMLEN + OCOMMLEN + 2];
+	char tmpbuff[COMMLEN + TDNAMLEN + 2];
 	VAR *v;
 
 	v = ve->var;
@@ -199,12 +199,12 @@ ucomm(KINFO *k, VARENT *ve)
 			(void)printf("%s", k->ki_d.prefix);
 		(void)printf("%s", k->ki_p->ki_comm);
 		if (showthreads && k->ki_p->ki_numthreads > 1)
-			printf("/%s", k->ki_p->ki_ocomm);
+			printf("/%s", k->ki_p->ki_tdname);
 	} else {
 		bzero(tmpbuff, sizeof(tmpbuff));
 		if (showthreads && k->ki_p->ki_numthreads > 1)
 			sprintf(tmpbuff, "%s/%s", k->ki_p->ki_comm,
-			    k->ki_p->ki_ocomm);
+			    k->ki_p->ki_tdname);
 		else
 			sprintf(tmpbuff, "%s", k->ki_p->ki_comm);
 		(void)printf("%-*s", v->width, tmpbuff);
@@ -218,7 +218,7 @@ tdnam(KINFO *k, VARENT *ve)
 
 	v = ve->var;
 	if (showthreads && k->ki_p->ki_numthreads > 1)
-		(void)printf("%-*s", v->width, k->ki_p->ki_ocomm);
+		(void)printf("%-*s", v->width, k->ki_p->ki_tdname);
 	else
 		(void)printf("%-*s", v->width, "      ");
 }
@@ -943,12 +943,12 @@ loginclass(KINFO *k, VARENT *ve)
 int
 s_comm(KINFO *k)
 {
-	char tmpbuff[COMMLEN + OCOMMLEN + 2];
+	char tmpbuff[COMMLEN + TDNAMLEN + 2];
 
 	bzero(tmpbuff, sizeof(tmpbuff));
 	if (showthreads && k->ki_p->ki_numthreads > 1)
 		sprintf(tmpbuff, "%s/%s", k->ki_p->ki_comm,
-		    k->ki_p->ki_ocomm);
+		    k->ki_p->ki_tdname);
 	else
 		sprintf(tmpbuff, "%s", k->ki_p->ki_comm);
 	return (strlen(tmpbuff));

Modified: head/lib/libkvm/kvm_proc.c
==============================================================================
--- head/lib/libkvm/kvm_proc.c	Mon Jul 18 19:42:18 2011	(r224198)
+++ head/lib/libkvm/kvm_proc.c	Mon Jul 18 20:06:15 2011	(r224199)
@@ -426,10 +426,10 @@ nopgrp:
 			kp->ki_lastcpu = mtd.td_lastcpu;
 			kp->ki_wchan = mtd.td_wchan;
 			if (mtd.td_name[0] != 0)
-				strlcpy(kp->ki_ocomm, mtd.td_name, MAXCOMLEN);
+				strlcpy(kp->ki_tdname, mtd.td_name, MAXCOMLEN);
 			kp->ki_oncpu = mtd.td_oncpu;
 			if (mtd.td_name[0] != '\0')
-				strlcpy(kp->ki_ocomm, mtd.td_name, sizeof(kp->ki_ocomm));
+				strlcpy(kp->ki_tdname, mtd.td_name, sizeof(kp->ki_tdname));
 			kp->ki_pctcpu = 0;
 			kp->ki_rqindex = 0;
 		} else {

Modified: head/sys/compat/freebsd32/freebsd32.h
==============================================================================
--- head/sys/compat/freebsd32/freebsd32.h	Mon Jul 18 19:42:18 2011	(r224198)
+++ head/sys/compat/freebsd32/freebsd32.h	Mon Jul 18 20:06:15 2011	(r224199)
@@ -310,7 +310,7 @@ struct kinfo_proc32 {
 	char	ki_rqindex;
 	u_char	ki_oncpu;
 	u_char	ki_lastcpu;
-	char	ki_ocomm[OCOMMLEN+1];
+	char	ki_tdname[TDNAMLEN+1];
 	char	ki_wmesg[WMESGLEN+1];
 	char	ki_login[LOGNAMELEN+1];
 	char	ki_lockname[LOCKNAMELEN+1];

Modified: head/sys/kern/kern_proc.c
==============================================================================
--- head/sys/kern/kern_proc.c	Mon Jul 18 19:42:18 2011	(r224198)
+++ head/sys/kern/kern_proc.c	Mon Jul 18 20:06:15 2011	(r224199)
@@ -855,7 +855,7 @@ fill_kinfo_thread(struct thread *td, str
 		strlcpy(kp->ki_wmesg, td->td_wmesg, sizeof(kp->ki_wmesg));
 	else
 		bzero(kp->ki_wmesg, sizeof(kp->ki_wmesg));
-	strlcpy(kp->ki_ocomm, td->td_name, sizeof(kp->ki_ocomm));
+	strlcpy(kp->ki_tdname, td->td_name, sizeof(kp->ki_tdname));
 	if (TD_ON_LOCK(td)) {
 		kp->ki_kiflag |= KI_LOCKBLOCK;
 		strlcpy(kp->ki_lockname, td->td_lockname,
@@ -1059,7 +1059,7 @@ freebsd32_kinfo_proc_out(const struct ki
 	CP(*ki, *ki32, ki_rqindex);
 	CP(*ki, *ki32, ki_oncpu);
 	CP(*ki, *ki32, ki_lastcpu);
-	bcopy(ki->ki_ocomm, ki32->ki_ocomm, OCOMMLEN + 1);
+	bcopy(ki->ki_tdname, ki32->ki_tdname, TDNAMLEN + 1);
 	bcopy(ki->ki_wmesg, ki32->ki_wmesg, WMESGLEN + 1);
 	bcopy(ki->ki_login, ki32->ki_login, LOGNAMELEN + 1);
 	bcopy(ki->ki_lockname, ki32->ki_lockname, LOCKNAMELEN + 1);

Modified: head/sys/sys/user.h
==============================================================================
--- head/sys/sys/user.h	Mon Jul 18 19:42:18 2011	(r224198)
+++ head/sys/sys/user.h	Mon Jul 18 20:06:15 2011	(r224199)
@@ -95,13 +95,18 @@
 
 #define	WMESGLEN	8		/* size of returned wchan message */
 #define	LOCKNAMELEN	8		/* size of returned lock name */
-#define	OCOMMLEN	16		/* size of returned thread name */
+#define	TDNAMLEN	16		/* size of returned thread name */
 #define	COMMLEN		19		/* size of returned ki_comm name */
 #define	KI_EMULNAMELEN	16		/* size of returned ki_emul */
 #define KI_NGROUPS	16		/* number of groups in ki_groups */
 #define	LOGNAMELEN	17		/* size of returned ki_login */
 #define	LOGINCLASSLEN	17		/* size of returned ki_loginclass */
 
+#ifndef BURN_BRIDGES
+#define	OCOMMLEN	TDNAMLEN	
+#define	ki_ocomm	ki_tdname
+#endif
+
 /* Flags for the process credential. */
 #define	KI_CRF_CAPABILITY_MODE	0x00000001
 /*
@@ -167,7 +172,7 @@ struct kinfo_proc {
 	char	ki_rqindex;		/* Run queue index */
 	u_char	ki_oncpu;		/* Which cpu we are on */
 	u_char	ki_lastcpu;		/* Last cpu we were on */
-	char	ki_ocomm[OCOMMLEN+1];	/* thread name */
+	char	ki_tdname[TDNAMLEN+1];	/* thread name */
 	char	ki_wmesg[WMESGLEN+1];	/* wchan message */
 	char	ki_login[LOGNAMELEN+1];	/* setlogin name */
 	char	ki_lockname[LOCKNAMELEN+1]; /* lock name */

Modified: head/usr.bin/procstat/procstat_kstack.c
==============================================================================
--- head/usr.bin/procstat/procstat_kstack.c	Mon Jul 18 19:42:18 2011	(r224198)
+++ head/usr.bin/procstat/procstat_kstack.c	Mon Jul 18 20:06:15 2011	(r224199)
@@ -213,9 +213,9 @@ procstat_kstack(struct kinfo_proc *kipp,
 		printf("%5d ", kipp->ki_pid);
 		printf("%6d ", kkstp->kkst_tid);
 		printf("%-16s ", kipp->ki_comm);
-		printf("%-16s ", (strlen(kipp->ki_ocomm) &&
-		    (strcmp(kipp->ki_comm, kipp->ki_ocomm) != 0)) ?
-		    kipp->ki_ocomm : "-");
+		printf("%-16s ", (strlen(kipp->ki_tdname) &&
+		    (strcmp(kipp->ki_comm, kipp->ki_tdname) != 0)) ?
+		    kipp->ki_tdname : "-");
 
 		switch (kkstp->kkst_state) {
 		case KKST_STATE_RUNNING:

Modified: head/usr.bin/procstat/procstat_threads.c
==============================================================================
--- head/usr.bin/procstat/procstat_threads.c	Mon Jul 18 19:42:18 2011	(r224198)
+++ head/usr.bin/procstat/procstat_threads.c	Mon Jul 18 20:06:15 2011	(r224199)
@@ -86,9 +86,9 @@ procstat_threads(struct kinfo_proc *kipp
 		printf("%6d ", kipp->ki_tid);
 		printf("%-16s ", strlen(kipp->ki_comm) ?
 		    kipp->ki_comm : "-");
-		printf("%-16s ", (strlen(kipp->ki_ocomm) &&
-		    (strcmp(kipp->ki_comm, kipp->ki_ocomm) != 0)) ?
-		    kipp->ki_ocomm : "-");
+		printf("%-16s ", (strlen(kipp->ki_tdname) &&
+		    (strcmp(kipp->ki_comm, kipp->ki_tdname) != 0)) ?
+		    kipp->ki_tdname : "-");
 		if (kipp->ki_oncpu != 255)
 			printf("%3d ", kipp->ki_oncpu);
 		else if (kipp->ki_lastcpu != 255)

Modified: head/usr.bin/top/machine.c
==============================================================================
--- head/usr.bin/top/machine.c	Mon Jul 18 19:42:18 2011	(r224198)
+++ head/usr.bin/top/machine.c	Mon Jul 18 20:06:15 2011	(r224199)
@@ -833,8 +833,8 @@ format_next_process(caddr_t handle, char
 
 	if (!(flags & FMT_SHOWARGS)) {
 		if (ps.thread && pp->ki_flag & P_HADTHREADS &&
-		    pp->ki_ocomm[0]) {
-			snprintf(cmdbuf, cmdlengthdelta, "{%s}", pp->ki_ocomm);
+		    pp->ki_tdname[0]) {
+			snprintf(cmdbuf, cmdlengthdelta, "{%s}", pp->ki_tdname);
 		} else {
 			snprintf(cmdbuf, cmdlengthdelta, "%s", pp->ki_comm);
 		}
@@ -844,9 +844,9 @@ format_next_process(caddr_t handle, char
 		    (args = kvm_getargv(kd, pp, cmdlengthdelta)) == NULL ||
 		    !(*args)) {
 			if (ps.thread && pp->ki_flag & P_HADTHREADS &&
-		    	    pp->ki_ocomm[0]) {
+		    	    pp->ki_tdname[0]) {
 				snprintf(cmdbuf, cmdlengthdelta,
-				    "{%s}", pp->ki_ocomm);
+				    "{%s}", pp->ki_tdname);
 			} else {
 				snprintf(cmdbuf, cmdlengthdelta,
 				    "[%s]", pp->ki_comm);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201107182006.p6IK6FCJ037403>