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)
This commit is contained in:
Bjoern A. Zeeb 2011-07-18 20:06:15 +00:00
parent 8953ac4334
commit 925af54487
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=224199
9 changed files with 31 additions and 26 deletions

View File

@ -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},

View File

@ -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));

View File

@ -426,10 +426,10 @@ kvm_proclist(kvm_t *kd, int what, int arg, struct proc *p,
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 {

View File

@ -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];

View File

@ -855,7 +855,7 @@ fill_kinfo_thread(struct thread *td, struct kinfo_proc *kp, int preferthread)
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 kinfo_proc *ki, struct kinfo_proc32 *ki32)
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);

View File

@ -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 */

View File

@ -213,9 +213,9 @@ procstat_kstack(struct kinfo_proc *kipp, int kflag)
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:

View File

@ -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)

View File

@ -833,8 +833,8 @@ format_next_process(caddr_t handle, char *(*get_userid)(int), int flags)
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 *(*get_userid)(int), int flags)
(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);