top: convert to generic object payload
[monky] / src / common.h
1 /* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*- 
2  * vim: ts=4 sw=4 noet ai cindent syntax=c
3  */
4
5 #ifndef _COMMON_H
6 #define _COMMON_H
7
8 #include <stdio.h>
9 #include <stdlib.h>
10 #include <string.h>
11 #include <sys/socket.h>
12
13 void add_update_callback(void (*func)(void));
14 void free_update_callbacks(void);
15 void start_update_threading(void);
16
17
18 void strfold(char *start, int count);
19 int check_mount(char *s);
20 void prepare_update(void);
21 void update_uptime(void);
22 void update_meminfo(void);
23 void update_net_stats(void);
24 void update_cpu_usage(void);
25 void update_total_processes(void);
26 void update_uname(void);
27 void update_running_processes(void);
28 void update_i8k(void);
29 void update_stuff(void);
30 char get_freq(char *, size_t, const char *, int, unsigned int);
31 void get_freq_dynamic(char *, size_t, const char *, int);
32 char get_voltage(char *, size_t, const char *, int, unsigned int);      /* ptarjan */
33 void update_load_average(void);
34 void update_top(void);
35 void free_all_processes(void);
36 struct process *get_first_process(void);
37 void get_cpu_count(void);
38 double get_time(void);
39
40 /* Converts '~/...' paths to '/home/blah/...' assumes that 'dest' is at least
41  * DEFAULT_TEXT_BUFFER_SIZE.  It's similar to variable_substitute, except only
42  * cheques for $HOME and ~/ in path */
43 void to_real_path(char *dest, const char *source);
44 FILE *open_file(const char *file, int *reported);
45 int open_fifo(const char *file, int *reported);
46 void variable_substitute(const char *s, char *dest, unsigned int n);
47
48 void format_seconds(char *buf, unsigned int n, long t);
49 void format_seconds_short(char *buf, unsigned int n, long t);
50
51 #ifdef X11
52 void update_x11info(void);
53 #endif
54
55 int round_to_int_temp(float);
56
57 unsigned int round_to_int(float);
58
59 extern int no_buffers;
60
61 void get_adt746x_cpu(char *, size_t);
62 void get_adt746x_fan(char *, size_t);
63
64 int open_acpi_temperature(const char *name);
65 double get_acpi_temperature(int fd);
66 void get_acpi_ac_adapter(char *, size_t);
67 void get_acpi_fan(char *, size_t);
68 void get_battery_stuff(char *buf, unsigned int n, const char *bat, int item);
69 int get_battery_perct(const char *bat);
70 int get_battery_perct_bar(const char *bat);
71 void get_battery_short_status(char *buf, unsigned int n, const char *bat);
72
73 #endif /* _COMMON_H */