For processes with no controlling terminal, display "-" in the TTY column

instead of "?".

Submitted by:	arundel
This commit is contained in:
Edward Tomasz Napierala 2011-10-30 15:21:27 +00:00
parent 8d5eb1c4c8
commit aa7a15b6bb
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=226939
2 changed files with 8 additions and 4 deletions

View File

@ -362,7 +362,7 @@ tdev(KINFO *k, VARENT *ve)
v = ve->var; v = ve->var;
dev = k->ki_p->ki_tdev; dev = k->ki_p->ki_tdev;
if (dev == NODEV) if (dev == NODEV)
str = strdup("??"); str = strdup("-");
else else
asprintf(&str, "%#jx", (uintmax_t)dev); asprintf(&str, "%#jx", (uintmax_t)dev);
@ -379,7 +379,7 @@ tname(KINFO *k, VARENT *ve)
v = ve->var; v = ve->var;
dev = k->ki_p->ki_tdev; dev = k->ki_p->ki_tdev;
if (dev == NODEV || (ttname = devname(dev, S_IFCHR)) == NULL) if (dev == NODEV || (ttname = devname(dev, S_IFCHR)) == NULL)
str = strdup("?? "); str = strdup("- ");
else { else {
if (strncmp(ttname, "tty", 3) == 0 || if (strncmp(ttname, "tty", 3) == 0 ||
strncmp(ttname, "cua", 3) == 0) strncmp(ttname, "cua", 3) == 0)
@ -403,7 +403,7 @@ longtname(KINFO *k, VARENT *ve)
v = ve->var; v = ve->var;
dev = k->ki_p->ki_tdev; dev = k->ki_p->ki_tdev;
if (dev == NODEV || (ttname = devname(dev, S_IFCHR)) == NULL) if (dev == NODEV || (ttname = devname(dev, S_IFCHR)) == NULL)
ttname = "??"; ttname = "-";
return (strdup(ttname)); return (strdup(ttname));
} }

View File

@ -29,7 +29,7 @@
.\" @(#)ps.1 8.3 (Berkeley) 4/18/94 .\" @(#)ps.1 8.3 (Berkeley) 4/18/94
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd October 1, 2011 .Dd October 30, 2011
.Dt PS 1 .Dt PS 1
.Os .Os
.Sh NAME .Sh NAME
@ -437,6 +437,10 @@ This is followed by a
.Ql - .Ql -
if the process can no longer reach that if the process can no longer reach that
controlling terminal (i.e., it has been revoked). controlling terminal (i.e., it has been revoked).
A
.Ql -
without a preceding two letter abbreviation or pseudo-terminal device number
indicates a process which never had a controlling terminal.
The full pathname of the controlling terminal is available via the The full pathname of the controlling terminal is available via the
.Cm tty .Cm tty
keyword. keyword.