pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/33772: sysutils/xfce4-diskperf-plugin failed to compile.



>Number:         33772
>Category:       pkg
>Synopsis:       sysutils/xfce4-diskperf-plugin failed to compile.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jun 20 06:25:00 +0000 2006
>Originator:     Kibum Han
>Release:        NetBSD 3.99.21
>Organization:
n/a
>Environment:
NetBSD 3.99.21 (YUIKERNEL) #0: Sun Jun 18 14:10:52 KST 2006  
root@caspar:/usr/obj/sys/arch/amd64/compile/YUIKERNEL
>Description:
yet another disk_sysctl issue.
Since disk_sysctl was replaced by io_sysctl, xfce4-diskperf-plugin failed to 
compile.

>How-To-Repeat:
In the newest io_sysctl environment,

$ cd sysutils/xfce4-diskperf-plugin
$ make

>Fix:
This patch was inspired by 
http://mail-index.netbsd.org/pkgsrc-bugs/2006/05/23/0024.html

-- cut here --
$NetBSD$

--- panel-plugin/devperf.c.orig 2003-11-30 19:58:54.000000000 +0900
+++ panel-plugin/devperf.c
@@ -264,21 +264,39 @@ int DevGetPerfData (const void *p_pvDevi
        const char     *device = (const char *) p_pvDevice;
        struct timeval tv;
        size_t size, i, ndrives;
+#ifdef HW_DISKSTATS
        struct disk_sysctl *drives, drive;
+#else
+       struct io_sysctl *drives, drive;
+#endif
        int mib[3];

        mib[0] = CTL_HW;
+#ifdef HW_DISKSTATS
        mib[1] = HW_DISKSTATS;
        mib[2] = sizeof(struct disk_sysctl);
+#else
+       mib[1] = HW_IOSTATS;
+       mib[2] = sizeof(struct io_sysctl);
+#endif
+
        if (sysctl(mib, 3, NULL, &size, NULL, 0) == -1)
                return(-1);
+#ifdef HW_DISKSTATS
        ndrives = size / sizeof(struct disk_sysctl);
+#else
+       ndrives = size / sizeof(struct io_sysctl);
+#endif
        drives = malloc(size);
        if (sysctl(mib, 3, drives, &size, NULL, 0) == -1)
                return(-1);

        for (i = 0; i < ndrives; i++) {
+#ifdef HW_DISKSTATS
                if (strcmp(drives[i].dk_name, device) == 0) {
+#else
+               if (strcmp(drives[i].name, device) == 0) {
+#endif
                        drive = drives[i];
                        break;
                }
@@ -292,13 +310,18 @@ int DevGetPerfData (const void *p_pvDevi
        gettimeofday (&tv, 0);
        perf->timestamp_ns = (uint64_t)1000ull * 1000ull * 1000ull *
                tv.tv_sec + 1000ull * tv.tv_usec;
-#if defined(__NetBSD_Version__) && (__NetBSD_Version__ < 106110000)
+#ifdef HW_DISKSTATS
+# if defined(__NetBSD_Version__) && (__NetBSD_Version__ < 106110000)
   /* NetBSD < 1.6K does not have separate read/write statistics. */
        perf->rbytes = drive.dk_bytes;
        perf->wbytes = drive.dk_bytes;
-#else
+# else
        perf->rbytes = drive.dk_rbytes;
        perf->wbytes = drive.dk_wbytes;
+# endif
+#else
+       perf->rbytes = drive.rbytes;
+       perf->wbytes = drive.wbytes;
 #endif

   /*
@@ -306,10 +329,18 @@ int DevGetPerfData (const void *p_pvDevi
    * time separatly.
    *                                              -- Benedikt
    */
+#ifdef HW_DISKSTATS
   perf->qlen = drive.dk_xfer;
        perf->rbusy_ns = ((uint64_t)1000ull * 1000ull * 1000ull * 
drive.dk_time_sec
     + 1000ull * drive.dk_time_usec) / 2ull;
   perf->wbusy_ns = perf->rbusy_ns;
+#else
+  perf->qlen = drive.xfer;
+       perf->rbusy_ns = ((uint64_t)1000ull * 1000ull * 1000ull * drive.time_sec
+    + 1000ull * drive.time_usec) / 2ull;
+  perf->wbusy_ns = perf->rbusy_ns;
+
+#endif

        return(0);
 }
-- cut here --

or you can wget "http://yui.pe.kr/distfiles/x-d-p_patch-aa";.




Home | Main Index | Thread Index | Old Index