|
From: <bre...@us...> - 2008-10-08 11:41:24
|
Revision: 1266
http://conky.svn.sourceforge.net/conky/?rev=1266&view=rev
Author: brenden1
Date: 2008-10-08 11:41:16 +0000 (Wed, 08 Oct 2008)
Log Message:
-----------
* Applied OpenBSD patches
Modified Paths:
--------------
trunk/conky1/ChangeLog
trunk/conky1/src/fs.c
trunk/conky1/src/openbsd.c
trunk/conky1/src/openbsd.h
Modified: trunk/conky1/ChangeLog
===================================================================
--- trunk/conky1/ChangeLog 2008-10-01 18:16:16 UTC (rev 1265)
+++ trunk/conky1/ChangeLog 2008-10-08 11:41:16 UTC (rev 1266)
@@ -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)
Modified: trunk/conky1/src/fs.c
===================================================================
--- trunk/conky1/src/fs.c 2008-10-01 18:16:16 UTC (rev 1265)
+++ trunk/conky1/src/fs.c 2008-10-08 11:41:16 UTC (rev 1266)
@@ -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 @@
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) {
Modified: trunk/conky1/src/openbsd.c
===================================================================
--- trunk/conky1/src/openbsd.c 2008-10-01 18:16:16 UTC (rev 1265)
+++ trunk/conky1/src/openbsd.c 2008-10-08 11:41:16 UTC (rev 1266)
@@ -598,6 +598,7 @@
void update_top()
{
+ kvm_init();
proc_find_top(info.cpu, info.memu);
}
@@ -654,6 +655,10 @@
}
#endif
+void clear_diskio_stats()
+{
+}
+
void update_diskio()
{
return; /* XXX: implement? hifi: not sure how */
@@ -695,18 +700,22 @@
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 @@
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++;
}
}
Modified: trunk/conky1/src/openbsd.h
===================================================================
--- trunk/conky1/src/openbsd.h 2008-10-01 18:16:16 UTC (rev 1265)
+++ trunk/conky1/src/openbsd.h 2008-10-08 11:41:16 UTC (rev 1266)
@@ -12,6 +12,32 @@
#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];
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|