Added a few function declarations and header inclusions to get rid of
authorwtc
Fri, 08 May 1998 18:37:38 +0000
changeset 107 34ab4d33f743a02e0f425da0374c41f7c8ff12f4
parent 106 36a2085110ffaa29de4080c6ae2f75ebb9f7b7e0
child 108 a1b56fb109a5ebc7b5356781c30a1c91c737e500
push idunknown
push userunknown
push dateunknown
Added a few function declarations and header inclusions to get rid of compiler warnings.
pr/include/md/_darwin.h
pr/include/md/_rhapsody.h
--- a/pr/include/md/_darwin.h
+++ b/pr/include/md/_darwin.h
@@ -14,16 +14,18 @@
  * Communications Corporation.  Portions created by Netscape are
  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  * Reserved.
  */
 
 #ifndef nspr_rhapsody_defs_h___
 #define nspr_rhapsody_defs_h___
 
+#include "prthread.h"
+
 #include <sys/syscall.h>
 
 #define PR_LINKER_ARCH	"rhapsody"
 #define _PR_SI_SYSNAME  "RHAPSODY"
 #ifdef i386
 #define _PR_SI_ARCHITECTURE "x86"
 #else
 #define _PR_SI_ARCHITECTURE "ppc"
@@ -39,16 +41,18 @@
 #define HAVE_WEAK_MALLOC_SYMBOLS
 /* do this until I figure out the rhapsody dll stuff. */
 #define HAVE_DLL
 #define USE_RLD
 #define _PR_HAVE_SOCKADDR_LEN
 
 #define USE_SETJMP
 
+#ifndef _PR_PTHREADS
+
 #include <setjmp.h>
 
 #define PR_CONTEXT_TYPE	jmp_buf
 
 #define CONTEXT(_th) ((_th)->md.context)
 
 #define _MD_GET_SP(_th)    (_th)->md.context[0]
 #define PR_NUM_GCREGS	_JBLEN
@@ -57,17 +61,17 @@
 ** Initialize a thread context to run "_main()" when started
 */
 #define _MD_INIT_CONTEXT(_thread, _sp, _main, status)  \
 {  \
     *status = PR_TRUE;  \
     if (setjmp(CONTEXT(_thread))) {  \
         _main();  \
     }  \
-    _MD_GET_SP(_thread) = (unsigned char*) ((_sp) - 128); \
+    _MD_GET_SP(_thread) = (int) ((_sp) - 64); \
 }
 
 #define _MD_SWITCH_CONTEXT(_thread)  \
     if (!setjmp(CONTEXT(_thread))) {  \
 	(_thread)->md.errcode = errno;  \
 	_PR_Schedule();  \
     }
 
