[Prev][Next][Index][Thread]

possible bug in freebsd alarm()



I am porting a freebsd program to oskit. This program does
   alarm(5);
   recvfrom(...)
   alarm(0);

The freebsd manual says :
     The request alarm(0) voids the current alarm and the signal SIGALRM
     will not be delivered.

But the program does not work because alarm(0) does not cancel the current
alarm.

In order to display the possible bug, I have written this little program :
--------------------------------------------------------------------------------
#include <signal.h>

void clock(int sig)
{
printf("Tic\n");
exit(0);
}

main()
{
oskit_init_libc();
start_clock();

printf("Starting ...\n");
signal(SIGALRM, clock);

alarm(5);
alarm(0);

while(1) ;
}
--------------------------------------------------------------------------------

If I understand alarm() correctly, this program should never print Tic and
should never exit, but it does.

I am using oskit-990402 and here are the libs I link the program with :
        -loskit_startup \
        -loskit_linux_dev -loskit_dev -loskit_kern \
        -loskit_freebsd_c -loskit_com  -loskit_kern -loskit_lmm \

May be my initializations are not correct ? I am in the dark.

-- 
Amicalement,

-------------------------------------------------------------------------------
Bernard Cassagne                 Laboratoire CLIPS - IMAG
Domaine Universitaire       BP 53         38041 Grenoble CEDEX 9         FRANCE
tel: 04.76.51.46.14     fax: 04.76.44.66.75     e-mail:Bernard.Cassagne@imag.fr