problems with SIGALRM.....

Arup Mukherjee arup at grad1.cis.upenn.edu
Sun Apr 9 08:58:35 AEST 1989


Dear netlanders,
        Can anyone tell me what is wrong with the following program?
It works fine under Ultrix 3.0 but not under earlier versions of
Ultrix. It also does not work under SunOS 4.0. Am I making some kind
of mistake, or is this a known bug? If so, are there any workarounds
that will allow SIGALRM to work properly. (Note that if I try to trap,
for example, SIGSEGV instead, and then generate a segmentation violation on 
purpose, it works on any machine).


				Thanks very much....
						
						Arup Mukherjee
					[arup at grasp.cis.upenn.edu]
---cut here---

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

struct sigvec f;

int handler()
{
	fprintf (stderr, "I got a signal!\n");
	fflush(stderr);
}

main()
{

# ifdef TRY2                             /* neither of these two work on */
	f.sv_handler = handler;          /* most machines I tried        */
	f.sv_mask = 0;
	f.sv_onstack = 0;                /* Under Ultrix 3.0 on a        */
                                         /* uVax 3500, both work ok      */
        sigvec (SIGALRM, &f, NULL);
# else 
	signal (SIGALRM, handler);
# endif  
	

	alarm(1);
	sleep(10);


}



More information about the Comp.unix.questions mailing list