SCCS-vsn: usr.bin/w/w.c 5.11
#endif not lint
#ifndef lint
#endif not lint
#ifndef lint
-static char sccsid[] = "@(#)w.c 5.10 (Berkeley) %G%";
+static char sccsid[] = "@(#)w.c 5.11 (Berkeley) %G%";
time_t proctime; /* cpu time of process in doing */
double avenrun[3];
struct proc *aproc;
time_t proctime; /* cpu time of process in doing */
double avenrun[3];
struct proc *aproc;
+pid_t pgid;
+pid_t tpgid;
#define DIV60(t) ((t+30)/60) /* x/60 rounded */
#define TTYEQ (tty == pr[i].w_tty)
#define DIV60(t) ((t+30)/60) /* x/60 rounded */
#define TTYEQ (tty == pr[i].w_tty)
continue;
/* only include a process whose tty has a pgrp which matchs its own */
continue;
/* only include a process whose tty has a pgrp which matchs its own */
- lseek(kmem, (long)up.u_ttyp, 0);
- if (read(kmem, &ttyent, sizeof(ttyent)) != sizeof(ttyent))
+ lseek(kmem, (off_t)(&up.u_ttyp->t_pgid), 0);
+ if (read(kmem, &tpgid, sizeof(tpgid)) != sizeof(tpgid))
- if (ttyent.t_pgrp != mproc.p_pgrp)
+ lseek(kmem, (off_t)(&mproc.p_pgrp->pg_id), 0);
+ if (read(kmem, &pgid, sizeof(pgid)) != sizeof(pgid))
+ continue;
+ if (pgid != tpgid)
continue;
/* save the interesting parts */
continue;
/* save the interesting parts */