#include <afsconfig.h>
#include <afs/param.h>
+#include <roken.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#ifdef AFS_NT40_ENV
-#include <winsock2.h>
-#include <malloc.h>
-extern void lwp_abort(void);
-#else
-#include <unistd.h> /* select() prototype */
-#include <sys/types.h> /* fd_set on older platforms */
-#include <sys/time.h> /* struct timeval, select() prototype */
-#ifndef FD_SET
-# include <sys/select.h> /* fd_set on newer platforms */
-#endif
-#include <sys/file.h>
-#endif /* AFS_NT40_ENV */
-#include "lwp.h"
-#include "timer.h"
-#include <signal.h>
-#include <errno.h>
-#ifdef AFS_SUN5_ENV
-#include <fcntl.h>
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
#endif
-#if defined(USE_PTHREADS) || defined(USE_SOLARIS_THREADS)
+#include <afs/opr.h>
-void IOMGR_Initialize() /* noop */
-{ }
-
-void IOMGR_Sleep (seconds)
- unsigned seconds;
-{
- struct timespec itv;
-
- itv.tv_sec = seconds;
- itv.tv_nsec = 0;
- MUTEX_EXIT(&lwp_mutex);
- osi_Assert(pthread_delay_np(&itv) == 0);
- MUTEX_ENTER(&lwp_mutex);
-}
-
-#else
-
-#ifdef AFS_DECOSF_ENV
-extern void *malloc();
-#endif /* AFS_DECOSF_ENV */
+#include "lwp.h"
+#include "timer.h"
typedef unsigned char bool;
#define FALSE 0
iomgrFreeFDSets = iomgrFreeFDSets->next;
}
else {
- t = (struct IOMGR_fd_set *)malloc(sizeof(fd_set));
+ t = malloc(sizeof(fd_set));
}
if (!t)
return (fd_set*)0;
{
struct IoRequest *request;
- if ((request=iorFreeList))
+ if ((request=iorFreeList)) {
iorFreeList = (struct IoRequest *) (request->next);
- else request = (struct IoRequest *) malloc(sizeof(struct IoRequest));
+ memset(request, 0, sizeof(struct IoRequest));
+ } else request = calloc(1, sizeof(struct IoRequest));
- memset((char*)request, 0, sizeof(struct IoRequest));
return request;
}
}
#endif
iomgr_errno = errno;
- lwp_abort();
+ opr_abort();
}
}
fprintf(stderr, "IOMGR_Select: fds=%d, more than max %d\n",
fds, FD_SETSIZE);
fflush(stderr);
- lwp_abort();
+ opr_abort();
}
#endif
timeout.tv_usec = 0;
IOMGR_Select(0, 0, 0, 0, &timeout);
}
-#endif /* USE_PTHREADS */