2005-08-05 01:06:17 +00:00
|
|
|
/*
|
|
|
|
* Conky, a system monitor, based on torsmo
|
|
|
|
*
|
|
|
|
* This program is licensed under BSD license, read COPYING
|
|
|
|
*
|
|
|
|
* $Id$
|
|
|
|
*/
|
|
|
|
|
2005-07-20 00:30:40 +00:00
|
|
|
#ifndef _conky_h_
|
|
|
|
#define _conky_h_
|
|
|
|
|
2006-01-05 07:06:42 +00:00
|
|
|
#include <pthread.h>
|
2005-08-23 06:10:25 +00:00
|
|
|
#if defined(HAS_MCHECK_H)
|
2005-08-12 04:34:06 +00:00
|
|
|
#include <mcheck.h>
|
2005-08-23 06:10:25 +00:00
|
|
|
#endif /* HAS_MCHECK_H */
|
2005-07-20 00:30:40 +00:00
|
|
|
#include "config.h"
|
|
|
|
#include <sys/utsname.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
2006-11-12 06:38:21 +00:00
|
|
|
#include <string.h>
|
2005-07-24 23:08:51 +00:00
|
|
|
#include <locale.h>
|
|
|
|
#include <langinfo.h>
|
|
|
|
#include <wchar.h>
|
2005-10-16 11:53:36 +00:00
|
|
|
#include <sys/param.h>
|
2005-12-31 17:22:03 +00:00
|
|
|
#if defined(__FreeBSD__)
|
2005-10-16 11:53:36 +00:00
|
|
|
#include <sys/mount.h>
|
|
|
|
#include <sys/ucred.h>
|
2006-03-22 19:27:31 +00:00
|
|
|
#include <fcntl.h>
|
|
|
|
#include <kvm.h>
|
2005-10-16 11:53:36 +00:00
|
|
|
#endif /* __FreeBSD__ */
|
2005-07-20 00:30:40 +00:00
|
|
|
|
2005-09-29 03:22:31 +00:00
|
|
|
#if defined(__FreeBSD__) && (defined(i386) || defined(__i386__))
|
2005-08-30 04:19:16 +00:00
|
|
|
#include <machine/apm_bios.h>
|
|
|
|
#endif /* __FreeBSD__ */
|
|
|
|
|
2006-11-03 20:54:52 +00:00
|
|
|
#ifdef AUDACIOUS
|
|
|
|
#include "audacious.h"
|
|
|
|
#endif
|
|
|
|
|
2006-03-25 21:21:07 +00:00
|
|
|
#ifdef XMMS2
|
|
|
|
#include <xmmsclient/xmmsclient.h>
|
|
|
|
#endif
|
|
|
|
|
2005-07-20 00:30:40 +00:00
|
|
|
#define TOP_CPU 1
|
|
|
|
#define TOP_NAME 2
|
|
|
|
#define TOP_PID 3
|
|
|
|
#define TOP_MEM 4
|
|
|
|
|
2006-02-13 02:28:46 +00:00
|
|
|
#define TEXT_BUFFER_SIZE 1280
|
2005-12-10 21:07:24 +00:00
|
|
|
#define P_MAX_SIZE ((TEXT_BUFFER_SIZE * 4) - 2)
|
2005-07-20 00:30:40 +00:00
|
|
|
|
2006-11-09 00:33:46 +00:00
|
|
|
/* maximum size of config TEXT buffer, i.e. below TEXT line. */
|
|
|
|
#define MAX_USER_TEXT_DEFAULT 16384
|
|
|
|
|
2005-07-20 00:30:40 +00:00
|
|
|
#include <sys/socket.h>
|
|
|
|
|
|
|
|
#define ERR(s, varargs...) \
|
|
|
|
fprintf(stderr, "Conky: " s "\n", ##varargs)
|
|
|
|
|
|
|
|
/* critical error */
|
|
|
|
#define CRIT_ERR(s, varargs...) \
|
|
|
|
{ fprintf(stderr, "Conky: " s "\n", ##varargs); exit(EXIT_FAILURE); }
|
|
|
|
|
2005-08-30 14:59:37 +00:00
|
|
|
struct i8k_struct {
|
2005-08-27 07:15:44 +00:00
|
|
|
char *version;
|
|
|
|
char *bios;
|
|
|
|
char *serial;
|
|
|
|
char *cpu_temp;
|
|
|
|
char *left_fan_status;
|
|
|
|
char *right_fan_status;
|
|
|
|
char *left_fan_rpm;
|
|
|
|
char *right_fan_rpm;
|
|
|
|
char *ac_status;
|
|
|
|
char *buttons_status;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct i8k_struct i8k;
|
|
|
|
|
2005-07-20 00:30:40 +00:00
|
|
|
struct net_stat {
|
|
|
|
const char *dev;
|
|
|
|
int up;
|
|
|
|
long long last_read_recv, last_read_trans;
|
|
|
|
long long recv, trans;
|
|
|
|
double recv_speed, trans_speed;
|
|
|
|
struct sockaddr addr;
|
|
|
|
int linkstatus;
|
|
|
|
double net_rec[15], net_trans[15];
|
|
|
|
};
|
|
|
|
|
2005-08-26 02:52:54 +00:00
|
|
|
unsigned int diskio_value;
|
|
|
|
|
2005-07-20 00:30:40 +00:00
|
|
|
struct fs_stat {
|
|
|
|
char *path;
|
|
|
|
long long size;
|
|
|
|
long long avail;
|
2005-12-01 06:32:14 +00:00
|
|
|
long long free;
|
2005-07-20 00:30:40 +00:00
|
|
|
};
|
|
|
|
|
2006-05-08 22:34:38 +00:00
|
|
|
struct thread_info_s {
|
|
|
|
pthread_t thread;
|
2006-05-14 04:49:55 +00:00
|
|
|
pthread_mutex_t mutex;
|
2006-05-08 22:34:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct mail_s { // for imap and pop3
|
2006-05-13 19:51:26 +00:00
|
|
|
unsigned long unseen;
|
|
|
|
unsigned long messages;
|
|
|
|
unsigned long used;
|
|
|
|
unsigned long quota;
|
|
|
|
unsigned long port;
|
2006-05-08 22:34:38 +00:00
|
|
|
float interval;
|
|
|
|
double last_update;
|
|
|
|
char host[128];
|
|
|
|
char user[128];
|
|
|
|
char pass[128];
|
|
|
|
char command[1024];
|
|
|
|
char folder[128];
|
|
|
|
int pos;
|
|
|
|
struct thread_info_s thread_info;
|
2006-05-13 19:51:26 +00:00
|
|
|
char secure;
|
2006-05-08 22:34:38 +00:00
|
|
|
} mail;
|
|
|
|
|
2005-08-27 09:29:24 +00:00
|
|
|
/*struct cpu_stat {
|
2005-07-20 00:30:40 +00:00
|
|
|
unsigned int user, nice, system, idle, iowait, irq, softirq;
|
|
|
|
int cpu_avg_samples;
|
2005-08-27 09:29:24 +00:00
|
|
|
};*/
|
2005-07-20 00:30:40 +00:00
|
|
|
|
|
|
|
#ifdef MPD
|
|
|
|
struct mpd_s {
|
|
|
|
char *title;
|
|
|
|
char *artist;
|
|
|
|
char *album;
|
|
|
|
char *status;
|
2005-10-11 01:37:46 +00:00
|
|
|
char *random;
|
|
|
|
char *repeat;
|
|
|
|
char *track;
|
2006-01-31 03:32:26 +00:00
|
|
|
char *name;
|
|
|
|
char *file;
|
2005-07-20 00:30:40 +00:00
|
|
|
int volume;
|
|
|
|
unsigned int port;
|
2005-07-24 23:08:51 +00:00
|
|
|
char host[128];
|
2006-01-31 03:32:26 +00:00
|
|
|
char password[128];
|
2005-07-20 00:30:40 +00:00
|
|
|
float progress;
|
|
|
|
int bitrate;
|
2005-07-28 04:48:27 +00:00
|
|
|
int length;
|
|
|
|
int elapsed;
|
2005-07-20 00:30:40 +00:00
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2006-03-25 21:21:07 +00:00
|
|
|
#ifdef XMMS2
|
|
|
|
struct xmms2_s {
|
2006-04-16 03:49:49 +00:00
|
|
|
char* artist;
|
|
|
|
char* album;
|
|
|
|
char* title;
|
|
|
|
char* genre;
|
|
|
|
char* comment;
|
|
|
|
char* decoder;
|
|
|
|
char* transport;
|
|
|
|
char* url;
|
|
|
|
char* date;
|
|
|
|
int tracknr;
|
|
|
|
int bitrate;
|
|
|
|
unsigned int id;
|
|
|
|
int duration;
|
|
|
|
int elapsed;
|
|
|
|
float size;
|
|
|
|
|
|
|
|
float progress;
|
|
|
|
char* status;
|
2006-03-25 21:21:07 +00:00
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2006-11-03 20:54:52 +00:00
|
|
|
#ifdef AUDACIOUS
|
|
|
|
struct audacious_s {
|
|
|
|
audacious_t items; /* e.g. items[AUDACIOUS_STATUS] */
|
|
|
|
pthread_t thread; /* worker thread */
|
|
|
|
pthread_attr_t thread_attr; /* thread attributes */
|
|
|
|
pthread_mutex_t item_mutex; /* mutex for item array */
|
2006-11-14 02:04:27 +00:00
|
|
|
pthread_mutex_t runnable_mutex; /* mutex for runnable */
|
|
|
|
pthread_cond_t runnable_cond; /* cond for runnable */
|
2006-11-03 20:54:52 +00:00
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2005-12-30 09:44:40 +00:00
|
|
|
#ifdef BMPX
|
2006-01-02 03:39:51 +00:00
|
|
|
void update_bmpx();
|
2005-12-30 09:44:40 +00:00
|
|
|
struct bmpx_s {
|
|
|
|
char *title;
|
|
|
|
char *artist;
|
|
|
|
char *album;
|
|
|
|
char *uri;
|
|
|
|
int bitrate;
|
|
|
|
int track;
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2005-10-31 05:17:06 +00:00
|
|
|
#ifdef TCP_PORT_MONITOR
|
|
|
|
#include "libtcp-portmon.h"
|
2005-11-11 03:28:24 +00:00
|
|
|
#define MIN_PORT_MONITORS_DEFAULT 16
|
|
|
|
#define MIN_PORT_MONITOR_CONNECTIONS_DEFAULT 256
|
2005-10-31 05:17:06 +00:00
|
|
|
#endif
|
|
|
|
|
2005-07-20 00:30:40 +00:00
|
|
|
enum {
|
|
|
|
INFO_CPU = 0,
|
|
|
|
INFO_MAIL = 1,
|
|
|
|
INFO_MEM = 2,
|
|
|
|
INFO_NET = 3,
|
2006-11-05 00:23:18 +00:00
|
|
|
INFO_PROCS = 4,
|
|
|
|
INFO_RUN_PROCS = 5,
|
|
|
|
INFO_UPTIME = 6,
|
|
|
|
INFO_BUFFERS = 7,
|
|
|
|
INFO_FS = 8,
|
|
|
|
INFO_I2C = 9,
|
|
|
|
INFO_MIXER = 10,
|
|
|
|
INFO_LOADAVG = 11,
|
|
|
|
INFO_UNAME = 12,
|
|
|
|
INFO_FREQ = 13,
|
2005-07-20 00:30:40 +00:00
|
|
|
#ifdef MPD
|
2006-11-05 00:23:18 +00:00
|
|
|
INFO_MPD = 14,
|
2005-07-20 00:30:40 +00:00
|
|
|
#endif
|
2006-11-05 00:23:18 +00:00
|
|
|
INFO_TOP = 15,
|
|
|
|
INFO_WIFI = 16,
|
|
|
|
INFO_DISKIO = 17,
|
|
|
|
INFO_I8K = 18,
|
2005-10-31 05:17:06 +00:00
|
|
|
#ifdef TCP_PORT_MONITOR
|
2006-11-05 00:23:18 +00:00
|
|
|
INFO_TCP_PORT_MONITOR = 19,
|
2005-10-31 05:17:06 +00:00
|
|
|
#endif
|
2006-11-03 20:54:52 +00:00
|
|
|
#ifdef AUDACIOUS
|
2006-11-05 00:23:18 +00:00
|
|
|
INFO_AUDACIOUS = 20,
|
2006-11-03 20:54:52 +00:00
|
|
|
#endif
|
2006-01-08 08:02:37 +00:00
|
|
|
#ifdef BMPX
|
2006-11-05 00:23:18 +00:00
|
|
|
INFO_BMPX = 21,
|
2006-01-07 07:01:22 +00:00
|
|
|
#endif
|
2006-03-25 21:21:07 +00:00
|
|
|
#ifdef XMMS2
|
2006-11-05 00:23:18 +00:00
|
|
|
INFO_XMMS2 = 22,
|
2006-03-25 21:21:07 +00:00
|
|
|
#endif
|
2005-07-20 00:30:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef MPD
|
|
|
|
#include "libmpdclient.h"
|
|
|
|
#endif
|
|
|
|
|
2005-11-01 06:51:48 +00:00
|
|
|
volatile int g_signal_pending;
|
|
|
|
|
2005-07-20 00:30:40 +00:00
|
|
|
struct information {
|
|
|
|
unsigned int mask;
|
|
|
|
|
|
|
|
struct utsname uname_s;
|
|
|
|
|
|
|
|
char freq[10];
|
|
|
|
|
|
|
|
double uptime;
|
|
|
|
|
|
|
|
/* memory information in kilobytes */
|
2005-10-18 00:54:51 +00:00
|
|
|
unsigned long mem, memmax, swap, swapmax;
|
|
|
|
unsigned long bufmem, buffers, cached;
|
2005-07-20 00:30:40 +00:00
|
|
|
|
2005-11-27 06:56:35 +00:00
|
|
|
unsigned short procs;
|
|
|
|
unsigned short run_procs;
|
2005-07-20 00:30:40 +00:00
|
|
|
|
2005-08-27 09:29:24 +00:00
|
|
|
float *cpu_usage;
|
|
|
|
/* struct cpu_stat cpu_summed; what the hell is this? */
|
2005-07-20 00:30:40 +00:00
|
|
|
unsigned int cpu_count;
|
|
|
|
unsigned int cpu_avg_samples;
|
|
|
|
|
|
|
|
unsigned int net_avg_samples;
|
|
|
|
|
|
|
|
float loadavg[3];
|
|
|
|
|
|
|
|
int new_mail_count, mail_count;
|
2006-05-08 22:34:38 +00:00
|
|
|
struct mail_s* mail;
|
|
|
|
int mail_running;
|
2005-07-20 00:30:40 +00:00
|
|
|
#ifdef MPD
|
|
|
|
struct mpd_s mpd;
|
|
|
|
mpd_Connection *conn;
|
2005-12-30 09:44:40 +00:00
|
|
|
#endif
|
2006-03-25 21:21:07 +00:00
|
|
|
#ifdef XMMS2
|
|
|
|
struct xmms2_s xmms2;
|
|
|
|
int xmms2_conn_state;
|
|
|
|
xmms_socket_t xmms2_fd;
|
|
|
|
fd_set xmms2_fdset;
|
|
|
|
xmmsc_connection_t *xmms2_conn;
|
|
|
|
#endif
|
2006-11-03 20:54:52 +00:00
|
|
|
#ifdef AUDACIOUS
|
|
|
|
struct audacious_s audacious;
|
|
|
|
#endif
|
2005-12-30 09:44:40 +00:00
|
|
|
#ifdef BMPX
|
|
|
|
struct bmpx_s bmpx;
|
2005-07-20 00:30:40 +00:00
|
|
|
#endif
|
2005-07-25 00:22:16 +00:00
|
|
|
struct process *cpu[10];
|
|
|
|
struct process *memu[10];
|
2005-11-10 04:19:43 +00:00
|
|
|
struct process *first_process;
|
2005-07-20 00:30:40 +00:00
|
|
|
unsigned long looped;
|
2005-10-31 05:17:06 +00:00
|
|
|
#ifdef TCP_PORT_MONITOR
|
|
|
|
tcp_port_monitor_collection_t * p_tcp_port_monitor_collection;
|
|
|
|
#endif
|
2005-11-27 06:56:35 +00:00
|
|
|
short kflags; /* kernel settings, see enum KFLAG */
|
2005-07-20 00:30:40 +00:00
|
|
|
};
|
|
|
|
|
2005-11-27 06:56:35 +00:00
|
|
|
enum {
|
|
|
|
KFLAG_IS_LONGSTAT = 0x01, /* set to true if kernel uses "long" format for /proc/stats */
|
|
|
|
KFLAG_PROC_IS_THREADS=0x02 /* set to true if kernel shows # of threads for the proc value in sysinfo() call */
|
|
|
|
/* KFLAG_NEXT_ONE=0x04 bits 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 available for future use */
|
|
|
|
};
|
|
|
|
|
|
|
|
#define KFLAG_SETON(a) info.kflags |= a
|
|
|
|
#define KFLAG_SETOFF(a) info.kflags &= (~a)
|
|
|
|
#define KFLAG_FLIP(a) info.kflags ^= a
|
|
|
|
#define KFLAG_ISSET(a) info.kflags & a
|
|
|
|
|
|
|
|
|
2005-08-08 01:18:52 +00:00
|
|
|
int out_to_console;
|
|
|
|
|
|
|
|
int top_cpu;
|
|
|
|
int top_mem;
|
|
|
|
|
|
|
|
int use_spacer;
|
|
|
|
|
2005-11-25 04:17:54 +00:00
|
|
|
char tmpstring1[TEXT_BUFFER_SIZE];
|
|
|
|
char tmpstring2[TEXT_BUFFER_SIZE];
|
2005-08-02 05:06:53 +00:00
|
|
|
|
2005-08-08 01:18:52 +00:00
|
|
|
#ifdef X11
|
2005-07-20 00:30:40 +00:00
|
|
|
/* in x11.c */
|
|
|
|
|
|
|
|
#include <X11/Xlib.h>
|
|
|
|
#include <X11/Xlib.h>
|
|
|
|
#include <X11/Xatom.h>
|
|
|
|
|
|
|
|
#ifdef XFT
|
|
|
|
#include <X11/Xft/Xft.h>
|
|
|
|
#endif
|
|
|
|
|
2006-11-07 01:19:32 +00:00
|
|
|
#ifdef HAVE_XDBE
|
2005-07-20 00:30:40 +00:00
|
|
|
#include <X11/extensions/Xdbe.h>
|
|
|
|
#endif
|
|
|
|
|
2006-03-07 04:47:30 +00:00
|
|
|
#define ATOM(a) XInternAtom(display, #a, False)
|
2005-07-20 00:30:40 +00:00
|
|
|
|
2006-03-06 23:35:41 +00:00
|
|
|
#ifdef OWN_WINDOW
|
2006-03-08 22:17:27 +00:00
|
|
|
enum _window_type {
|
|
|
|
TYPE_NORMAL = 0,
|
2006-03-09 02:28:38 +00:00
|
|
|
TYPE_DESKTOP,
|
|
|
|
TYPE_OVERRIDE
|
2006-03-08 22:17:27 +00:00
|
|
|
};
|
|
|
|
|
2006-03-06 23:35:41 +00:00
|
|
|
enum _window_hints {
|
|
|
|
HINT_UNDECORATED = 0,
|
|
|
|
HINT_BELOW,
|
|
|
|
HINT_ABOVE,
|
|
|
|
HINT_STICKY,
|
|
|
|
HINT_SKIP_TASKBAR,
|
|
|
|
HINT_SKIP_PAGER
|
|
|
|
};
|
|
|
|
#define SET_HINT(mask,hint) (mask |= (1<<hint))
|
|
|
|
#define TEST_HINT(mask,hint) (mask & (1<<hint))
|
|
|
|
#endif
|
2005-07-20 00:30:40 +00:00
|
|
|
struct conky_window {
|
2006-03-07 19:46:51 +00:00
|
|
|
Window root,window,desktop;
|
2005-07-20 00:30:40 +00:00
|
|
|
Drawable drawable;
|
|
|
|
GC gc;
|
2006-11-07 02:19:58 +00:00
|
|
|
#ifdef HAVE_XDBE
|
2005-07-20 00:30:40 +00:00
|
|
|
XdbeBackBuffer back_buffer;
|
|
|
|
#endif
|
|
|
|
#ifdef XFT
|
|
|
|
XftDraw *xftdraw;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
#ifdef OWN_WINDOW
|
2006-03-06 23:35:41 +00:00
|
|
|
char wm_class_name[256];
|
2005-07-20 00:30:40 +00:00
|
|
|
int x;
|
|
|
|
int y;
|
2006-03-08 22:17:27 +00:00
|
|
|
unsigned int type;
|
2006-03-06 23:35:41 +00:00
|
|
|
unsigned long hints;
|
2005-07-20 00:30:40 +00:00
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
2006-11-07 02:19:58 +00:00
|
|
|
#ifdef HAVE_XDBE
|
2005-07-20 00:30:40 +00:00
|
|
|
extern int use_xdbe;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef XFT
|
|
|
|
extern int use_xft;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
extern Display *display;
|
|
|
|
extern int display_width;
|
|
|
|
extern int display_height;
|
|
|
|
extern int screen;
|
|
|
|
|
|
|
|
extern int workarea[4];
|
|
|
|
|
|
|
|
extern struct conky_window window;
|
|
|
|
|
|
|
|
void init_X11();
|
2006-03-06 05:58:58 +00:00
|
|
|
void init_window(int use_own_window, int width, int height, int set_trans, int back_colour, char * nodename,
|
|
|
|
char **argv, int argc);
|
2005-07-20 00:30:40 +00:00
|
|
|
void create_gc();
|
|
|
|
void set_transparent_background(Window win);
|
|
|
|
long get_x11_color(const char *);
|
|
|
|
|
2005-08-08 01:18:52 +00:00
|
|
|
#endif /* X11 */
|
|
|
|
|
2005-07-20 00:30:40 +00:00
|
|
|
/* in common.c */
|
|
|
|
|
|
|
|
/* struct that has all info */
|
|
|
|
struct information info;
|
|
|
|
|
2005-11-01 06:51:48 +00:00
|
|
|
void signal_handler(int);
|
|
|
|
void reload_config(void);
|
|
|
|
void clean_up(void);
|
|
|
|
|
2005-07-20 00:30:40 +00:00
|
|
|
void update_uname();
|
|
|
|
double get_time(void);
|
|
|
|
FILE *open_file(const char *file, int *reported);
|
|
|
|
void variable_substitute(const char *s, char *dest, unsigned int n);
|
|
|
|
void format_seconds(char *buf, unsigned int n, long t);
|
|
|
|
void format_seconds_short(char *buf, unsigned int n, long t);
|
|
|
|
struct net_stat *get_net_stat(const char *dev);
|
|
|
|
|
|
|
|
void update_stuff();
|
|
|
|
|
2005-08-30 14:59:37 +00:00
|
|
|
int round_to_int(float f);
|
|
|
|
|
2005-07-20 00:30:40 +00:00
|
|
|
#define SET_NEED(a) need_mask |= 1 << (a)
|
2005-07-30 11:23:26 +00:00
|
|
|
extern unsigned long long need_mask;
|
2005-07-20 00:30:40 +00:00
|
|
|
|
|
|
|
extern double current_update_time, last_update_time;
|
|
|
|
|
|
|
|
extern int no_buffers;
|
|
|
|
|
|
|
|
/* system dependant (in linux.c) */
|
|
|
|
|
2005-08-26 02:52:54 +00:00
|
|
|
void update_diskio(void);
|
2005-07-20 00:30:40 +00:00
|
|
|
void prepare_update(void);
|
|
|
|
void update_uptime(void);
|
|
|
|
void update_meminfo(void);
|
|
|
|
void update_net_stats(void);
|
|
|
|
void update_wifi_stats(void);
|
|
|
|
void update_cpu_usage(void);
|
|
|
|
void update_total_processes(void);
|
|
|
|
void update_running_processes(void);
|
2005-08-27 07:15:44 +00:00
|
|
|
void update_i8k(void);
|
2006-10-07 01:42:37 +00:00
|
|
|
char get_freq( char *, size_t, char *, int, unsigned int );
|
|
|
|
void get_freq_dynamic( char *, size_t, char *, int );
|
2006-05-24 00:46:50 +00:00
|
|
|
char get_voltage(char *, size_t, char *, int, unsigned int ); /* ptarjan */
|
2005-07-20 00:30:40 +00:00
|
|
|
void update_load_average();
|
|
|
|
int open_i2c_sensor(const char *dev, const char *type, int n, int *div,
|
|
|
|
char *devtype);
|
|
|
|
double get_i2c_info(int *fd, int arg, char *devtype, char *type);
|
|
|
|
|
2006-10-07 01:42:37 +00:00
|
|
|
void get_adt746x_cpu( char *, size_t );
|
|
|
|
void get_adt746x_fan( char *, size_t );
|
2005-08-26 02:16:35 +00:00
|
|
|
unsigned int get_diskio(void);
|
2005-07-20 00:30:40 +00:00
|
|
|
|
|
|
|
int open_acpi_temperature(const char *name);
|
|
|
|
double get_acpi_temperature(int fd);
|
2006-10-07 01:42:37 +00:00
|
|
|
void get_acpi_ac_adapter( char *, size_t );
|
|
|
|
void get_acpi_fan( char *, size_t );
|
2005-07-20 00:30:40 +00:00
|
|
|
void get_battery_stuff(char *buf, unsigned int n, const char *bat);
|
2006-04-15 18:00:39 +00:00
|
|
|
void get_ibm_acpi_fan(char *buf, size_t client_buffer_size);
|
|
|
|
void get_ibm_acpi_temps(void);
|
|
|
|
void get_ibm_acpi_volume(char *buf, size_t client_buffer_size);
|
|
|
|
void get_ibm_acpi_brightness(char *buf, size_t client_buffer_size);
|
2006-05-22 03:26:44 +00:00
|
|
|
void get_cpu_count();
|
2006-04-15 18:00:39 +00:00
|
|
|
|
|
|
|
struct ibm_acpi_struct {
|
|
|
|
unsigned int temps[8];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ibm_acpi_struct ibm_acpi;
|
2005-07-20 00:30:40 +00:00
|
|
|
|
2006-04-23 21:35:31 +00:00
|
|
|
enum { PB_BATT_STATUS, PB_BATT_PERCENT, PB_BATT_TIME};
|
2006-04-23 21:37:59 +00:00
|
|
|
void get_powerbook_batt_info(char*, size_t, int);
|
2006-04-23 21:35:31 +00:00
|
|
|
|
2005-07-20 00:30:40 +00:00
|
|
|
struct process {
|
|
|
|
struct process *next;
|
|
|
|
struct process *previous;
|
|
|
|
|
|
|
|
pid_t pid;
|
|
|
|
char *name;
|
|
|
|
float amount;
|
2005-11-08 23:03:25 +00:00
|
|
|
unsigned long user_time;
|
|
|
|
unsigned long total;
|
|
|
|
unsigned long kernel_time;
|
|
|
|
unsigned long previous_user_time;
|
|
|
|
unsigned long previous_kernel_time;
|
2005-07-20 00:30:40 +00:00
|
|
|
unsigned int vsize;
|
|
|
|
unsigned int rss;
|
|
|
|
unsigned int time_stamp;
|
|
|
|
unsigned int counted;
|
|
|
|
unsigned int changed;
|
|
|
|
float totalmem;
|
|
|
|
};
|
|
|
|
|
|
|
|
void update_top();
|
2005-11-10 04:19:43 +00:00
|
|
|
void free_all_processes();
|
|
|
|
struct process *get_first_process();
|
2005-07-20 00:30:40 +00:00
|
|
|
|
|
|
|
/* fs-stuff is possibly system dependant (in fs.c) */
|
|
|
|
|
|
|
|
void update_fs_stats(void);
|
|
|
|
struct fs_stat *prepare_fs_stat(const char *path);
|
|
|
|
void clear_fs_stats(void);
|
|
|
|
|
|
|
|
/* in mixer.c */
|
|
|
|
|
|
|
|
int mixer_init(const char *);
|
|
|
|
int mixer_get_avg(int);
|
|
|
|
int mixer_get_left(int);
|
|
|
|
int mixer_get_right(int);
|
|
|
|
|
|
|
|
/* in mail.c */
|
|
|
|
|
|
|
|
extern char *current_mail_spool;
|
|
|
|
|
|
|
|
void update_mail_count();
|
|
|
|
|
2005-08-30 04:19:16 +00:00
|
|
|
/* in freebsd.c */
|
2006-03-22 19:27:31 +00:00
|
|
|
#if defined(__FreeBSD__)
|
|
|
|
kvm_t *kd;
|
|
|
|
#endif
|
|
|
|
|
2005-09-29 03:22:31 +00:00
|
|
|
#if defined(__FreeBSD__) && (defined(i386) || defined(__i386__))
|
2005-08-30 04:19:16 +00:00
|
|
|
int apm_getinfo(int fd, apm_info_t aip);
|
|
|
|
char *get_apm_adapter(void);
|
|
|
|
char *get_apm_battery_life(void);
|
|
|
|
char *get_apm_battery_time(void);
|
|
|
|
#endif
|
2005-07-20 00:30:40 +00:00
|
|
|
|
2006-03-25 21:21:07 +00:00
|
|
|
/* in mpd.c */
|
2005-07-20 00:30:40 +00:00
|
|
|
#ifdef MPD
|
|
|
|
void update_mpd();
|
|
|
|
#endif
|
|
|
|
|
2006-11-05 00:23:18 +00:00
|
|
|
/* in xmms2.c */
|
2006-03-25 21:21:07 +00:00
|
|
|
#ifdef XMMS2
|
|
|
|
void update_xmms2();
|
|
|
|
#endif
|
|
|
|
|
2006-08-10 16:56:13 +00:00
|
|
|
/* in hddtemp.c */
|
|
|
|
#ifdef HDDTEMP
|
|
|
|
int scan_hddtemp(const char *arg, char **dev, char **addr, int *port);
|
|
|
|
char *get_hddtemp_info(char *dev, char *addr, int port, char *unit);
|
|
|
|
#endif /* HDDTEMP */
|
|
|
|
|
2005-07-20 00:30:40 +00:00
|
|
|
/* in linux.c */
|
|
|
|
|
|
|
|
#endif
|
2006-08-10 16:56:13 +00:00
|
|
|
|
|
|
|
|