FreeBSD Bugzilla – Attachment 36593 Details for
Bug 58591
Fix broken on sysutils/xsysinfo
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 12.12 KB, created by
Cheng-Lung Sung
on 2003-10-27 07:40:16 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
Cheng-Lung Sung
Created:
2003-10-27 07:40:16 UTC
Size:
12.12 KB
patch
obsolete
>diff -ruN /usr/ports/sysutils/xsysinfo/Makefile ./xsysinfo/Makefile >--- /usr/ports/sysutils/xsysinfo/Makefile Tue Sep 9 21:01:24 2003 >+++ ./xsysinfo/Makefile Mon Oct 27 15:29:43 2003 >@@ -19,10 +19,6 @@ > > .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} ; \ >diff -ruN /usr/ports/sysutils/xsysinfo/files/patch-ae ./xsysinfo/files/patch-ae >--- /usr/ports/sysutils/xsysinfo/files/patch-ae Wed Oct 14 07:52:47 1998 >+++ ./xsysinfo/files/patch-ae Thu Jan 1 08:00:00 1970 >@@ -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 -ruN /usr/ports/sysutils/xsysinfo/files/patch-af ./xsysinfo/files/patch-af >--- /usr/ports/sysutils/xsysinfo/files/patch-af Thu Apr 8 03:23:33 1999 >+++ ./xsysinfo/files/patch-af Thu Jan 1 08:00:00 1970 >@@ -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 -ruN /usr/ports/sysutils/xsysinfo/files/patch-ag ./xsysinfo/files/patch-ag >--- /usr/ports/sysutils/xsysinfo/files/patch-ag Fri Sep 10 11:56:36 1999 >+++ ./xsysinfo/files/patch-ag Thu Jan 1 08:00:00 1970 >@@ -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 -ruN /usr/ports/sysutils/xsysinfo/files/patch-sysinfo.c ./xsysinfo/files/patch-sysinfo.c >--- /usr/ports/sysutils/xsysinfo/files/patch-sysinfo.c Thu Jan 1 08:00:00 1970 >+++ ./xsysinfo/files/patch-sysinfo.c Mon Oct 27 15:28:34 2003 >@@ -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 ? */
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 58591
: 36593