$NetBSD: patch-bb,v 1.1 2002/04/13 12:53:43 fredb Exp $

--- machdep/engine-m68000-netbsd.h.orig	Fri Nov 12 15:02:41 1999
+++ machdep/engine-m68000-netbsd.h
@@ -10,7 +10,13 @@
 
 #include <unistd.h>
 #include <setjmp.h>
+#include <stdlib.h>
 #include <sys/time.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <sys/resource.h>
+
+#include <pthread/sysfunc.h>
 
 /*
  * The first machine dependent functions are the SEMAPHORES
@@ -70,7 +76,7 @@
  * For initial thread only.
  */
 #define MACHDEP_PTHREAD_INIT    \
-{ NULL, NULL, NULL, { { 0, 0 }, { 0, 100000 } }, 0 }
+       { NULL, NULL, NULL, { { 0, 0 }, { 0, 100000 } }, { 0 }, { 0 } }
 
 /*
  * New functions
@@ -90,17 +96,86 @@
 #ifndef __machdep_stack_repl
 #define __machdep_stack_repl(x, y)                          \
 {                                                           \
-    if (stack = __machdep_stack_get(x)) {                   \
+    if ((stack = __machdep_stack_get(x))) {                 \
         __machdep_stack_free(stack);                        \
     }                                                       \
     __machdep_stack_set(x, y);                              \
 }
 #endif
 
-void *  __machdep_stack_alloc(size_t);
-void    __machdep_stack_free(void *);
-    
-int machdep_save_state(void);
+/* ==========================================================================
+ * machdep_set_thread_timer()
+ */
+static inline
+void machdep_set_thread_timer(struct machdep_pthread *machdep_pthread)
+{
+    if (setitimer(ITIMER_VIRTUAL, &(machdep_pthread->machdep_timer), NULL)) {
+        PANIC("setitimer failed");
+    }
+}
+ 
+/* ==========================================================================
+ * __machdep_stack_alloc()
+ */ 
+static inline
+void * __machdep_stack_alloc(size_t size)
+{   
+    return((void*)malloc(size));
+}     
+
+/* ==========================================================================
+ * __machdep_stack_free()
+ */
+static inline
+void __machdep_stack_free(void * stack)
+{       
+    free(stack);
+}
+
+/* ==========================================================================
+ * machdep_pthread_cleanup()
+ */
+static inline
+void *machdep_pthread_cleanup(struct machdep_pthread *machdep_pthread)
+{
+    return(machdep_pthread->machdep_stack);
+}
+
+/* ==========================================================================
+ * machdep_sys_wait3() 
+ */
+static inline
+int machdep_sys_wait3(int * b, int c, struct rusage * d)
+{
+        return(machdep_sys_wait4(0, b, c, d));
+}
+ 
+/* ==========================================================================
+ * machdep_sys_waitpid()
+ */
+static inline
+int machdep_sys_waitpid(int a, int * b, int c)
+{
+        return(machdep_sys_wait4(a, b, c, NULL));
+}
+
+/* ==========================================================================
+ * machdep_sys_getdtablesize()
+ */
+static inline
+int machdep_sys_getdtablesize(void)
+{
+        return(sysconf(_SC_OPEN_MAX));
+}
+
+/* ==========================================================================
+ * machdep_sys_getdirentries()
+ */
+static inline
+int machdep_sys_getdirentries(int fd, char * buf, int len, int * seek)
+{
+        return(machdep_sys_getdents(fd, buf, len));
+}
 
 #endif
 
