1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-05 21:07:52 +00:00

* Applied OpenBSD patches

git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@1266 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
Brenden Matthews 2008-10-08 11:41:16 +00:00
parent 06954506f1
commit 1ab4b8ec51
4 changed files with 47 additions and 9 deletions

View File

@ -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)

View File

@ -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) {

View 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++;
}
}

View File

@ -10,6 +10,32 @@ 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];
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;