Problems getting signal to work

Chris Welch cwelch at neumes.com
Wed Sep 4 14:44:15 UTC 2002


Yes, the clock is enabled and is operating correctly.

The state of the blocked alarm signal is reported at a one second interval.

After 3 seconds SIGALRM is reported by sigpending() as pending.  The handler
is never called.

POSIX is enabled in the build configuration:

../rtems-4.5.0/configure --target=m68k --program-prefix=m68k-rtems- --disabl
e-networking --enable-posix --enable-cxx --disable-tcpip --prefix=/cygdrive/
c/rtems

I tried the RTEMS native timer to do the same functionality and it works
correctly.  The handler routine is called when the timer expires.

For what ever reason the functionality is not making it up to the POSIX
level.

Is there a POSIX API configuration that requires enabling?

Thanks much!

Chris

-----Original Message-----
From: Joel Sherrill [mailto:joel.sherrill at OARcorp.com]
Sent: Wednesday, September 04, 2002 9:49 AM
To: cwelch at neumes.com
Cc: RTEMS
Subject: Re: Problems getting signal to work




Chris Welch wrote:
>
> I'm having problems to get signals working properly with RTEMS 4.5.1.
>
> With the program example at the end of this email, SIGALRM is does get set
> (sigismember begins to return 1) after a three second delay, but the
> handler, catchsig, is never called.
>
> This program works correctly under Linux and Cygwin.
>
> Any suggestions would be appreciated.
>
> Perhaps there is a configuration definition I'm missing?

It looks like it should work although I have not tried to run
it yet.  This is certainly similar to code written

Do you have POSIX enabled in your configuration?

Do you have a clock tick device driver configured?   I assume so
if the sleep(1) actually works.

> Thanks in advance,
>
> Chris
>
> ----------------
> #include <stdio.h>
> #include <signal.h>
>
> void catchsig();
>
> int main()
> {
>         char     c = '.';
>         sigset_t NewSet;
>         struct sigaction NewSigAction;
>         struct sigaction OldSigAction;
>
>         // Set up the new signal action
>         NewSigAction.sa_handler = catchsig;
>         sigemptyset(&NewSet);
>         NewSigAction.sa_mask    = NewSet;
>         NewSigAction.sa_flags   = 0;
>
>         sigaction(SIGALRM, &NewSigAction, &OldSigAction);
>         alarm(3);
>
>         write(1, &c, 1);
>         while(1)
>         {
>                 //pause();
>                 sleep(1);
>                 sigpending(&NewSet);
>                 printf("%lx\n", sigismember(&NewSet, SIGALRM));
>         }
>         exit (0);
> }
>
> void catchsig()
> {
>         char c = '.';
>
>         write(1, &c, 1);
>         alarm(1);
> }
>
> ----
> Chris Welch, Neumes Consulting, PC and UNIX Solutions
> mailto:cwelch at neumes.com
> 613)797-7831 FAX:(613)838-5602
> http://www.neumes.com

--
Joel Sherrill, Ph.D.             Director of Research & Development
joel at OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available                (256) 722-9985




More information about the users mailing list