sysfs is a Linux-only feature.
[monky] / src / common.h
1 #ifndef _COMMON_H
2 #define _COMMON_H
3
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <string.h>
7 #include <sys/socket.h>
8
9 int check_mount(char *s);
10 void prepare_update(void);
11 void update_uptime(void);
12 void update_meminfo(void);
13 void update_net_stats(void);
14 void update_cpu_usage(void);
15 void update_total_processes(void);
16 void update_uname(void);
17 void update_running_processes(void);
18 void update_i8k(void);
19 void update_stuff(void);
20 char get_freq(char *, size_t, const char *, int, unsigned int);
21 void get_freq_dynamic(char *, size_t, const char *, int);
22 char get_voltage(char *, size_t, const char *, int, unsigned int);      /* ptarjan */
23 void update_load_average(void);
24 void update_top(void);
25 void free_all_processes(void);
26 struct process *get_first_process(void);
27 void get_cpu_count(void);
28 double get_time(void);
29
30 FILE *open_file(const char *, int *);
31 void variable_substitute(const char *s, char *dest, unsigned int n);
32
33 void format_seconds(char *buf, unsigned int n, long t);
34 void format_seconds_short(char *buf, unsigned int n, long t);
35
36 #ifdef X11
37 void update_x11info(void);
38 #endif
39
40 int round_to_int(float);
41
42 extern unsigned long long need_mask;
43 extern int no_buffers;
44
45 struct dns_data {
46         int nscount;
47         char **ns_list;
48 };
49 void free_dns_data(void);
50
51 struct net_stat {
52         const char *dev;
53         int up;
54         long long last_read_recv, last_read_trans;
55         long long recv, trans;
56         double recv_speed, trans_speed;
57         struct sockaddr addr;
58 #if defined(__linux__)
59         char addrs[273];
60 #endif /* __linux__ */
61         double net_rec[15], net_trans[15];
62         // wireless extensions
63         char essid[32];
64         char bitrate[16];
65         char mode[16];
66         int link_qual;
67         int link_qual_max;
68         char ap[18];
69 };
70 void clear_net_stats(void);
71 struct net_stat *get_net_stat(const char *);
72
73 void get_adt746x_cpu(char *, size_t);
74 void get_adt746x_fan(char *, size_t);
75
76 int open_acpi_temperature(const char *name);
77 double get_acpi_temperature(int fd);
78 void get_acpi_ac_adapter(char *, size_t);
79 void get_acpi_fan(char *, size_t);
80 void get_battery_stuff(char *buf, unsigned int n, const char *bat, int item);
81 int get_battery_perct(const char *bat);
82 int get_battery_perct_bar(const char *bat);
83 void get_battery_short_status(char *buf, unsigned int n, const char *bat);
84
85 #endif /* _COMMON_H */