2009-09-22 18:19:08 +02:00
|
|
|
/* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
|
|
|
|
* vim: ts=4 sw=4 noet ai cindent syntax=c
|
|
|
|
*/
|
2009-07-28 23:44:22 +02:00
|
|
|
|
2008-12-15 22:40:24 +01:00
|
|
|
#ifndef _COMMON_H
|
|
|
|
#define _COMMON_H
|
|
|
|
|
|
|
|
#include <stdio.h>
|
2008-12-22 20:59:42 -07:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2008-12-15 22:40:24 +01:00
|
|
|
#include <sys/socket.h>
|
2009-10-25 13:49:10 +01:00
|
|
|
#include "text_object.h"
|
2008-06-14 18:41:12 +00:00
|
|
|
|
2010-05-05 18:57:27 +02:00
|
|
|
void add_update_callback(int (*func)(void));
|
2009-09-07 00:14:54 +02:00
|
|
|
void free_update_callbacks(void);
|
2009-09-22 18:19:08 +02:00
|
|
|
void start_update_threading(void);
|
|
|
|
|
2009-09-07 00:14:54 +02:00
|
|
|
|
2009-07-21 23:41:47 +02:00
|
|
|
void strfold(char *start, int count);
|
2008-06-14 18:41:12 +00:00
|
|
|
int check_mount(char *s);
|
|
|
|
void prepare_update(void);
|
2010-05-05 18:57:27 +02:00
|
|
|
int update_uptime(void);
|
|
|
|
int update_meminfo(void);
|
|
|
|
int update_net_stats(void);
|
|
|
|
int update_cpu_usage(void);
|
|
|
|
int update_total_processes(void);
|
|
|
|
int update_uname(void);
|
|
|
|
int update_threads(void);
|
|
|
|
int update_running_processes(void);
|
2009-08-07 01:24:24 -06:00
|
|
|
void update_stuff(void);
|
2008-06-14 18:41:12 +00:00
|
|
|
char get_freq(char *, size_t, const char *, int, unsigned int);
|
2009-11-13 00:24:54 +01:00
|
|
|
void print_voltage_mv(struct text_object *, char *, int);
|
|
|
|
void print_voltage_v(struct text_object *, char *, int);
|
2010-05-05 18:57:27 +02:00
|
|
|
int update_load_average(void);
|
|
|
|
int update_top(void);
|
2008-06-14 18:41:12 +00:00
|
|
|
void free_all_processes(void);
|
|
|
|
struct process *get_first_process(void);
|
|
|
|
void get_cpu_count(void);
|
2008-12-15 22:40:24 +01:00
|
|
|
double get_time(void);
|
|
|
|
|
2009-05-24 22:33:47 -06:00
|
|
|
/* Converts '~/...' paths to '/home/blah/...' assumes that 'dest' is at least
|
|
|
|
* DEFAULT_TEXT_BUFFER_SIZE. It's similar to variable_substitute, except only
|
|
|
|
* cheques for $HOME and ~/ in path */
|
|
|
|
void to_real_path(char *dest, const char *source);
|
2009-07-22 22:08:31 +02:00
|
|
|
FILE *open_file(const char *file, int *reported);
|
|
|
|
int open_fifo(const char *file, int *reported);
|
2008-12-15 22:40:24 +01:00
|
|
|
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);
|
|
|
|
|
|
|
|
#ifdef X11
|
2010-05-05 18:57:27 +02:00
|
|
|
int update_x11info(void);
|
2008-12-15 22:40:24 +01:00
|
|
|
#endif
|
|
|
|
|
2009-05-17 23:30:10 -06:00
|
|
|
int round_to_int_temp(float);
|
|
|
|
|
|
|
|
unsigned int round_to_int(float);
|
2008-12-15 22:40:24 +01:00
|
|
|
|
|
|
|
extern int no_buffers;
|
|
|
|
|
2008-06-14 18:41:12 +00:00
|
|
|
int open_acpi_temperature(const char *name);
|
|
|
|
double get_acpi_temperature(int fd);
|
2010-01-24 15:34:03 +01:00
|
|
|
void get_acpi_ac_adapter(char *p_client_buffer, size_t client_buffer_size, const char *adapter);
|
2008-06-14 18:41:12 +00:00
|
|
|
void get_acpi_fan(char *, size_t);
|
|
|
|
void get_battery_stuff(char *buf, unsigned int n, const char *bat, int item);
|
|
|
|
int get_battery_perct(const char *bat);
|
|
|
|
int get_battery_perct_bar(const char *bat);
|
2009-02-17 21:49:45 -07:00
|
|
|
void get_battery_short_status(char *buf, unsigned int n, const char *bat);
|
2008-06-14 18:41:12 +00:00
|
|
|
|
2009-10-25 13:49:10 +01:00
|
|
|
void scan_loadavg_arg(struct text_object *, const char *);
|
|
|
|
void print_loadavg(struct text_object *, char *, int);
|
|
|
|
#ifdef X11
|
|
|
|
void scan_loadgraph_arg(struct text_object *, const char *);
|
2009-11-22 21:12:54 +01:00
|
|
|
void print_loadgraph(struct text_object *, char *, int);
|
2009-10-25 13:49:10 +01:00
|
|
|
#endif /* X11 */
|
|
|
|
|
2008-12-15 22:40:24 +01:00
|
|
|
#endif /* _COMMON_H */
|