On Sun, Sep 06, 2015 at 11:36:00AM +0200, Niels Thykier wrote: > On 2015-09-06 11:19, Jakub Wilk wrote: > >> my $signal = $? & 0xff; > > > > This is almost right. :) You need only 7 bits to get the signal number. > > The eighth bit is on iff core was dumped: > > > > $ ulimit -c unlimited > > $ perl -E 'system("kill -11 \$\$"); say $? & 0xff, ", ", $? & 0x7f' > > 139, 11 > > > > Thanks, corrected. :)
Hm, this is a personal pet peeve, feel free to ignore it :) ...but it does make me cringe a little bit every time people parse the wait() status code directly instead of using WIFEXITED(), WEXITCODE() and friends... Yes, I know that the Linux and FreeBSD kernels do it this way, up to and including the 0x80 core flag, but still I like to think that these macros are there for a reason :) G'luck, Peter -- Peter Pentchev r...@ringlet.net r...@freebsd.org p...@storpool.com PGP key: http://people.FreeBSD.org/~roam/roam.key.asc Key fingerprint 2EE7 A7A5 17FC 124C F115 C354 651E EFB0 2527 DF13
signature.asc
Description: Digital signature