From owner-svn-src-all@FreeBSD.ORG Sat Dec 5 20:52:12 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 983EF1065670; Sat, 5 Dec 2009 20:52:12 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6DFF28FC12; Sat, 5 Dec 2009 20:52:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB5KqCNa099975; Sat, 5 Dec 2009 20:52:12 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB5KqCbZ099972; Sat, 5 Dec 2009 20:52:12 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200912052052.nB5KqCbZ099972@svn.freebsd.org> From: Ed Schouten Date: Sat, 5 Dec 2009 20:52:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200167 - head/usr.bin/systat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2009 20:52:12 -0000 Author: ed Date: Sat Dec 5 20:52:11 2009 New Revision: 200167 URL: http://svn.freebsd.org/changeset/base/200167 Log: Let systat's vmstat use utmpx. Modified: head/usr.bin/systat/Makefile head/usr.bin/systat/vmstat.c Modified: head/usr.bin/systat/Makefile ============================================================================== --- head/usr.bin/systat/Makefile Sat Dec 5 20:44:19 2009 (r200166) +++ head/usr.bin/systat/Makefile Sat Dec 5 20:52:11 2009 (r200167) @@ -14,7 +14,7 @@ SRCS+= icmp6.c ip6.c CFLAGS+= -DINET6 .endif -DPADD= ${LIBCURSES} ${LIBM} ${LIBDEVSTAT} ${LIBKVM} -LDADD= -lcursesw -lm -ldevstat -lkvm +DPADD= ${LIBCURSES} ${LIBM} ${LIBDEVSTAT} ${LIBKVM} ${LIBULOG} +LDADD= -lcursesw -lm -ldevstat -lkvm -lulog .include Modified: head/usr.bin/systat/vmstat.c ============================================================================== --- head/usr.bin/systat/vmstat.c Sat Dec 5 20:44:19 2009 (r200166) +++ head/usr.bin/systat/vmstat.c Sat Dec 5 20:52:11 2009 (r200167) @@ -65,8 +65,9 @@ static const char sccsid[] = "@(#)vmstat #include #include #include +#define _ULOG_POSIX_NAMES +#include #include -#include #include #include "systat.h" #include "extern.h" @@ -141,7 +142,6 @@ static void putlongdouble(long double, i static int ucount(void); static int ncpu; -static int ut; static char buf[26]; static time_t t; static double etime; @@ -150,16 +150,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 +161,6 @@ void closekre(WINDOW *w) { - (void) close(ut); if (w == NULL) return; wclear(w); @@ -634,14 +627,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); }