View | Details | Raw Unified | Return to bug 147795 | Differences between
and this patch

Collapse All | Expand All

(-)conky/Makefile (-2 / +8 lines)
Lines 6-13 Link Here
6
#
6
#
7
7
8
PORTNAME=	conky
8
PORTNAME=	conky
9
PORTVERSION=	1.7.2
9
PORTVERSION=	1.8.0
10
PORTREVISION=	7
11
CATEGORIES=	sysutils
10
CATEGORIES=	sysutils
12
MASTER_SITES=	SF
11
MASTER_SITES=	SF
13
12
Lines 40-45 Link Here
40
		AUDACIOUS "Enable Audacious support" Off \
39
		AUDACIOUS "Enable Audacious support" Off \
41
		BMPX "Enable BMPX support" Off \
40
		BMPX "Enable BMPX support" Off \
42
		MPD "Enable MPD support" Off \
41
		MPD "Enable MPD support" Off \
42
		NCURSES "Enable ncurses support" Off \
43
		RSS "Enable RSS support" Off \
43
		RSS "Enable RSS support" Off \
44
		METAR "Enable METAR Weather support" Off \
44
		METAR "Enable METAR Weather support" Off \
45
		XOAP "Enable XOAP Weather support" Off \
45
		XOAP "Enable XOAP Weather support" Off \
Lines 115-120 Link Here
115
CONFIGURE_ARGS+=	--enable-lua-imlib2
115
CONFIGURE_ARGS+=	--enable-lua-imlib2
116
.endif
116
.endif
117
117
118
.if defined(WITH_NCURSES)
119
CONFIGURE_ARGS+=	--enable-ncurses
120
.else
121
CONFIGURE_ARGS+=	--disable-ncurses
122
.endif
123
118
.if defined(WITH_XFT)
124
.if defined(WITH_XFT)
119
LIB_DEPENDS+=		Xft.2:${PORTSDIR}/x11-fonts/libXft
125
LIB_DEPENDS+=		Xft.2:${PORTSDIR}/x11-fonts/libXft
120
CONFIGURE_ARGS+=	--enable-xft
126
CONFIGURE_ARGS+=	--enable-xft
(-)conky/distinfo (-3 / +3 lines)
Lines 1-3 Link Here
1
MD5 (conky-1.7.2.tar.bz2) = cf6f5d45d42ad68c618c00271813b80d
1
MD5 (conky-1.8.0.tar.bz2) = 494cbaf1108cfdb977fc80454d9b13e2
2
SHA256 (conky-1.7.2.tar.bz2) = b3c0a1b0ff90579d48df542a6070adbe67d3926d6d0c66ee12b52b2d5a2c675c
2
SHA256 (conky-1.8.0.tar.bz2) = badb3824a9655eee90281939df8bdb3ca95cf8bab03269b3b3775bfea2ed0a51
3
SIZE (conky-1.7.2.tar.bz2) = 585099
3
SIZE (conky-1.8.0.tar.bz2) = 610545
(-)conky/files/patch-configure (-28 / +72 lines)
Lines 1-37 Link Here
1
--- configure.orig
1
--- configure.orig	2010-05-01 05:57:07.000000000 +0300
2
+++ configure
2
+++ configure	2010-05-01 06:00:45.000000000 +0300
3
@@ -12805,7 +12805,7 @@
3
@@ -11233,12 +11233,12 @@
4
         pkg_cv_Audacious_CFLAGS="$Audacious_CFLAGS"
5
     else
6
         if test -n "$PKG_CONFIG" && \
7
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"audacious >= 1.4.0 dbus-glib-1 glib-2.0 gobject-2.0\""; } >&5
8
-  ($PKG_CONFIG --exists --print-errors "audacious >= 1.4.0 dbus-glib-1 glib-2.0 gobject-2.0") 2>&5
9
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"audacious >= 1.4.0 audclient dbus-glib-1 glib-2.0 gobject-2.0\""; } >&5
10
+  ($PKG_CONFIG --exists --print-errors "audacious >= 1.4.0 audclient dbus-glib-1 glib-2.0 gobject-2.0") 2>&5
11
   ac_status=$?
12
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
13
   test $ac_status = 0; }; then
14
-  pkg_cv_Audacious_CFLAGS=`$PKG_CONFIG --cflags "audacious >= 1.4.0 dbus-glib-1 glib-2.0 gobject-2.0" 2>/dev/null`
15
+  pkg_cv_Audacious_CFLAGS=`$PKG_CONFIG --cflags "audacious >= 1.4.0 audclient dbus-glib-1 glib-2.0 gobject-2.0" 2>/dev/null`
16
 else
17
   pkg_failed=yes
18
 fi
19
@@ -11251,12 +11251,12 @@
20
         pkg_cv_Audacious_LIBS="$Audacious_LIBS"
21
     else
22
         if test -n "$PKG_CONFIG" && \
23
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"audacious >= 1.4.0 dbus-glib-1 glib-2.0 gobject-2.0\""; } >&5
24
-  ($PKG_CONFIG --exists --print-errors "audacious >= 1.4.0 dbus-glib-1 glib-2.0 gobject-2.0") 2>&5
25
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"audacious >= 1.4.0 audclient dbus-glib-1 glib-2.0 gobject-2.0\""; } >&5
26
+  ($PKG_CONFIG --exists --print-errors "audacious >= 1.4.0 audclient dbus-glib-1 glib-2.0 gobject-2.0") 2>&5
27
   ac_status=$?
28
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
29
   test $ac_status = 0; }; then
30
-  pkg_cv_Audacious_LIBS=`$PKG_CONFIG --libs "audacious >= 1.4.0 dbus-glib-1 glib-2.0 gobject-2.0" 2>/dev/null`
31
+  pkg_cv_Audacious_LIBS=`$PKG_CONFIG --libs "audacious >= 1.4.0 audclient dbus-glib-1 glib-2.0 gobject-2.0" 2>/dev/null`
32
 else
33
   pkg_failed=yes
34
 fi
35
@@ -11275,14 +11275,14 @@
36
         _pkg_short_errors_supported=no
37
 fi
38
         if test $_pkg_short_errors_supported = yes; then
39
-	        Audacious_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "audacious >= 1.4.0 dbus-glib-1 glib-2.0 gobject-2.0"`
40
+	        Audacious_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "audacious >= 1.4.0 audclient dbus-glib-1 glib-2.0 gobject-2.0"`
41
         else
42
-	        Audacious_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "audacious >= 1.4.0 dbus-glib-1 glib-2.0 gobject-2.0"`
43
+	        Audacious_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "audacious >= 1.4.0 audclient dbus-glib-1 glib-2.0 gobject-2.0"`
44
         fi
45
 	# Put the nasty error message in config.log where it belongs
46
 	echo "$Audacious_PKG_ERRORS" >&5
47
 
48
-	as_fn_error "Package requirements (audacious >= 1.4.0 dbus-glib-1 glib-2.0 gobject-2.0) were not met:
49
+	as_fn_error "Package requirements (audacious >= 1.4.0 audclient dbus-glib-1 glib-2.0 gobject-2.0) were not met:
50
 
51
 $Audacious_PKG_ERRORS
52
 
53
@@ -11645,7 +11645,7 @@
4
 
54
 
5
 
55
 
6
 if test x$want_apcupsd = xyes; then
56
 if test x$want_apcupsd = xyes; then
7
-  if test x"$uname" != xLinux; then
57
-  if test x"$uname" != xLinux; then
8
+  if test x"$uname" != xLinux -a x"$uname" != xFreeBSD; then
58
+  if test x"$uname" != xLinux -a x"$uname" != xFreeBSD; then
9
       { $as_echo "$as_me:$LINENO: apcupsd not supported on $uname... disabling" >&5
59
       { $as_echo "$as_me:${as_lineno-$LINENO}: apcupsd not supported on $uname... disabling" >&5
10
 $as_echo "$as_me: apcupsd not supported on $uname... disabling" >&6;}
60
 $as_echo "$as_me: apcupsd not supported on $uname... disabling" >&6;}
11
       want_apcupsd=no
61
       want_apcupsd="not supported on $uname"
12
@@ -15930,7 +15930,7 @@
62
@@ -15950,11 +15950,6 @@
13
 
14
 			fi
63
 			fi
64
 
15
 		fi
65
 		fi
16
-		for ac_prog in tolua++ tolua++5.1
66
-if test x$want_alsa = xyes; then
17
+		for ac_prog in tolua++ tolua++5.1 tolua++-5.1
67
-
18
 do
68
-$as_echo "#define MIXER_IS_ALSA 1" >>confdefs.h
19
   # Extract the first word of "$ac_prog", so it can be a program name with args.
69
-
20
 set dummy $ac_prog; ac_word=$2
70
-fi
21
@@ -16006,7 +16006,7 @@
71
 
22
   return 0;
72
 for ac_header in signal.h unistd.h sys/utsname.h sys/stat.h linux/soundcard.h alsa/asoundlib.h dirent.h mcheck.h \
23
 }
73
       sys/statfs.h sys/param.h pthread.h semaphore.h assert.h errno.h time.h
24
 _ACEOF
74
@@ -18905,6 +18900,7 @@
25
-for ac_lib in '' tolua++ tolua++5.1; do
75
   ALSA mixer:       $want_alsa
26
+for ac_lib in '' tolua++-5.1 tolua++ tolua++5.1; do
76
   apcupsd:          $want_apcupsd
27
   if test -z "$ac_lib"; then
77
   I/O stats:        $want_iostats
28
     ac_res="none required"
78
+  ncurses:          $want_ncurses
29
   else
30
@@ -19845,7 +19845,6 @@
31
 ac_res=$ac_cv_search_clock_gettime
32
 if test "$ac_res" != no; then
33
   test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
34
-  conky_LIBS="$conky_LIBS -lrt"
35
 
79
 
36
 cat >>confdefs.h <<\_ACEOF
80
  * Lua ($want_lua) bindings:
37
 #define HAVE_CLOCK_GETTIME 1
81
   Cairo:            $want_lua_cairo
(-)conky/files/patch-doc-variables.xml (+29 lines)
Line 0 Link Here
1
--- doc/variables.xml.orig
2
+++ doc/variables.xml
3
@@ -7,8 +7,8 @@
4
             <option>(adapter)</option>
5
         </term>
6
         <listitem>ACPI ac adapter state. On linux, the adapter option specifies the
7
-        subfolder of /sys/class/power_supply containing the state information (defaults
8
-        to "AC"). Other systems ignore it.
9
+        subfolder of /sys/class/power_supply containing the state information (tries "AC"
10
+        and "ADP1" if there is no argument given). Non-linux systems ignore it.
11
         <para /></listitem>
12
     </varlistentry>
13
     <varlistentry>
14
@@ -2416,6 +2416,15 @@
15
         <listitem>Hostname 
16
         <para /></listitem>
17
     </varlistentry>
18
+     <varlistentry>
19
+        <term>
20
+            <command>
21
+                <option>nodename_short</option>
22
+            </command>
23
+        </term>
24
+        <listitem>Short hostname (same as 'hostname -s' shell command).
25
+        <para /></listitem>
26
+    </varlistentry>
27
     <varlistentry>
28
         <term>
29
             <command>
(-)conky/files/patch-lua-cairo.pkg (+10 lines)
Line 0 Link Here
1
--- lua/cairo.pkg.orig	2010-05-01 04:41:44.000000000 +0300
2
+++ lua/cairo.pkg	2010-05-01 04:20:40.000000000 +0300
3
@@ -4,6 +4,7 @@
4
 $#include <cairo-xlib.h>
5
 $#include <X11/Xlib.h>
6
 $#include "libcairo-helper.h"
