Date: Sun, 27 Jul 2008 22:30:12 GMT From: Ed Schouten <ed@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 146071 for review Message-ID: <200807272230.m6RMUCjv085276@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 <sys/syscallsubr.h> #include <sys/sysctl.h> #include <sys/sysproto.h> +#include <sys/tty.h> #include <sys/unistd.h> #include <sys/user.h> #include <sys/vnode.h> @@ -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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200807272230.m6RMUCjv085276>