diff options
author | Mathieu Arnold <mat@FreeBSD.org> | 2015-10-15 14:55:14 +0000 |
---|---|---|
committer | Mathieu Arnold <mat@FreeBSD.org> | 2015-10-15 14:55:14 +0000 |
commit | 7f0f664d7e0d5fbb1fd0e1cc45d4b413f66c97ae (patch) | |
tree | d30bee8baf5be305289898828fb58299162e2f54 /sysutils/rmonitor | |
parent | b3175cfda759707ed077a4649b634cad8934eb1b (diff) | |
download | ports-7f0f664d7e0d5fbb1fd0e1cc45d4b413f66c97ae.tar.gz ports-7f0f664d7e0d5fbb1fd0e1cc45d4b413f66c97ae.zip |
Notes
Diffstat (limited to 'sysutils/rmonitor')
-rw-r--r-- | sysutils/rmonitor/files/patch-src__rmonitor.c | 53 | ||||
-rw-r--r-- | sysutils/rmonitor/files/patch-utmpx | 51 |
2 files changed, 50 insertions, 54 deletions
diff --git a/sysutils/rmonitor/files/patch-src__rmonitor.c b/sysutils/rmonitor/files/patch-src__rmonitor.c index dcd449f3472c..bb7929c7aa57 100644 --- a/sysutils/rmonitor/files/patch-src__rmonitor.c +++ b/sysutils/rmonitor/files/patch-src__rmonitor.c @@ -1,6 +1,15 @@ ---- ./src/rmonitor.c.orig 2001-07-20 18:31:10.000000000 +0300 -+++ ./src/rmonitor.c 2009-02-20 11:24:12.000000000 +0200 -@@ -294,7 +294,7 @@ +--- src/rmonitor.c.orig 2015-09-18 17:10:16 UTC ++++ src/rmonitor.c +@@ -88,7 +88,7 @@ static const char rcsid[] = "$Id: rmonit + #include <sys/vmmeter.h> + #include <time.h> + #include <unistd.h> +-#include <utmp.h> ++#include <utmpx.h> + + + #define DEFTOL 2.5 /* default tolerance */ +@@ -294,13 +294,13 @@ void getstat ( char *stat ) /* ----- #define samples 2 double lavg[samples]; int dbufs = 0; @@ -9,3 +18,41 @@ int maxf = -1; int maxp = -1; int memfre = 0; + int memtot = 0; + int memuse = 0; +- int nu = -1; ++ int nu = 0; + int np = -1; + int openf = -1; + int pgcnt = 0; +@@ -309,9 +309,8 @@ void getstat ( char *stat ) /* ----- + int pgsize = 0; + int slvl = 0; + int vn[3]; +- int utfd; + time_t ct; +- struct utmp utmprec; ++ struct utmpx *utmprec; + + union { + char buf[STRLEN]; +@@ -402,14 +401,12 @@ void getstat ( char *stat ) /* ----- + + if (getloadavg(lavg, samples) != samples) errmsg("getloadavg"); + +- if ((utfd = open(_PATH_UTMP, O_RDONLY)) >= 0) { +- nu = 0; +- while (read(utfd, &utmprec, sizeof utmprec) > 0) +- if (*(utmprec.ut_name)) nu++; +- if (close(utfd) < 0) errmsg("close"); ++ setutxent(); ++ while ((utmprec = getutxent()) != NULL) { ++ if (utmprec->ut_type == USER_PROCESS) ++ nu++; + } +- else +- errmsg("open"); ++ endutxent(); + + #if __FreeBSD_version >= 420000 + snprintf(stat, STRLEN, diff --git a/sysutils/rmonitor/files/patch-utmpx b/sysutils/rmonitor/files/patch-utmpx deleted file mode 100644 index 74701016bf05..000000000000 --- a/sysutils/rmonitor/files/patch-utmpx +++ /dev/null @@ -1,51 +0,0 @@ ---- src/rmonitor.c -+++ src/rmonitor.c -@@ -88,7 +88,7 @@ - #include <sys/vmmeter.h> - #include <time.h> - #include <unistd.h> --#include <utmp.h> -+#include <utmpx.h> - - - #define DEFTOL 2.5 /* default tolerance */ -@@ -300,7 +300,7 @@ - int memfre = 0; - int memtot = 0; - int memuse = 0; -- int nu = -1; -+ int nu = 0; - int np = -1; - int openf = -1; - int pgcnt = 0; -@@ -309,9 +309,8 @@ - int pgsize = 0; - int slvl = 0; - int vn[3]; -- int utfd; - time_t ct; -- struct utmp utmprec; -+ struct utmpx *utmprec; - - union { - char buf[STRLEN]; -@@ -402,14 +401,12 @@ - - if (getloadavg(lavg, samples) != samples) errmsg("getloadavg"); - -- if ((utfd = open(_PATH_UTMP, O_RDONLY)) >= 0) { -- nu = 0; -- while (read(utfd, &utmprec, sizeof utmprec) > 0) -- if (*(utmprec.ut_name)) nu++; -- if (close(utfd) < 0) errmsg("close"); -+ setutxent(); -+ while ((utmprec = getutxent()) != NULL) { -+ if (utmprec->ut_type == USER_PROCESS) -+ nu++; - } -- else -- errmsg("open"); -+ endutxent(); - - #if __FreeBSD_version >= 420000 - snprintf(stat, STRLEN, |