- add checkAlarms function

- this function will be used to determine wether expiration alarms are active. If qemu dies or terminates unexpectly, this function will check if it was before an timeout. In that case alarms will be active. Note: if qemu is killed purposely, OsSupport::cancelAlarms must be called to prevent automatic termination of sysreg process

svn path=/trunk/; revision=29509
This commit is contained in:
Johannes Anderwald 2007-10-11 18:41:39 +00:00
parent 8e11e74890
commit 01a2631183
2 changed files with 25 additions and 2 deletions

View file

@ -15,7 +15,7 @@ namespace System_
OsSupport::TimeEntryVector OsSupport::s_Entries;
//int gettimeofday(struct timeval *tv, void * tz);
//------------------------------------------------------------------------
void OsSupport::checkAlarms()
{
struct timeval tm;
@ -44,7 +44,11 @@ namespace System_
}
#endif
}
bool OsSupport::hasAlarms ()
{
return (s_Entries.size () != 0);
}
//------------------------------------------------------------------------
void OsSupport::cancelAlarms()
{
@ -284,6 +288,18 @@ __inline int gettimeofday(struct timeval *tv, struct timezone *tz)
{
OsSupport::checkAlarms();
}
else if (sig == SIGCHLD)
{
if (OsSupport::hasAlarms())
{
///
/// FIXME
///
/// there are expiriation alarms active and a child died unexpectly
/// lets commit suicide
exit(-2);
}
}
}
void OsSupport::setAlarm(long secs, OsSupport::ProcessID pid)
{

View file

@ -120,6 +120,13 @@ namespace System_
static void checkAlarms();
///---------------------------------------------------------------------------------------
///
/// hasAlarms
///
/// Description: this function checks wether there are alarms set active
static bool hasAlarms();
protected:
//---------------------------------------------------------------------------------------