home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / nspr30-e.zip / nspr30-e / include / md / _scoos.h < prev    next >
C/C++ Source or Header  |  1998-11-02  |  5KB  |  186 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_scoos5_defs_h___
  20. #define nspr_scoos5_defs_h___
  21.  
  22. /*
  23.  * Internal configuration macros
  24.  */
  25.  
  26. #define PR_LINKER_ARCH    "scoos5"
  27. #define PR_DLL_SUFFIX        ".so"
  28.  
  29. #define _PR_SI_SYSNAME      "SCO"
  30. #define _PR_SI_ARCHITECTURE "x86"
  31. #define _PR_STACK_VMBASE    0x50000000
  32.  
  33. #define _MD_DEFAULT_STACK_SIZE    65536L
  34. #define _MD_MMAP_FLAGS          MAP_PRIVATE
  35.  
  36. #undef  HAVE_STACK_GROWING_UP
  37. #define    HAVE_DLL
  38. #define    USE_DLFCN
  39.  
  40. #if !defined (HAVE_STRERROR)
  41. #define HAVE_STRERROR
  42. #endif
  43.  
  44. #ifndef    HAVE_WEAK_IO_SYMBOLS
  45. #define    HAVE_WEAK_IO_SYMBOLS
  46. #endif
  47.  
  48. #define _PR_POLL_AVAILABLE
  49. #define _PR_USE_POLL
  50. #define _PR_NO_LARGE_FILES
  51. #define _PR_STAT_HAS_ONLY_ST_ATIME
  52.  
  53. #define NEED_STRFTIME_LOCK
  54. #define NEED_TIME_R
  55. #define _PR_RECV_BROKEN /* recv doesn't work on Unix Domain Sockets */
  56.  
  57. #define USE_SETJMP
  58.  
  59. #ifdef _PR_LOCAL_THREADS_ONLY
  60. #include <setjmp.h>
  61.  
  62. #define _MD_GET_SP(_t)  (_t)->md.jb[4]
  63. #define PR_NUM_GCREGS    _SIGJBLEN
  64. #define PR_CONTEXT_TYPE    sigjmp_buf
  65.  
  66. #define CONTEXT(_th) ((_th)->md.jb)
  67.  
  68. #define _MD_INIT_CONTEXT(_thread, _sp, _main, status)                \
  69. {                                                                      \
  70.     *status = PR_TRUE;                                                \
  71.     if (sigsetjmp(CONTEXT(_thread),1)) {                              \
  72.         (*_main)();                                                 \
  73.     }                                                                  \
  74.     _MD_GET_SP(_thread) = (int) ((_sp) - 64);    \
  75. }
  76.  
  77. #define _MD_SWITCH_CONTEXT(_thread)                                  \
  78.     if (!sigsetjmp(CONTEXT(_thread), 1)) {                             \
  79.         (_thread)->md.errcode = errno;                              \
  80.         _PR_Schedule();                                                 \
  81.     }
  82.  
  83. /*
  84. ** Restore a thread context, saved by _MD_SWITCH_CONTEXT
  85. */
  86. #define _MD_RESTORE_CONTEXT(_thread)                                \
  87. {                                                                     \
  88.     errno = (_thread)->osErrorCode;                                     \
  89.     _MD_SET_CURRENT_THREAD(_thread);                                \
  90.     siglongjmp(CONTEXT(_thread), 1);                                \
  91. }
  92.  
  93. #endif /* _PR_LOCAL_THREADS_ONLY */
  94.  
  95. struct _MDThread {
  96.     jmp_buf jb;
  97.     int id;
  98.     int errcode;
  99. };
  100.  
  101. struct _MDThreadStack {
  102.     PRInt8 notused;
  103. };
  104.  
  105. struct _MDLock {
  106.     PRInt8 notused;
  107. };
  108.  
  109. struct _MDSemaphore {
  110.     PRInt8 notused;
  111. };
  112.  
  113. struct _MDCVar {
  114.     PRInt8 notused;
  115. };
  116.  
  117. struct _MDSegment {
  118.     PRInt8 notused;
  119. };
  120.  
  121. /*
  122.  * md-specific cpu structure field
  123.  */
  124. #define _PR_MD_MAX_OSFD FD_SETSIZE
  125.  
  126. struct _MDCPU_Unix {
  127.     PRCList ioQ;
  128.     PRUint32 ioq_timeout;
  129.     PRInt32 ioq_max_osfd;
  130.     PRInt32 ioq_osfd_cnt;
  131. #ifndef _PR_USE_POLL
  132.     fd_set fd_read_set, fd_write_set, fd_exception_set;
  133.     PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
  134.                 fd_exception_cnt[_PR_MD_MAX_OSFD];
  135. #else
  136.     struct pollfd *ioq_pollfds;
  137.     int ioq_pollfds_size;
  138. #endif    /* _PR_USE_POLL */
  139. };
  140.  
  141. #define _PR_IOQ(_cpu)            ((_cpu)->md.md_unix.ioQ)
  142. #define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
  143. #define _PR_FD_READ_SET(_cpu)        ((_cpu)->md.md_unix.fd_read_set)
  144. #define _PR_FD_READ_CNT(_cpu)        ((_cpu)->md.md_unix.fd_read_cnt)
  145. #define _PR_FD_WRITE_SET(_cpu)        ((_cpu)->md.md_unix.fd_write_set)
  146. #define _PR_FD_WRITE_CNT(_cpu)        ((_cpu)->md.md_unix.fd_write_cnt)
  147. #define _PR_FD_EXCEPTION_SET(_cpu)    ((_cpu)->md.md_unix.fd_exception_set)
  148. #define _PR_FD_EXCEPTION_CNT(_cpu)    ((_cpu)->md.md_unix.fd_exception_cnt)
  149. #define _PR_IOQ_TIMEOUT(_cpu)        ((_cpu)->md.md_unix.ioq_timeout)
  150. #define _PR_IOQ_MAX_OSFD(_cpu)        ((_cpu)->md.md_unix.ioq_max_osfd)
  151. #define _PR_IOQ_OSFD_CNT(_cpu)        ((_cpu)->md.md_unix.ioq_osfd_cnt)
  152. #define _PR_IOQ_POLLFDS(_cpu)        ((_cpu)->md.md_unix.ioq_pollfds)
  153. #define _PR_IOQ_POLLFDS_SIZE(_cpu)    ((_cpu)->md.md_unix.ioq_pollfds_size)
  154.  
  155. #define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu)    32
  156.  
  157. struct _MDCPU {
  158.     struct _MDCPU_Unix md_unix;
  159. };
  160.  
  161. #define _MD_INIT_LOCKS()
  162. #define _MD_NEW_LOCK(lock) PR_SUCCESS
  163. #define _MD_FREE_LOCK(lock)
  164. #define _MD_LOCK(lock)
  165. #define _MD_UNLOCK(lock)
  166. #define _MD_INIT_IO()
  167. #define _MD_IOQ_LOCK()
  168. #define _MD_IOQ_UNLOCK()
  169.  
  170. #define _MD_EARLY_INIT              _MD_EarlyInit
  171. #define _MD_FINAL_INIT                _PR_UnixInit
  172. #define _MD_INIT_RUNNING_CPU(cpu)     _MD_unix_init_running_cpu(cpu)
  173. #define _MD_INIT_THREAD             _MD_InitializeThread
  174. #define _MD_EXIT_THREAD(thread)
  175. #define    _MD_SUSPEND_THREAD(thread)
  176. #define    _MD_RESUME_THREAD(thread)
  177. #define _MD_CLEAN_THREAD(_thread)
  178.  
  179. #define _MD_GET_INTERVAL                  _PR_UNIX_GetInterval
  180. #define _MD_INTERVAL_PER_SEC              _PR_UNIX_TicksPerSecond
  181.  
  182. #define _MD_SELECT        _select
  183. #define _MD_POLL        _poll
  184.  
  185. #endif /* nspr_scoos5_defs_h___ */
  186.