BERTRAND Joël | 15 Apr 2008 21:23
Picon

sigpending

	Hello,

	I have written a subroutine that perfectly work on several Unices 
(Solaris, Linux, Tru64, HP-UX). This subroutine can be compiled on 
NetBSD 4.0 without any error, but doesn't work. I have done some test 
and I have see that sigsuspend seems to return 0 even if a signal is 
caught. I have seen that sigsuspend doesn't work in NetBSD 3.1, but I 
haven't found any information about sigsuspend on NetBSD 4.0. Any news ?

	Regards,

	JKB

Manuel Bouyer | 15 Apr 2008 21:56

Re: sigpending

On Tue, Apr 15, 2008 at 09:23:04PM +0200, BERTRAND Joël wrote:
> 	Hello,
> 
> 	I have written a subroutine that perfectly work on several Unices 
> (Solaris, Linux, Tru64, HP-UX). This subroutine can be compiled on 
> NetBSD 4.0 without any error, but doesn't work. I have done some test 
> and I have see that sigsuspend seems to return 0 even if a signal is 
> caught. I have seen that sigsuspend doesn't work in NetBSD 3.1, but I 
> haven't found any information about sigsuspend on NetBSD 4.0. Any news ?

sigsuspend seems to work fine for me, on both NetBSD 3.1 and 4.0, using
the test program below (that is, sigsuspend returns -1 when SIGUSR1
is sent to the process)

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>

void handler(int sig)
{
        printf("signal %d\n", sig);
}

main()
{
        sigset_t sigset;
        struct sigaction act;
        int ret;

(Continue reading)

BERTRAND Joël | 15 Apr 2008 22:06
Picon

Re: sigpending

Manuel Bouyer a écrit :
> On Tue, Apr 15, 2008 at 09:23:04PM +0200, BERTRAND Joël wrote:
>> 	Hello,
>>
>> 	I have written a subroutine that perfectly work on several Unices 
>> (Solaris, Linux, Tru64, HP-UX). This subroutine can be compiled on 
>> NetBSD 4.0 without any error, but doesn't work. I have done some test 
>> and I have see that sigsuspend seems to return 0 even if a signal is 
>> caught. I have seen that sigsuspend doesn't work in NetBSD 3.1, but I 
>> haven't found any information about sigsuspend on NetBSD 4.0. Any news ?
> 
> sigsuspend seems to work fine for me, on both NetBSD 3.1 and 4.0, using
> the test program below (that is, sigsuspend returns -1 when SIGUSR1
> is sent to the process)

	Sorry, not sigsuspend, sigpending. Sigsuspend works fine.

	Regards,

	JKB

Manuel Bouyer | 15 Apr 2008 22:29

Re: sigpending

On Tue, Apr 15, 2008 at 10:06:05PM +0200, BERTRAND Joël wrote:
> Manuel Bouyer a écrit :
> >On Tue, Apr 15, 2008 at 09:23:04PM +0200, BERTRAND Joël wrote:
> >>	Hello,
> >>
> >>	I have written a subroutine that perfectly work on several Unices 
> >>(Solaris, Linux, Tru64, HP-UX). This subroutine can be compiled on 
> >>NetBSD 4.0 without any error, but doesn't work. I have done some test 
> >>and I have see that sigsuspend seems to return 0 even if a signal is 
> >>caught. I have seen that sigsuspend doesn't work in NetBSD 3.1, but I 
> >>haven't found any information about sigsuspend on NetBSD 4.0. Any news ?
> >
> >sigsuspend seems to work fine for me, on both NetBSD 3.1 and 4.0, using
> >the test program below (that is, sigsuspend returns -1 when SIGUSR1
> >is sent to the process)
> 
> 	Sorry, not sigsuspend, sigpending. Sigsuspend works fine.

Hum. When you says it always returns 0, do you mean the integer returned
by the function, or the sigset_t passed as pointer ?
Reading the man page it seems OK for the function to always return 0.

--

-- 
Manuel Bouyer <bouyer <at> antioche.eu.org>
     NetBSD: 26 ans d'experience feront toujours la difference
--

Manuel Bouyer | 15 Apr 2008 22:37

Re: sigpending

On Tue, Apr 15, 2008 at 10:29:35PM +0200, Manuel Bouyer wrote:
> Hum. When you says it always returns 0, do you mean the integer returned
> by the function, or the sigset_t passed as pointer ?
> Reading the man page it seems OK for the function to always return 0.

It seems I couldn't get sigpending() working either :(

--

-- 
Manuel Bouyer <bouyer <at> antioche.eu.org>
     NetBSD: 26 ans d'experience feront toujours la difference
--

BERTRAND Joël | 16 Apr 2008 08:38
Picon

Re: sigpending

Manuel Bouyer a écrit :
> On Tue, Apr 15, 2008 at 10:29:35PM +0200, Manuel Bouyer wrote:
>> Hum. When you says it always returns 0, do you mean the integer returned
>> by the function, or the sigset_t passed as pointer ?
>> Reading the man page it seems OK for the function to always return 0.
> 
> It seems I couldn't get sigpending() working either :(

	I was tired when I have written this mail. Of course, on NetBSD, 
sigpending always returns 0. On Solaris and Linux, it can returns -1. 
Thus, I have written :

         if (sigpending(&set) != 0)
         {
             (*s_etat_processus).erreur_systeme = d_es_processus;
         }
         else if (sigismember(&set, SIGSTART) == 0)
         {
             while(sigismember(&set, SIGSTART) == 0)
             {
                 if (sigpending(&set) != 0)
                 {
                     (*s_etat_processus).erreur_systeme = d_es_processus;
                 }

                 nanosleep(&attente, NULL);
             }
         }

and 'set' is not modified by sigpending even if I send a blocked signal 
(Continue reading)


Gmane