mirror of
https://git.freebsd.org/ports.git
synced 2025-07-18 17:59:20 -04:00
- Fix build on HEAD
PR: 143310 Patched by: ed@ Submitted by: Konrad Heuer <kheuer@gwdg.de> (maintainer)
This commit is contained in:
parent
549d898acf
commit
31c0d6f284
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=248769
2 changed files with 58 additions and 1 deletions
|
@ -20,4 +20,10 @@ MANCOMPRESSED= yes
|
|||
|
||||
#CFLAGS+= -w
|
||||
|
||||
.include <bsd.port.mk>
|
||||
.include <bsd.port.pre.mk>
|
||||
|
||||
.if ${OSVERSION} >= 900007
|
||||
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-utmpx
|
||||
.endif
|
||||
|
||||
.include <bsd.port.post.mk>
|
||||
|
|
51
sysutils/rmonitor/files/extra-patch-utmpx
Normal file
51
sysutils/rmonitor/files/extra-patch-utmpx
Normal file
|
@ -0,0 +1,51 @@
|
|||
--- 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,
|
Loading…
Add table
Reference in a new issue