diff options
author | Olivier Houchard <cognet@FreeBSD.org> | 2019-11-11 00:21:05 +0000 |
---|---|---|
committer | Olivier Houchard <cognet@FreeBSD.org> | 2019-11-11 00:21:05 +0000 |
commit | 2b2cde807c8f17ec8698522d5f2fa5e48a3f7ca8 (patch) | |
tree | 98df328eb5d2e5366ad2d25e4f38b1782ae26fec /sys/compat/linprocfs/linprocfs.c | |
parent | dc67cfef96f985aa02a78b45f5375c3c0d8f240e (diff) |
linprocfs: Make sure to report -1 as tty when we have no controlling tty.
When reporting a process' stats, we can't just provide the tty as an
unsigned long, as if we have no controlling tty, the tty would be NODEV, or
-1. Instaed, just special-case NODEV.
Submitted by: Juraj Lutter <otis@sk.FreeBSD.org>
MFC after: 1 week
Notes
Notes:
svn path=/head/; revision=354602
Diffstat (limited to 'sys/compat/linprocfs/linprocfs.c')
-rw-r--r-- | sys/compat/linprocfs/linprocfs.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/compat/linprocfs/linprocfs.c b/sys/compat/linprocfs/linprocfs.c index 8c1f387ca4c0..070213a9af53 100644 --- a/sys/compat/linprocfs/linprocfs.c +++ b/sys/compat/linprocfs/linprocfs.c @@ -809,7 +809,10 @@ linprocfs_doprocstat(PFS_FILL_ARGS) PS_ADD("pgrp", "%d", p->p_pgid); PS_ADD("session", "%d", p->p_session->s_sid); PROC_UNLOCK(p); - PS_ADD("tty", "%ju", (uintmax_t)kp.ki_tdev); + if (kp.ki_tdev == NODEV) + PS_ADD("tty", "%s", "-1"); + else + PS_ADD("tty", "%ju", (uintmax_t)kp.ki_tdev); PS_ADD("tpgid", "%d", kp.ki_tpgid); PS_ADD("flags", "%u", 0); /* XXX */ PS_ADD("minflt", "%lu", kp.ki_rusage.ru_minflt); |