aboutsummaryrefslogtreecommitdiffstats
path: root/sysutils
diff options
context:
space:
mode:
authormiwi <miwi@FreeBSD.org>2010-01-27 09:03:30 +0800
committermiwi <miwi@FreeBSD.org>2010-01-27 09:03:30 +0800
commitc3d64b2db8a0b06d1c9363d8ab1cef5b41d47029 (patch)
treec85a3702757822b9aef35ae48d94cf6d398273c1 /sysutils
parent94e4157498c290d446150aa6217f4850e43d9898 (diff)
downloadfreebsd-ports-gnome-c3d64b2db8a0b06d1c9363d8ab1cef5b41d47029.tar.gz
freebsd-ports-gnome-c3d64b2db8a0b06d1c9363d8ab1cef5b41d47029.tar.zst
freebsd-ports-gnome-c3d64b2db8a0b06d1c9363d8ab1cef5b41d47029.zip
- Fix build with HEAD
PR: 143240 Submitted by: Rob Farmer <rfarmer@predatorlabs.net> Reviewed by: ed@ patch reworked
Diffstat (limited to 'sysutils')
-rw-r--r--sysutils/nctop/Makefile8
-rw-r--r--sysutils/nctop/files/utmpx-machine.c44
2 files changed, 51 insertions, 1 deletions
diff --git a/sysutils/nctop/Makefile b/sysutils/nctop/Makefile
index ba6be2f28d76..3527307fbd64 100644
--- a/sysutils/nctop/Makefile
+++ b/sysutils/nctop/Makefile
@@ -24,4 +24,10 @@ CONFIGURE_ARGS= --prefix=${PREFIX} \
MAN1= nctopd.1 nctop.1
-.include <bsd.port.mk>
+.include <bsd.port.pre.mk>
+
+.if ${OSVERSION} > 900006
+EXTRA_PATCHES= ${FILESDIR}/utmpx-machine.c
+.endif
+
+.include <bsd.port.post.mk>
diff --git a/sysutils/nctop/files/utmpx-machine.c b/sysutils/nctop/files/utmpx-machine.c
new file mode 100644
index 000000000000..1aeb7a265409
--- /dev/null
+++ b/sysutils/nctop/files/utmpx-machine.c
@@ -0,0 +1,44 @@
+--- machines/freebsd.c
++++ machines/freebsd.c
+@@ -16,7 +16,7 @@
+ #include <stdlib.h>
+ #include <ctype.h>
+ #include <sys/types.h>
+-#include <utmp.h>
++#include <utmpx.h>
+ #include <kvm.h>
+ #include <fcntl.h>
+ #include <sys/sysctl.h>
+@@ -93,7 +93,6 @@
+ /* read the state of the machine */
+ void getstat (int signal) {
+
+- FILE *stream;
+
+
+ size_t len;
+@@ -101,18 +100,15 @@
+ /* nusers */
+ {
+
+- struct utmp utmp;
++ struct utmpx *utmp;
+
+- if ((stream = fopen(_PATH_UTMP,"r")) == NULL) {
+- perror(_PATH_UTMP);
+- } else {
+- for (hoststat.nusers=0; fread(&utmp,sizeof(utmp),1,stream);) {
+- if (utmp.ut_name[0] != '\0') {
+- ++hoststat.nusers;
+- }
++ setutxent();
++ for (hoststat.nusers=0; (utmp = getutxent()) != NULL;) {
++ if (utmp->ut_type == USER_PROCESS) {
++ ++hoststat.nusers;
+ }
+- fclose(stream);
+ }
++ endutxent();
+ }
+
+