aboutsummaryrefslogtreecommitdiffstats
path: root/sysutils
diff options
context:
space:
mode:
authorume <ume@FreeBSD.org>2010-01-20 20:33:58 +0800
committerume <ume@FreeBSD.org>2010-01-20 20:33:58 +0800
commit1248f9e714648228a7a75582c43573a23552a73a (patch)
tree8085938157d87a4d7b2c8b3e69b5856f62302a40 /sysutils
parent140bb79ee5a90eec243058ba147c0f8d4079a4dc (diff)
downloadfreebsd-ports-gnome-1248f9e714648228a7a75582c43573a23552a73a.tar.gz
freebsd-ports-gnome-1248f9e714648228a7a75582c43573a23552a73a.tar.zst
freebsd-ports-gnome-1248f9e714648228a7a75582c43573a23552a73a.zip
Fix build on 9-CURRENT after utmp -> utmpx change.
Reported by: pointyhat via erwin
Diffstat (limited to 'sysutils')
-rw-r--r--sysutils/gkrellm/files/patch-src::proc.c72
1 files changed, 72 insertions, 0 deletions
diff --git a/sysutils/gkrellm/files/patch-src::proc.c b/sysutils/gkrellm/files/patch-src::proc.c
new file mode 100644
index 000000000000..2881c1bfe776
--- /dev/null
+++ b/sysutils/gkrellm/files/patch-src::proc.c
@@ -0,0 +1,72 @@
+Index: src/proc.c
+diff -u -p src/proc.c.orig src/proc.c
+--- src/proc.c.orig 2002-07-01 11:21:19.000000000 +0900
++++ src/proc.c 2010-01-19 20:51:02.658138473 +0900
+@@ -99,7 +99,11 @@ void (*read_system_proc_info)();
+ #include <kvm.h>
+ #include <limits.h>
+ #include <paths.h>
++#if !defined(__FreeBSD__) || __FreeBSD_version < 900007
+ #include <utmp.h>
++#else
++#include <utmpx.h>
++#endif
+
+ extern kvm_t *kvmd;
+
+@@ -153,8 +157,14 @@ read_freebsd_proc()
+ gint r_forks, r_vforks, r_rforks;
+ gint len;
+ gint nextpid, nforked;
++#if !defined(__FreeBSD__) || __FreeBSD_version < 900007
+ FILE *ut;
+ struct utmp utmp;
++#define UTMP_FILE _PATH_UTMP
++#else
++ struct utmpx *utmp;
++#define UTMP_FILE "/var/run/utx.active"
++#endif
+ struct stat sb, s;
+ static time_t utmp_mtime;
+ gchar ttybuf[MAXPATHLEN];
+@@ -211,8 +221,9 @@ read_freebsd_proc()
+
+ if (!GK.five_second_tick || !proc.extra_info)
+ return;
+- if (stat(_PATH_UTMP, &s) != 0 || s.st_mtime == utmp_mtime)
++ if (stat(UTMP_FILE, &s) != 0 || s.st_mtime == utmp_mtime)
+ return;
++#if !defined(__FreeBSD__) || __FreeBSD_version < 900007
+ if ((ut = fopen(_PATH_UTMP, "r")) != NULL)
+ {
+ proc.n_users = 0;
+@@ -222,13 +233,27 @@ read_freebsd_proc()
+ continue;
+ (void)snprintf(ttybuf, sizeof(ttybuf), "%s/%s",
+ _PATH_DEV, utmp.ut_line);
+- /* corrupted record */
+ if (stat(ttybuf, &sb))
+- continue;
++ continue; /* corrupted record */
+ ++proc.n_users;
+ }
+ (void)fclose(ut);
+ }
++#else
++ setutxent();
++ proc.n_users = 0;
++ while ((utmp = getutxent()) != NULL)
++ {
++ if (utmp->ut_type != USER_PROCESS)
++ continue;
++ (void)snprintf(ttybuf, sizeof(ttybuf), "%s/%s",
++ _PATH_DEV, utmp->ut_line);
++ if (stat(ttybuf, &sb))
++ continue; /* corrupted record */
++ ++proc.n_users;
++ }
++ endutxent();
++#endif
+ utmp_mtime = s.st_mtime;
+ }
+ #endif