michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: /* michael@0: * SCO ODT 5.0 - originally created by mikep michael@0: */ michael@0: #include "primpl.h" michael@0: michael@0: #include michael@0: michael@0: void _MD_EarlyInit(void) michael@0: { michael@0: } michael@0: michael@0: PRWord *_MD_HomeGCRegisters(PRThread *t, int isCurrent, int *np) michael@0: { michael@0: if (isCurrent) { michael@0: (void) setjmp(CONTEXT(t)); michael@0: } michael@0: *np = sizeof(CONTEXT(t)) / sizeof(PRWord); michael@0: return (PRWord *) CONTEXT(t); michael@0: } michael@0: michael@0: #ifdef ALARMS_BREAK_TCP /* I don't think they do */ michael@0: michael@0: PRInt32 _MD_connect(PRInt32 osfd, PRNetAddr *addr, PRInt32 addrlen, michael@0: PRIntervalTime timeout) michael@0: { michael@0: PRInt32 rv; michael@0: michael@0: _MD_BLOCK_CLOCK_INTERRUPTS(); michael@0: rv = _connect(osfd,addr,addrlen); michael@0: _MD_UNBLOCK_CLOCK_INTERRUPTS(); michael@0: } michael@0: michael@0: PRInt32 _MD_accept(PRInt32 osfd, PRNetAddr *addr, PRInt32 addrlen, michael@0: PRIntervalTime timeout) michael@0: { michael@0: PRInt32 rv; michael@0: michael@0: _MD_BLOCK_CLOCK_INTERRUPTS(); michael@0: rv = _accept(osfd,addr,addrlen); michael@0: _MD_UNBLOCK_CLOCK_INTERRUPTS(); michael@0: return(rv); michael@0: } michael@0: #endif michael@0: michael@0: /* michael@0: * These are also implemented in pratom.c using NSPR locks. Any reason michael@0: * this might be better or worse? If you like this better, define michael@0: * _PR_HAVE_ATOMIC_OPS in include/md/unixware.h michael@0: */ michael@0: #ifdef _PR_HAVE_ATOMIC_OPS michael@0: /* Atomic operations */ michael@0: #include michael@0: static FILE *_uw_semf; michael@0: michael@0: void michael@0: _MD_INIT_ATOMIC(void) michael@0: { michael@0: /* Sigh. Sure wish SYSV semaphores weren't such a pain to use */ michael@0: if ((_uw_semf = tmpfile()) == NULL) michael@0: PR_ASSERT(0); michael@0: michael@0: return; michael@0: } michael@0: michael@0: void michael@0: _MD_ATOMIC_INCREMENT(PRInt32 *val) michael@0: { michael@0: flockfile(_uw_semf); michael@0: (*val)++; michael@0: unflockfile(_uw_semf); michael@0: } michael@0: michael@0: void michael@0: _MD_ATOMIC_ADD(PRInt32 *ptr, PRInt32 val) michael@0: { michael@0: flockfile(_uw_semf); michael@0: (*ptr) += val; michael@0: unflockfile(_uw_semf); michael@0: } michael@0: michael@0: void michael@0: _MD_ATOMIC_DECREMENT(PRInt32 *val) michael@0: { michael@0: flockfile(_uw_semf); michael@0: (*val)--; michael@0: unflockfile(_uw_semf); michael@0: } michael@0: michael@0: void michael@0: _MD_ATOMIC_SET(PRInt32 *val, PRInt32 newval) michael@0: { michael@0: flockfile(_uw_semf); michael@0: *val = newval; michael@0: unflockfile(_uw_semf); michael@0: } michael@0: #endif michael@0: michael@0: void michael@0: _MD_SET_PRIORITY(_MDThread *thread, PRUintn newPri) michael@0: { michael@0: return; michael@0: } michael@0: michael@0: PRStatus michael@0: _MD_InitializeThread(PRThread *thread) michael@0: { michael@0: return PR_SUCCESS; michael@0: } michael@0: michael@0: PRStatus michael@0: _MD_WAIT(PRThread *thread, PRIntervalTime ticks) michael@0: { michael@0: PR_ASSERT(!(thread->flags & _PR_GLOBAL_SCOPE)); michael@0: _PR_MD_SWITCH_CONTEXT(thread); michael@0: return PR_SUCCESS; michael@0: } michael@0: michael@0: PRStatus michael@0: _MD_WAKEUP_WAITER(PRThread *thread) michael@0: { michael@0: if (thread) { michael@0: PR_ASSERT(!(thread->flags & _PR_GLOBAL_SCOPE)); michael@0: } michael@0: return PR_SUCCESS; michael@0: } michael@0: michael@0: /* These functions should not be called for SCO */ michael@0: void michael@0: _MD_YIELD(void) michael@0: { michael@0: PR_NOT_REACHED("_MD_YIELD should not be called for SCO."); michael@0: } michael@0: michael@0: PRStatus michael@0: _MD_CREATE_THREAD( michael@0: PRThread *thread, michael@0: void (*start) (void *), michael@0: PRThreadPriority priority, michael@0: PRThreadScope scope, michael@0: PRThreadState state, michael@0: PRUint32 stackSize) michael@0: { michael@0: PR_NOT_REACHED("_MD_CREATE_THREAD should not be called for SCO."); michael@0: }