1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-24 11:55:43 +00:00

added #define/#undef SIGNAL_BLOCKING

git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky@427 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
Philip Kovacs 2005-11-24 02:18:42 +00:00
parent dc61eb3daa
commit b6ead422a2
3 changed files with 65 additions and 51 deletions

View File

@ -1,7 +1,9 @@
# $Id$ # $Id$
2005-11-23 2005-11-23
* Synchronous signal processing. Fixes gentoo bug# 113219 * Added #define/#undef SIGNAL_BLOCKING in conky.c for experimenting
with synchronous signal processing. set to #undef for previous behavior.
* Use POSIX signal api's, not the ANSI signal().
2005-11-22 2005-11-22
* Fixed IP address bug (sf.net bug 1359055) * Fixed IP address bug (sf.net bug 1359055)

90
README
View File

@ -4,16 +4,16 @@ conky(1) conky(1)
NAME NAME
conky - A system monitor for X originally based on the torsmo code, but conky - A system monitor for X originally based on the torsmo code, but
more kickass. It just keeps on given'er. Yeah. more kickass. It just keeps on givener. Yeah.
SYNOPSIS SYNOPSIS
conky [options] conky [options]
DESCRIPTION DESCRIPTION
Conky is a system monitor for X originally based on the torsmo code. Conky is a system monitor for X originally based on the torsmo code.
Since it's original conception, Conky has changed a fair bit from it's Since its original conception, Conky has changed a fair bit from its
predecessor. Conky can display just about anything, either on your predecessor. Conky can display just about anything, either on your
root desktop or in it's own window. Conky has many built-in objects, root desktop or in its own window. Conky has many built-in objects,
as well as the ability to execute programs and scripts, then display as well as the ability to execute programs and scripts, then display
the output from stdout. the output from stdout.
@ -28,11 +28,11 @@ COMPILING
libraries installed. This should be a package along the lines of libraries installed. This should be a package along the lines of
"libx11-dev or xorg-x11-dev". "libx11-dev or xorg-x11-dev".
Gentoo users -- Conky is in Gentoo's Portage... simply use "emerge app- Gentoo users -- Conky is in Gentoos Portage... simply use "emerge app-
admin/conky" for installation. There is also usually an up-to-date admin/conky" for installation. There is also usually an up-to-date
ebuild within Conky's package or in CVS. ebuild within Conkys package or in CVS.
Debian,etc. users -- Conky will be in Debian's repositories soon (by Debian,etc. users -- Conky will be in Debians repositories soon (by
mid-September, hopefully), and then Ubuntu shortly thereafter. Until mid-September, hopefully), and then Ubuntu shortly thereafter. Until
then, "dpkg -i" the .deb package to install. then, "dpkg -i" the .deb package to install.
@ -43,7 +43,7 @@ COMPILING
./configure --prefix=/usr --mandir=/usr/share/man ./configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc
--localstatedir=/var/lib --enable-xft --enable-seti --enable-dou- --localstatedir=/var/lib --enable-xft --enable-seti --enable-dou
ble-buffer --enable-own-window --enable-proc-uptime --enable-mpd ble-buffer --enable-own-window --enable-proc-uptime --enable-mpd
--enable-mldonkey --enable-x11 --enable-portmon --enable-mldonkey --enable-x11 --enable-portmon
@ -53,14 +53,14 @@ COMPILING
src/conky src/conky
Conky probably doesn't compile with compilers other than gcc and icc. Conky probably doesnt compile with compilers other than gcc and icc.
It doesn't compile with C89 compiler and not even with pure C99. It It doesnt compile with C89 compiler and not even with pure C99. It
uses a few things that might not exist: strdup(), strcasecmp(), strn- uses a few things that might not exist: strdup(), strcasecmp(), strn
casecmp(), optarg variable with getopt() and long long (not in C89). casecmp(), optarg variable with getopt() and long long (not in C89).
Crashes in file system statistics stuff when compiled with icc, I don't Crashes in file system statistics stuff when compiled with icc, I dont
know exactly why. know exactly why.
You can disable 'drawing to own window' feature in case you don't need You can disable drawing to own window feature in case you dont need
it by passing --disable-own-window to configure -script. it by passing --disable-own-window to configure -script.
@ -71,14 +71,14 @@ YOU SHOULD KNOW
rest of Conky. rest of Conky.
If you do use them, please do not complain about memory or CPU usage, If you do use them, please do not complain about memory or CPU usage,
unless you think something's seriously wrong (mem leak, etc.). unless you think somethings seriously wrong (mem leak, etc.).
An easy way to force Conky to reload your ~/.conkyrc: "killall -SIGUSR1 An easy way to force Conky to reload your ~/.conkyrc: "killall -SIGUSR1
conky". Saves you the trouble of having to kill and then restart. conky". Saves you the trouble of having to kill and then restart.
IMPORTANT: For previous Conky users, Conky 1.3 no longer supports the IMPORTANT: For previous Conky users, Conky 1.3 no longer supports the
metar stuff. mdsplib was causing way too many problems. Hopefully metar stuff. mdsplib was causing way too many problems. Hopefully
there'll be a better solution in Conky 2.x... therell be a better solution in Conky 2.x...
OPTIONS OPTIONS
Command line options override configurations defined in configuration Command line options override configurations defined in configuration
@ -113,7 +113,7 @@ OPTIONS
-t TEXT -t TEXT
Text to render, remember single quotes, like -t ' $uptime ' Text to render, remember single quotes, like -t $uptime
-u SECONDS -u SECONDS
@ -135,14 +135,14 @@ OPTIONS
CONFIGURATION SETTINGS CONFIGURATION SETTINGS
Default configuration file is $HOME/.conkyrc (can be changed from Default configuration file is $HOME/.conkyrc (can be changed from
conky.c among other things). See conkyrc.sample. If installing from conky.c among other things). See conkyrc.sample. If installing from
Debian package, this should be in /usr/share/doc/conky/examples ("gun- Debian package, this should be in /usr/share/doc/conky/examples ("gun
zip conkyrc.sample.gz" to get conkyrc.sample). zip conkyrc.sample.gz" to get conkyrc.sample).
You might want to copy it to $HOME/.conkyrc and then start modifying You might want to copy it to $HOME/.conkyrc and then start modifying
it. Other configs can be found at http://conky.sf.net it. Other configs can be found at http://conky.sf.net
alignment alignment
Aligned position on screen, may be top_left, top_right, bot- Aligned position on screen, may be top_left, top_right, bot
tom_left, bottom_right, or none tom_left, bottom_right, or none
@ -172,7 +172,7 @@ CONFIGURATION SETTINGS
default_shade_color default_shade_color
Default shading color and border's shading color Default shading color and borders shading color
default_outline_color default_outline_color
@ -180,8 +180,8 @@ CONFIGURATION SETTINGS
double_buffer double_buffer
Use the Xdbe extension? (eliminates flicker) It is highly recom- Use the Xdbe extension? (eliminates flicker) It is highly recom
mended to use own window with this one so double buffer won't be mended to use own window with this one so double buffer wont be
so big. so big.
@ -321,7 +321,7 @@ CONFIGURATION SETTINGS
VARIABLES VARIABLES
Colors are parsed using XParsecolor(), there might be a list of them: Colors are parsed using XParsecolor(), there might be a list of them:
/usr/X11R6/lib/X11/rgb.txt. Also, http://sedition.com/perl/rgb.html /usr/X11R6/lib/X11/rgb.txt. Also, http://sedition.com/perl/rgb.html
[http://sedition.com/perl/rgb.html]. Color can be also in #rrggbb for- [http://sedition.com/perl/rgb.html]. Color can be also in #rrggbb for
mat (hex). Note that when displaying bytes, power is 1024 and not 1000 mat (hex). Note that when displaying bytes, power is 1024 and not 1000
so 1M really means 1024*1024 bytes and not 1000*1000. so 1M really means 1024*1024 bytes and not 1000*1000.
@ -397,7 +397,7 @@ VARIABLES
cpubar (cpu number) (height),(width) cpubar (cpu number) (height),(width)
Bar that shows CPU usage, height is bar's height in pixels. See Bar that shows CPU usage, height is bars height in pixels. See
$cpu for more info on SMP. $cpu for more info on SMP.
@ -434,8 +434,8 @@ VARIABLES
exec command exec command
Executes a shell command and displays the output in conky. warn- Executes a shell command and displays the output in conky. warn
ing: this takes a lot more resources than other variables. I'd ing: this takes a lot more resources than other variables. Id
recommend coding wanted behaviour in C and posting a patch. recommend coding wanted behaviour in C and posting a patch.
@ -450,7 +450,7 @@ VARIABLES
execi interval command execi interval command
Same as exec but with specific interval. Interval can't be less Same as exec but with specific interval. Interval cant be less
than update_interval in configuration. See also $texeci than update_interval in configuration. See also $texeci
@ -507,7 +507,7 @@ VARIABLES
head logfile lines (interval) head logfile lines (interval)
Displays first N lines of supplied text text file. If interval Displays first N lines of supplied text text file. If interval
is not supplied, Conky assumes 2x Conky's interval. Max of 30 is not supplied, Conky assumes 2x Conkys interval. Max of 30
lines can be displayed, or until the text buffer is filled. lines can be displayed, or until the text buffer is filled.
@ -552,7 +552,7 @@ VARIABLES
i8k_left_fan_rpm i8k_left_fan_rpm
If running the i8k kernel driver for Inspiron laptops, displays If running the i8k kernel driver for Inspiron laptops, displays
the left fan's rate of rotation, in revolutions per minute as the left fans rate of rotation, in revolutions per minute as
listed in /proc/i8k. Beware, some laptops i8k reports these fans listed in /proc/i8k. Beware, some laptops i8k reports these fans
in reverse order. in reverse order.
@ -566,7 +566,7 @@ VARIABLES
i8k_right_fan_rpm i8k_right_fan_rpm
If running the i8k kernel driver for Inspiron laptops, displays If running the i8k kernel driver for Inspiron laptops, displays
the right fan's rate of rotation, in revolutions per minute as the right fans rate of rotation, in revolutions per minute as
listed in /proc/i8k. Beware, some laptops i8k reports these fans listed in /proc/i8k. Beware, some laptops i8k reports these fans
in reverse order. in reverse order.
@ -647,7 +647,7 @@ VARIABLES
mpd_bar (height),(width) mpd_bar (height),(width)
Bar of mpd's progress Bar of mpds progress
mpd_bitrate mpd_bitrate
@ -663,19 +663,19 @@ VARIABLES
mpd_vol mpd_vol
MPD's volume MPDs volume
mpd_elapsed mpd_elapsed
Song's elapsed time Songs elapsed time
mpd_length mpd_length
Song's length Songs length
mpd_percent mpd_percent
Percent of song's progress Percent of songs progress
mpd_random mpd_random
@ -768,7 +768,7 @@ VARIABLES
Examples: Examples:
${tcp_portmon 6881 6999 count} - displays the number of connec- ${tcp_portmon 6881 6999 count} - displays the number of connec
tions in the bittorrent port range tions in the bittorrent port range
${tcp_portmon 22 22 rip 0} - displays the remote host ip of the ${tcp_portmon 22 22 rip 0} - displays the remote host ip of the
@ -787,7 +787,7 @@ VARIABLES
name of the fifteenth connection in the range of all ports name of the fifteenth connection in the range of all ports
Note that port monitor variables which share the same port range Note that port monitor variables which share the same port range
actually refer to the same monitor, so many references to a sin- actually refer to the same monitor, so many references to a sin
gle port range for different items and different indexes all use gle port range for different items and different indexes all use
the same monitor internally. In other words, the program avoids the same monitor internally. In other words, the program avoids
creating redundant monitors. creating redundant monitors.
@ -795,7 +795,7 @@ VARIABLES
texeci interval command texeci interval command
Runs a command at an interval inside a thread and displays the Runs a command at an interval inside a thread and displays the
output. Same as $execi, except the command is run inside a output. Same as $execi, except the command is run inside a
thread. Use this if you have a slow script to keep Conky updat- thread. Use this if you have a slow script to keep Conky updat
ing. You should make the interval slightly longer then the time ing. You should make the interval slightly longer then the time
it takes your script to execute. For example, if you have a it takes your script to execute. For example, if you have a
script that take 5 seconds to execute, you should make the script that take 5 seconds to execute, you should make the
@ -808,18 +808,18 @@ VARIABLES
tail logfile lines (interval) tail logfile lines (interval)
Displays last N lines of supplied text text file. If interval is Displays last N lines of supplied text text file. If interval is
not supplied, Conky assumes 2x Conky's interval. Max of 30 lines not supplied, Conky assumes 2x Conkys interval. Max of 30 lines
can be displayed, or until the text buffer is filled. can be displayed, or until the text buffer is filled.
time (format) time (format)
Local time, see man strftime to get more information about for- Local time, see man strftime to get more information about for
mat mat
totaldown net totaldown net
Total download, overflows at 4 GB on Linux with 32-bit arch and Total download, overflows at 4 GB on Linux with 32-bit arch and
there doesn't seem to be a way to know how many times it has there doesnt seem to be a way to know how many times it has
already done that before conky has started. already done that before conky has started.
@ -882,7 +882,7 @@ VARIABLES
EXAMPLES EXAMPLES
conky -t '${time %D %H:%m}' -o -u 30 conky -t ${time %D %H:%m} -o -u 30
Start Conky in its own window with date and clock as text and 30 Start Conky in its own window with date and clock as text and 30
sec update interval. sec update interval.
@ -893,9 +893,9 @@ FILES
~/.conkyrc default configuration file ~/.conkyrc default configuration file
BUGS BUGS
Drawing to root or some other desktop window directly doesn't work with Drawing to root or some other desktop window directly doesnt work with
all window managers. Especially doesn't work well with Gnome and it has all window managers. Especially doesnt work well with Gnome and it has
been reported that it doesn't work with KDE either. Nautilus can be been reported that it doesnt work with KDE either. Nautilus can be
disabled from drawing to desktop with program gconf-editor. Uncheck disabled from drawing to desktop with program gconf-editor. Uncheck
show_desktop in /apps/nautilus/preferences/. There is -w switch in show_desktop in /apps/nautilus/preferences/. There is -w switch in
Conky to set some specific window id. You might find xwininfo -tree Conky to set some specific window id. You might find xwininfo -tree
@ -905,13 +905,13 @@ BUGS
SEE ALSO SEE ALSO
http://conky.sourceforge.net [http://conky.sourceforge.net] http://conky.sourceforge.net [http://conky.sourceforge.net]
http://www.sourceforge.net/projects/conky [http://www.source- http://www.sourceforge.net/projects/conky [http://www.source
forge.net/projects/conky] forge.net/projects/conky]
#conky on irc.freenode.net #conky on irc.freenode.net
AUTHORS AUTHORS
The Conky dev team. What's up now! The Conky dev team. Whats up now!