7
+$#define tolua_outside
8
 /*
9
  * This code was mostly copied from cairo.h and cairo-xlib.h with comments
10
  * removed.  The licence noticed below is present for the sake of clarity.
(-)conky/files/patch-src-Makefile.in (+11 lines)
Line 0 Link Here
1
--- src/Makefile.in.orig	2010-04-30 21:55:48.000000000 +0300
2
+++ src/Makefile.in	2010-04-30 21:55:50.000000000 +0300
3
@@ -141,7 +141,7 @@
4
 am__objects_15 = conky-linux.$(OBJEXT) conky-top.$(OBJEXT) \
5
 	conky-users.$(OBJEXT) conky-sony.$(OBJEXT) conky-i8k.$(OBJEXT)
6
 @BUILD_LINUX_TRUE@am__objects_16 = $(am__objects_15)
7
-am__objects_17 = conky-freebsd.$(OBJEXT)
8
+am__objects_17 = conky-freebsd.$(OBJEXT) conky-top.$(OBJEXT)
9
 @BUILD_FREEBSD_TRUE@am__objects_18 = $(am__objects_17)
10
 am__objects_19 = conky-openbsd.$(OBJEXT)
11
 @BUILD_OPENBSD_TRUE@am__objects_20 = $(am__objects_19)
(-)conky/files/patch-src-apcupsd.c (+18 lines)
Line 0 Link Here
1
--- src/apcupsd.c.orig
2
+++ src/apcupsd.c
3
@@ -154,7 +154,7 @@ static int fill_items(int sock, PAPCUPSD_S apc) {
4
 //
5
 // Conky update function for apcupsd data
6
 //
7
-void update_apcupsd(void) {
8
+int update_apcupsd(void) {
9
 
10
 	int i;
11
 	APCUPSD_S apc;
12
@@ -225,5 +225,5 @@ void update_apcupsd(void) {
13
 	// "atomically" copy the data into working set
14
 	//
15
 	memcpy(info.apcupsd.items, apc.items, sizeof(info.apcupsd.items));
16
-	return;
17
+	return 0;
18
 }
(-)conky/files/patch-src-apcupsd.h (+10 lines)
Line 0 Link Here
1
--- src/apcupsd.h.orig
2
+++ src/apcupsd.h
3
@@ -49,6 +49,6 @@ typedef struct apcupsd_s {
4
 } APCUPSD_S, *PAPCUPSD_S;
5
 
6
 /* Service routine for the conky main thread */
7
-void update_apcupsd(void);
8
+int update_apcupsd(void);
9
 
10
 #endif /*APCUPSD_H_*/
(-)conky/files/patch-src-audacious.c (+19 lines)
Line 0 Link Here
1
--- src/audacious.c.orig
2
+++ src/audacious.c
3
@@ -62,7 +62,7 @@ static audacious_t audacious_items;
4
 /* -----------------------------------------
5
  * Conky update function for audacious data.
6
  * ----------------------------------------- */
7
-void update_audacious(void)
8
+int update_audacious(void)
9
 {
10
 	/* The worker thread is updating audacious_items array asynchronously
11
 	 * to the main conky thread.
12
@@ -79,6 +79,7 @@ void update_audacious(void)
13
 	timed_thread_lock(info.audacious.p_timed_thread);
14
 	memcpy(&info.audacious.items, audacious_items, sizeof(audacious_items));
15
 	timed_thread_unlock(info.audacious.p_timed_thread);
16
+	return 0;
17
 }
18
 
19
 /* ---------------------------------------------------------
(-)conky/files/patch-src-audacious.h (+11 lines)
Line 0 Link Here
1
--- src/audacious.h.orig
2
+++ src/audacious.h
3
@@ -60,7 +60,7 @@ int create_audacious_thread(void);
4
 int destroy_audacious_thread(void);
5
 
6
 /* Service routine for the conky main thread */
7
-void update_audacious(void);
8
+int update_audacious(void);
9
 
10
 /* Thread functions */
11
 void *audacious_thread_func(void *);
(-)conky/files/patch-src-bmpx.c (-60 lines)
Lines 1-60 Link Here
1
--- src/bmpx.c.orig	2009-09-23 22:02:33.000000000 +0300
2
+++ src/bmpx.c	2009-09-23 22:03:54.000000000 +0300
3
@@ -41,7 +41,7 @@
4
 static int connected = 0;
5
 static char *unknown = "unknown";
6
 
7
-void fail(GError *error);
8
+void fail(GError *error, struct information *);
9
 
10
 void update_bmpx()
11
 {
12
@@ -57,15 +57,15 @@
13
 		bus = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
14
 		if (bus == NULL) {
15
 			ERR("BMPx error 1: %s\n", error->message);
16
-			fail(error);
17
+			fail(error, current_info);
18
 			return;
19
 		}
20
 
21
 		remote_object = dbus_g_proxy_new_for_name(bus, BMP_DBUS_SERVICE,
22
-				BMP_DBUS_PATH, BMP_DBUS_INTERFACE);
23
+				BMP_DBUS_PATH__BMP, BMP_DBUS_INTERFACE__BMP);
24
 		if (!remote_object) {
25
 			ERR("BMPx error 2: %s\n", error->message);
26
-			fail(error);
27
+			fail(error, current_info);
28
 			return;
29
 		}
30
 
31
@@ -77,7 +77,7 @@
32
 					G_TYPE_INVALID, G_TYPE_INT, &current_track, G_TYPE_INVALID)) {
33
 		} else {
34
 			ERR("BMPx error 3: %s\n", error->message);
35
-			fail(error);
36
+			fail(error, current_info);
37
 			return;
38
 		}
39
 
40
@@ -111,17 +111,17 @@
41
 				g_value_get_string(g_hash_table_lookup(metadata, "location"));
42
 		} else {
43
 			ERR("BMPx error 4: %s\n", error->message);
44
-			fail(error);
45
+			fail(error, current_info);
46
 			return;
47
 		}
48
 
49
 		g_hash_table_destroy(metadata);
50
 	} else {
51
-		fail(error);
52
+		fail(error, current_info);
53
 	}
54
 }
55
 
56
-void fail(GError *error)
57
+void fail(GError *error, struct information *current_info)
58
 {
59
 	if (error) {
60
 		g_error_free(error);
(-)conky/files/patch-src-bmpx.h (-42 lines)
Lines 1-42 Link Here
1
--- src/bmpx.h.orig	2009-09-23 22:04:47.000000000 +0300
2
+++ src/bmpx.h	2009-09-23 22:02:05.000000000 +0300
3
@@ -0,0 +1,39 @@
4
+/* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
5
+ * vim: ts=4 sw=4 noet ai cindent syntax=c
6
+ *
7
+ * Conky, a system monitor, based on torsmo
8
+ *
9
+ * Please see COPYING for details
10
+ *
11
+ * Copyright (c) 2005-2009 Brenden Matthews, Philip Kovacs, et. al.
12
+ *	(see AUTHORS)
13
+ * All rights reserved.
14
+ *
15
+ * This program is free software: you can redistribute it and/or modify
16
+ * it under the terms of the GNU General Public License as published by
17
+ * the Free Software Foundation, either version 3 of the License, or
18
+ * (at your option) any later version.
19
+ *
20
+ * This program is distributed in the hope that it will be useful,
21
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
22
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
+ * GNU General Public License for more details.
24
+ * You should have received a copy of the GNU General Public License
25
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
26
+ *
27
+ */
28
+
29
+#ifndef BMPX_H_
30
+#define BMPX_H_
31
+
32
+void update_bmpx(void);
33
+struct bmpx_s {
34
+	char *title;
35
+	char *artist;
36
+	char *album;
37
+	char *uri;
38
+	int bitrate;
39
+	int track;
40
+};
41
+
42
+#endif /*BMPX_H_*/
(-)conky/files/patch-src-common.c (+62 lines)
Line 0 Link Here
1
--- src/common.c.orig
2
+++ src/common.c
3
@@ -84,9 +84,10 @@ char *strndup(const char *s, size_t n)
4
 }
5
 #endif /* HAVE_STRNDUP */
6
 
7
-void update_uname(void)
8
+int update_uname(void)
9
 {
10
 	uname(&info.uname_s);
11
+	return 0;
12
 }
13
 
14
 double get_time(void)
15
@@ -268,7 +269,7 @@ void format_seconds_short(char *buf, unsigned int n, long seconds)
16
  * Populated while initialising text objects in construct_text_object(). */
17
 static struct update_cb {
18
 	struct update_cb *next;
19
-	void (*func)(void);
20
+	int (*func)(void);
21
 	pthread_t thread;
22
 	sem_t start_wait, end_wait;
23
 
24
@@ -286,7 +287,7 @@ static int threading_started = 0;
25
 
26
 /* Register an update callback. Don't allow duplicates, to minimise side
27
  * effects and overhead. */
28
-void add_update_callback(void (*func)(void))
29
+void add_update_callback(int (*func)(void))
30
 {
31
 	struct update_cb *uc = &update_cb_head;
32
 
33
@@ -376,7 +377,12 @@ static void *run_update_callback(void *data)
34
 	while (1) {
35
 		if (sem_wait(&ucb->start_wait)) pthread_exit(NULL);
36
 		if (ucb->running == 0) pthread_exit(NULL);
37
-		(*ucb->func)();
38
+		if((*ucb->func)()) {
39
+			ucb->next = ucb;	//this is normally not be possible, so we use it to show that there was a critical error
40
+			sem_post(&ucb->end_wait);
41
+			sem_post(&ucb->end_wait);
42
+			pthread_exit(NULL);
43
+		}
44
 		if (sem_post(&ucb->end_wait)) pthread_exit(NULL);
45
 	}
46
 }
47
@@ -411,8 +417,14 @@ void update_stuff(void)
48
 	}
49
 	/* need to synchronise here, otherwise locking is needed (as data
50
 	 * would be printed with some update callbacks still running) */
51
-	for (uc = update_cb_head.next; uc; uc = uc->next)
52
+	for (uc = update_cb_head.next; uc; uc = uc->next) {
53
 		sem_wait(&uc->end_wait);
54
+		if(uc == uc->next) {
55
+			pthread_join(uc->thread, NULL);
56
+			free(uc);
57
+			exit(EXIT_FAILURE);
58
+		}
59
+	}
60
 
61
 	/* XXX: move the following into the update_meminfo() functions? */
62
 	if (no_buffers) {
(-)conky/files/patch-src-common.h (+51 lines)
Line 0 Link Here
1
--- src/common.h.orig
2
+++ src/common.h
3
@@ -11,7 +11,7 @@
4
 #include <sys/socket.h>
5
 #include "text_object.h"
6
 
7
-void add_update_callback(void (*func)(void));
8
+void add_update_callback(int (*func)(void));
9
 void free_update_callbacks(void);
10
 void start_update_threading(void);
11
 
12
@@ -19,20 +19,20 @@ void start_update_threading(void);
13
 void strfold(char *start, int count);
14
 int check_mount(char *s);
15
 void prepare_update(void);
16
-void update_uptime(void);
17
-void update_meminfo(void);
18
-void update_net_stats(void);
19
-void update_cpu_usage(void);
20
-void update_total_processes(void);
21
-void update_uname(void);
22
-void update_threads(void);
23
-void update_running_processes(void);
24
+int update_uptime(void);
25
+int update_meminfo(void);
26
+int update_net_stats(void);
27
+int update_cpu_usage(void);
28
+int update_total_processes(void);
29
+int update_uname(void);
30
+int update_threads(void);
31
+int update_running_processes(void);
32
 void update_stuff(void);
33
 char get_freq(char *, size_t, const char *, int, unsigned int);
34
 void print_voltage_mv(struct text_object *, char *, int);
35
 void print_voltage_v(struct text_object *, char *, int);
36
-void update_load_average(void);
37
-void update_top(void);
38
+int update_load_average(void);
39
+int update_top(void);
40
 void free_all_processes(void);
41
 struct process *get_first_process(void);
42
 void get_cpu_count(void);
43
@@ -50,7 +50,7 @@ void format_seconds(char *buf, unsigned int n, long t);
44
 void format_seconds_short(char *buf, unsigned int n, long t);
45
 
46
 #ifdef X11
47
-void update_x11info(void);
48
+int update_x11info(void);
49
 #endif
50
 
51
 int round_to_int_temp(float);
(-)conky/files/patch-src-conky.c (+404 lines)
Line 0 Link Here
1
--- src/conky.c.orig	2010-03-25 22:27:32.000000000 +0200
2
+++ src/conky.c	2010-06-11 23:10:56.000000000 +0300
3
@@ -166,9 +166,7 @@
4
 #ifdef IOSTATS
5
 int top_io;
6
 #endif
7
-#ifdef __linux__
8
 int top_running;
9
-#endif
10
 int output_methods;
11
 static int extra_newline;
12
 enum x_initialiser_state x_initialised = NO;
13
@@ -269,9 +267,6 @@
14
 #ifdef IMLIB2
15
 		   "  * Imlib2\n"
16
 #endif /* IMLIB2 */
17
-#ifdef MIXER_IS_ALSA
18
-		   "  * ALSA mixer support\n"
19
-#endif /* MIXER_IS_ALSA */
20
 #ifdef APCUPSD
21
 		   "  * apcupsd\n"
22
 #endif /* APCUPSD */
23
@@ -463,7 +458,7 @@
24
 		}
25
 		fclose(where);
26
 	} else {
27
-		NORM_ERR("Could not open the file");
28
+		NORM_ERR("Could not open the file '%s'", f);
29
 	}
