summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarcus <marcus@df743ca5-7f9a-e211-a948-0013205c9059>2010-05-02 08:04:47 +0800
committermarcus <marcus@df743ca5-7f9a-e211-a948-0013205c9059>2010-05-02 08:04:47 +0800
commit377957ea616fc2c7594a8210c74975ea47e2aceb (patch)
tree72ed16b35fbbd57c23216a2080c4201eaffc49e1
parent60893e3dfbdd846c76c34334114b863e7c25b83b (diff)
downloadmarcuscom-ports-377957ea616fc2c7594a8210c74975ea47e2aceb.tar
marcuscom-ports-377957ea616fc2c7594a8210c74975ea47e2aceb.tar.gz
marcuscom-ports-377957ea616fc2c7594a8210c74975ea47e2aceb.tar.bz2
marcuscom-ports-377957ea616fc2c7594a8210c74975ea47e2aceb.tar.lz
marcuscom-ports-377957ea616fc2c7594a8210c74975ea47e2aceb.tar.xz
marcuscom-ports-377957ea616fc2c7594a8210c74975ea47e2aceb.tar.zst
marcuscom-ports-377957ea616fc2c7594a8210c74975ea47e2aceb.zip
Remove the last vestiges of /proc from the FreeBSD backend.
git-svn-id: svn://creme-brulee.marcuscom.com/ports/trunk@14119 df743ca5-7f9a-e211-a948-0013205c9059
-rw-r--r--devel/libgtop/Makefile4
-rw-r--r--devel/libgtop/files/patch-sysdeps_freebsd_procwd.c38
2 files changed, 32 insertions, 10 deletions
diff --git a/devel/libgtop/Makefile b/devel/libgtop/Makefile
index 838203233..ce77a1e92 100644
--- a/devel/libgtop/Makefile
+++ b/devel/libgtop/Makefile
@@ -3,12 +3,12 @@
# Whom: Joe Marcus Clarke <marcus@FreeBSD.org>
#
# $FreeBSD$
-# $MCom: ports/devel/libgtop/Makefile,v 1.54 2010/04/01 13:17:47 kwm Exp $
+# $MCom: ports/devel/libgtop/Makefile,v 1.55 2010/04/03 17:22:26 marcus Exp $
#
PORTNAME= libgtop
PORTVERSION= 2.28.1
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= devel gnome
MASTER_SITES= GNOME
DIST_SUBDIR= gnome2
diff --git a/devel/libgtop/files/patch-sysdeps_freebsd_procwd.c b/devel/libgtop/files/patch-sysdeps_freebsd_procwd.c
index 8fd7fffff..dda721f82 100644
--- a/devel/libgtop/files/patch-sysdeps_freebsd_procwd.c
+++ b/devel/libgtop/files/patch-sysdeps_freebsd_procwd.c
@@ -1,5 +1,5 @@
---- sysdeps/freebsd/procwd.c.orig 2009-12-13 18:53:02.827740000 -0500
-+++ sysdeps/freebsd/procwd.c 2009-12-13 18:59:27.000000000 -0500
+--- sysdeps/freebsd/procwd.c.orig 2010-05-01 20:02:13.419532000 -0400
++++ sysdeps/freebsd/procwd.c 2010-05-01 20:03:27.000000000 -0400
@@ -27,6 +27,9 @@
#include <sys/sysctl.h>
#include <sys/param.h>
@@ -19,13 +19,19 @@
static GPtrArray *
parse_output(const char *output, glibtop_proc_wd *buf)
{
-@@ -101,10 +104,14 @@ glibtop_get_proc_wd_s(glibtop *server, g
+@@ -97,24 +100,39 @@ parse_output(const char *output, glibtop
+ char**
+ glibtop_get_proc_wd_s(glibtop *server, glibtop_proc_wd *buf, pid_t pid)
+ {
+- char path[MAXPATHLEN];
++ int exe_mib[4];
++ size_t len;
#if __FreeBSD_version > 800018 || (__FreeBSD_version < 800000 && __FreeBSD_version >= 700104)
struct kinfo_file *freep, *kif;
GPtrArray *dirs;
-+#ifndef HAVE_KINFO_GETFILE
- size_t len;
+- size_t len;
- int i;
++#ifndef HAVE_KINFO_GETFILE
int name[4];
#else
+ int cnt;
@@ -35,15 +41,31 @@
char *output;
#endif
-@@ -115,6 +122,7 @@ glibtop_get_proc_wd_s(glibtop *server, g
- buf->flags |= (1 << GLIBTOP_PROC_WD_EXE);
+ memset (buf, 0, sizeof (glibtop_proc_wd));
++ len = 0;
+
+- g_snprintf(path, sizeof(path), "/proc/%u/file", pid);
+- if (safe_readlink(path, buf->exe, sizeof(buf->exe)))
+- buf->flags |= (1 << GLIBTOP_PROC_WD_EXE);
++ exe_mib[0] = CTL_KERN;
++ exe_mib[1] = KERN_PROC;
++ exe_mib[2] = KERN_PROC_PATHNAME;
++ exe_mib[3] = pid;
++
++ if (sysctl(exe_mib, 4, NULL, &len, NULL, 0) == 0) {
++ if (len > sizeof(buf->exe))
++ len = sizeof(buf->exe);
++ if (sysctl(exe_mib, 4, buf->exe, &len, NULL, 0) == 0)
++ buf->flags |= (1 << GLIBTOP_PROC_WD_EXE);
++ }
#if __FreeBSD_version > 800018 || (__FreeBSD_version < 800000 && __FreeBSD_version >= 700104)
+#ifndef HAVE_KINFO_GETFILE
++ len = 0;
name[0] = CTL_KERN;
name[1] = KERN_PROC;
name[2] = KERN_PROC_FILEDESC;
-@@ -127,10 +135,21 @@ glibtop_get_proc_wd_s(glibtop *server, g
+@@ -127,10 +145,21 @@ glibtop_get_proc_wd_s(glibtop *server, g
g_free(freep);
return NULL;
}