Reliably reset signals at server init time

Each DDX currently calls OsReleaseSIGIO in case it was suspended when
the server regen started. This causes a BUG to occur if SIGIO was
*not* blocked at that time. Instead of relying on each DDX, make the
OS layer reliably reset all signal state at server init time, ensuring
that signals are suitably unblocked and that the various signal state
counting variables are set back to zero.

Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
Keith Packard 2012-07-09 16:34:39 -07:00
parent d6756e0298
commit 023127915e
4 changed files with 17 additions and 1 deletions

View File

@ -1012,7 +1012,6 @@ OsVendorInit(void)
}
#endif
#endif
OsReleaseSIGIO();
beenHere = TRUE;
}

View File

@ -340,6 +340,9 @@ OsBlockSIGIO(void);
extern _X_EXPORT void
OsReleaseSIGIO(void);
extern void
OsResetSignals(void);
extern _X_EXPORT void
OsAbort(void)
_X_NORETURN;

View File

@ -288,6 +288,7 @@ OsInit(void)
}
TimerInit();
OsVendorInit();
OsResetSignals();
/*
* No log file by default. OsVendorInit() should call LogInit() with the
* log file name if logging to a file is desired.

View File

@ -1243,6 +1243,19 @@ OsReleaseSignals(void)
#endif
}
void
OsResetSignals(void)
{
#ifdef SIG_BLOCK
while (BlockedSignalCount > 0)
OsReleaseSignals();
#ifdef SIGIO
while (sigio_blocked > 0)
OsReleaseSIGIO();
#endif
#endif
}
/*
* Pending signals may interfere with core dumping. Provide a
* mechanism to block signals when aborting.