Re: [Exim] Small change to exiwhat

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Jim Knoble
Dátum:  
Címzett: exim-users
Tárgy: Re: [Exim] Small change to exiwhat
Circa 2002-Jul-08 12:15:26 -0400 dixit Dave C.:

: killall is fine - the only difference between kill and killall is that
: kill takes PID's killall takes a pattern to match against process names.

That's the killall that's part of the psmisc package:

http://psmisc.sourceforge.net/

It's generally only guaranteed to available on Linux systems (as
/usr/bin/killall, possibly /bin/killall).

Under Solaris, /usr/sbin/killall takes no pattern argument, only a
signal argument, and it sends that signal to all processes with open
files. It's also mode 0500 (non-world-executable). Very unsuitable
for exiwhat.

However, it may be possible to detect a suitable killall at runtime
from exiwhat. psmisc's killall accepts a '-l' option to list the
available signals on stdout and exits zero:

--------
$ killall -l 2>/dev/null
HUP INT QUIT ILL TRAP ABRT IOT BUS FPE KILL USR1 SEGV USR2 PIPE ALRM TERM
STKFLT CHLD CONT STOP TSTP TTIN TTOU URG XCPU XFSZ VTALRM PROF WINCH IO PWR SYS
UNUSED
$ echo $?
0
--------

Under Solaris, /usr/sbin/killall seems to print usage information on
stderr and exit 1:

--------
# /usr/sbin/killall -l 1>/dev/null
usage: killall [signal]
# echo $?
1
--------

Obviously, the same test for a suitable killall would work at configure
time.

--
jim knoble | jmknoble@??? | http://www.pobox.com/~jmknoble/
(GnuPG fingerprint: 31C4:8AAC:F24E:A70C:4000::BBF4:289F:EAA8:1381:1491)