NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: lib/41085: sigaction returns EINVAL instead of -1
The following reply was made to PR lib/41085; it has been noted by GNATS.
From: Matteo Beccati <matteo%beccati.com@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc:
Subject: Re: lib/41085: sigaction returns EINVAL instead of -1
Date: Sat, 28 Mar 2009 01:08:21 +0100
> From: David Holland <dholland-bugs%netbsd.org@localhost>
> On Fri, Mar 27, 2009 at 01:15:01PM +0000, matteo%beccati.com@localhost
> wrote:
> > 43 retval = sigaction(signo, &act, &oact);
> > (gdb) step
> > 45 if (retval < 0)
> > (gdb) print retval
> > $1 = 22
>
> That's bizarre. If this is repeatable, can you try running it under
> ktrace? That would reveal at least which sigaction call it's actually
> making, and if the return/error value shows up strangely under ktrace
> it will be a big hint.
Even more bizzare is the fact that I can't see any call to the
__sigaction_sigtramp when sigaction() is returning 22:
Proper call to sigaction(SIGALRM), with PHP outputting the result bool(true)
15993 1 php RET write 12/0xc
15993 1 php CALL
__sigaction_sigtramp(SIGALRM,0xbfbfcfbc,0xbfbfcfa4,0xbaf58e6c,2)
15993 1 php RET __sigaction_sigtramp 0
15993 1 php CALL write(1,0x83b30f4,0xb)
15993 1 php GIO fd 1 wrote 11 bytes
"bool(true)
"
Call with a wrong callback, PHP outputs an error, plus the false result:
15993 1 php RET write 11/0xb
15993 1 php CALL write(1,0x83b3254,0x8c)
15993 1 php GIO fd 1 wrote 140 bytes
"
Warning: pcntl_signal(): Invalid value for handle argument
specified i\
n /root/compile/php-HEAD/ext/pcntl/tests/pcntl_signal.php on
line 10
"
15993 1 php RET write 140/0x8c
15993 1 php CALL write(1,0x83b30f4,0xc)
15993 1 php GIO fd 1 wrote 12 bytes
"bool(false)
"
This is the interesting bit. PHP outputs bool(true) because sigaction
returned 22. No trace of the sigaction(-1) call.
15993 1 php RET write 12/0xc
15993 1 php CALL write(1,0x83b30f4,0xb)
15993 1 php GIO fd 1 wrote 11 bytes
"bool(true)
"
It seems that sigaction() validates signo itself and returns EINVAL
without making the syscall, or something along the lines.
Home |
Main Index |
Thread Index |
Old Index