diff options
Diffstat (limited to 'usr.bin/systat/vmstat.c')
-rw-r--r-- | usr.bin/systat/vmstat.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/usr.bin/systat/vmstat.c b/usr.bin/systat/vmstat.c index 3866438..1a02197 100644 --- a/usr.bin/systat/vmstat.c +++ b/usr.bin/systat/vmstat.c @@ -66,7 +66,7 @@ static const char sccsid[] = "@(#)vmstat.c 8.2 (Berkeley) 1/12/94"; #include <string.h> #include <time.h> #include <unistd.h> -#include <utmp.h> +#include <utmpx.h> #include <devstat.h> #include "systat.h" #include "extern.h" @@ -141,7 +141,6 @@ static void putlongdouble(long double, int, int, int, int, int); static int ucount(void); static int ncpu; -static int ut; static char buf[26]; static time_t t; static double etime; @@ -150,16 +149,10 @@ static long *intrloc; static char **intrname; static int nextintsrow; -struct utmp utmp; - - WINDOW * openkre(void) { - ut = open(_PATH_UTMP, O_RDONLY); - if (ut < 0) - error("No utmp"); return (stdscr); } @@ -167,7 +160,6 @@ void closekre(WINDOW *w) { - (void) close(ut); if (w == NULL) return; wclear(w); @@ -634,14 +626,14 @@ static int ucount(void) { int nusers = 0; + struct utmpx *ut; - if (ut < 0) - return (0); - while (read(ut, &utmp, sizeof(utmp))) - if (utmp.ut_name[0] != '\0') + setutxent(); + while ((ut = getutxent()) != NULL) + if (ut->ut_type == USER_PROCESS) nusers++; + endutxent(); - lseek(ut, 0L, L_SET); return (nusers); } |