home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / nsprpub / pr / include / md / _aix.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  4.0 KB  |  166 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_aix_defs_h___
  20. #define nspr_aix_defs_h___
  21.  
  22. #include <sys/types.h>
  23. #if defined(_PR_PTHREADS) || defined(PTHREADS_USER)
  24. #include <pthread.h>
  25. #endif
  26.  
  27. /*
  28.  * To pick up fd_set.  In AIX 4.2, fd_set is defined in <sys/time.h>,
  29.  * which is included by _unixos.h.
  30.  */
  31. #ifdef AIX4_1
  32. #include <sys/select.h>
  33. #include <sys/poll.h>
  34. #endif
  35.  
  36. /*
  37.  * Internal configuration macros
  38.  */
  39.  
  40. #define PR_LINKER_ARCH          "aix"
  41. #define _PR_SI_SYSNAME        "AIX"
  42. #define _PR_SI_ARCHITECTURE    "rs6000"
  43. #define PR_DLL_SUFFIX        ".so"
  44.  
  45. #define _PR_VMBASE         0x30000000
  46. #define _PR_STACK_VMBASE    0x50000000
  47. #define _MD_DEFAULT_STACK_SIZE    65536L
  48. #define _MD_MMAP_FLAGS        MAP_PRIVATE
  49.  
  50. #define NEED_TIME_R
  51. #undef  HAVE_STACK_GROWING_UP
  52. #undef    HAVE_WEAK_IO_SYMBOLS
  53. #undef    HAVE_WEAK_MALLOC_SYMBOLS
  54. #define    HAVE_DLL
  55. #define    USE_DLFCN
  56.  
  57. #undef _PR_HAVE_ATOMIC_OPS
  58.  
  59. #define _MD_GET_INTERVAL                  _PR_UNIX_GetInterval
  60. #define _MD_INTERVAL_PER_SEC              _PR_UNIX_TicksPerSecond
  61.  
  62. #define USE_SETJMP
  63.  
  64. #include <setjmp.h>
  65.  
  66. #define _MD_GET_SP(_t)                (_t)->md.jb[3]
  67. #define _MD_SET_THR_SP(_t, _sp)        ((_t)->md.jb[3] = (int) (_sp - 2 * 64))
  68. #define PR_NUM_GCREGS                _JBLEN
  69.  
  70. #define CONTEXT(_th)                 ((_th)->md.jb)
  71. #define SAVE_CONTEXT(_th)            _setjmp(CONTEXT(_th))
  72. #define GOTO_CONTEXT(_th)            _longjmp(CONTEXT(_th), 1)
  73.  
  74. #ifdef PTHREADS_USER
  75. #include "_nspr_pthread.h"
  76. #else
  77.  
  78. /*
  79. ** Initialize the thread context preparing it to execute _main.
  80. */
  81. #define _MD_INIT_CONTEXT(_thread, _sp, _main, status)          \
  82.     PR_BEGIN_MACRO                      \
  83.         *status = PR_TRUE;              \
  84.     if (setjmp(CONTEXT(_thread))) {    \
  85.         (*_main)();            \
  86.     }                \
  87.     _MD_GET_SP(_thread) = (int) (_sp - 2 * 64);        \
  88.     PR_END_MACRO
  89.  
  90. #define _MD_SWITCH_CONTEXT(_thread)  \
  91.     if (!setjmp(CONTEXT(_thread))) { \
  92.     (_thread)->md.errcode = errno;  \
  93.     _PR_Schedule();             \
  94.     }
  95.  
  96. /*
  97. ** Restore a thread context, saved by _MD_SWITCH_CONTEXT
  98. */
  99. #define _MD_RESTORE_CONTEXT(_thread) \
  100. {                     \
  101.     errno = (_thread)->md.errcode; \
  102.     _MD_SET_CURRENT_THREAD(_thread); \
  103.     longjmp(CONTEXT(_thread), 1); \
  104. }
  105.  
  106. /* Machine-dependent (MD) data structures */
  107.  
  108. struct _MDThread {
  109.     jmp_buf jb;
  110.     int id;
  111.     int errcode;
  112. };
  113.  
  114. struct _MDThreadStack {
  115.     PRInt8 notused;
  116. };
  117.  
  118. struct _MDLock {
  119.     PRInt8 notused;
  120. };
  121.  
  122. struct _MDSemaphore {
  123.     PRInt8 notused;
  124. };
  125.  
  126. struct _MDCVar {
  127.     PRInt8 notused;
  128. };
  129.  
  130. struct _MDSegment {
  131.     PRInt8 notused;
  132. };
  133.  
  134. struct _MDCPU {
  135.     struct _MDCPU_Unix md_unix;
  136. };
  137.  
  138. #if !defined(_PR_PTHREADS)
  139. #define _MD_INIT_LOCKS()
  140. #endif
  141.  
  142. #define _MD_NEW_LOCK(lock) PR_SUCCESS
  143. #define _MD_FREE_LOCK(lock)
  144. #define _MD_LOCK(lock)
  145. #define _MD_UNLOCK(lock)
  146. #define _MD_INIT_IO()
  147. #define _MD_IOQ_LOCK()
  148. #define _MD_IOQ_UNLOCK()
  149.  
  150. #define _MD_EARLY_INIT              _MD_EarlyInit
  151. #define _MD_FINAL_INIT            _PR_UnixInit
  152. #define _MD_INIT_RUNNING_CPU(cpu)    _MD_unix_init_running_cpu(cpu)
  153. #define _MD_INIT_THREAD            _MD_InitializeThread
  154. #define _MD_EXIT_THREAD(thread)
  155. #define    _MD_SUSPEND_THREAD(thread)
  156. #define    _MD_RESUME_THREAD(thread)
  157. #define _MD_CLEAN_THREAD(_thread)
  158. #endif /* PTHREADS_USER */
  159.  
  160. #ifdef AIX4_1
  161. #define _MD_SELECT    select
  162. #define _MD_POLL    poll
  163. #endif
  164.  
  165. #endif /* nspr_aix_defs_h___ */
  166.