svn commit: r355332 - stable/11/sys/compat/linprocfs

Olivier Houchard cognet at FreeBSD.org
Tue Dec 3 16:33:35 UTC 2019


Author: cognet
Date: Tue Dec  3 16:33:35 2019
New Revision: 355332
URL: https://svnweb.freebsd.org/changeset/base/355332

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/11/sys/compat/linprocfs/linprocfs.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linprocfs/linprocfs.c
==============================================================================
--- stable/11/sys/compat/linprocfs/linprocfs.c	Tue Dec  3 16:32:30 2019	(r355331)
+++ stable/11/sys/compat/linprocfs/linprocfs.c	Tue Dec  3 16:33:35 2019	(r355332)
@@ -618,7 +618,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);


More information about the svn-src-all mailing list