From owner-p4-projects@FreeBSD.ORG Sun Jul 27 22:30:12 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id A0E94106566C; Sun, 27 Jul 2008 22:30:12 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4CF6C106564A for ; Sun, 27 Jul 2008 22:30:12 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 424F38FC17 for ; Sun, 27 Jul 2008 22:30:12 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.2/8.14.2) with ESMTP id m6RMUC4n085278 for ; Sun, 27 Jul 2008 22:30:12 GMT (envelope-from ed@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.2/8.14.1/Submit) id m6RMUCjv085276 for perforce@freebsd.org; Sun, 27 Jul 2008 22:30:12 GMT (envelope-from ed@FreeBSD.org) Date: Sun, 27 Jul 2008 22:30:12 GMT Message-Id: <200807272230.m6RMUCjv085276@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to ed@FreeBSD.org using -f From: Ed Schouten To: Perforce Change Reviews Cc: Subject: PERFORCE change 146071 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jul 2008 22:30:12 -0000 http://perforce.freebsd.org/chv.cgi?CH=146071 Change 146071 by ed@ed_dull on 2008/07/27 22:29:18 Add support for PTY master devices to procstat(1). Affected files ... .. //depot/projects/mpsafetty/sys/dev/pts/pts.c#7 edit .. //depot/projects/mpsafetty/sys/kern/kern_descrip.c#2 edit .. //depot/projects/mpsafetty/sys/sys/tty.h#4 edit .. //depot/projects/mpsafetty/sys/sys/user.h#2 edit .. //depot/projects/mpsafetty/usr.bin/procstat/procstat.1#2 edit .. //depot/projects/mpsafetty/usr.bin/procstat/procstat_files.c#2 edit Differences ... ==== //depot/projects/mpsafetty/sys/dev/pts/pts.c#7 (text+ko) ==== @@ -255,7 +255,7 @@ /* Reverse device name lookups, for ptsname() and ttyname() */ fgn = data; - p = devtoname(tp->t_dev); + p = tty_devname(tp); i = strlen(p) + 1; if (i > fgn->len) return (EINVAL); ==== //depot/projects/mpsafetty/sys/kern/kern_descrip.c#2 (text+ko) ==== @@ -70,6 +70,7 @@ #include #include #include +#include #include #include #include @@ -2564,6 +2565,7 @@ struct vnode *vp; struct file *fp; struct proc *p; + struct tty *tp; int vfslocked; name = (int *)arg1; @@ -2595,6 +2597,7 @@ kif->kf_structsize = sizeof(*kif); vp = NULL; so = NULL; + tp = NULL; kif->kf_fd = i; switch (fp->f_type) { case DTYPE_VNODE: @@ -2637,6 +2640,11 @@ kif->kf_type = KF_TYPE_SEM; break; + case DTYPE_PTS: + kif->kf_type = KF_TYPE_PTS; + tp = fp->f_data; + break; + default: kif->kf_type = KF_TYPE_UNKNOWN; break; @@ -2730,6 +2738,10 @@ kif->kf_sock_type = so->so_type; kif->kf_sock_protocol = so->so_proto->pr_protocol; } + if (tp != NULL) { + strlcpy(kif->kf_path, tty_devname(tp), + sizeof(kif->kf_path)); + } error = SYSCTL_OUT(req, kif, sizeof(*kif)); if (error) break; ==== //depot/projects/mpsafetty/sys/sys/tty.h#4 (text+ko) ==== @@ -182,6 +182,7 @@ #define tty_opened(tp) ((tp)->t_flags & TF_OPENED) #define tty_gone(tp) ((tp)->t_flags & TF_GONE) #define tty_softc(tp) ((tp)->t_softc) +#define tty_devname(tp) devtoname((tp)->t_dev) /* Status line printing */ void tty_info(struct tty *); ==== //depot/projects/mpsafetty/sys/sys/user.h#2 (text+ko) ==== @@ -250,6 +250,7 @@ #define KF_TYPE_MQUEUE 7 #define KF_TYPE_SHM 8 #define KF_TYPE_SEM 9 +#define KF_TYPE_PTS 10 #define KF_TYPE_UNKNOWN 255 #define KF_VTYPE_VNON 0 ==== //depot/projects/mpsafetty/usr.bin/procstat/procstat.1#2 (text+ko) ==== @@ -148,11 +148,13 @@ .It k kqueue .It m -messsage queue +message queue .It p pipe .It s socket +.It t +pseudo-terminal master .It v vnode .El ==== //depot/projects/mpsafetty/usr.bin/procstat/procstat_files.c#2 (text+ko) ==== @@ -222,6 +222,10 @@ str = "h"; break; + case KF_TYPE_PTS: + str = "t"; + break; + case KF_TYPE_SEM: str = "e"; break; @@ -296,6 +300,7 @@ switch (kif->kf_type) { case KF_TYPE_VNODE: case KF_TYPE_FIFO: + case KF_TYPE_PTS: printf("%-3s ", "-"); printf("%-18s", kif->kf_path); break;