tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

_qnx.h (4767B)


      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 
      6 #ifndef nspr_qnx_defs_h___
      7 #define nspr_qnx_defs_h___
      8 
      9 /*
     10 ** Internal configuration macros
     11 */
     12 #define PR_LINKER_ARCH      "qnx"
     13 #define _PR_SI_SYSNAME      "QNX"
     14 #define _PR_SI_ARCHITECTURE "x86"
     15 #define PR_DLL_SUFFIX       ".so"
     16 
     17 #define _PR_VMBASE      0x30000000
     18 #define _PR_STACK_VMBASE    0x50000000
     19 #define _MD_DEFAULT_STACK_SIZE  65536L
     20 #define _MD_MMAP_FLAGS      MAP_PRIVATE
     21 
     22 #ifndef HAVE_WEAK_IO_SYMBOLS
     23 #define HAVE_WEAK_IO_SYMBOLS
     24 #endif
     25 
     26 #undef _PR_POLL_AVAILABLE
     27 #undef _PR_USE_POLL
     28 #define _PR_HAVE_SOCKADDR_LEN
     29 #define HAVE_BSD_FLOCK
     30 #define _PR_NO_LARGE_FILES
     31 #define _PR_STAT_HAS_ONLY_ST_ATIME
     32 
     33 #include <sys/select.h>
     34 
     35 #undef  HAVE_STACK_GROWING_UP
     36 #undef  HAVE_DLL
     37 #undef  USE_DLFCN
     38 #define NEED_STRFTIME_LOCK
     39 #define NEED_TIME_R
     40 #define _PR_NEED_STRCASECMP
     41 
     42 #ifndef HAVE_STRERROR
     43 #define HAVE_STRERROR
     44 #endif
     45 
     46 #define USE_SETJMP
     47 
     48 #include <setjmp.h>
     49 
     50 #define _SETJMP         setjmp
     51 #define _LONGJMP        longjmp
     52 #define _PR_CONTEXT_TYPE    jmp_buf
     53 #define _PR_NUM_GCREGS      _JBLEN
     54 #define _MD_GET_SP(_t)      (_t)->md.context[7]
     55 
     56 #define CONTEXT(_th)        ((_th)->md.context)
     57 
     58 /*
     59 ** Initialize the thread context preparing it to execute _main.
     60 */
     61 #define _MD_INIT_CONTEXT(_thread, _sp, _main, status)   \
     62 {                           \
     63    *status = PR_TRUE;                  \
     64    if(_SETJMP(CONTEXT(_thread))) (*_main)();       \
     65    _MD_GET_SP(_thread) = (int) ((_sp) - 128);      \
     66 }
     67 
     68 #define _MD_SWITCH_CONTEXT(_thread) \
     69    if (!_SETJMP(CONTEXT(_thread))) {   \
     70    (_thread)->md.errcode = errno;  \
     71    _PR_Schedule();         \
     72    }
     73 
     74 /*
     75 ** Restore a thread context, saved by _MD_SWITCH_CONTEXT
     76 */
     77 #define _MD_RESTORE_CONTEXT(_thread)    \
     78 {                   \
     79    errno = (_thread)->md.errcode;  \
     80    _MD_SET_CURRENT_THREAD(_thread);    \
     81    _LONGJMP(CONTEXT(_thread), 1);  \
     82 }
     83 
     84 /*
     85 ** Machine-dependent (MD) data structures.
     86 */
     87 struct _MDThread {
     88    _PR_CONTEXT_TYPE context;
     89    int id;
     90    int errcode;
     91 };
     92 
     93 struct _MDThreadStack {
     94    PRInt8 notused;
     95 };
     96 
     97 struct _MDLock {
     98    PRInt8 notused;
     99 };
    100 
    101 struct _MDSemaphore {
    102    PRInt8 notused;
    103 };
    104 
    105 struct _MDCVar {
    106    PRInt8 notused;
    107 };
    108 
    109 struct _MDSegment {
    110    PRInt8 notused;
    111 };
    112 
    113 /*
    114 ** md-specific cpu structure field
    115 */
    116 #define _PR_MD_MAX_OSFD     FD_SETSIZE
    117 
    118 struct _MDCPU_Unix {
    119    PRCList ioQ;
    120    PRUint32 ioq_timeout;
    121    PRInt32 ioq_max_osfd;
    122    PRInt32 ioq_osfd_cnt;
    123 #ifndef _PR_USE_POLL
    124    fd_set fd_read_set, fd_write_set, fd_exception_set;
    125    PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD], fd_write_cnt[_PR_MD_MAX_OSFD], fd_exception_cnt[_PR_MD_MAX_OSFD];
    126 #else
    127    struct pollfd *ioq_pollfds;
    128    int ioq_pollfds_size;
    129 #endif
    130 };
    131 
    132 #define _PR_IOQ(_cpu)           ((_cpu)->md.md_unix.ioQ)
    133 #define _PR_ADD_TO_IOQ(_pq, _cpu)   PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
    134 #define _PR_FD_READ_SET(_cpu)       ((_cpu)->md.md_unix.fd_read_set)
    135 #define _PR_FD_READ_CNT(_cpu)       ((_cpu)->md.md_unix.fd_read_cnt)
    136 #define _PR_FD_WRITE_SET(_cpu)      ((_cpu)->md.md_unix.fd_write_set)
    137 #define _PR_FD_WRITE_CNT(_cpu)      ((_cpu)->md.md_unix.fd_write_cnt)
    138 #define _PR_FD_EXCEPTION_SET(_cpu)  ((_cpu)->md.md_unix.fd_exception_set)
    139 #define _PR_FD_EXCEPTION_CNT(_cpu)  ((_cpu)->md.md_unix.fd_exception_cnt)
    140 #define _PR_IOQ_TIMEOUT(_cpu)       ((_cpu)->md.md_unix.ioq_timeout)
    141 #define _PR_IOQ_MAX_OSFD(_cpu)      ((_cpu)->md.md_unix.ioq_max_osfd)
    142 #define _PR_IOQ_OSFD_CNT(_cpu)      ((_cpu)->md.md_unix.ioq_osfd_cnt)
    143 #define _PR_IOQ_POLLFDS(_cpu)       ((_cpu)->md.md_unix.ioq_pollfds)
    144 #define _PR_IOQ_POLLFDS_SIZE(_cpu)  ((_cpu)->md.md_unix.ioq_pollfds_size)
    145 
    146 #define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu)  32
    147 
    148 struct _MDCPU {
    149    struct _MDCPU_Unix md_unix;
    150 };
    151 
    152 #define _MD_INIT_LOCKS()
    153 #define _MD_NEW_LOCK(lock)      PR_SUCCESS
    154 #define _MD_FREE_LOCK(lock)
    155 #define _MD_LOCK(lock)
    156 #define _MD_UNLOCK(lock)
    157 #define _MD_INIT_IO()
    158 #define _MD_IOQ_LOCK()
    159 #define _MD_IOQ_UNLOCK()
    160 
    161 #define _MD_INTERVAL_USE_GTOD
    162 #define _MD_EARLY_INIT          _MD_EarlyInit
    163 #define _MD_FINAL_INIT          _PR_UnixInit
    164 #define _MD_INIT_RUNNING_CPU(cpu)   _MD_unix_init_running_cpu(cpu)
    165 #define _MD_INIT_THREAD         _MD_InitializeThread
    166 #define _MD_EXIT_THREAD(thread)
    167 #define _MD_SUSPEND_THREAD(thread)
    168 #define _MD_RESUME_THREAD(thread)
    169 #define _MD_CLEAN_THREAD(_thread)
    170 
    171 /*
    172 ** We wrapped the select() call.  _MD_SELECT refers to the built-in,
    173 ** unwrapped version.
    174 */
    175 #include <sys/time.h>
    176 #include <sys/types.h>
    177 #include <sys/select.h>
    178 #define _MD_SELECT      select
    179 
    180 #define SA_RESTART 0
    181 
    182 #endif /* nspr_qnx_defs_h___ */