30
 	return ret;
31
 }
32
@@ -512,6 +507,7 @@
33
 	char *ps, *pe;
34
 	int special_index = 0; /* specials index */
35
 
36
+	if(! b) return;
37
 	for (ps = b, pe = b; *pe; pe++) {
38
 		if (*pe == '\n') {
39
 			*pe = '\0';
40
@@ -765,6 +761,8 @@
41
 	buff_in[0] = 0;
42
 #endif /* HAVE_ICONV */
43
 
44
+	if(! p) return;
45
+
46
 	p[0] = 0;
47
 	obj = root.next;
48
 	while (obj && p_max_size > 0) {
49
@@ -1330,7 +1328,7 @@
50
 					DO_JUMP;
51
 				} else if (spc) {
52
 					*spc = '\0';
53
-					if (check_contains(obj->data.s, spc + 1))
54
+					if (!check_contains(obj->data.s, spc + 1))
55
 						DO_JUMP;
56
 					*spc = ' ';
57
 				}
58
@@ -1503,6 +1501,15 @@
59
 			OBJ(nodename) {
60
 				snprintf(p, p_max_size, "%s", cur->uname_s.nodename);
61
 			}
62
+			OBJ(nodename_short) {
63
+				char *pos;
64
+				pos = strstr(cur->uname_s.nodename, ".");
65
+				if(pos != NULL) {
66
+					snprintf(p, MIN(pos-cur->uname_s.nodename+1, p_max_size), "%s", cur->uname_s.nodename);
67
+				} else {
68
+					snprintf(p, p_max_size, "%s", cur->uname_s.nodename);
69
+				}
70
+			}
71
 			OBJ(outlinecolor) {
72
 				new_outline(p, obj->data.l);
73
 			}
74
@@ -2062,9 +2069,11 @@
75
 			OBJ(xmms2_percent) {
76
 				snprintf(p, p_max_size, "%2.0f", cur->xmms2.progress * 100);
77
 			}
78
+#ifdef X11
79
 			OBJ(xmms2_bar) {
80
 				new_bar(obj, p, p_max_size, (int) (cur->xmms2.progress * 255.0f));
81
 			}
82
+#endif /* X11 */
83
 			OBJ(xmms2_playlist) {
84
 				snprintf(p, p_max_size, "%s", cur->xmms2.playlist);
85
 			}
86
@@ -2140,6 +2149,7 @@
87
 				snprintf(p, p_max_size, "%s",
88
 					cur->audacious.items[AUDACIOUS_MAIN_VOLUME]);
89
 			}
90
+#ifdef X11
91
 			OBJ(audacious_bar) {
92
 				double progress;
93
 
94
@@ -2148,6 +2158,7 @@
95
 					atof(cur->audacious.items[AUDACIOUS_LENGTH_SECONDS]);
96
 				new_bar(obj, p, p_max_size, (int) (progress * 255.0f));
97
 			}
98
+#endif /* X11 */
99
 #endif /* AUDACIOUS */
100
 
101
 #ifdef BMPX
102
@@ -2173,7 +2184,6 @@
103
 			/* we have four different types of top (top, top_mem,
104
 			 * top_time and top_io). To avoid having almost-same code four
105
 			 * times, we have this special handler. */
106
-#ifdef __linux__
107
 			break;
108
 			case OBJ_top:
109
 			case OBJ_top_mem:
110
@@ -2182,7 +2192,6 @@
111
 			case OBJ_top_io:
112
 #endif
113
 				print_top(obj, p, p_max_size);
114
-#endif /* __linux__ */
115
 			OBJ(tail) {
116
 				print_tailhead("tail", obj, p, p_max_size);
117
 			}
118
@@ -2375,13 +2384,7 @@
119
 #ifdef HAVE_ICONV
120
 			iconv_convert(&a, buff_in, p, p_max_size);
121
 #endif /* HAVE_ICONV */
122
-			if (obj->type != OBJ_text && obj->type != OBJ_execp && obj->type != OBJ_execpi
123
-#ifdef HAVE_LUA
124
-					&& obj->type != OBJ_lua && obj->type != OBJ_lua_parse
125
-#endif /* HAVE_LUA */
126
-					) {
127
-				substitute_newlines(p, a - 2);
128
-			}
129
+			substitute_newlines(p, a - 2);
130
 			p += a;
131
 			p_max_size -= a;
132
 			(*p) = 0;
133
@@ -3119,36 +3122,49 @@
134
 						if (seconds != 0) {
135
 							timeunits = seconds / 86400; seconds %= 86400;
136
 							if (timeunits > 0) {
137
-								asprintf(&tmp_day_str, "%dd", timeunits);
138
+								if (asprintf(&tmp_day_str, "%dd", timeunits) < 0) {
139
+									tmp_day_str = 0;
140
+								}
141
 							} else {
142
 								tmp_day_str = strdup("");
143
 							}
144
 							timeunits = seconds / 3600; seconds %= 3600;
145
 							if (timeunits > 0) {
146
-								asprintf(&tmp_hour_str, "%dh", timeunits);
147
+								if (asprintf(&tmp_hour_str, "%dh", timeunits) < 0) {
148
+									tmp_day_str = 0;
149
+								}
150
 							} else {
151
 								tmp_hour_str = strdup("");
152
 							}
153
 							timeunits = seconds / 60; seconds %= 60;
154
 							if (timeunits > 0) {
155
-								asprintf(&tmp_min_str, "%dm", timeunits);
156
+								if (asprintf(&tmp_min_str, "%dm", timeunits) < 0) {
157
+									tmp_min_str = 0;
158
+								}
159
 							} else {
160
 								tmp_min_str = strdup("");
161
 							}
162
 							if (seconds > 0) {
163
-								asprintf(&tmp_sec_str, "%ds", seconds);
164
+								if (asprintf(&tmp_sec_str, "%ds", seconds) < 0) {
165
+									tmp_sec_str = 0;
166
+								}
167
 							} else {
168
 								tmp_sec_str = strdup("");
169
 							}
170
-							asprintf(&tmp_str, "%s%s%s%s", tmp_day_str, tmp_hour_str, tmp_min_str, tmp_sec_str);
171
-							free(tmp_day_str); free(tmp_hour_str); free(tmp_min_str); free(tmp_sec_str);
172
+							if (asprintf(&tmp_str, "%s%s%s%s", tmp_day_str,
173
+										tmp_hour_str, tmp_min_str, tmp_sec_str) < 0) {
174
+								tmp_str = 0;
175
+							}
176
+#define FREE(a) if ((a)) free((a));
177
+							FREE(tmp_day_str); FREE(tmp_hour_str); FREE(tmp_min_str); FREE(tmp_sec_str);
178
 						} else {
179
-							asprintf(&tmp_str, "Range not possible"); // should never happen, but better safe then sorry
180
+							tmp_str = strdup("Range not possible"); /* should never happen, but better safe then sorry */
181
 						}
182
 						cur_x += (w / 2) - (font_ascent() * (strlen(tmp_str) / 2));
183
 						cur_y += font_h / 2;
184
 						draw_string(tmp_str);
185
-						free(tmp_str);
186
+						FREE(tmp_str);
187
+#undef FREE
188
 						cur_x = tmp_x;
189
 						cur_y = tmp_y;
190
 					}
191
@@ -3974,11 +3990,39 @@
192
 	initialisation(argc_copy, argv_copy);
193
 }
194
 
