aboutsummaryrefslogtreecommitdiffstats
path: root/sysutils/xsysinfo
diff options
context:
space:
mode:
authorosa <osa@FreeBSD.org>2003-11-04 20:13:53 +0800
committerosa <osa@FreeBSD.org>2003-11-04 20:13:53 +0800
commit35f4814e2ed9584a5729fdae098868f18da03304 (patch)
treeb085a298432e010e1ece8296d05fc74cb4d48ad4 /sysutils/xsysinfo
parent31a7a52d02a20d719d442defb47d1a0ad356418c (diff)
downloadfreebsd-ports-gnome-35f4814e2ed9584a5729fdae098868f18da03304.tar.gz
freebsd-ports-gnome-35f4814e2ed9584a5729fdae098868f18da03304.tar.zst
freebsd-ports-gnome-35f4814e2ed9584a5729fdae098868f18da03304.zip
Fix broken on 5.1 (about nfs include path).
Submitted by: Cheng-Lung Sung <clsung@dragon2.net> Approved by: maintainer (timeout) PR: 58591
Diffstat (limited to 'sysutils/xsysinfo')
-rw-r--r--sysutils/xsysinfo/Makefile8
-rw-r--r--sysutils/xsysinfo/files/patch-ae29
-rw-r--r--sysutils/xsysinfo/files/patch-af68
-rw-r--r--sysutils/xsysinfo/files/patch-ag12
-rw-r--r--sysutils/xsysinfo/files/patch-sysinfo.c300
5 files changed, 301 insertions, 116 deletions
diff --git a/sysutils/xsysinfo/Makefile b/sysutils/xsysinfo/Makefile
index 42a278796cf7..5cc436c182e4 100644
--- a/sysutils/xsysinfo/Makefile
+++ b/sysutils/xsysinfo/Makefile
@@ -17,12 +17,6 @@ USE_IMAKE= yes
MANCOMPRESSED= yes
MAN1= xsysinfo.1
-.include <bsd.port.pre.mk>
-
-.if ${OSVERSION} >= 500113
-BROKEN= "Does not compile"
-.endif
-
pre-configure:
if [ -e /usr/lib/libdevstat.a -o -e /usr/lib/aout/libdevstat.a ]; then \
cd ${WRKSRC} ; \
@@ -31,4 +25,4 @@ pre-configure:
${SED} -e "s:-lkvm:-lkvm -ldevstat:" Imakefile.i1 > Imakefile ; \
fi
-.include <bsd.port.post.mk>
+.include <bsd.port.mk>
diff --git a/sysutils/xsysinfo/files/patch-ae b/sysutils/xsysinfo/files/patch-ae
deleted file mode 100644
index 71c85cd4501b..000000000000
--- a/sysutils/xsysinfo/files/patch-ae
+++ /dev/null
@@ -1,29 +0,0 @@
---- sysinfo.c.orig Tue Oct 6 16:21:18 1998
-+++ sysinfo.c Tue Oct 13 09:47:49 1998
-@@ -238,6 +238,9 @@
- int pkt_in_out;
- int total_xfers=0;
- int mib[3], size;
-+#if (__FreeBSD_version >= 300004)
-+ struct vfsconf vfc;
-+#endif
-
- /* NPROCS=0, CPU */
- if (cpuflag) {
-@@ -361,10 +364,13 @@
- #else
- mib[0] = CTL_VFS;
- #endif
--#if (__FreeBSD_version >= 300003) /* ?? */
-- mib[1] = MNT_EXPORTED;
-+#if (__FreeBSD_version >= 300004)
-+ if (getvfsbyname("nfs", &vfc) < 0)
-+ /* no NFS in the kernel */
-+ goto nfs_out;
-+ mib[1] = vfc.vfc_typenum;
- #else
-- mib[1] = MNT_NFS;
-+ mib[1] = MOUNT_NFS;
- #endif
- mib[2] = NFS_NFSSTATS;
- if (sysctl( mib, 3, &nfsstats, &size, NULL, 0) < 0)
diff --git a/sysutils/xsysinfo/files/patch-af b/sysutils/xsysinfo/files/patch-af
deleted file mode 100644
index 7ce0df34ff97..000000000000
--- a/sysutils/xsysinfo/files/patch-af
+++ /dev/null
@@ -1,68 +0,0 @@
---- sysinfo.c.orig Tue Apr 6 22:53:17 1999
-+++ sysinfo.c Tue Apr 6 23:09:37 1999
-@@ -102,6 +102,7 @@
- struct nlist nl[] = {
- #define X_CP_TIME 0
- { "_cp_time" },
-+#if __FreeBSD_version < 400000
- #define VM_SWAPLIST 1
- { "_swaplist" },/* list of free swap areas */
- #define VM_SWDEVT 2
-@@ -129,6 +130,27 @@
- #define X_DKXFER 12
- { "_dk_xfer" },
- #endif
-+#else /* __FreeBSD_version < 400000 */
-+#define VM_DMMAX 1
-+ { "_dmmax" }, /* maximum size of a swap block */
-+#define V_MOUNTLIST 2
-+ { "_mountlist" }, /* address of head of mount list. */
-+#define V_NUMV 3
-+ { "_numvnodes" },
-+#define FNL_NFILE 4
-+ {"_nfiles"},
-+#define FNL_MAXFILE 5
-+ {"_maxfiles"},
-+#define NLMANDATORY FNL_MAXFILE /* names up to here are mandatory */
-+#define X_CNT 6
-+ { "_cnt" }, /* struct vmmeter cnt */
-+#define N_IFNET 7
-+ { "_ifnet" },
-+#ifndef HAVE_DEVSTAT
-+#define X_DKXFER 8
-+ { "_dk_xfer" },
-+#endif
-+#endif /* __FreeBSD_version < 400000 */
- { "" },
- };
-
-@@ -444,6 +466,21 @@
- void
- swapmode(int *used, int *avail)
- {
-+#if __FreeBSD_version >= 400000
-+ /* based on swapmode from /usr/src/usr.bin/top/machine.c */
-+ int n;
-+ struct kvm_swap swapary[1];
-+
-+ n = kvm_getswapinfo(kd, swapary, 1, 0);
-+ if (n < 0) {
-+ *avail = *used = 0;
-+ return;
-+ }
-+
-+ *avail = swapary[0].ksw_total - swapary[0].ksw_used;
-+ *used = swapary[0].ksw_used;
-+ return;
-+#else
- char *header;
- int hlen, nswap, nswdev, dmmax;
- int i, div, nfree, npfree;
-@@ -552,6 +589,7 @@
- *used = *avail - nfree;
- free(sw);
- free(perdev);
-+#endif /* __FreeBSD_version >= 400000 */
- }
-
- /*
diff --git a/sysutils/xsysinfo/files/patch-ag b/sysutils/xsysinfo/files/patch-ag
deleted file mode 100644
index f9d9b94c3151..000000000000
--- a/sysutils/xsysinfo/files/patch-ag
+++ /dev/null
@@ -1,12 +0,0 @@
---- sysinfo.c.orig Thu Sep 9 20:54:08 1999
-+++ sysinfo.c Thu Sep 9 20:54:25 1999
-@@ -13,7 +13,9 @@
- #include <sys/ioctl_compat.h> /* XXX NTTYDISC is too well hidden */
- #include <sys/tty.h>
- #include <sys/conf.h>
-+#if __FreeBSD_version < 400000
- #include <sys/rlist.h>
-+#endif
- #include <sys/sysctl.h>
- #include <sys/socket.h>
- #include <err.h>
diff --git a/sysutils/xsysinfo/files/patch-sysinfo.c b/sysutils/xsysinfo/files/patch-sysinfo.c
new file mode 100644
index 000000000000..57e4d56cc592
--- /dev/null
+++ b/sysutils/xsysinfo/files/patch-sysinfo.c
@@ -0,0 +1,300 @@
+--- sysinfo.c.orig Tue Oct 6 22:21:18 1998
++++ sysinfo.c Mon Oct 27 15:28:22 2003
+@@ -13,7 +13,9 @@
+ #include <sys/ioctl_compat.h> /* XXX NTTYDISC is too well hidden */
+ #include <sys/tty.h>
+ #include <sys/conf.h>
++#if __FreeBSD_version < 400000
+ #include <sys/rlist.h>
++#endif
+ #include <sys/sysctl.h>
+ #include <sys/socket.h>
+ #include <err.h>
+@@ -34,8 +36,14 @@
+ #include <sys/time.h>
+ #include <sys/mount.h>
+ #include <nfs/rpcv2.h>
++#if __FreeBSD_version >= 500000
++#include <nfs/nfsproto.h>
++#include <nfsclient/nfs.h>
++#include <nfsserver/nfsrvstats.h>
++#else
+ #include <nfs/nfsv2.h>
+ #include <nfs/nfs.h>
++#endif
+ #include <osreldate.h>
+ #include <fcntl.h>
+
+@@ -95,6 +103,9 @@
+ #endif /* HAVE_DEVSTAT */
+
+ static struct nfsstats nfsstats;
++#if __FreeBSD_version >= 500000
++static struct nfsrvstats nfsrvstats;
++#endif
+ static struct _nfsStats {
+ int nfsServer, nfsClient;
+ } nfsStats, old_nfsStats;
+@@ -102,6 +113,7 @@
+ struct nlist nl[] = {
+ #define X_CP_TIME 0
+ { "_cp_time" },
++#if __FreeBSD_version < 400000
+ #define VM_SWAPLIST 1
+ { "_swaplist" },/* list of free swap areas */
+ #define VM_SWDEVT 2
+@@ -129,6 +141,27 @@
+ #define X_DKXFER 12
+ { "_dk_xfer" },
+ #endif
++#else /* __FreeBSD_version < 400000 */
++#define VM_DMMAX 1
++ { "_dmmax" }, /* maximum size of a swap block */
++#define V_MOUNTLIST 2
++ { "_mountlist" }, /* address of head of mount list. */
++#define V_NUMV 3
++ { "_numvnodes" },
++#define FNL_NFILE 4
++ {"_nfiles"},
++#define FNL_MAXFILE 5
++ {"_maxfiles"},
++#define NLMANDATORY FNL_MAXFILE /* names up to here are mandatory */
++#define X_CNT 6
++ { "_cnt" }, /* struct vmmeter cnt */
++#define N_IFNET 7
++ { "_ifnet" },
++#ifndef HAVE_DEVSTAT
++#define X_DKXFER 8
++ { "_dk_xfer" },
++#endif
++#endif /* __FreeBSD_version < 400000 */
+ { "" },
+ };
+
+@@ -238,6 +271,14 @@
+ int pkt_in_out;
+ int total_xfers=0;
+ int mib[3], size;
++#if __FreeBSD_version >= 500000
++ int rvsize;
++ struct xvfsconf vfc;
++#else
++#if (__FreeBSD_version >= 300004)
++ struct vfsconf vfc;
++#endif
++#endif // #if __FreeBSD_version >= 500000
+
+ /* NPROCS=0, CPU */
+ if (cpuflag) {
+@@ -356,19 +397,30 @@
+ for (i=0; i<10; i++)
+ states[i] = 0;
+ size = sizeof(nfsstats);
++#if __FreeBSD_version >= 500000
++ rvsize = sizeof(nfsrvstats);
++#endif
+ #if (__FreeBSD_version < 199512)
+ mib[0] = CTL_FS;
+ #else
+ mib[0] = CTL_VFS;
+ #endif
+-#if (__FreeBSD_version >= 300003) /* ?? */
+- mib[1] = MNT_EXPORTED;
++#if (__FreeBSD_version >= 300004)
++ if (getvfsbyname("nfs", &vfc) < 0)
++ /* no NFS in the kernel */
++ goto nfs_out;
++ mib[1] = vfc.vfc_typenum;
+ #else
+- mib[1] = MNT_NFS;
++ mib[1] = MOUNT_NFS;
+ #endif
+ mib[2] = NFS_NFSSTATS;
++#if __FreeBSD_version >= 500000
++ if (sysctl( mib, 3, &nfsstats, &size, NULL, 0) < 0 || sysctl( mib, 3, &nfsrvstats, &rvsize, NULL, 0) < 0)
++ return;
++#else
+ if (sysctl( mib, 3, &nfsstats, &size, NULL, 0) < 0)
+ goto nfs_out;
++#endif
+ else {
+ old_nfsStats = nfsStats;
+
+@@ -395,6 +447,22 @@
+ #else
+ nfsstats.rpccnt[NFSPROC_READDIR];
+ #endif
++#if __FreeBSD_version >= 500000
++ nfsStats.nfsServer = nfsrvstats.srvrpccnt[NFSPROC_GETATTR] +
++ nfsrvstats.srvrpccnt[NFSPROC_SETATTR] +
++ nfsrvstats.srvrpccnt[NFSPROC_LOOKUP] +
++ nfsrvstats.srvrpccnt[NFSPROC_READLINK] +
++ nfsrvstats.srvrpccnt[NFSPROC_READ] +
++ nfsrvstats.srvrpccnt[NFSPROC_WRITE] +
++ nfsrvstats.srvrpccnt[NFSPROC_CREATE] +
++ nfsrvstats.srvrpccnt[NFSPROC_REMOVE] +
++ nfsrvstats.srvrpccnt[NFSPROC_RENAME] +
++ nfsrvstats.srvrpccnt[NFSPROC_LINK] +
++ nfsrvstats.srvrpccnt[NFSPROC_SYMLINK] +
++ nfsrvstats.srvrpccnt[NFSPROC_MKDIR] +
++ nfsrvstats.srvrpccnt[NFSPROC_RMDIR] +
++ nfsrvstats.srvrpccnt[NFSPROC_READDIR];
++#else
+ nfsStats.nfsServer = nfsstats.srvrpccnt[NFSPROC_GETATTR] +
+ nfsstats.srvrpccnt[NFSPROC_SETATTR] +
+ nfsstats.srvrpccnt[NFSPROC_LOOKUP] +
+@@ -418,6 +486,7 @@
+ #else
+ nfsstats.srvrpccnt[NFSPROC_READDIR];
+ #endif
++#endif // #if __FreeBSD_version >= 500000
+ }
+ scale_bar(250, nfsStats.nfsClient-old_nfsStats.nfsClient, 25, states, 0);
+ draw_bar(nfsflag-1, states, 10);
+@@ -438,6 +507,21 @@
+ void
+ swapmode(int *used, int *avail)
+ {
++#if __FreeBSD_version >= 400000
++ /* based on swapmode from /usr/src/usr.bin/top/machine.c */
++ int n;
++ struct kvm_swap swapary[1];
++
++ n = kvm_getswapinfo(kd, swapary, 1, 0);
++ if (n < 0) {
++ *avail = *used = 0;
++ return;
++ }
++
++ *avail = swapary[0].ksw_total - swapary[0].ksw_used;
++ *used = swapary[0].ksw_used;
++ return;
++#else
+ char *header;
+ int hlen, nswap, nswdev, dmmax;
+ int i, div, nfree, npfree;
+@@ -546,6 +630,7 @@
+ *used = *avail - nfree;
+ free(sw);
+ free(perdev);
++#endif /* __FreeBSD_version >= 400000 */
+ }
+
+ /*
+@@ -623,13 +708,21 @@
+ * Make sure that the userland devstat version matches the kernel
+ * devstat version.
+ */
++#if __FreeBSD_version >= 500000
++ if (devstat_checkversion(kd) < 0) {
++#else
+ if (checkversion() < 0) {
++#endif
+ nodisk++;
+ return;
+ }
+
+ /* find out how many devices we have */
++#if __FreeBSD_version >= 500000
++ if ((num_devices = devstat_getnumdevs(kd)) < 0) {
++#else
+ if ((num_devices = getnumdevs()) < 0) {
++#endif
+ nodisk++;
+ return;
+ }
+@@ -644,7 +737,11 @@
+ * changed here, since it almost certainly has. We only look for
+ * errors.
+ */
++#if __FreeBSD_version >= 500000
++ if (devstat_getdevs(kd,&cur) == -1) {
++#else
+ if (getdevs(&cur) == -1) {
++#endif
+ nodisk++;
+ return;
+ }
+@@ -656,7 +753,11 @@
+
+ /* only interested in disks */
+ matches = NULL;
++#if __FreeBSD_version >= 500000
++ if (devstat_buildmatch("da", &matches, &num_matches) != 0) {
++#else
+ if (buildmatch("da", &matches, &num_matches) != 0) {
++#endif
+ nodisk++;
+ return;
+ }
+@@ -671,7 +772,11 @@
+ * device list has changed, so we don't look for return values of 0
+ * or 1. If we get back -1, though, there is an error.
+ */
++#if __FreeBSD_version >= 500000
++ if (devstat_selectdevs(&dev_select, &num_selected,
++#else
+ if (selectdevs(&dev_select, &num_selected,
++#endif
+ &num_selections, &select_generation,
+ generation, cur.dinfo->devices, num_devices,
+ matches, num_matches,
+@@ -697,7 +802,11 @@
+ * the selection process again, in case a device that we
+ * were previously displaying has gone away.
+ */
++#if __FreeBSD_version >= 500000
++ switch (devstat_getdevs(kd,&cur)) {
++#else
+ switch (getdevs(&cur)) {
++#endif
+ case -1:
+ return (0);
+ case 1: {
+@@ -705,7 +814,11 @@
+
+ num_devices = cur.dinfo->numdevs;
+ generation = cur.dinfo->generation;
++#if __FreeBSD_version >= 500000
++ retval = devstat_selectdevs(&dev_select, &num_selected,
++#else
+ retval = selectdevs(&dev_select, &num_selected,
++#endif
+ &num_selections, &select_generation,
+ generation, cur.dinfo->devices,
+ num_devices, matches, num_matches,
+@@ -729,14 +842,22 @@
+ * Calculate elapsed time up front, since it's the same for all
+ * devices.
+ */
++#if __FreeBSD_version >= 500000
++ busy_seconds = cur.snap_time - last.snap_time;
++#else
+ busy_seconds = compute_etime(cur.busy_time, last.busy_time);
++#endif
+
+ /* this is the first time thru so just copy cur to last */
+ if (last.dinfo->numdevs == 0) {
+ tmp_dinfo = last.dinfo;
+ last.dinfo = cur.dinfo;
+ cur.dinfo = tmp_dinfo;
++#if __FreeBSD_version >= 500000
++ last.snap_time = cur.snap_time;
++#else
+ last.busy_time = cur.busy_time;
++#endif
+ return (0);
+ }
+
+@@ -764,7 +885,11 @@
+ last.dinfo = cur.dinfo;
+ cur.dinfo = tmp_dinfo;
+
++#if __FreeBSD_version >= 500000
++ last.snap_time = cur.snap_time;
++#else
+ last.busy_time = cur.busy_time;
++#endif
+
+ } else
+ /* no disks found ? */