* Applied OpenBSD patches
authorBrenden Matthews <brenden1@rty.ca>
Wed, 8 Oct 2008 11:41:16 +0000 (11:41 +0000)
committerBrenden Matthews <brenden1@rty.ca>
Wed, 8 Oct 2008 11:41:16 +0000 (11:41 +0000)
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@1266 7f574dfc-610e-0410-a909-a81674777703

ChangeLog
src/fs.c
src/openbsd.c
src/openbsd.h

index 2335773..8e4c00b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 # $Id$
 
+2008-10-08
+       * Applied OpenBSD patches
+
 2008-09-24
        * Introduced (buggy) support for IMAP IDLE
        * Added support for MOC (the console audio player) (thanks henux)
index 53a3c5e..1d567b5 100644 (file)
--- a/src/fs.c
+++ b/src/fs.c
@@ -44,7 +44,7 @@
 #include <sys/mount.h>
 #endif
 
-#if !defined(HAVE_STRUCT_STATFS_F_FSTYPENAME) && !defined(__FreeBSD__)
+#if !defined(HAVE_STRUCT_STATFS_F_FSTYPENAME) && !defined (__OpenBSD__) && !defined(__FreeBSD__)
 #include <mntent.h>
 #endif
 
@@ -124,7 +124,7 @@ static void update_fs_stat(struct fs_stat *fs)
 void get_fs_type(const char *path, char *result)
 {
 
-#if defined(HAVE_STRUCT_STATFS_F_FSTYPENAME) || defined(__FreeBSD__)
+#if defined(HAVE_STRUCT_STATFS_F_FSTYPENAME) || defined(__FreeBSD__) || defined (__OpenBSD__)
 
        struct statfs s;
        if (statfs(path, &s) == 0) {
index 524ebd7..d81e2e1 100644 (file)
@@ -598,6 +598,7 @@ char get_freq(char *p_client_buffer, size_t client_buffer_size,
 
 void update_top()
 {
+       kvm_init();
        proc_find_top(info.cpu, info.memu);
 }
 
@@ -654,6 +655,10 @@ cleanup:
 }
 #endif
 
+void clear_diskio_stats()
+{
+}
+
 void update_diskio()
 {
        return; /* XXX: implement? hifi: not sure how */
@@ -695,18 +700,22 @@ inline void proc_find_top(struct process **cpu, struct process **mem)
        struct process *processes;
        int mib[2];
 
-       int total_pages;
+       u_int total_pages;
+       int64_t usermem;
        int pagesize = getpagesize();
 
        /* we get total pages count again to be sure it is up to date */
        mib[0] = CTL_HW;
-       mib[1] = HW_USERMEM;
-       size_t size = sizeof(total_pages);
+       mib[1] = HW_USERMEM64;
+       size_t size = sizeof(usermem);
 
-       if (sysctl(mib, 2, &total_pages, &size, NULL, 0) == -1) {
-               ERR("error reading nmempages");
+       if (sysctl(mib, 2, &usermem, &size, NULL, 0) == -1) {
+               ERR("error reading usermem");
        }
 
+       /* translate bytes into page count */
+       total_pages = usermem / pagesize;
+
        int max_size = sizeof(struct kinfo_proc2);
 
        p = kvm_getproc2(kd, KERN_PROC_ALL, 0, max_size, &n_processes);
@@ -717,8 +726,8 @@ inline void proc_find_top(struct process **cpu, struct process **mem)
                        processes[j].pid = p[i].p_pid;
                        processes[j].name = strndup(p[i].p_comm, text_buffer_size);
                        processes[j].amount = 100.0 * p[i].p_pctcpu / FSCALE;
-                       processes[j].totalmem = (float) (p[i].p_vm_rssize * pagesize /
-                               (float) total_pages) * 100.0;
+                       processes[j].totalmem = (float) (p[i].p_vm_rssize /
+                                       (float) total_pages) * 100.0;
                        j++;
                }
        }
index 131fe26..273bc75 100644 (file)
@@ -12,6 +12,32 @@ void get_obsd_product(char *buf, size_t client_buffer_size);
 
 #define OBSD_MAX_SENSORS 256
 struct obsd_sensors_struct {
+       int device;
+       float temp[MAXSENSORDEVICES][OBSD_MAX_SENSORS];
+       unsigned int fan[MAXSENSORDEVICES][OBSD_MAX_SENSORS];
+       float volt[MAXSENSORDEVICES][OBSD_MAX_SENSORS];
+};
+struct obsd_sensors_struct obsd_sensors;
+
+#if defined(i386) || defined(__i386__)
+typedef struct apm_power_info *apm_info_t;
+#endif
+
+#endif /*OPENBSD_H_*/
+#ifndef OPENBSD_H_
+#define OPENBSD_H_
+
+#include "common.h"
+#include <sys/sysctl.h>
+#include <sys/sensors.h>
+#include <machine/apmvar.h>
+
+void update_obsd_sensors(void);
+void get_obsd_vendor(char *buf, size_t client_buffer_size);
+void get_obsd_product(char *buf, size_t client_buffer_size);
+
+#define OBSD_MAX_SENSORS 256
+struct obsd_sensors_struct {
        int device;
        float temp[MAXSENSORDEVICES][OBSD_MAX_SENSORS];
        unsigned int fan[MAXSENSORDEVICES][OBSD_MAX_SENSORS];