195
-void clean_up(void *memtofree1, void* memtofree2)
196
-{
197
-	int i;
198
+#ifdef X11
199
+void clean_up_x11() {
200
+	if(window_created == 1) {
201
+		XClearArea(display, window.window, text_start_x - window.border_inner_margin - window.border_outer_margin - window.border_width,
202
+			text_start_y - window.border_inner_margin - window.border_outer_margin - window.border_width,
203
+			text_width + window.border_inner_margin * 2 + window.border_outer_margin * 2 + window.border_width * 2,
204
+			text_height + window.border_inner_margin * 2 + window.border_outer_margin * 2 + window.border_width * 2, 0);
205
+	}
206
+	destroy_window();
207
+	free_fonts();
208
+	fonts = NULL;
209
+	if(x11_stuff.region) {
210
+		XDestroyRegion(x11_stuff.region);
211
+		x11_stuff.region = NULL;
212
+	}
213
+	if(display) {
214
+		XCloseDisplay(display);
215
+		display = NULL;
216
+	}
217
+	if(info.x11.desktop.all_names) {
218
+		free(info.x11.desktop.all_names);
219
+		info.x11.desktop.all_names = NULL;
220
+	}
221
+	if (info.x11.desktop.name) {
222
+		free(info.x11.desktop.name);
223
+		info.x11.desktop.name = NULL;
224
+	}
225
+	x_initialised = NO;
226
+}
227
+#endif
228
 
229
-	free_update_callbacks();
230
+void clean_up_without_threads(void *memtofree1, void* memtofree2) {
231
+	int i;
232
 
233
 #ifdef NCURSES
234
 	if(output_methods & TO_NCURSES) {
235
@@ -4001,29 +4045,7 @@
236
 	}
237
 #ifdef X11
238
 	if (x_initialised == YES) {
239
-		if(window_created == 1) {
240
-			XClearArea(display, window.window, text_start_x - window.border_inner_margin - window.border_outer_margin - window.border_width,
241
-				text_start_y - window.border_inner_margin - window.border_outer_margin - window.border_width,
242
-				text_width + window.border_inner_margin * 2 + window.border_outer_margin * 2 + window.border_width * 2,
243
-				text_height + window.border_inner_margin * 2 + window.border_outer_margin * 2 + window.border_width * 2, 0);
244
-		}
245
-		destroy_window();
246
-		free_fonts();
247
-		if(x11_stuff.region) {
248
-			XDestroyRegion(x11_stuff.region);
249
-			x11_stuff.region = NULL;
250
-		}
251
-		XCloseDisplay(display);
252
-		display = NULL;
253
-		if(info.x11.desktop.all_names) {
254
-			free(info.x11.desktop.all_names);
255
-			info.x11.desktop.all_names = NULL;
256
-		}
257
-		if (info.x11.desktop.name) {
258
-			free(info.x11.desktop.name);
259
-			info.x11.desktop.name = NULL;
260
-		}
261
-		x_initialised = NO;
262
+		clean_up_x11();
263
 	}else{
264
 		free(fonts);	//in set_default_configurations a font is set but not loaded
265
 		font_count = -1;
266
@@ -4097,6 +4119,12 @@
267
 	}
268
 }
269
 
270
+void clean_up(void *memtofree1, void* memtofree2)
271
+{
272
+	free_update_callbacks();
273
+	clean_up_without_threads(memtofree1, memtofree2);
274
+}
275
+
276
 static int string_to_bool(const char *s)
277
 {
278
 	if (!s) {
279
@@ -4200,9 +4228,7 @@
280
 #ifdef IOSTATS
281
 	top_io = 0;
282
 #endif
283
-#ifdef __linux__
284
 	top_running = 0;
285
-#endif
286
 #ifdef MPD
287
 	mpd_env_host = getenv("MPD_HOST");
288
 	mpd_env_port = getenv("MPD_PORT");
289
@@ -4252,6 +4278,9 @@
290
 	output_methods = TO_STDOUT;
291
 #endif
292
 #ifdef X11
293
+#ifdef BUILD_XFT
294
+	use_xft = 0;
295
+#endif
296
 	show_graph_scale = 0;
297
 	show_graph_range = 0;
298
 	draw_shades = 1;
299
@@ -4282,11 +4311,11 @@
300
 	text_alignment = BOTTOM_LEFT;
301
 	info.x11.monitor.number = 1;
302
 	info.x11.monitor.current = 0;
303
-	info.x11.desktop.current = 1; 
304
+	info.x11.desktop.current = 1;
305
 	info.x11.desktop.number = 1;
306
 	info.x11.desktop.nitems = 0;
307
-	info.x11.desktop.all_names = NULL; 
308
-	info.x11.desktop.name = NULL; 
309
+	info.x11.desktop.all_names = NULL;
310
+	info.x11.desktop.name = NULL;
311
 #endif /* X11 */
312
 
313
 	free_templates();
314
@@ -4518,13 +4547,13 @@
315
 		int a = string_to_alignment(value);
316
 
317
 		if (a <= 0) {
318
-			if(setbyconffile == true) {
319
+			if (setbyconffile) {
320
 				CONF_ERR;
321
 			} else NORM_ERR("'%s' is not a alignment setting", value);
322
 		} else {
323
 			*ltext_alignment = a;
324
 		}
325
-	} else if(setbyconffile == true) {
326
+	} else if (setbyconffile) {
327
 		CONF_ERR;
328
 	}
329
 }
330
@@ -4552,15 +4581,12 @@
331
 
332
 #ifdef X11
333
 		CONF2("out_to_x") {
334
-			/* don't listen if X is already initialised or
335
-			 * if we already know we don't want it */
336
-			if(x_initialised != YES) {
337
-				if (string_to_bool(value)) {
338
-					output_methods &= TO_X;
339
-				} else {
340
-					output_methods &= ~TO_X;
341
-					x_initialised = NEVER;
342
-				}
343
+			if (string_to_bool(value)) {
344
+				output_methods &= TO_X;
345
+			} else {
346
+				clean_up_x11();
347
+				output_methods &= ~TO_X;
348
+				x_initialised = NEVER;
349
 			}
350
 		}
351
 		CONF("display") {
352
@@ -4573,7 +4599,7 @@
353
 			}
354
 		}
355
 		CONF("alignment") {
356
-			setalignment(&text_alignment, window.type, value, f, line, true);
357
+			setalignment(&text_alignment, window.type, value, f, line, 1);
358
 		}
359
 		CONF("background") {
360
 			fork_to_background = string_to_bool(value);
361
@@ -4609,7 +4635,7 @@
362
 		CONF("border_width") {
363
 			if (value) {
364
 				window.border_width = strtol(value, 0, 0);
365
-				if (window.border_width < 0) window.border_width = 0;
366
+				if (window.border_width < 1) window.border_width = 1;
367
 			} else {
368
 				CONF_ERR;
369
 			}
370
@@ -5696,7 +5722,7 @@
371
 				set_first_font(optarg);
372
 				break;
373
 			case 'a':
374
-				setalignment(&text_alignment, window.type, optarg, NULL, 0, false);
375
+				setalignment(&text_alignment, window.type, optarg, NULL, 0, 0);
376
 				break;
377
 
378
 #ifdef OWN_WINDOW
379
@@ -5895,7 +5921,9 @@
380
 				current_config = strndup(optarg, max_user_text);
381
 				break;
382
 			case 'q':
383
-				freopen("/dev/null", "w", stderr);
384
+				if (!freopen("/dev/null", "w", stderr)) {
385
+					NORM_ERR("unable to redirect stderr to /dev/null");
386
+				}
387
 				break;
388
 			case 'h':
389
 				print_help(argv[0]);
390
@@ -5929,7 +5957,13 @@
391
 #endif /* XOAP */
392
 
393
 #ifdef HAVE_SYS_INOTIFY_H
394
-	inotify_fd = inotify_init1(IN_NONBLOCK);
395
+	inotify_fd = inotify_init();
396
+	if(inotify_fd != -1) {
397
+		int fl;
398
+
399
+		fl = fcntl(inotify_fd, F_GETFL);
400
+		fcntl(inotify_fd, F_SETFL, fl | O_NONBLOCK);
401
+	}
402
 #endif /* HAVE_SYS_INOTIFY_H */
403
 
404
 	initialisation(argc, argv);
(-)conky/files/patch-src-conky.h (+21 lines)
Line 0 Link Here
1
--- src/conky.h.orig
2
+++ src/conky.h
3
@@ -296,9 +296,7 @@ extern int top_cpu, top_mem, top_time;
4
 #ifdef IOSTATS
5
 extern int top_io;
6
 #endif
7
-#ifdef __linux__
8
 extern int top_running;
9
-#endif
10
 
11
 /* defined in conky.c, needed by top.c */
12
 extern int cpu_separate;
13
@@ -308,7 +306,7 @@ extern int cpu_separate;
14
 extern struct information info;
15
 
16
 /* defined in users.c */
17
-void update_users(void);
18
+int update_users(void);
19
 void update_user_time(char *tty);
20
 
21
 /* defined in conky.c */
(-)conky/files/patch-src-core.c (+126 lines)
Line 0 Link Here
1
--- src/core.c.orig	2010-03-25 22:27:32.000000000 +0200
2
+++ src/core.c	2010-06-15 10:38:22.000000000 +0300
3
@@ -171,8 +171,6 @@
4
 			NORM_ERR("acpiacadapter: arg is only used on linux");
5
 #endif
6
 		}
7
-		if(! obj->data.opaque)
8
-			obj->data.opaque = strdup("AC");
9
 #endif /* !__OpenBSD__ */
10
 	END OBJ(freq, 0)
11
 		get_cpu_count();
12
@@ -279,8 +277,9 @@
13
 		obj->data.s = strndup(bat, text_buffer_size);
14
 	END OBJ(battery_bar, 0)
15
 		char bat[64];
16
-		if (arg) {
17
-			arg = scan_bar(obj, arg);
18
+
19
+		arg = scan_bar(obj, arg);
20
+		if (arg && strlen(arg)>0) {
21
 			sscanf(arg, "%63s", bat);
22
 		} else {
23
 			strcpy(bat, "BAT0");
24
@@ -372,18 +371,18 @@
25
 		scan_loadgraph_arg(obj, arg);
26
 #endif /* X11 */
27
 	END OBJ(diskio, &update_diskio)
28
-		parse_diskio_arg(obj, arg);
29
+		parse_diskio_arg(obj, dev_name(arg));
30
 	END OBJ(diskio_read, &update_diskio)
31
-		parse_diskio_arg(obj, arg);
32
+		parse_diskio_arg(obj, dev_name(arg));
33
 	END OBJ(diskio_write, &update_diskio)
34
-		parse_diskio_arg(obj, arg);
35
+		parse_diskio_arg(obj, dev_name(arg));
36
 #ifdef X11
37
 	END OBJ(diskiograph, &update_diskio)
38
-		parse_diskiograph_arg(obj, arg);
39
+		parse_diskiograph_arg(obj, dev_name(arg));
40
 	END OBJ(diskiograph_read, &update_diskio)
41
-		parse_diskiograph_arg(obj, arg);
42
+		parse_diskiograph_arg(obj, dev_name(arg));
43
 	END OBJ(diskiograph_write, &update_diskio)
44
-		parse_diskiograph_arg(obj, arg);
45
+		parse_diskiograph_arg(obj, dev_name(arg));
46
 #endif /* X11 */
47
 	END OBJ(color, 0)
48
 #ifdef X11
49
@@ -542,6 +541,11 @@
50
 		parse_platform_sensor(obj, arg);
51
 	END OBJ_ARG(hwmon, 0, "hwmon needs argumanets")
52
 		parse_hwmon_sensor(obj, arg);
53
+	END OBJ(addr, &update_net_stats)
54
+		parse_net_stat_arg(obj, arg, free_at_crash);
55
+	END OBJ(addrs, &update_net_stats)
56
+		parse_net_stat_arg(obj, arg, free_at_crash);
57
+#endif /* __linux__ */
58
 	END
59
 	/* we have four different types of top (top, top_mem, top_time and top_io). To
60
 	 * avoid having almost-same code four times, we have this special
61
@@ -552,12 +556,8 @@
62
 		if (!parse_top_args(s, arg, obj)) {
63
 			return NULL;
64
 		}
65
-	} else OBJ(addr, &update_net_stats)
66
-		parse_net_stat_arg(obj, arg, free_at_crash);
67
-	END OBJ(addrs, &update_net_stats)
68
-		parse_net_stat_arg(obj, arg, free_at_crash);
69
-#endif /* __linux__ */
70
-	END OBJ_ARG(tail, 0, "tail needs arguments")
71
+	} else
72
+		OBJ_ARG(tail, 0, "tail needs arguments")
73
 		init_tailhead("tail", arg, obj, free_at_crash);
74
 	END OBJ_ARG(head, 0, "head needs arguments")
75
 		init_tailhead("head", arg, obj, free_at_crash);
76
@@ -657,6 +657,7 @@
77
 		obj->sub = malloc(sizeof(struct text_object));
78
 		extract_variable_text_internal(obj->sub, arg);
79
 	END OBJ(nodename, 0)
80
+	END OBJ(nodename_short, 0)
81
 	END OBJ_ARG(cmdline_to_pid, 0, "cmdline_to_pid needs a command line as argument")
82
 		scan_cmdline_to_pid_arg(obj, arg, free_at_crash);
83
 	END OBJ_ARG(pid_chroot, 0, "pid_chroot needs a pid as argument")
84
@@ -786,9 +787,9 @@
85
 		obj->sub = malloc(sizeof(struct text_object));
86
 		extract_variable_text_internal(obj->sub, arg);
87
 	END OBJ(processes, &update_total_processes)
88
-#ifdef __linux__
89
 	END OBJ(running_processes, &update_top)
90
 		top_running = 1;
91
+#ifdef __linux__
92
 	END OBJ(threads, &update_threads)
93
 	END OBJ(running_threads, &update_stat)
94
 #else
95
@@ -966,8 +967,10 @@
96
 	END OBJ(xmms2_size, &update_xmms2)
97
 	END OBJ(xmms2_status, &update_xmms2)
98
 	END OBJ(xmms2_percent, &update_xmms2)
99
+#ifdef X11
100
 	END OBJ(xmms2_bar, &update_xmms2)
101
 		scan_bar(obj, arg);
102
+#endif
103
 	END OBJ(xmms2_smart, &update_xmms2)
104
 	END OBJ(xmms2_playlist, &update_xmms2)
105
 	END OBJ(xmms2_timesplayed, &update_xmms2)
106
@@ -993,9 +996,11 @@
107
 	END OBJ(audacious_playlist_length, &update_audacious)
108
 	END OBJ(audacious_playlist_position, &update_audacious)
109
 	END OBJ(audacious_main_volume, &update_audacious)
110
+#ifdef X11
111
 	END OBJ(audacious_bar, &update_audacious)
112
 		scan_bar(obj, arg);
113
 #endif
114
+#endif
115
 #ifdef BMPX
116
 	END OBJ(bmpx_title, &update_bmpx)
117
 		memset(&(info.bmpx), 0, sizeof(struct bmpx_s));
118
@@ -1327,7 +1332,7 @@
119
 			strfold(p, 1);
120
 		} else if (*p == '#') {
121
 			char c;
122
-			if (remove_comment(p, &c) && p > orig_p && c == '\n') {
123
+			if (remove_comment(p, &c) && p >= orig_p && c == '\n') {
124
 				/* if remove_comment removed a newline, we need to 'back up' with p */
125
 				p--;
126
 			}
(-)conky/files/patch-src-diskio.c (+15 lines)
Line 0 Link Here
1
--- src/diskio.c.orig
2
+++ src/diskio.c
3
@@ -76,12 +76,6 @@ struct diskio_stat *prepare_diskio_stat(const char *s)
4
 	if (!s)
5
 		return &stats;
6
 
7
-#if defined(__FreeBSD__)
8
-	if (strncmp(s, "/dev/", 5) == 0) {
9
-		// supplied a /dev/device arg, so cut off the /dev part
10
-		strncpy(device_name, s + 5, text_buffer_size);
11
-	} else
12
-#endif
13
 	strncpy(device_name, s, text_buffer_size);
14
 
15
 	snprintf(stat_name, text_buffer_size, "/dev/%s", device_name);
(-)conky/files/patch-src-diskio.h (+11 lines)
Line 0 Link Here
1
--- src/diskio.h.orig
2
+++ src/diskio.h
3
@@ -47,7 +47,7 @@ struct diskio_stat {
4
 extern struct diskio_stat stats;
5
 
6
 struct diskio_stat *prepare_diskio_stat(const char *);
7
-void update_diskio(void);
8
+int update_diskio(void);
9
 void clear_diskio_stats(void);
10
 void update_diskio_values(struct diskio_stat *, unsigned int, unsigned int);
11
 
(-)conky/files/patch-src-entropy.c (+15 lines)
Line 0 Link Here
1
--- src/entropy.c.orig
2
+++ src/entropy.c
3
@@ -49,10 +49,11 @@ static struct {
4
 	.poolsize = 0,
5
 };
6
 
7
-void update_entropy(void)
8
+int update_entropy(void)
9
 {
10
 	get_entropy_avail(&entropy.avail);
11
 	get_entropy_poolsize(&entropy.poolsize);
12
+	return 0;
13
 }
14
 
15
 void print_entropy_avail(struct text_object *obj, char *p, int p_max_size)
(-)conky/files/patch-src-entropy.h (+11 lines)
Line 0 Link Here
1
--- src/entropy.h.orig
2
+++ src/entropy.h
3
@@ -31,7 +31,7 @@
4
 #ifndef _ENTROPY_H
5
 #define _ENTROPY_H
6
 
7
-void update_entropy(void);
8
+int update_entropy(void);
9
 
10
 void print_entropy_avail(struct text_object *, char *, int);
11
 void print_entropy_perc(struct text_object *, char *, int);
(-)conky/files/patch-src-exec.c (+129 lines)
Line 0 Link Here
1
--- src/exec.c.orig
2
+++ src/exec.c
3
@@ -140,7 +140,8 @@ static inline double get_barnum(char *buf)
4
 	return barnum;
5
 }
6
 
7
-static inline void read_exec(const char *data, char *buf, const int size)
8
+static inline void read_exec(const char *data, char *buf, const int size, const
9
+		char use_alarm)
10
 {
11
 	FILE *fp;
12
 
13
@@ -149,7 +150,7 @@ static inline void read_exec(const char *data, char *buf, const int size)
14
 	if (!data)
15
 		return;
16
 
17
-	alarm(update_interval);
18
+	if (use_alarm) alarm(update_interval);
19
 	fp = pid_popen(data, "r", &childpid);
20
 	if(fp) {
21
 		int length;
22
@@ -163,7 +164,7 @@ static inline void read_exec(const char *data, char *buf, const int size)
23
 	} else {
24
 		buf[0] = '\0';
25
 	}
26
-	alarm(0);
27
+	if (use_alarm) alarm(0);
28
 }
29
 
30
 static void *threaded_exec(void *) __attribute__((noreturn));
31
@@ -176,7 +177,7 @@ static void *threaded_exec(void *arg)
32
 
33
 	while (1) {
34
 		buff = malloc(text_buffer_size);
35
-		read_exec(ed->cmd, buff, text_buffer_size);
36
+		read_exec(ed->cmd, buff, text_buffer_size, 0);
37
 		p2 = buff;
38
 		while (*p2) {
39
 			if (*p2 == '\001') {
40
@@ -216,7 +217,7 @@ void scan_pre_exec_arg(struct text_object *obj, const char *arg)
41
 	char buf[2048];
42
 
43
 	obj->type = OBJ_text;
44
-	read_exec(arg, buf, sizeof(buf));
45
+	read_exec(arg, buf, sizeof(buf), 1);
46
 	obj->data.s = strndup(buf, text_buffer_size);
47
 }
48
 
49
@@ -258,7 +259,7 @@ void scan_execgraph_arg(struct text_object *obj, const char *arg)
50
 
51
 void print_exec(struct text_object *obj, char *p, int p_max_size)
52
 {
53
-	read_exec(obj->data.s, p, p_max_size);
54
+	read_exec(obj->data.s, p, p_max_size, 1);
55
 	remove_deleted_chars(p);
56
 }
57
 
58
@@ -271,7 +272,7 @@ void print_execp(struct text_object *obj, char *p, int p_max_size)
59
 	buf = malloc(text_buffer_size);
60
 	memset(buf, 0, text_buffer_size);
61
 
62
-	read_exec(obj->data.s, buf, text_buffer_size);
63
+	read_exec(obj->data.s, buf, text_buffer_size, 1);
64
 
65
 	tmp_info = malloc(sizeof(struct information));
66
 	memcpy(tmp_info, &info, sizeof(struct information));
67
@@ -292,7 +293,7 @@ void print_execi(struct text_object *obj, char *p, int p_max_size)
68
 	if (time_to_update(ed)) {
69
 		if (!ed->buffer)
70
 			ed->buffer = malloc(text_buffer_size);
71
-		read_exec(ed->cmd, ed->buffer, text_buffer_size);
72
+		read_exec(ed->cmd, ed->buffer, text_buffer_size, 1);
73
 		ed->last_update = current_update_time;
74
 	}
75
 	snprintf(p, p_max_size, "%s", ed->buffer);
76
@@ -365,7 +366,7 @@ void print_execgauge(struct text_object *obj, char *p, int p_max_size)
77
 {
78
 	double barnum;
79
 
80
-	read_exec(obj->data.s, p, p_max_size);
81
+	read_exec(obj->data.s, p, p_max_size, 1);
82
 	barnum = get_barnum(p); /*using the same function*/
83
 
84
 	if (barnum >= 0.0) {
85
@@ -383,7 +384,7 @@ void print_execgraph(struct text_object *obj, char *p, int p_max_size)
86
 	if (!ed)
87
 		return;
88
 
89
-	read_exec(ed->cmd, p, p_max_size);
90
+	read_exec(ed->cmd, p, p_max_size, 1);
91
 	barnum = get_barnum(p);
92
 
93
 	if (barnum > 0) {
94
@@ -401,7 +402,7 @@ void print_execigraph(struct text_object *obj, char *p, int p_max_size)
95
 	if (time_to_update(ed)) {
96
 		double barnum;
97
 
98
-		read_exec(ed->cmd, p, p_max_size);
99
+		read_exec(ed->cmd, p, p_max_size, 1);
100
 		barnum = get_barnum(p);
101
 
102
 		if (barnum >= 0.0) {
103
@@ -423,7 +424,7 @@ void print_execigauge(struct text_object *obj, char *p, int p_max_size)
104
 	if (time_to_update(ed)) {
105
 		double barnum;
106
 
107
-		read_exec(ed->cmd, p, p_max_size);
108
+		read_exec(ed->cmd, p, p_max_size, 1);
109
 		barnum = get_barnum(p);
110
 
111
 		if (barnum >= 0.0) {
112
@@ -437,7 +438,7 @@ void print_execigauge(struct text_object *obj, char *p, int p_max_size)
113
 void print_execbar(struct text_object *obj, char *p, int p_max_size)
114
 {
115
 	double barnum;
116
-	read_exec(obj->data.s, p, p_max_size);
117
+	read_exec(obj->data.s, p, p_max_size, 1);
118
 	barnum = get_barnum(p);
119
 
120
 	if (barnum >= 0.0) {
121
@@ -455,7 +456,7 @@ void print_execibar(struct text_object *obj, char *p, int p_max_size)
122
 		return;
123
 
124
 	if (time_to_update(ed)) {
125
-		read_exec(ed->cmd, p, p_max_size);
126
+		read_exec(ed->cmd, p, p_max_size, 1);
127
 		barnum = get_barnum(p);
128
 
129
 		if (barnum >= 0.0) {
(-)conky/files/patch-src-freebsd.c (-20 / +246 lines)
Lines 1-7 Link Here
1
--- src/freebsd.c.orig	2009-08-09 00:05:55.000000000 +0400
1
--- src/freebsd.c.orig
2
+++ src/freebsd.c	2010-01-11 01:20:59.000000000 +0300
2
+++ src/freebsd.c
3
@@ -284,40 +284,38 @@
3
@@ -67,7 +67,7 @@
4
 #endif
5
 
6
 __attribute__((gnu_inline)) inline void
7
-proc_find_top(struct process **cpu, struct process **mem);
8
+proc_find_top(struct process **cpu, struct process **mem, struct process **time);
9
 
10
 static short cpu_setup = 0;
11
 
12
@@ -118,7 +118,7 @@ void prepare_update(void)
13
 {
14
 }
15
 
16
-void update_uptime(void)
17
+int update_uptime(void)
18
 {
19
 	int mib[2] = { CTL_KERN, KERN_BOOTTIME };
20
 	struct timeval boottime;
21
@@ -133,6 +133,8 @@ void update_uptime(void)
22
 		fprintf(stderr, "Could not get uptime\n");
23
 		info.uptime = 0;
24
 	}
25
+
26
+	return 0;
27
 }
28
 
29
 int check_mount(char *s)
30
@@ -150,7 +152,7 @@ int check_mount(char *s)
31
 	return 0;
32
 }
33
 
34
-void update_meminfo(void)
35
+int update_meminfo(void)
36
 {
37
 	u_int total_pages, inactive_pages, free_pages;
38
 	unsigned long swap_avail, swap_free;
39
@@ -182,9 +184,11 @@ void update_meminfo(void)
40
 		info.swap = 0;
41
 		info.swapfree = 0;
42
 	}
43
+
44
+	return 0;
45
 }
46
 
47
-void update_net_stats(void)
48
+int update_net_stats(void)
49
 {
50
 	struct net_stat *ns;
51
 	double delta;
52
@@ -195,11 +199,11 @@ void update_net_stats(void)
53
 	/* get delta */
54
 	delta = current_update_time - last_update_time;
55
 	if (delta <= 0.0001) {
56
-		return;
57
+		return 0;
58
 	}
59
 
60
 	if (getifaddrs(&ifap) < 0) {
61
-		return;
62
+		return 0;
63
 	}
64
 
65
 	for (ifa = ifap; ifa; ifa = ifa->ifa_next) {
66
@@ -255,18 +259,20 @@ void update_net_stats(void)
67
 	}
68
 
69
 	freeifaddrs(ifap);
70
+	return 0;
71
 }
72
 
73
-void update_total_processes(void)
74
+int update_total_processes(void)
75
 {
76
 	int n_processes;
77
 
78
 	kvm_getprocs(kd, KERN_PROC_ALL, 0, &n_processes);
79
 
80
 	info.procs = n_processes;
81
+	return 0;
82
 }
83
 
84
-void update_running_processes(void)
85
+int update_running_processes(void)
86
 {
87
 	struct kinfo_proc *p;
88
 	int n_processes;
89
@@ -284,42 +290,41 @@ void update_running_processes(void)
90
 	}
91
 
4
 	info.run_procs = cnt;
92
 	info.run_procs = cnt;
93
+	return 0;
5
 }
94
 }
6
 
95
 
7
-struct cpu_load_struct {
96
-struct cpu_load_struct {
Lines 39-50 Link Here
39
 }
128
 }
40
 
129
 
41
-/* XXX: SMP support */
130
-/* XXX: SMP support */
131
-void update_cpu_usage(void)
42
+struct cpu_info {
132
+struct cpu_info {
43
+	long oldtotal;
133
+	long oldtotal;
44
+	long oldused;
134
+	long oldused;
45
+};
135
+};
46
+
136
+
47
 void update_cpu_usage(void)
137
+int update_cpu_usage(void)
48
 {
138
 {
49
+	int i, j = 0;
139
+	int i, j = 0;
50
 	long used, total;
140
 	long used, total;
Lines 58-64 Link Here
58
 
148
 
59
 	/* add check for !info.cpu_usage since that mem is freed on a SIGUSR1 */
149
 	/* add check for !info.cpu_usage since that mem is freed on a SIGUSR1 */
60
 	if ((cpu_setup == 0) || (!info.cpu_usage)) {
150
 	if ((cpu_setup == 0) || (!info.cpu_usage)) {
61
@@ -325,28 +323,68 @@
151
@@ -327,31 +332,72 @@ void update_cpu_usage(void)
62
 		cpu_setup = 1;
152
 		cpu_setup = 1;
63
 	}
153
 	}
64
 
154
 
Lines 69-82 Link Here
69
+		cpu = malloc(malloc_cpu_size);
159
+		cpu = malloc(malloc_cpu_size);
70
+		memset(cpu, 0, malloc_cpu_size);
160
+		memset(cpu, 0, malloc_cpu_size);
71
+		global_cpu = cpu;
161
+		global_cpu = cpu;
72
+	}
73
+
74
+	/* cpu[0] is overall stats, get it from separate sysctl */
75
+	cp_len = CPUSTATES * sizeof(long);
76
+	cp_time = malloc(cp_len);
77
+
78
+	if (sysctlbyname("kern.cp_time", cp_time, &cp_len, NULL, 0) < 0) {
79
+		fprintf(stderr, "Cannot get kern.cp_time\n");
80
 	}
162
 	}
81
 
163
 
82
-	fresh.load[0] = cp_time[CP_USER];
164
-	fresh.load[0] = cp_time[CP_USER];
Lines 84-100 Link Here
84
-	fresh.load[2] = cp_time[CP_SYS];
166
-	fresh.load[2] = cp_time[CP_SYS];
85
-	fresh.load[3] = cp_time[CP_IDLE];
167
-	fresh.load[3] = cp_time[CP_IDLE];
86
-	fresh.load[4] = cp_time[CP_IDLE];
168
-	fresh.load[4] = cp_time[CP_IDLE];
87
-
169
+	/* cpu[0] is overall stats, get it from separate sysctl */
170
+	cp_len = CPUSTATES * sizeof(long);
171
+	cp_time = malloc(cp_len);
172
 
88
-	used = fresh.load[0] + fresh.load[1] + fresh.load[2];
173
-	used = fresh.load[0] + fresh.load[1] + fresh.load[2];
89
-	total = fresh.load[0] + fresh.load[1] + fresh.load[2] + fresh.load[3];
174
-	total = fresh.load[0] + fresh.load[1] + fresh.load[2] + fresh.load[3];
90
-
175
+	if (sysctlbyname("kern.cp_time", cp_time, &cp_len, NULL, 0) < 0) {
91
-	if ((total - oldtotal) != 0) {
176
+		fprintf(stderr, "Cannot get kern.cp_time\n");
92
-		info.cpu_usage[0] = ((double) (used - oldused)) /
177
+	}
93
-			(double) (total - oldtotal);
178
+
94
+	total = 0;
179
+	total = 0;
95
+	for (j = 0; j < CPUSTATES; j++)
180
+	for (j = 0; j < CPUSTATES; j++)
96
+		total += cp_time[j];
181
+		total += cp_time[j];
97
+
182
 
183
-	if ((total - oldtotal) != 0) {
184
-		info.cpu_usage[0] = ((double) (used - oldused)) /
185
-			(double) (total - oldtotal);
98
+	used = total - cp_time[CP_IDLE];
186
+	used = total - cp_time[CP_IDLE];
99
+
187
+
100
+	if ((total - cpu[0].oldtotal) != 0) {
188
+	if ((total - cpu[0].oldtotal) != 0) {
Lines 140-145 Link Here
140
+	}
228
+	}
141
+
229
+
142
+	free(cp_time);
230
+	free(cp_time);
231
+	return 0;
143
 }
232
 }
144
 
233
 
145
 void update_load_average(void)
234
-void update_load_average(void)
235
+int update_load_average(void)
236
 {
237
 	double v[3];
238
 
239
@@ -360,6 +406,8 @@ void update_load_average(void)
240
 	info.loadavg[0] = (double) v[0];
241
 	info.loadavg[1] = (double) v[1];
242
 	info.loadavg[2] = (double) v[2];
243
+
244
+	return 0;
245
 }
246
 
247
 double get_acpi_temperature(int fd)
248
@@ -540,9 +588,10 @@ char get_freq(char *p_client_buffer, size_t client_buffer_size, const char *p_fo
249
 	return 1;
250
 }
251
 
252
-void update_top(void)
253
+int update_top(void)
254
 {
255
-	proc_find_top(info.cpu, info.memu);
256
+	proc_find_top(info.cpu, info.memu, info.time);
257
+	return 0;
258
 }
259
 
260
 #if 0
261
@@ -600,7 +649,7 @@ cleanup:
262
 }
263
 #endif
264
 
265
-void update_diskio(void)
266
+int update_diskio(void)
267
 {
268
 	int devs_count, num_selected, num_selections, dn;
269
 	struct device_selection *dev_select = NULL;
270
@@ -618,7 +667,7 @@ void update_diskio(void)
271
 
272
 	if (devstat_getdevs(NULL, &statinfo_cur) < 0) {
273
 		free(statinfo_cur.dinfo);
274
-		return;
275
+		return 0;
276
 	}
277
 
278
 	devs_count = statinfo_cur.dinfo->numdevs;
279
@@ -650,6 +699,7 @@ void update_diskio(void)
280
 	}
281
 
282
 	free(statinfo_cur.dinfo);
283
+	return 0;
284
 }
285
 
286
 /* While topless is obviously better, top is also not bad. */
287
@@ -676,8 +726,15 @@ int comparemem(const void *a, const void *b)
288
 	}
289
 }
290
 
291
+int comparetime(const void *va, const void *vb)
292
+{
293
+	struct process *a = (struct process *)va, *b = (struct process *)vb;
294
+
295
+	return b->total_cpu_time - a->total_cpu_time;
296
+}
297
+
298
 __attribute__((gnu_inline)) inline void
299
-proc_find_top(struct process **cpu, struct process **mem)
300
+proc_find_top(struct process **cpu, struct process **mem, struct process **time)
301
 {
302
 	struct kinfo_proc *p;
303
 	int n_processes;
304
@@ -701,6 +758,9 @@ proc_find_top(struct process **cpu, struct process **mem)
305
 			processes[j].amount = 100.0 * p[i].ki_pctcpu / FSCALE;
306
 			processes[j].vsize = p[i].ki_size;
307
 			processes[j].rss = (p[i].ki_rssize * getpagesize());
308
+			/* ki_runtime is in microseconds, total_cpu_time in centiseconds.
309
+			 * Therefore we divide by 10000. */
310
+			processes[j].total_cpu_time = p[i].ki_runtime / 10000;
311
 			j++;
312
 		}
313
 	}
314
@@ -710,11 +770,8 @@ proc_find_top(struct process **cpu, struct process **mem)
315
 		struct process *tmp, *ttmp;
316
 
317
 		tmp = malloc(sizeof(struct process));
318
-		tmp->pid = processes[i].pid;
319
-		tmp->amount = processes[i].amount;
320
+		memcpy(tmp, &processes[i], sizeof(struct process));
321
 		tmp->name = strndup(processes[i].name, text_buffer_size);
322
-		tmp->rss = processes[i].rss;
323
-		tmp->vsize = processes[i].vsize;
324
 
325
 		ttmp = mem[i];
326
 		mem[i] = tmp;
327
@@ -729,11 +786,8 @@ proc_find_top(struct process **cpu, struct process **mem)
328
 		struct process *tmp, *ttmp;
329
 
330
 		tmp = malloc(sizeof(struct process));
331
-		tmp->pid = processes[i].pid;
332
-		tmp->amount = processes[i].amount;
333
+		memcpy(tmp, &processes[i], sizeof(struct process));
334
 		tmp->name = strndup(processes[i].name, text_buffer_size);
335
-		tmp->rss = processes[i].rss;
336
-		tmp->vsize = processes[i].vsize;
337
 
338
 		ttmp = cpu[i];
339
 		cpu[i] = tmp;
340
@@ -743,6 +797,22 @@ proc_find_top(struct process **cpu, struct process **mem)
341
 		}
342
 	}
343
 
344
+	qsort(processes, j - 1, sizeof(struct process), comparetime);
345
+	for (i = 0; i < 10 && i < n_processes; i++) {
346
+		struct process *tmp, *ttmp;
347
+
348
+		tmp = malloc(sizeof(struct process));
349
+		memcpy(tmp, &processes[i], sizeof(struct process));
350
+		tmp->name = strndup(processes[i].name, text_buffer_size);
351
+
352
+		ttmp = time[i];
353
+		time[i] = tmp;
354
+		if (ttmp != NULL) {
355
+			free(ttmp->name);
356
+			free(ttmp);
357
+		}
358
+	}
359
+
360
 #if defined(FREEBSD_DEBUG)
361
 	printf("=====\nmem\n");
362
 	for (i = 0; i < 10; i++) {
363
@@ -916,8 +986,3 @@ int get_entropy_poolsize(unsigned int *val)
364
 	(void)val;
365
 	return 1;
366
 }
367
-
368
-/* empty stub so conky links */
369
-void free_all_processes(void)
370
-{
371
-}
(-)conky/files/patch-src-fs.c (+26 lines)
Line 0 Link Here
1
--- src/fs.c.orig
2
+++ src/fs.c
3
@@ -65,13 +65,13 @@ static void update_fs_stat(struct fs_stat *fs);
4
 
5
 void get_fs_type(const char *path, char *result);
6
 
7
-void update_fs_stats(void)
8
+int update_fs_stats(void)
9
 {
10
 	unsigned i;
11
 	static double last_fs_update = 0.0;
12
 
13
 	if (current_update_time - last_fs_update < 13)
14
-		return;
15
+		return 0;
16
 
17
 	for (i = 0; i < MAX_FS_STATS; ++i) {
18
 		if (fs_stats[i].set) {
19
@@ -79,6 +79,7 @@ void update_fs_stats(void)
20
 		}
21
 	}
22
 	last_fs_update = current_update_time;
23
+	return 0;
24
 }
25
 
26
 void clear_fs_stats(void)
(-)conky/files/patch-src-fs.h (+11 lines)
Line 0 Link Here
1
--- src/fs.h.orig
2
+++ src/fs.h
3
@@ -28,7 +28,7 @@ void print_fs_size(struct text_object *, char *, int);
4
 void print_fs_used(struct text_object *, char *, int);
5
 void print_fs_type(struct text_object *, char *, int);
6
 
7
-void update_fs_stats(void);
8
+int update_fs_stats(void);
9
 struct fs_stat *prepare_fs_stat(const char *path);
10
 void clear_fs_stats(void);
11
 
(-)conky/files/patch-src-i8k.c (+34 lines)
Line 0 Link Here
1
--- src/i8k.c.orig
2
+++ src/i8k.c
3
@@ -53,7 +53,7 @@ struct {
4
 #define PROC_I8K "/proc/i8k"
5
 #define I8K_DELIM " "
6
 static char *i8k_procbuf = NULL;
7
-void update_i8k(void)
8
+int update_i8k(void)
9
 {
10
 	FILE *fp;
11
 
12
@@ -61,8 +61,13 @@ void update_i8k(void)
13
 		i8k_procbuf = (char *) malloc(128 * sizeof(char));
14
 	}
15
 	if ((fp = fopen(PROC_I8K, "r")) == NULL) {
16
-		CRIT_ERR(NULL, NULL, "/proc/i8k doesn't exist! use insmod to make sure the kernel "
17
+		free(i8k_procbuf);
18
+		i8k_procbuf = NULL;
19
+		NORM_ERR("/proc/i8k doesn't exist! use insmod to make sure the kernel "
20
 			"driver is loaded...");
21
+		clean_up_without_threads(NULL, NULL);
22
+		free(current_mail_spool);
23
+		return 1;
24
 	}
25
 
26
 	memset(&i8k_procbuf[0], 0, 128);
27
@@ -82,6 +87,7 @@ void update_i8k(void)
28
 	i8k.right_fan_rpm = strtok(NULL, I8K_DELIM);
29
 	i8k.ac_status = strtok(NULL, I8K_DELIM);
30
 	i8k.buttons_status = strtok(NULL, I8K_DELIM);
31
+	return 0;
32
 }
33
 
34
 static const char *fan_status_to_string(int status)
(-)conky/files/patch-src-i8k.h (+11 lines)
Line 0 Link Here
1
--- src/i8k.h.orig
2
+++ src/i8k.h
3
@@ -32,7 +32,7 @@
4
 #ifndef _I8K_H
5
 #define _I8K_H
6
 
7
-void update_i8k(void);
8
+int update_i8k(void);
9
 void print_i8k_left_fan_status(struct text_object *, char *, int);
10
 void print_i8k_cpu_temp(struct text_object *, char *, int);
11
 void print_i8k_right_fan_status(struct text_object *, char *, int);
(-)conky/files/patch-src-logging.h (+20 lines)
Line 0 Link Here
1
--- src/logging.h.orig
2
+++ src/logging.h
3
@@ -30,6 +30,7 @@
4
 #include "mail.h"
5
 
6
 void clean_up(void *memtofree1, void* memtofree2);
7
+void clean_up_without_threads(void *memtofree1, void* memtofree2);
8
 
9
 #ifndef _LOGGING_H
10
 #define _LOGGING_H
11
@@ -44,6 +45,9 @@ void clean_up(void *memtofree1, void* memtofree2);
12
 #define CRIT_ERR(memtofree1, memtofree2, ...) \
13
 	{ NORM_ERR(__VA_ARGS__); clean_up(memtofree1, memtofree2); free(current_mail_spool); exit(EXIT_FAILURE); }
14
 
15
+#define THREAD_CRIT_ERR(memtofree1, memtofree2, ...) \
16
+	{ NORM_ERR(__VA_ARGS__); clean_up_without_threads(memtofree1, memtofree2); free(current_mail_spool); return; }
17
+
18
 /* debugging output */
19
 extern int global_debug_level;
20
 #define __DBGP(level, ...) \
(-)conky/files/patch-src-mail.c (+46 lines)
Line 0 Link Here
1
--- src/mail.c.orig
2
+++ src/mail.c
3
@@ -61,6 +61,8 @@
4
 #define POP3_TYPE 1
5
 #define IMAP_TYPE 2
6
 
7
+#define MAXFOLDERSIZE 128
8
+
9
 struct mail_s {			// for imap and pop3
10
 	unsigned long unseen;
11
 	unsigned long messages;
12
@@ -74,7 +76,7 @@ struct mail_s {			// for imap and pop3
13
 	char user[128];
14
 	char pass[128];
15
 	char command[1024];
16
-	char folder[128];
17
+	char folder[MAXFOLDERSIZE];
18
 	timed_thread *p_timed_thread;
19
 	char secure;
20
 };
21
@@ -465,17 +467,20 @@ struct mail_s *parse_mail_args(char type, const char *arg)
22
 	if (type == IMAP_TYPE) {
23
 		tmp = strstr(arg, "-f ");
24
 		if (tmp) {
25
-			int len = 1024;
26
+			int len = MAXFOLDERSIZE-1;
27
 			tmp += 3;
28
 			if (tmp[0] == '\'') {
29
 				len = strstr(tmp + 1, "'") - tmp - 1;
30
-				if (len > 1024) {
31
-					len = 1024;
32
+				if (len > MAXFOLDERSIZE-1) {
33
+					len = MAXFOLDERSIZE-1;
34
 				}
35
+				tmp++;
36
 			}
37
-			strncpy(mail->folder, tmp + 1, len);
38
+			strncpy(mail->folder, tmp, len);
39
+			mail->folder[len-1] = 0;
40
 		} else {
41
-			strncpy(mail->folder, "INBOX", 128);	// default imap inbox
42
+			strncpy(mail->folder, "INBOX", MAXFOLDERSIZE-1);	// default imap inbox
43
+			mail->folder[MAXFOLDERSIZE-1] = 0;
44
 		}
45
 	}
46
 	tmp = strstr(arg, "-e ");
(-)conky/files/patch-src-mixer.c (+196 lines)
Line 0 Link Here
1
--- src/mixer.c.orig
2
+++ src/mixer.c
3
@@ -38,9 +38,6 @@
4
 #include <ctype.h>
5
 
6
 
7
-#ifdef MIXER_IS_ALSA
8
-#include <alsa/asoundlib.h>
9
-#else
10
 #ifdef HAVE_LINUX_SOUNDCARD_H
11
 #include <linux/soundcard.h>
12
 #else
13
@@ -50,173 +47,12 @@
14
 #include <sys/soundcard.h>
15
 #endif /* __OpenBSD__ */
16
 #endif /* HAVE_LINUX_SOUNDCARD_H */
17
-#endif /* MIXER_IS_ALSA */
18
 
19
 #define MIXER_DEV "/dev/mixer"
20
 
21
-#ifdef MIXER_IS_ALSA
22
-#define MAX_MIXERS 8
23
-struct mixer_control {
24
-	char name[64];
25
-	snd_mixer_t *mixer;
26
-	snd_mixer_selem_id_t *sid;
27
-	snd_mixer_elem_t *elem;
28
-	long vol_min, vol_max;
29
-};
30
-
31
-static struct mixer_control mixer_data[MAX_MIXERS];
32
-int num_mixers = 0;
33
-static char soundcard[64] = "default";
34
-#else
35
 static int mixer_fd;
36
 static const char *devs[] = SOUND_DEVICE_NAMES;
37
-#endif
38
-
39
-#ifdef MIXER_IS_ALSA
40
-static int parse_simple_id(const char *str, snd_mixer_selem_id_t *sid)
41
-{
42
-	int c, size;
43
-	char buf[128];
44
-	char *ptr = buf;
45
-
46
-	while (*str == ' ' || *str == '\t')
47
-		str++;
48
-	if (!(*str))
49
-		return -EINVAL;
50
-	size = 1;	/* for '\0' */
51
-	if (*str != '"' && *str != '\'') {
52
-		while (*str && *str != ',') {
53
-			if (size < (int)sizeof(buf)) {
54
-				*ptr++ = *str;
55
-				size++;
56
-			}
57
-			str++;
58
-		}
59
-	} else {
60
-		c = *str++;
61
-		while (*str && *str != c) {
62
-			if (size < (int)sizeof(buf)) {
63
-				*ptr++ = *str;
64
-				size++;
65
-			}
66
-			str++;
67
-		}
68
-		if (*str == c)
69
-			str++;
70
-	}
71
-	if (*str == '\0') {
72
-		snd_mixer_selem_id_set_index(sid, 0);
73
-		*ptr = 0;
74
-		goto _set;
75
-	}
76
-	if (*str != ',')
77
-		return -EINVAL;
78
-	*ptr = 0;	/* terminate the string */
79
-	str++;
80
-	if (!isdigit(*str))
81
-		return -EINVAL;
82
-	snd_mixer_selem_id_set_index(sid, atoi(str));
83
-       _set:
84
-	snd_mixer_selem_id_set_name(sid, buf);
85
-	return 0;
86
-}
87
-
88
-int mixer_init (const char *name)
89
-{
90
-	/* from amixer.c, replaced -EINVAL with -1 */
91
-	int i, err;
92
-	if (!name)
93
-		name = "Master";
94
-
95
-	for (i = 0; i < num_mixers; i++) {
96
-		if (!strcasecmp (mixer_data[i].name, name)) {
97
-			return i;
98
-		}
99
-	}
100
-	if (i == MAX_MIXERS) {
101
-		fprintf (stderr, "max mixers (%d) reached\n", MAX_MIXERS);
102
-		return -1;
103
-	};
104
-
105
-	num_mixers++;
106
-#define data mixer_data[i]
107
-
108
-	strncpy (mixer_data[i].name, name, 63);
109
-	mixer_data[i].name[63] = '\0';
110
-	snd_mixer_selem_id_alloca (&data.sid);
111
-	data.mixer = NULL;
112
-	if (parse_simple_id (name, data.sid) < 0) {
113
-		fprintf (stderr, "Wrong mixer identifier: %s\n", name);
114
-		return -1;
115
-	}
116
-	if ((err = snd_mixer_open (&data.mixer, 0)) < 0) {
117
-		fprintf (stderr, "snd_mixer_open: %s\n", snd_strerror (err));
118
-		return -1;
119
-	}
120
-	if ((err = snd_mixer_attach (data.mixer, soundcard)) < 0) {
121
-		fprintf (stderr, "snd_mixer_attach: %s\n", snd_strerror (err));
122
-		return -1;
123
-	}
124
-	if ((err = snd_mixer_selem_register (data.mixer, NULL, NULL)) < 0) {
125
-		fprintf (stderr, "snd_mixer_selem_register: %s\n",
126
-			 snd_strerror (err));
127
-		return -1;
128
-	}
129
-	if ((err = snd_mixer_load (data.mixer)) < 0) {
130
-		fprintf (stderr, "snd_mixer_load: %s\n", snd_strerror (err));
131
-		return -1;
132
-	}
133
-	if (!(data.elem = snd_mixer_find_selem (data.mixer, data.sid))) {
134
-		fprintf (stderr, "snd_mixer_find_selem (\"%s\", %i)\n",
135
-			 snd_mixer_selem_id_get_name (data.sid),
136
-			 snd_mixer_selem_id_get_index (data.sid));
137
-		return -1;
138
-	}
139
-	snd_mixer_selem_get_playback_volume_range(data.elem, &data.vol_min, &data.vol_max);
140
-	return i;
141
-}
142
-static int mixer_get_avg (int i)
143
-{
144
-	long val;
145
-
146
-	snd_mixer_handle_events (data.mixer);
147
-	snd_mixer_selem_get_playback_volume (data.elem, 0, &val);
148
-	if(data.vol_max != 100) {
149
-		float avgf = ((float)val / data.vol_max) * 100;
150
-		int avg = (int)avgf;
151
-		return (avgf - avg < 0.5) ? avg : avg + 1;
152
-	}
153
-	return (int) val;
154
-}
155
-static int mixer_get_left (int i)
156
-{
157
-  /* stub */
158
-  return mixer_get_avg (i);
159
-}
160
-static int mixer_get_right (int i)
161
-{
162
-  /* stub */
163
-  return mixer_get_avg (i);
164
-}
165
-int mixer_to_255(int i, int x)
166
-{
167
-  return (x-data.vol_min)*255/(data.vol_max-data.vol_min);
168
-}
169
-int mixer_is_mute(int i)
170
-{
171
-	snd_mixer_handle_events (data.mixer);
172
-	if (snd_mixer_selem_has_playback_switch (data.elem)) {
173
-		int val, err;
174
-		if ((err = snd_mixer_selem_get_playback_switch(data.elem, 0, &val)) < 0)
175
-			fprintf (stderr, "playback_switch: %s\n", snd_strerror (err));
176
-		return !val;
177
-	} else {
178
-		return !mixer_get_avg(i);
179
-	}
180
-}
181
-#undef data
182
 
183
-#else /* MIXER_IS_ALSA */
184
 int mixer_init(const char *name)
185
 {
186
 	unsigned int i;
187
@@ -281,8 +117,7 @@ int mixer_is_mute(int i)
188
 	return !mixer_get(i);
189
 }
190
 
191
-#define mixer_to_255(i, x) x
192
-#endif /* MIXER_IS_ALSA */
193
+#define mixer_to_255(i, x) x * 2.55
194
 
195
 void parse_mixer_arg(struct text_object *obj, const char *arg)
196
 {
(-)conky/files/patch-src-moc.c (+12 lines)
Line 0 Link Here
1
--- src/moc.c.orig
2
+++ src/moc.c
3
@@ -133,7 +133,8 @@ static int run_moc_thread(double interval)
4
 	return 0;
5
 }
6
 
7
-void update_moc(void)
8
+int update_moc(void)
9
 {
10
 	run_moc_thread(info.music_player_interval * 100000);
11
+	return 0;
12
 }
(-)conky/files/patch-src-moc.h (+11 lines)
Line 0 Link Here
1
--- src/moc.h.orig
2
+++ src/moc.h
3
@@ -40,7 +40,7 @@ struct moc_s {
4
 };
5
 extern struct moc_s moc;
6
 
7
-void update_moc(void);
8
+int update_moc(void);
9
 void free_moc(void);
10
 
11
 #endif /* MOC_H_ */
(-)conky/files/patch-src-mpd.c (+30 lines)
Line 0 Link Here
1
--- src/mpd.c.orig
2
+++ src/mpd.c
3
@@ -113,23 +113,24 @@ void free_mpd(void)
4
 
5
 static void *update_mpd_thread(void *) __attribute__((noreturn));
6
 
7
-void update_mpd(void)
8
+int update_mpd(void)
9
 {
10
 	int interval;
11
 	static timed_thread *thread = NULL;
12
 
13
 	if (thread)
14
-		return;
15
+		return 0;
16
 
17
 	interval = info.music_player_interval * 1000000;
18
 	thread = timed_thread_create(&update_mpd_thread, &thread, interval);
19
 	if (!thread) {
20
 		NORM_ERR("Failed to create MPD timed thread");
21
-		return;
22
+		return 0;
23
 	}
24
 	timed_thread_register(thread, &thread);
25
 	if (timed_thread_run(thread))
26
 		NORM_ERR("Failed to run MPD timed thread");
27
+	return 0;
28
 }
29
 
30
 /* stringMAXdup dups at most text_buffer_size bytes */
(-)conky/files/patch-src-mpd.h (+11 lines)
Line 0 Link Here
1
--- src/mpd.h.orig
2
+++ src/mpd.h
3
@@ -31,7 +31,7 @@ int mpd_set_port(const char *);
4
 void init_mpd(void);
5
 struct mpd_s *mpd_get_info(void);
6
 void free_mpd(void);
7
-void update_mpd(void);
8
+int update_mpd(void);
9
 
10
 void print_mpd_elapsed(struct text_object *, char *, int);
11
 void print_mpd_length(struct text_object *, char *, int);
(-)conky/files/patch-src-net_stat.c (+28 lines)
Line 0 Link Here
1
--- src/net_stat.c.orig
2
+++ src/net_stat.c
3
@@ -400,7 +400,7 @@ void free_dns_data(void)
4
 	memset(&dns_data, 0, sizeof(dns_data));
5
 }
6
 
7
-void update_dns_data(void)
8
+int update_dns_data(void)
9
 {
10
 	FILE *fp;
11
 	char line[256];
12
@@ -416,7 +416,7 @@ void update_dns_data(void)
13
 	free_dns_data();
14
 
15
 	if ((fp = fopen("/etc/resolv.conf", "r")) == NULL)
16
-		return;
17
+		return 0;
18
 	while(!feof(fp)) {
19
 		if (fgets(line, 255, fp) == NULL) {
20
 			break;
21
@@ -429,6 +429,7 @@ void update_dns_data(void)
22
 		}
23
 	}
24
 	fclose(fp);
25
+	return 0;
26
 }
27
 
28
 void parse_nameserver_arg(struct text_object *obj, const char *arg)
(-)conky/files/patch-src-net_stat.h (+11 lines)
Line 0 Link Here
1
--- src/net_stat.h.orig
2
+++ src/net_stat.h
3
@@ -94,7 +94,7 @@ int interface_up(struct text_object *);
4
 void free_if_up(struct text_object *);
5
 
6
 void free_dns_data(void);
7
-void update_dns_data(void);
8
+int update_dns_data(void);
9
 void parse_nameserver_arg(struct text_object *, const char *);
10
 void print_nameserver(struct text_object *, char *, int);
11
 
(-)conky/files/patch-src-read_tcp.c (+11 lines)
Line 0 Link Here
1
--- src/read_tcp.c.orig
2
+++ src/read_tcp.c
3
@@ -87,7 +87,7 @@ void print_read_tcp(struct text_object *obj, char *p, int p_max_size)
4
 	addr.sin_family = AF_INET;
5
 	addr.sin_port = rtd->port;
6
 	memcpy(&addr.sin_addr, he->h_addr, he->h_length);
7
-	if (!connect(sock, (struct sockaddr*)&addr, sizeof(struct sockaddr))) {
8
+	if (connect(sock, (struct sockaddr*)&addr, sizeof(struct sockaddr)) != 0) {
9
 		NORM_ERR("read_tcp: Couldn't create a connection");
10
 		return;
11
 	}
(-)conky/files/patch-src-rss.c (+11 lines)
Line 0 Link Here
1
--- src/rss.c.orig
2
+++ src/rss.c
3
@@ -67,7 +67,7 @@ static void rss_process_info(char *p, int p_max_size, char *uri, char *action, i
4
 		curloc->result = malloc(sizeof(PRSS));
5
 		memset(curloc->result, 0, sizeof(PRSS));
6
 		curloc->process_function = &prss_parse_data;
7
-		ccurl_init_thread(curloc, interval);
8
+		ccurl_init_thread(curloc, interval * 60);
9
 		if (!curloc->p_timed_thread) {
10
 			NORM_ERR("error setting up RSS thread");
11
 		}
(-)conky/files/patch-src-tcp-portmon.c (+14 lines)
Line 0 Link Here
1
--- src/tcp-portmon.c.orig
2
+++ src/tcp-portmon.c
3
@@ -139,9 +139,10 @@ int tcp_portmon_action(struct text_object *obj, char *p, int p_max_size)
4
 	return 0;
5
 }
6
 
7
-void tcp_portmon_update(void)
8
+int tcp_portmon_update(void)
9
 {
10
 	update_tcp_port_monitor_collection(pmc);
11
+	return 0;
12
 }
13
 
14
 int tcp_portmon_clear(void)
(-)conky/files/patch-src-tcp-portmon.h (+11 lines)
Line 0 Link Here
1
--- src/tcp-portmon.h.orig
2
+++ src/tcp-portmon.h
3
@@ -40,7 +40,7 @@ struct text_object;
4
 
5
 int tcp_portmon_init(struct text_object *, const char *);
6
 int tcp_portmon_action(struct text_object *, char *, int);
7
-void tcp_portmon_update(void);
8
+int tcp_portmon_update(void);
9
 int tcp_portmon_clear(void);
10
 int tcp_portmon_set_max_connections(int);
11
 void tcp_portmon_free(struct text_object *);
(-)conky/files/patch-src-text_object.h (+10 lines)
Line 0 Link Here
1
--- src/text_object.h.orig
2
+++ src/text_object.h
3
@@ -230,6 +230,7 @@ enum text_object_type {
4
 #endif /* X11 */
5
 	OBJ_nameserver,
6
 	OBJ_nodename,
7
+	OBJ_nodename_short,
8
 	OBJ_nvidia,
9
 	OBJ_pre_exec,
10
 	OBJ_cmdline_to_pid,
(-)conky/files/patch-src-top.c (+25 lines)
Line 0 Link Here
1
--- src/top.c.orig
2
+++ src/top.c
3
@@ -880,16 +880,22 @@ int parse_top_args(const char *s, const char *arg, struct text_object *obj)
4
 #else /* IOSTATS */
5
 			NORM_ERR("must be one of: name, cpu, pid, mem, time, mem_res, mem_vsize");
6
 #endif /* IOSTATS */
7
+			free(td->s);
8
+			free(obj->data.opaque);
9
 			return 0;
10
 		}
11
 		if (n < 1 || n > 10) {
12
 			NORM_ERR("invalid num arg for top. Must be between 1 and 10.");
13
+			free(td->s);
14
+			free(obj->data.opaque);
15
 			return 0;
16
 		} else {
17
 			td->num = n - 1;
18
 		}
19
 	} else {
20
 		NORM_ERR("invalid argument count for top");
21
+		free(td->s);
22
+		free(obj->data.opaque);
23
 		return 0;
24
 	}
25
 	return 1;
(-)conky/files/patch-src-users.c (+17 lines)
Line 0 Link Here
1
--- src/users.c.orig
2
+++ src/users.c
3
@@ -157,7 +157,7 @@ void update_user_time(char *tty)
4
 	}
5
 }
6
 
7
-void update_users(void)
8
+int update_users(void)
9
 {
10
 	struct information *current_info = &info;
11
 	char temp[BUFLEN] = "";
12
@@ -221,4 +221,5 @@ void update_users(void)
13
 		current_info->users.times = malloc(text_buffer_size);
14
 		strncpy(current_info->users.times, "broken", text_buffer_size);
15
 	}
16
+	return 0;
17
 }
(-)conky/files/patch-src-x11.c (+37 lines)
Line 0 Link Here
1
--- src/x11.c.orig
2
+++ src/x11.c
3
@@ -44,7 +44,7 @@
4
 
5
 #ifdef XFT
6
 #include <X11/Xft/Xft.h>
7
-int use_xft = 0;
8
+int use_xft;
9
 #endif
10
 
11
 #ifdef HAVE_XDBE
12
@@ -336,7 +336,7 @@ void init_window(int own_window, int w, int h, int set_trans, int back_colour,
13
 			XClassHint classHint;
14
 			XWMHints wmHint;
15
 			Atom xa;
16
-			
17
+
18
 #ifdef USE_ARGB
19
 			if (have_argb_visual) {
20
 				attrs.colormap = window.colourmap;
21
@@ -775,13 +775,14 @@ void get_x11_desktop_info(Display *current_display, Atom atom)
22
 	}
23
 }
24
 
25
-void update_x11info(void)
26
+int update_x11info(void)
27
 {
28
 	struct information *current_info = &info;
29
 	if (x_initialised != YES)
30
-		return;
31
+		return 0;
32
 	current_info->x11.monitor.number = XScreenCount(display);
33
 	current_info->x11.monitor.current = XDefaultScreen(display);
34
+	return 0;
35
 }
36
 
37
 #ifdef OWN_WINDOW

Return to bug 147795