summaryrefslogtreecommitdiffstats
path: root/devel
diff options
context:
space:
mode:
authormarcus <marcus@df743ca5-7f9a-e211-a948-0013205c9059>2005-06-28 02:37:00 +0800
committermarcus <marcus@df743ca5-7f9a-e211-a948-0013205c9059>2005-06-28 02:37:00 +0800
commit145057f531ffdd6cd43dbc70bdc4749223b61d9b (patch)
tree7d6edc97e5aa52ee8777db99d545561120fd565a /devel
parentae8b0f1dc8df2db1ac8196e7ea5be5b0e6f74ae3 (diff)
downloadmarcuscom-ports-145057f531ffdd6cd43dbc70bdc4749223b61d9b.tar.gz
marcuscom-ports-145057f531ffdd6cd43dbc70bdc4749223b61d9b.tar.zst
marcuscom-ports-145057f531ffdd6cd43dbc70bdc4749223b61d9b.zip
Merge -CURRENT file system I/O support from the FreeBSD ports tree.
git-svn-id: svn://creme-brulee.marcuscom.com/ports/trunk@4127 df743ca5-7f9a-e211-a948-0013205c9059
Diffstat (limited to 'devel')
-rw-r--r--devel/libgtop2/Makefile13
-rw-r--r--devel/libgtop2/files/extra-patch-sysdeps_freebsd_Makefile.in11
-rw-r--r--devel/libgtop2/files/patch-sysdeps_freebsd_fsusage.c123
-rw-r--r--devel/libgtop2/files/pkg-message13
4 files changed, 159 insertions, 1 deletions
diff --git a/devel/libgtop2/Makefile b/devel/libgtop2/Makefile
index da7e5e22a..a4413c719 100644
--- a/devel/libgtop2/Makefile
+++ b/devel/libgtop2/Makefile
@@ -7,6 +7,7 @@
PORTNAME= libgtop2
PORTVERSION= 2.11.0
+PORTREVISION= 1
CATEGORIES= devel gnome
MASTER_SITES= ${MASTER_SITE_GNOME}
MASTER_SITE_SUBDIR= sources/${PORTNAME:S/2$//}/2.11
@@ -31,6 +32,13 @@ CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include" \
INFO= libgtop2
+.include <bsd.port.pre.mk>
+
+.if ${OSVERSION} >= 600000
+PKGMESSAGE= ${FILESDIR}/pkg-message
+EXTRA_PATCHES+= ${FILESDIR}/extra-patch-sysdeps_freebsd_Makefile.in
+.endif
+
post-patch:
@${REINPLACE_CMD} -e 's|int64_t|gint64|g' \
${WRKSRC}/include/glibtop/command.h \
@@ -40,5 +48,8 @@ post-patch:
post-install:
@${CHGRP} kmem ${PREFIX}/bin/libgtop_server2
@${CHMOD} 2555 ${PREFIX}/bin/libgtop_server2
+.if ${OSVERSION} >= 600000
+ @${CAT} ${PKGMESSAGE}
+.endif
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>
diff --git a/devel/libgtop2/files/extra-patch-sysdeps_freebsd_Makefile.in b/devel/libgtop2/files/extra-patch-sysdeps_freebsd_Makefile.in
new file mode 100644
index 000000000..8515798b6
--- /dev/null
+++ b/devel/libgtop2/files/extra-patch-sysdeps_freebsd_Makefile.in
@@ -0,0 +1,11 @@
+--- Makefile.in.orig Mon Jun 27 14:34:33 2005
++++ Makefile.in Mon Jun 27 14:34:46 2005
+@@ -174,7 +174,7 @@
+ X_PRE_LIBS = @X_PRE_LIBS@
+ libgtop_sysdeps_2_0_la_LIBADD =
+ libgtop_sysdeps_2_0_la_OBJECTS = nosuid.lo siglist.lo
+-libgtop_sysdeps_suid_2_0_la_LIBADD =
++libgtop_sysdeps_suid_2_0_la_LIBADD = -lgeom -ldevstat
+ libgtop_sysdeps_suid_2_0_la_OBJECTS = open.lo close.lo cpu.lo mem.lo \
+ swap.lo uptime.lo loadavg.lo shm_limits.lo msg_limits.lo sem_limits.lo \
+ proclist.lo procstate.lo procuid.lo proctime.lo procmem.lo \
diff --git a/devel/libgtop2/files/patch-sysdeps_freebsd_fsusage.c b/devel/libgtop2/files/patch-sysdeps_freebsd_fsusage.c
new file mode 100644
index 000000000..128eda35b
--- /dev/null
+++ b/devel/libgtop2/files/patch-sysdeps_freebsd_fsusage.c
@@ -0,0 +1,123 @@
+--- sysdeps/freebsd/fsusage.c.orig Mon Feb 28 03:54:41 2005
++++ sysdeps/freebsd/fsusage.c Tue May 24 01:49:42 2005
+@@ -9,6 +9,12 @@
+ #include <unistd.h>
+ #include <sys/param.h>
+ #include <sys/mount.h>
++#if __FreeBSD_version >= 600000
++#include <libgeom.h>
++#include <sys/resource.h>
++#include <devstat.h>
++#include <sys/devicestat.h>
++#endif
+
+ #include <stdio.h>
+ #include <string.h>
+@@ -27,15 +33,107 @@ _glibtop_freebsd_get_fsusage_read_write(
+ {
+ int result;
+ struct statfs sfs;
++#if __FreeBSD_version >= 600000
++ struct devstat *ds;
++ void *sc;
++ struct timespec ts;
++ struct gprovider *gp;
++ struct gident *gid;
++ struct gmesh gmp;
++ double etime;
++ uint64_t ld[2];
++#endif
+
+ result = statfs (path, &sfs);
+
+ if (result == -1) {
++ glibtop_warn_io_r (server, "statfs");
+ return;
+ }
++#if __FreeBSD_version >= 600000
++ ld[0] = 0;
++ ld[1] = 0;
++ result = geom_gettree (&gmp);
++ if (result != 0) {
++ glibtop_warn_io_r (server, "geom_gettree = %d", result);
++ return;
++ }
++
++ result = geom_stats_open ();
++ if (result) {
++ glibtop_warn_io_r (server, "geom_stats_open()");
++ geom_deletetree (&gmp);
++ return;
++ }
++
++ sc = geom_stats_snapshot_get ();
++ if (sc == NULL) {
++ glibtop_warn_io_r (server, "geom_stats_snapshot_get()");
++ geom_stats_close ();
++ geom_deletetree (&gmp);
++ return;
++ }
++
++ geom_stats_snapshot_timestamp (sc, &ts);
++ etime = ts.tv_sec + (ts.tv_nsec * 1e-9);
++ geom_stats_snapshot_reset (sc);
++
++ for (;;) {
++ ds = geom_stats_snapshot_next (sc);
++ if (ds == NULL) {
++ break;
++ }
++ if (ds->id == NULL) {
++ continue;
++ }
++
++ gid = geom_lookupid (&gmp, ds->id);
++ if (gid == NULL) {
++ geom_deletetree (&gmp);
++ result = geom_gettree (&gmp);
++ gid = geom_lookupid (&gmp, ds->id);
++ }
++
++ if (gid == NULL) {
++ continue;
++ }
++ if (gid->lg_what == ISCONSUMER) {
++ continue;
++ }
++
++ gp = gid->lg_ptr;
++
++ if (!g_str_has_suffix (sfs.f_mntfromname, gp->lg_name)) {
++ continue;
++ }
++ else {
++ result = devstat_compute_statistics (ds, NULL, etime,
++ DSM_TOTAL_TRANSFERS_READ,
++ &ld[0],
++ DSM_TOTAL_TRANSFERS_WRITE,
++ &ld[1], DSM_NONE);
++ if (result != 0) {
++ glibtop_warn_io_r (server,
++ "devstat_compute_statistics()");
++ geom_stats_snapshot_free (sc);
++ geom_stats_close ();
++ geom_deletetree (&gmp);
++ return;
++ }
++ break;
++ }
++ }
+
++ geom_stats_snapshot_free (sc);
++ geom_stats_close ();
++ geom_deletetree (&gmp);
++
++ buf->read = ld[0];
++ buf->write = ld[1];
++#else
+ buf->read = sfs.f_syncreads + sfs.f_asyncreads;
+ buf->write = sfs.f_syncwrites + sfs.f_asyncwrites;
++#endif
+
+ buf->flags |= (1 << GLIBTOP_FSUSAGE_READ) | (1 << GLIBTOP_FSUSAGE_WRITE);
+ }
diff --git a/devel/libgtop2/files/pkg-message b/devel/libgtop2/files/pkg-message
new file mode 100644
index 000000000..dacaf62a9
--- /dev/null
+++ b/devel/libgtop2/files/pkg-message
@@ -0,0 +1,13 @@
+===============================================================================
+
+In order to use the File System read/write monitor, you must chmod
+/dev/devstat so that all users can open it read-only. For example:
+
+# chmod 0444 /dev/devstat
+
+In order for this to persist across reboots, add the following to
+/etc/devfs.conf:
+
+perm devstat 0444
+
+===============================================================================