IO Manager routines & server process for VICE server.
*/
+/* This controls the size of an fd_set; it must be defined early before
+ * the system headers define that type and the macros that operate on it.
+ * Its value should be as large as the maximum file descriptor limit we
+ * are likely to run into on any platform. Right now, that is 65536
+ * which is the default hard fd limit on Solaris 9 */
+/* We don't do this on Windows because on that platform there is code
+ * which allocates fd_set's on the stack (IOMGR_Sleep on Win9x, and
+ * FDSetAnd on WinNT) */
+#ifndef _WIN32
+#define FD_SETSIZE 65536
+#endif
+
#include <afsconfig.h>
#include <afs/param.h>
#define TRUE 1
#ifndef MIN
-#define MIN(a,b) ((a)>(b)) ? b : a
+#define MIN(a,b) (((a)>(b)) ? (b) : (a))
#endif
#ifndef NSIG
/* fd_set pool managment.
* Use the pool instead of creating fd_set's on the stack. fd_set's can be
- * 2K in size, so making three could put 6K in the limited space of an LWP
+ * 8K in size, so making three could put 24K in the limited space of an LWP
* stack.
*/
struct IOMGR_fd_set {
if (nfds == 0)
return;
- n = INTS_PER_FDS(nfds);
- for (i=0; i<n; i++) {
+ for (i = 0, n = INTS_PER_FDS(nfds); i < n; i++) {
fd_set1->FDS_BITS[i] |= fd_set2->FDS_BITS[i];
}
#endif
iomgr_timeout.tv_sec = 100000000;
iomgr_timeout.tv_usec = 0;
}
-#ifdef AFS_NT40_ENV
+#if defined(AFS_NT40_ENV) || defined(AFS_LINUX24_ENV)
/* On NT, signals don't interrupt a select call. So this can potentially
* lead to long wait times before a signal is honored. To avoid this we
* dont do select() for longer than IOMGR_MAXWAITTIME (5 secs) */
+ /* Whereas Linux seems to sometimes "lose" signals */
if (iomgr_timeout.tv_sec > (IOMGR_MAXWAITTIME - 1)) {
iomgr_timeout.tv_sec = IOMGR_MAXWAITTIME;
iomgr_timeout.tv_usec = 0;
/* Real timeout only if signal handler hasn't set
iomgr_timeout to zero. */
-#ifdef AFS_NT40_ENV
+#if defined(AFS_NT40_ENV) || defined(AFS_LINUX24_ENV)
/* On NT, real timeout only if above and if iomgr_timeout
* interval is equal to timeout interval (i.e., not adjusted
* to check for pseudo-signals).
*/
+ /* And also for Linux as above */
if (iomgr_timeout.tv_sec != timeout.tv_sec ||
iomgr_timeout.tv_usec != timeout.tv_usec) {
/* signal check interval timed out; not real timeout */
/* Alright, this is the signal signalling routine. It delivers LWP signals
to LWPs waiting on Unix signals. NOW ALSO CAN YIELD!! */
-static int SignalSignals ()
+static int SignalSignals (void)
{
bool gotone = FALSE;
register int i;
for (i=0; i < NSOFTSIG; i++) {
PROCESS pid;
if (p=sigProc[i]) /* This yields!!! */
- LWP_CreateProcess2(p, stackSize, LWP_NORMAL_PRIORITY, sigRock[i],
- "SignalHandler", &pid);
+ LWP_CreateProcess2(p, stackSize, LWP_NORMAL_PRIORITY,
+ (void *) sigRock[i], "SignalHandler", &pid);
sigProc[i] = 0;
}
install_ncb_handler();
#endif /* AFS_DJGPP_ENV */
- return LWP_CreateProcess(IOMGR, AFS_LWP_MINSTACKSIZE, 0, 0, "IO MANAGER",
- &IOMGR_Id);
+ return LWP_CreateProcess(IOMGR, AFS_LWP_MINSTACKSIZE, 0, (void *) 0,
+ "IO MANAGER", &IOMGR_Id);
}
int IOMGR_Finalize()
#ifndef AFS_NT40_ENV
/* Cause delivery of signal signo to result in a LWP_SignalProcess of
event. */
-IOMGR_Signal (signo, event)
- int signo;
- char *event;
+int IOMGR_Signal (int signo, char *event)
{
struct sigaction sa;
}
/* Stop handling occurrences of signo. */
-IOMGR_CancelSignal (signo)
- int signo;
+int IOMGR_CancelSignal (int signo)
{
if (badsig(signo) || (sigsHandled & mysigmask(signo)) == 0)
return LWP_EBADSIG;
- sigaction (signo, &oldActions[signo], (struct sigaction *)0);
+ sigaction (signo, &oldActions[signo], NULL);
sigsHandled &= ~mysigmask(signo);
return LWP_SUCCESS;
}
/* Netbios code for djgpp port */
-int IOMGR_NCBSelect(ncbp, dos_ncb, timeout)
- NCB *ncbp;
- dos_ptr dos_ncb;
- struct timeval *timeout;
+int IOMGR_NCBSelect(NCB *ncbp, dos_ptr dos_ncb, struct timeval *timeout)
{
struct IoRequest *request;
int result;
}
}
-int IOMGR_CheckNCB()
+int IOMGR_CheckNCB(void)
{
int woke_someone = FALSE;
EVENT_HANDLE ev;
return;
}
-int install_ncb_handler()
+int install_ncb_handler(void)
{
callback_info.pm_offset = (long) ncb_handler;
if (_go32_dpmi_allocate_real_mode_callback_retf(&callback_info,