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);
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to