home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / nsprpub / pr / include / md / _unixware.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  4.1 KB  |  162 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /*
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  * 
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  * 
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. #ifndef nspr_unixware_defs_h___
  20. #define nspr_unixware_defs_h___
  21.  
  22. /*
  23.  * Internal configuration macros
  24.  */
  25.  
  26. #define PR_LINKER_ARCH    "unixware"
  27. #define _PR_SI_SYSNAME        "UnixWare"
  28. #define _PR_SI_ARCHITECTURE    "x86"
  29. #define PR_DLL_SUFFIX        ".so"
  30.  
  31. #define _PR_VMBASE         0x30000000
  32. #define _PR_STACK_VMBASE    0x50000000
  33. #define _MD_DEFAULT_STACK_SIZE    65536L
  34. #define _MD_MMAP_FLAGS          MAP_PRIVATE
  35.  
  36. #ifndef    HAVE_WEAK_IO_SYMBOLS
  37. #define    HAVE_WEAK_IO_SYMBOLS
  38. #endif
  39.  
  40. #undef  HAVE_STACK_GROWING_UP
  41. #define HAVE_NETCONFIG
  42. #define    HAVE_DLL
  43. #define    USE_DLFCN
  44. #define HAVE_STRERROR
  45. #define NEED_STRFTIME_LOCK
  46. #define NEED_TIME_R
  47. #define _PR_NEED_STRCASECMP
  48.  
  49. #define USE_SETJMP
  50.  
  51. #include <setjmp.h>
  52.  
  53. #define _SETJMP setjmp
  54. #define _LONGJMP longjmp
  55. #define _PR_CONTEXT_TYPE         jmp_buf
  56. #define _MD_GET_SP(_t)           (_t)->md.context[4]
  57. #define _PR_NUM_GCREGS    _JBLEN
  58.  
  59. #define CONTEXT(_th) ((_th)->md.context)
  60.  
  61. /*
  62. ** Initialize the thread context preparing it to execute _main.
  63. */
  64. #define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
  65. {                                  \
  66.     *status = PR_TRUE; \
  67.     if(_SETJMP(CONTEXT(_thread))) (*_main)(); \
  68.     _MD_GET_SP(_thread) = (int) ((_sp) - 128); \
  69. }
  70.  
  71. #define _MD_SWITCH_CONTEXT(_thread)  \
  72.     if (!_SETJMP(CONTEXT(_thread))) { \
  73.     (_thread)->md.errcode = errno;  \
  74.     _PR_Schedule();             \
  75.     }
  76.  
  77. /*
  78. ** Restore a thread context, saved by _MD_SWITCH_CONTEXT
  79. */
  80. #define _MD_RESTORE_CONTEXT(_thread) \
  81. {                     \
  82.     errno = (_thread)->md.errcode;         \
  83.     _MD_SET_CURRENT_THREAD(_thread); \
  84.     _LONGJMP(CONTEXT(_thread), 1);    \
  85. }
  86.  
  87. /* Machine-dependent (MD) data structures.
  88.  * Don't use SVR4 native threads (yet). 
  89.  */
  90.  
  91. struct _MDThread {
  92.     _PR_CONTEXT_TYPE context;
  93.     int id;
  94.     int errcode;
  95. };
  96.  
  97. struct _MDThreadStack {
  98.     PRInt8 notused;
  99. };
  100.  
  101. struct _MDLock {
  102.     PRInt8 notused;
  103. };
  104.  
  105. struct _MDSemaphore {
  106.     PRInt8 notused;
  107. };
  108.  
  109. struct _MDCVar {
  110.     PRInt8 notused;
  111. };
  112.  
  113. struct _MDSegment {
  114.     PRInt8 notused;
  115. };
  116.  
  117. struct _MDCPU {
  118.     struct _MDCPU_Unix md_unix;
  119. };
  120.  
  121. #define _MD_INIT_LOCKS()
  122. #define _MD_NEW_LOCK(lock) PR_SUCCESS
  123. #define _MD_FREE_LOCK(lock)
  124. #define _MD_LOCK(lock)
  125. #define _MD_UNLOCK(lock)
  126. #define _MD_INIT_IO()
  127. #define _MD_IOQ_LOCK()
  128. #define _MD_IOQ_UNLOCK()
  129.  
  130. /*
  131.  * The following are copied from _sunos.h, _aix.h.  This means
  132.  * some of them should probably be moved into _unixos.h.  But
  133.  * _irix.h seems to be quite different in regard to these macros.
  134.  */
  135. #define _MD_GET_INTERVAL                  _PR_UNIX_GetInterval
  136. #define _MD_INTERVAL_PER_SEC              _PR_UNIX_TicksPerSecond
  137.  
  138. #define _MD_EARLY_INIT        _MD_EarlyInit
  139. #define _MD_FINAL_INIT        _PR_UnixInit
  140. #define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
  141. #define _MD_INIT_THREAD         _MD_InitializeThread
  142. #define _MD_EXIT_THREAD(thread)
  143. #define    _MD_SUSPEND_THREAD(thread)
  144. #define    _MD_RESUME_THREAD(thread)
  145. #define _MD_CLEAN_THREAD(_thread)
  146.  
  147. /*
  148.  * We wrapped the select() call.  _MD_SELECT refers to the built-in,
  149.  * unwrapped version.
  150.  */
  151. #include <sys/time.h>
  152. #include <sys/types.h>
  153. #include <sys/select.h>
  154. extern int _select(int nfds, fd_set *readfds, fd_set *writefds,
  155.     fd_set *execptfds, struct timeval *timeout);
  156. #define _MD_SELECT _select
  157.  
  158. #define _MD_POLL _poll
  159. extern int _poll(struct pollfd *fds, unsigned long nfds, int timeout);
  160.  
  161. #endif /* nspr_unixware_defs_h___ */
  162.