@@ -117,28 +121,50 @@ struct _MDCPU {
 #define _MD_NEW_LOCK(lock) PR_SUCCESS
 #define _MD_FREE_LOCK(lock)
 #define _MD_LOCK(lock)
 #define _MD_UNLOCK(lock)
 #define _MD_INIT_IO()
 #define _MD_IOQ_LOCK()
 #define _MD_IOQ_UNLOCK()
 
+extern PRStatus _MD_InitializeThread(PRThread *thread);
+
 #define _MD_INIT_RUNNING_CPU(cpu)       _MD_unix_init_running_cpu(cpu)
 #define _MD_INIT_THREAD                 _MD_InitializeThread
 #define _MD_EXIT_THREAD(thread)
 #define _MD_SUSPEND_THREAD(thread)      _MD_suspend_thread
 #define _MD_RESUME_THREAD(thread)       _MD_resume_thread
 #define _MD_CLEAN_THREAD(_thread)
 
+extern PRStatus _MD_CREATE_THREAD(
+    PRThread *thread,
+    void (*start) (void *),
+    PRThreadPriority priority,
+    PRThreadScope scope,
+    PRThreadState state,
+    PRUint32 stackSize);
+extern void _MD_SET_PRIORITY(struct _MDThread *thread, PRUintn newPri);
+extern PRStatus _MD_WAIT(PRThread *, PRIntervalTime timeout);
+extern PRStatus _MD_WAKEUP_WAITER(PRThread *);
+extern void _MD_YIELD(void);
+
+#endif /* ! _PR_PTHREADS */
+
+extern void _MD_EarlyInit(void);
+extern PRIntervalTime _PR_UNIX_GetInterval(void);
+extern PRIntervalTime _PR_UNIX_TicksPerSecond(void);
+
 #define _MD_EARLY_INIT                  _MD_EarlyInit
 #define _MD_FINAL_INIT			_PR_UnixInit
 #define _MD_GET_INTERVAL                  _PR_UNIX_GetInterval
 #define _MD_INTERVAL_PER_SEC              _PR_UNIX_TicksPerSecond
 
 /*
  * We wrapped the select() call.  _MD_SELECT refers to the built-in,
  * unwrapped version.
  */
 #define _MD_SELECT(nfds,r,w,e,tv) syscall(SYS_select,nfds,r,w,e,tv)
 
+/* For writev() */
+#include <sys/uio.h>
 
 #endif /* nspr_rhapsody_defs_h___ */
--- a/pr/include/md/_rhapsody.h
+++ b/pr/include/md/_rhapsody.h
@@ -14,16 +14,18 @@
  * Communications Corporation.  Portions created by Netscape are
  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  * Reserved.
  */
 
 #ifndef nspr_rhapsody_defs_h___
 #define nspr_rhapsody_defs_h___
 
+#include "prthread.h"
+
 #include <sys/syscall.h>
 
 #define PR_LINKER_ARCH	"rhapsody"
 #define _PR_SI_SYSNAME  "RHAPSODY"
 #ifdef i386
 #define _PR_SI_ARCHITECTURE "x86"
 #else
 #define _PR_SI_ARCHITECTURE "ppc"
@@ -39,16 +41,18 @@
 #define HAVE_WEAK_MALLOC_SYMBOLS
 /* do this until I figure out the rhapsody dll stuff. */
 #define HAVE_DLL
 #define USE_RLD
 #define _PR_HAVE_SOCKADDR_LEN
 
 #define USE_SETJMP
 
+#ifndef _PR_PTHREADS
+
 #include <setjmp.h>
 
 #define PR_CONTEXT_TYPE	jmp_buf
 
 #define CONTEXT(_th) ((_th)->md.context)
 
 #define _MD_GET_SP(_th)    (_th)->md.context[0]
 #define PR_NUM_GCREGS	_JBLEN
@@ -57,17 +61,17 @@
 ** Initialize a thread context to run "_main()" when started
 */
 #define _MD_INIT_CONTEXT(_thread, _sp, _main, status)  \
 {  \
     *status = PR_TRUE;  \
     if (setjmp(CONTEXT(_thread))) {  \
         _main();  \
     }  \
-    _MD_GET_SP(_thread) = (unsigned char*) ((_sp) - 128); \
+    _MD_GET_SP(_thread) = (int) ((_sp) - 64); \
 }
 
 #define _MD_SWITCH_CONTEXT(_thread)  \
     if (!setjmp(CONTEXT(_thread))) {  \
 	(_thread)->md.errcode = errno;  \
 	_PR_Schedule();  \
     }
 
@@ -117,28 +121,50 @@ struct _MDCPU {
 #define _MD_NEW_LOCK(lock) PR_SUCCESS
 #define _MD_FREE_LOCK(lock)
 #define _MD_LOCK(lock)
 #define _MD_UNLOCK(lock)
 #define _MD_INIT_IO()
 #define _MD_IOQ_LOCK()
 #define _MD_IOQ_UNLOCK()
 
+extern PRStatus _MD_InitializeThread(PRThread *thread);
+
 #define _MD_INIT_RUNNING_CPU(cpu)       _MD_unix_init_running_cpu(cpu)
 #define _MD_INIT_THREAD                 _MD_InitializeThread
 #define _MD_EXIT_THREAD(thread)
 #define _MD_SUSPEND_THREAD(thread)      _MD_suspend_thread
 #define _MD_RESUME_THREAD(thread)       _MD_resume_thread
 #define _MD_CLEAN_THREAD(_thread)
 
+extern PRStatus _MD_CREATE_THREAD(
+    PRThread *thread,
+    void (*start) (void *),
+    PRThreadPriority priority,
+    PRThreadScope scope,
+    PRThreadState state,
+    PRUint32 stackSize);
+extern void _MD_SET_PRIORITY(struct _MDThread *thread, PRUintn newPri);
+extern PRStatus _MD_WAIT(PRThread *, PRIntervalTime timeout);
+extern PRStatus _MD_WAKEUP_WAITER(PRThread *);
+extern void _MD_YIELD(void);
+
+#endif /* ! _PR_PTHREADS */
+
+extern void _MD_EarlyInit(void);
+extern PRIntervalTime _PR_UNIX_GetInterval(void);
+extern PRIntervalTime _PR_UNIX_TicksPerSecond(void);
+
 #define _MD_EARLY_INIT                  _MD_EarlyInit
 #define _MD_FINAL_INIT			_PR_UnixInit
 #define _MD_GET_INTERVAL                  _PR_UNIX_GetInterval
 #define _MD_INTERVAL_PER_SEC              _PR_UNIX_TicksPerSecond
 
 /*
  * We wrapped the select() call.  _MD_SELECT refers to the built-in,
  * unwrapped version.
  */
 #define _MD_SELECT(nfds,r,w,e,tv) syscall(SYS_select,nfds,r,w,e,tv)
 
+/* For writev() */
+#include <sys/uio.h>
 
 #endif /* nspr_rhapsody_defs_h___ */