View File

@ -34,6 +34,14 @@
#define MAIL_FILE "$MAIL" #define MAIL_FILE "$MAIL"
#define MAX_IF_BLOCK_DEPTH 5 #define MAX_IF_BLOCK_DEPTH 5
/* defining SIGNAL_BLOCKING will cause conky to block asynchronous signal handlin,
* in favor of inspecting for pending signals synchronously. this is experimental
* code designed to avoid signal events in slow/blocking system calls like select().
* use #undef SIGNAL_BLOCKING for the tradiational, asynchronous signal handling. */
/* #define SIGNAL_BLOCKING */
#undef SIGNAL_BLOCKING
#ifdef X11 #ifdef X11
/* alignments */ /* alignments */
@ -4060,12 +4068,14 @@ static void update_text()
static void main_loop() static void main_loop()
{ {
sigset_t newmask, oldmask, pendmask; #ifdef SIGNAL_BLOCKING
sigset_t newmask, oldmask;
sigemptyset(&newmask); sigemptyset(&newmask);
sigaddset(&newmask,SIGINT); sigaddset(&newmask,SIGINT);
sigaddset(&newmask,SIGTERM); sigaddset(&newmask,SIGTERM);
sigaddset(&newmask,SIGUSR1); sigaddset(&newmask,SIGUSR1);
#endif
#ifdef X11 #ifdef X11
Region region = XCreateRegion(); Region region = XCreateRegion();
@ -4075,9 +4085,11 @@ static void main_loop()
while (total_run_times == 0 || info.looped < total_run_times - 1) { while (total_run_times == 0 || info.looped < total_run_times - 1) {
info.looped++; info.looped++;
#ifdef SIGNAL_BLOCKING
/* block signals. we will inspect for pending signals later */ /* block signals. we will inspect for pending signals later */
if (sigprocmask(SIG_BLOCK, &newmask, &oldmask) < 0) if (sigprocmask(SIG_BLOCK, &newmask, &oldmask) < 0)
CRIT_ERR("unable to sigprocmask()"); CRIT_ERR("unable to sigprocmask()");
#endif
#ifdef X11 #ifdef X11
XFlush(display); XFlush(display);
@ -4299,13 +4311,11 @@ static void main_loop()
} }
#endif /* X11 */ #endif /* X11 */
/* fetch pending signals prior to entering next loop */ #ifdef SIGNAL_BLOCKING
if (sigpending(&pendmask) < 0)
CRIT_ERR("unable to sigpending()");
/* unblock signals of interest and let handler fly */ /* unblock signals of interest and let handler fly */
if (sigprocmask(SIG_SETMASK, &oldmask, NULL) < 0) if (sigprocmask(SIG_SETMASK, &oldmask, NULL) < 0)
CRIT_ERR("unable to sigprocmask()"); CRIT_ERR("unable to sigprocmask()");
#endif
switch(g_signal_pending) { switch(g_signal_pending) {
case SIGUSR1: case SIGUSR1:
@ -5265,7 +5275,9 @@ int main(int argc, char **argv)
act.sa_handler = signal_handler; act.sa_handler = signal_handler;
sigemptyset(&act.sa_mask); sigemptyset(&act.sa_mask);
act.sa_flags = 0; act.sa_flags = 0;
#ifdef SA_RESTART
act.sa_flags |= SA_RESTART; act.sa_flags |= SA_RESTART;
#endif
if ( sigaction(SIGINT,&act,&oact) < 0 || if ( sigaction(SIGINT,&act,&oact) < 0 ||
sigaction(SIGUSR1,&act,&oact) < 0 || sigaction(SIGUSR1,&act,&oact) < 0 ||