libwp: Tidy header includes
[openafs.git] / src / lwp / rw.c
index 15ddf2d..03a14cd 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright 2000, International Business Machines Corporation and others.
  * All Rights Reserved.
- * 
+ *
  * This software has been released under the terms of the IBM Public
  * License.  For details, see the LICENSE file in the top-level source
  * directory or online at http://www.openafs.org/dl/license10.html
@@ -17,23 +17,11 @@ Created: 11/1/83, J. Rosenberg
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID
-    ("$Header$");
-
-#ifdef AFS_NT40_ENV
-#include <malloc.h>
-#include <stdlib.h>
-#else
-#include <sys/time.h>
-extern char *calloc();
-#endif
-#include <stdio.h>
-#include <stdlib.h>
+#include <roken.h>
 
 #include "lwp.h"
 #include "lock.h"
 #include "preempt.h"
-#include <afs/assert.h>
 
 #define DEFAULT_READERS        5
 
@@ -57,8 +45,7 @@ init()
 }
 
 char
-empty(q)
-     queue *q;
+empty(queue *q)
 {
     return (q->prev == q && q->next == q);
 }
@@ -77,15 +64,14 @@ insert(queue * q, char *s)
 }
 
 char *
-Remove(q)
-     queue *q;
+Remove(queue *q)
 {
     queue *old;
     char *s;
 
     if (empty(q)) {
        printf("Remove from empty queue");
-       assert(0);
+       exit(0);
     }
 
     old = q->next;
@@ -95,22 +81,22 @@ Remove(q)
     free(old);
     return (s);
 }
-\f
+
 queue *q;
 
 int asleep;                    /* Number of processes sleeping -- used for
                                 * clean termination */
 
-static int
-read_process(id)
-     int *id;
+static void *
+read_process(void *arg)
 {
+    int *id = (int *) arg;
     printf("\t[Reader %d]\n", *id);
     LWP_DispatchProcess();     /* Just relinquish control for now */
 
     PRE_PreemptMe();
     for (;;) {
-       register int i;
+       int i;
 
        /* Wait until there is something in the queue */
        asleep++;
@@ -131,8 +117,8 @@ read_process(id)
     return 0;
 }
 
-static int
-write_process()
+static void *
+write_process(void *dummy)
 {
     static char *messages[] = {
        "Mary had a little lamb,",
@@ -204,9 +190,8 @@ write_process()
 
 #include "AFS_component_version_number.c"
 
-main(argc, argv)
-     int argc;
-     char **argv;
+int
+main(int argc, char **argv)
 {
     int nreaders, i;
     PROCESS pid;