[Exim] Testers wanted (again)

Top Page
Delete this message
Reply to this message
Author: Philip Hazel
Date:  
To: exim-users
Subject: [Exim] Testers wanted (again)
I need to know whether the setitimer() function is available on all the
OS that Exim supports. I believe it is, and have tested Solaris, SunOS4,
Linux, IRIX, HP-UX, Digital Unix and FreeBSD. However, it would be
reassuring if people who use systems other than the above could compile
and run the short test program that is attached to this message. Just do

[g]cc test.c
./a.out

The output should look like this:

Wait 250 msec
...done
Wait 500 msec
...done
Wait 1000 msec
...done
Wait 1500 msec
...done
Wait 2000 msec
...done
End

and there should be delays of that number of milliseconds each time. In
fact, if the program compiles, I'm sure it will run OK.

Thanks,
Philip

-- 
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.





#include <stdio.h>
#include <signal.h>
#include <sys/time.h>

static void sigalrm_handler(int sig)
{
sig = sig;
}


void
millisleep(int msec)
{
void (*oldsignal)(int) = signal(SIGALRM, sigalrm_handler);
struct itimerval itval;
sigset_t sigmask;
itval.it_interval.tv_sec = 0;
itval.it_interval.tv_usec = 0;
itval.it_value.tv_sec = msec/1000;
itval.it_value.tv_usec = (msec % 1000) * 1000;
(void)setitimer(ITIMER_REAL, &itval, NULL);
(void)sigemptyset(&sigmask);
(void)sigsuspend(&sigmask);
signal(SIGALRM, oldsignal);
}



void
testit(int msec)
{
printf("Wait %d msec\n", msec);
millisleep(msec);
printf("...done\n");
}




int main(void)
{
testit(250);
testit(500);
testit(1000);
testit(1500);
testit(2000);
printf("End\n");
return 0;
}