1 /* Conky, a system monitor, based on torsmo
3 * Any original torsmo code is licensed under the BSD license
5 * All code written since the fork of torsmo is licensed under the GPL
7 * Please see COPYING for details
9 * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
10 * Copyright (c) 2005-2008 Brenden Matthews, Philip Kovacs, et. al.
12 * All rights reserved.
14 * This program is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation, either version 3 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program. If not, see <http://www.gnu.org/licenses/>.
31 #include "config.h" /* defines */
32 #include "common.h" /* at least for struct dns_data */
33 #include <sys/utsname.h> /* struct uname_s */
35 #if defined(HAS_MCHECK_H)
37 #endif /* HAS_MCHECK_H */
42 #define EQUAL 0 //returnvalue of strcmp-variants when strings are equal
47 #if !defined(__GNUC__)
48 # define __attribute__(x) /* nothing */
52 // use our own strndup() if it's not available
53 char *strndup(const char *s, size_t n);
54 #endif /* HAVE_STRNDUP */
56 /* headers of optional features
57 * include them here, so we don't need to run the check
58 * in every code file optionally using the feature
62 #include "audacious.h"
97 #ifdef TCP_PORT_MONITOR
98 #include "tcp-portmon.h"
105 /* A size for temporary, static buffers to use when
106 * one doesn't know what to choose. Defaults to 256. */
107 extern unsigned int text_buffer_size;
110 unsigned int entropy_avail;
111 unsigned int poolsize;
121 struct gateway_info {
128 struct monitor_info {
134 struct monitor_info monitor;
160 #ifdef TCP_PORT_MONITOR
161 INFO_TCP_PORT_MONITOR = 19,
193 /* get_battery_stuff() item selector
194 * needed by conky.c, linux.c and freebsd.c */
200 /* if_up strictness selector
201 * needed by conky.c and linux.c (and potentially others) */
211 struct utsname uname_s;
217 /* memory information in kilobytes */
218 unsigned long long mem, memeasyfree, memfree, memmax, swap, swapmax;
219 unsigned long long bufmem, buffers, cached;
221 unsigned short procs;
222 unsigned short run_procs;
225 /* struct cpu_stat cpu_summed; what the hell is this? */
226 unsigned int cpu_count;
227 unsigned int cpu_avg_samples;
229 unsigned int net_avg_samples;
239 struct xmms2_s xmms2;
240 int xmms2_conn_state;
241 xmms_socket_t xmms2_fd;
243 xmmsc_connection_t *xmms2_conn;
246 AUDACIOUS_S audacious;
251 struct usr_info users;
252 struct gateway_info gw_info;
253 struct dns_data nameserver_info;
254 struct process *cpu[10];
255 struct process *memu[10];
256 struct process *first_process;
257 unsigned long looped;
258 struct entropy_s entropy;
259 double music_player_interval;
265 short kflags; /* kernel settings, see enum KFLAG */
268 /* needed by linux.c and top.c -> outsource somewhere */
270 /* set to true if kernel uses "long" format for /proc/stats */
271 KFLAG_IS_LONGSTAT = 0x01,
272 /* set to true if kernel shows # of threads for the proc value
273 * in sysinfo() call */
274 KFLAG_PROC_IS_THREADS = 0x02
275 /* bits 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 available for future use */
276 /* KFLAG_NEXT_ONE = 0x04 */
278 #define KFLAG_SETON(a) info.kflags |= a
279 #define KFLAG_SETOFF(a) info.kflags &= (~a)
280 #define KFLAG_FLIP(a) info.kflags ^= a
281 #define KFLAG_ISSET(a) info.kflags & a
283 /* defined in conky.c, needed by top.c */
284 extern int top_cpu, top_mem;
286 /* defined in conky.c, needed by top.c */
287 extern int cpu_separate;
289 /* struct that has all info to be shared between
290 * instances of the same text object */
291 extern struct information info;
293 /* defined in users.c */
294 void update_users(void);
296 /* defined in conky.c */
297 extern double current_update_time, last_update_time;