openbsd-20021119
[openafs.git] / src / rx / rx_event.c
index ce580dc..7c719f5 100644 (file)
@@ -7,34 +7,48 @@
  * directory or online at http://www.openafs.org/dl/license10.html
  */
 
+#include <afsconfig.h>
 #ifdef KERNEL
-#include "../afs/param.h"
+#include "afs/param.h"
+#else
+#include <afs/param.h>
+#endif
+
+#ifdef AFS_SUN59_ENV
+#include <sys/time_impl.h>
+#endif
+
+RCSID("$Header$");
+
+#ifdef KERNEL
 #ifndef UKERNEL
-#include "../afs/afs_osi.h"
+#include "afs/afs_osi.h"
 #else /* !UKERNEL */
-#include "../afs/sysincludes.h"
-#include "../afs/afsincludes.h"
+#include "afs/sysincludes.h"
+#include "afsincludes.h"
 #endif /* !UKERNEL */
-#include "../rx/rx_clock.h"
-#include "../rx/rx_queue.h"
-#include "../rx/rx_event.h"
-#include "../rx/rx_kernel.h"
-#include "../rx/rx_kmutex.h"
+#include "rx/rx_clock.h"
+#include "rx/rx_queue.h"
+#include "rx/rx_event.h"
+#include "rx/rx_kernel.h"
+#include "rx_kmutex.h"
 #ifdef RX_ENABLE_LOCKS
-#include "../rx/rx.h"
+#include "rx/rx.h"
 #endif /* RX_ENABLE_LOCKS */
-#include "../rx/rx_globals.h"
+#include "rx/rx_globals.h"
 #if defined(AFS_SGI_ENV)
-#include "../sys/debug.h"
+#include "sys/debug.h"
 /* These are necessary to get curproc (used by GLOCK asserts) to work. */
-#include "../h/proc.h"
+#include "h/proc.h"
 #if !defined(AFS_SGI64_ENV) && !defined(UKERNEL)
-#include "../h/user.h"
+#include "h/user.h"
 #endif
 extern void *osi_Alloc();
 #endif
+#if defined(AFS_OBSD_ENV)
+#include "h/proc.h"
+#endif
 #else /* KERNEL */
-#include "afs/param.h"
 #include <stdio.h>
 #include "rx_clock.h"
 #include "rx_queue.h"
@@ -66,7 +80,7 @@ static int rxepoch_allocUnit = 10;   /* Allocation unit (number of epoch records
 int rxevent_nFree;                /* Number of free event records */
 int rxevent_nPosted;      /* Current number of posted events */
 int rxepoch_nFree;                /* Number of free epoch records */
-static int (*rxevent_ScheduledEarlierEvent)(); /* Proc to call when an event is scheduled that is earlier than all other events */
+static int (*rxevent_ScheduledEarlierEvent)(void); /* Proc to call when an event is scheduled that is earlier than all other events */
 struct xfreelist { 
     void *mem;
     int size;
@@ -104,10 +118,7 @@ pthread_mutex_t rx_event_mutex;
 
 /* Pass in the number of events to allocate at a time */
 int rxevent_initialized = 0;
-void
-rxevent_Init(nEvents, scheduler)
-    int nEvents;
-    int (*scheduler)();
+void rxevent_Init(int nEvents, void (*scheduler)(void))
 {
     LOCK_EV_INIT
     if (rxevent_initialized) {
@@ -165,8 +176,16 @@ struct rxepoch *rxepoch_Allocate(struct clock *when)
  * "when" argument specifies when "func" should be called, in clock (clock.h)
  * units. */
 
-struct rxevent *rxevent_Post(struct clock *when, void (*func)(),
-                            void *arg, void *arg1)
+#if 0
+struct rxevent *rxevent_Post(struct clock *when, 
+       void (*func)(struct rxevent *event,
+        struct rx_connection *conn, struct rx_call *acall),
+       void *arg, void *arg1)
+#else
+struct rxevent *rxevent_Post(struct clock *when, 
+       void (*func)(),
+       void *arg, void *arg1)
+#endif
 {
     register struct rxevent *ev, *evqe, *evqpr;
     register struct rxepoch *ep, *epqe, *epqpr;
@@ -274,19 +293,11 @@ struct rxevent *rxevent_Post(struct clock *when, void (*func)(),
 #ifdef RX_ENABLE_LOCKS
 #ifdef RX_REFCOUNT_CHECK
 int rxevent_Cancel_type = 0;
-void rxevent_Cancel_1(ev, call, type)
-    register struct rxevent *ev;
-    register struct rx_call *call;
-    register int type;
-#else /* RX_REFCOUNT_CHECK */
-void rxevent_Cancel_1(ev, call)
-    register struct rxevent *ev;
-    register struct rx_call *call;
-#endif /* RX_REFCOUNT_CHECK */
-#else  /* RX_ENABLE_LOCKS */
-void rxevent_Cancel_1(ev)
-    register struct rxevent *ev;
-#endif /* RX_ENABLE_LOCKS */
+#endif
+#endif
+
+void rxevent_Cancel_1(register struct rxevent *ev, 
+       register struct rx_call *call, register int type)
 {
 #ifdef RXDEBUG
     if (rx_Log_event) {
@@ -338,12 +349,11 @@ void rxevent_Cancel_1(ev)
  * and the function returns 1.  If there are is no next epoch, the function
  * returns 0.
  */
-int rxevent_RaiseEvents(next)
-    struct clock *next;
+int rxevent_RaiseEvents(struct clock *next)
 {
     register struct rxepoch *ep;
     register struct rxevent *ev;
-    struct clock now;
+    volatile struct clock now;
 
     MUTEX_ENTER(&rxevent_lock);
 
@@ -413,6 +423,7 @@ void shutdown_rxevent(void)
        osi_Free((char *)xp, sizeof(struct xfreelist));
        xp = nxp;
     }
+    xfreemallocs = NULL;
 #endif
 
 }