Date: Tue, 3 Dec 2019 16:32:31 +0000 (UTC) From: Olivier Houchard <cognet@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355331 - stable/12/sys/compat/linprocfs Message-ID: <201912031632.xB3GWVuU083446@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: cognet Date: Tue Dec 3 16:32:30 2019 New Revision: 355331 URL: https://svnweb.freebsd.org/changeset/base/355331 Log: MFC r354602 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. Modified: stable/12/sys/compat/linprocfs/linprocfs.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linprocfs/linprocfs.c ============================================================================== --- stable/12/sys/compat/linprocfs/linprocfs.c Tue Dec 3 15:48:28 2019 (r355330) +++ stable/12/sys/compat/linprocfs/linprocfs.c Tue Dec 3 16:32:30 2019 (r355331) @@ -737,7 +737,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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201912031632.xB3GWVuU083446>