[vbox-dev] [linux guest on linux host] alarm() system call broken?
walt
w41ter at gmail.com
Fri Nov 16 05:42:07 PST 2012
(vbox 4.2.4_gentoo_r81684)
The code snippet below is part of a 'configure' script that compiles okay but hangs forever when it runs on a linux guest. I'm wondering if it's a vbox bug or a gentoo bug (i.e. my host and guest machines). Can anyone reproduce? Thanks.
#include <errno.h>
#include <unistd.h>
#include <signal.h>
static void
handle_alarm (int sig)
{
if (sig != SIGALRM)
_exit (2);
}
int
main ()
{
/* Failure to compile this test due to missing alarm is okay,
since all such platforms (mingw) also lack sleep. */
unsigned int pentecost = 50 * 24 * 60 * 60; /* 50 days. */
unsigned int remaining;
signal (SIGALRM, handle_alarm);
alarm (1);
remaining = sleep (pentecost);
if (remaining > pentecost)
return 3;
if (remaining <= pentecost - 10)
return 4;
return 0;
;
return 0;
}
More information about the vbox-dev
mailing list