1 /* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
3 * Conky, a system monitor, based on torsmo
5 * Any original torsmo code is licensed under the BSD license
7 * All code written since the fork of torsmo is licensed under the GPL
9 * Please see COPYING for details
11 * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
12 * Copyright (c) 2005-2009 Brenden Matthews, Philip Kovacs, et. al.
14 * All rights reserved.
16 * This program is free software: you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation, either version 3 of the License, or
19 * (at your option) any later version.
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with this program. If not, see <http://www.gnu.org/licenses/>.
28 * vim: ts=4 sw=4 noet ai cindent syntax=c
35 #include "config.h" /* defines */
36 #include "common.h" /* at least for struct dns_data */
37 #include <sys/utsname.h> /* struct uname_s */
39 #if defined(HAS_MCHECK_H)
41 #endif /* HAS_MCHECK_H */
46 #define EQUAL 0 //returnvalue of strcmp-variants when strings are equal
50 #define DEFAULT_BAR_WIDTH_NO_X 10
52 #if !defined(__GNUC__)
53 # define __attribute__(x) /* nothing */
57 // use our own strndup() if it's not available
58 char *strndup(const char *s, size_t n);
59 #endif /* HAVE_STRNDUP */
61 /* headers of optional features
62 * include them here, so we don't need to run the check
63 * in every code file optionally using the feature
67 #include "audacious.h"
95 #include "ccurl_thread.h"
96 #endif /* HAVE_CURL */
104 #error "WEATHER needs to be defined if XOAP is defined"
112 #ifdef TCP_PORT_MONITOR
113 #include "tcp-portmon.h"
132 /* A size for temporary, static buffers to use when
133 * one doesn't know what to choose. Defaults to 256. */
134 extern unsigned int text_buffer_size;
137 unsigned int entropy_avail;
138 unsigned int poolsize;
148 struct gateway_info {
155 struct monitor_info {
160 struct desktop_info {
169 struct monitor_info monitor;
170 struct desktop_info desktop;
196 #ifdef TCP_PORT_MONITOR
197 INFO_TCP_PORT_MONITOR = 19,
232 /* get_battery_stuff() item selector
233 * needed by conky.c, linux.c and freebsd.c */
239 /* if_up strictness selector
240 * needed by conky.c and linux.c (and potentially others) */
250 struct utsname uname_s;
256 /* memory information in kilobytes */
257 unsigned long long mem, memeasyfree, memfree, memmax, swap, swapfree, swapmax;
258 unsigned long long bufmem, buffers, cached;
260 unsigned short procs;
261 unsigned short run_procs;
264 /* struct cpu_stat cpu_summed; what the hell is this? */
265 unsigned int cpu_count;
270 int diskio_avg_samples;
277 struct xmms2_s xmms2;
280 AUDACIOUS_S audacious;
285 struct usr_info users;
286 struct gateway_info gw_info;
287 struct dns_data nameserver_info;
288 struct process *cpu[10];
289 struct process *memu[10];
290 struct process *time[10];
292 struct process *io[10];
294 struct process *first_process;
295 unsigned long looped;
296 struct entropy_s entropy;
297 double music_player_interval;
307 short kflags; /* kernel settings, see enum KFLAG */
312 #endif /* HAVE_LUA */
314 /* needed by linux.c and top.c -> outsource somewhere */
316 /* set to true if kernel uses "long" format for /proc/stats */
317 KFLAG_IS_LONGSTAT = 0x01,
318 /* set to true if kernel shows # of threads for the proc value
319 * in sysinfo() call */
320 KFLAG_PROC_IS_THREADS = 0x02
321 /* bits 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 available for future use */
322 /* KFLAG_NEXT_ONE = 0x04 */
324 #define KFLAG_SETON(a) info.kflags |= a
325 #define KFLAG_SETOFF(a) info.kflags &= (~a)
326 #define KFLAG_FLIP(a) info.kflags ^= a
327 #define KFLAG_ISSET(a) info.kflags & a
329 /* defined in conky.c, needed by top.c */
330 extern int top_cpu, top_mem, top_time;
335 /* defined in conky.c, needed by top.c */
336 extern int cpu_separate;
338 /* struct that has all info to be shared between
339 * instances of the same text object */
340 extern struct information info;
342 /* defined in users.c */
343 void update_users(void);
345 /* defined in conky.c */
346 extern double current_update_time, last_update_time, update_interval;
348 /* defined in conky.c */
349 int spaced_print(char *, int, const char *, int, ...)
350 __attribute__((format(printf, 3, 5)));
351 extern int inotify_fd;
353 /* defined in conky.c
354 * evaluates 'text' and places the result in 'buffer'
356 void evaluate(const char *text, char *buffer);
358 /* maximum size of config TEXT buffer, i.e. below TEXT line. */
359 extern unsigned int max_user_text;
361 /* path to config file */
362 extern char *current_config;
369 #define OVERWRITE_FILE 8
370 #define APPEND_FILE 16
372 #define TO_NCURSES 32
374 enum x_initialiser_state {
379 extern int output_methods;
380 extern enum x_initialiser_state x_initialised;
382 void set_update_interval(double interval);
384 #define DEFAULT_TEXT_BUFFER_SIZE_S "##DEFAULT_TEXT_BUFFER_SIZE"
388 /* to get rid of 'unused variable' warnings */
389 #define UNUSED(a) (void)a
390 #define UNUSED_ATTR __attribute__ ((unused))
392 #endif /* _conky_h_ */