_scoos.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #ifndef nspr_scoos5_defs_h___
  6. #define nspr_scoos5_defs_h___
  7. /*
  8. * Internal configuration macros
  9. */
  10. #define PR_LINKER_ARCH "scoos5"
  11. #define PR_DLL_SUFFIX ".so"
  12. #define _PR_SI_SYSNAME "SCO"
  13. #define _PR_SI_ARCHITECTURE "x86"
  14. #define _PR_STACK_VMBASE 0x50000000
  15. #define _MD_DEFAULT_STACK_SIZE 65536L
  16. #define _MD_MMAP_FLAGS MAP_PRIVATE
  17. #undef HAVE_STACK_GROWING_UP
  18. #define HAVE_DLL
  19. #define USE_DLFCN
  20. #if !defined (HAVE_STRERROR)
  21. #define HAVE_STRERROR
  22. #endif
  23. #ifndef HAVE_WEAK_IO_SYMBOLS
  24. #define HAVE_WEAK_IO_SYMBOLS
  25. #endif
  26. #define _PR_POLL_AVAILABLE
  27. #define _PR_USE_POLL
  28. #define _PR_NO_LARGE_FILES
  29. #define _PR_STAT_HAS_ONLY_ST_ATIME
  30. #define NEED_STRFTIME_LOCK
  31. #define NEED_TIME_R
  32. #define _PR_RECV_BROKEN /* recv doesn't work on Unix Domain Sockets */
  33. #define USE_SETJMP
  34. #ifdef _PR_LOCAL_THREADS_ONLY
  35. #include <setjmp.h>
  36. #define _MD_GET_SP(_t) (_t)->md.jb[4]
  37. #define PR_NUM_GCREGS _SIGJBLEN
  38. #define PR_CONTEXT_TYPE sigjmp_buf
  39. #define CONTEXT(_th) ((_th)->md.jb)
  40. #define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
  41. { \
  42. *status = PR_TRUE; \
  43. if (sigsetjmp(CONTEXT(_thread),1)) { \
  44. (*_main)(); \
  45. } \
  46. _MD_GET_SP(_thread) = (int) ((_sp) - 64); \
  47. }
  48. #define _MD_SWITCH_CONTEXT(_thread) \
  49. if (!sigsetjmp(CONTEXT(_thread), 1)) { \
  50. (_thread)->md.errcode = errno; \
  51. _PR_Schedule(); \
  52. }
  53. /*
  54. ** Restore a thread context, saved by _MD_SWITCH_CONTEXT
  55. */
  56. #define _MD_RESTORE_CONTEXT(_thread) \
  57. { \
  58. errno = (_thread)->osErrorCode; \
  59. _MD_SET_CURRENT_THREAD(_thread); \
  60. siglongjmp(CONTEXT(_thread), 1); \
  61. }
  62. #endif /* _PR_LOCAL_THREADS_ONLY */
  63. struct _MDThread {
  64. jmp_buf jb;
  65. int id;
  66. int errcode;
  67. };
  68. struct _MDThreadStack {
  69. PRInt8 notused;
  70. };
  71. struct _MDLock {
  72. PRInt8 notused;
  73. };
  74. struct _MDSemaphore {
  75. PRInt8 notused;
  76. };
  77. struct _MDCVar {
  78. PRInt8 notused;
  79. };
  80. struct _MDSegment {
  81. PRInt8 notused;
  82. };
  83. /*
  84. * md-specific cpu structure field
  85. */
  86. #define _PR_MD_MAX_OSFD FD_SETSIZE
  87. struct _MDCPU_Unix {
  88. PRCList ioQ;
  89. PRUint32 ioq_timeout;
  90. PRInt32 ioq_max_osfd;
  91. PRInt32 ioq_osfd_cnt;
  92. #ifndef _PR_USE_POLL
  93. fd_set fd_read_set, fd_write_set, fd_exception_set;
  94. PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
  95. fd_exception_cnt[_PR_MD_MAX_OSFD];
  96. #else
  97. struct pollfd *ioq_pollfds;
  98. int ioq_pollfds_size;
  99. #endif /* _PR_USE_POLL */
  100. };
  101. #define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
  102. #define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
  103. #define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
  104. #define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
  105. #define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
  106. #define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
  107. #define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
  108. #define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
  109. #define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
  110. #define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
  111. #define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
  112. #define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
  113. #define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
  114. #define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
  115. struct _MDCPU {
  116. struct _MDCPU_Unix md_unix;
  117. };
  118. #define _MD_INIT_LOCKS()
  119. #define _MD_NEW_LOCK(lock) PR_SUCCESS
  120. #define _MD_FREE_LOCK(lock)
  121. #define _MD_LOCK(lock)
  122. #define _MD_UNLOCK(lock)
  123. #define _MD_INIT_IO()
  124. #define _MD_IOQ_LOCK()
  125. #define _MD_IOQ_UNLOCK()
  126. #define _MD_EARLY_INIT _MD_EarlyInit
  127. #define _MD_FINAL_INIT _PR_UnixInit
  128. #define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
  129. #define _MD_INIT_THREAD _MD_InitializeThread
  130. #define _MD_EXIT_THREAD(thread)
  131. #define _MD_SUSPEND_THREAD(thread)
  132. #define _MD_RESUME_THREAD(thread)
  133. #define _MD_CLEAN_THREAD(_thread)
  134. #define _MD_INTERVAL_USE_GTOD
  135. #define _MD_SELECT _select
  136. #define _MD_POLL _poll
  137. #endif /* nspr_scoos5_defs_h___ */