/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nspr_os2_defs_h___
#define nspr_os2_defs_h___
#define INCL_DOS
#define INCL_DOSPROCESS
#define INCL_DOSERRORS
#define INCL_WIN
#define INCL_WPS
#include <os2.h>
#include "prio.h"
#include <errno.h>
#ifdef XP_OS2_VACPP
#define USE_RAMSEM
#endif
#ifdef USE_RAMSEM
#pragma pack(4)
#pragma pack(2)
typedef struct _RAMSEM
{
typedef struct _CRITICAL_SECTION
{
#pragma pack(4)
#endif
/*
* Internal configuration macros
*/
#define HAVE_DLL
#define _PR_GLOBAL_THREADS_ONLY
#define _PR_HAVE_THREADSAFE_GETHOST
#define _PR_HAVE_ATOMIC_OPS
#ifndef TCPV40HDRS /* bird */
#endif /* bird */
#define HANDLE unsigned long
/* --- Common User-Thread/Native-Thread Definitions --------------------- */
/* --- Globals --- */
extern struct PRLock *_pr_schedLock;
/* --- Typedefs --- */
typedef void (*FiberFunc)(void *);
typedef int (*FARPROC)();
struct _MDSemaphore {
};
struct _MDCPU {
int unused;
};
struct _MDThread {
* for IO or CondVar.
*/
* wait queue of some cond var.
* PR_FALSE otherwise. */
* chain the PRThread structures
* together */
};
struct _MDThreadStack {
};
struct _MDSegment {
};
struct _MDDir {
* by FindFirstFile()? */
};
struct _MDCVar {
* linked list of threads
* waiting on this condition
* variable */
* wait queue */
};
struct _MDNotified {
* structure */
struct {
};
struct _MDLock {
#ifdef USE_RAMSEM
#else
#endif
/*
* When notifying cvars, there is no point in actually
* waking up the threads waiting on the cvars until we've
* released the lock. So, we temporarily record the cvars.
* When doing an unlock, we'll then wake up the waiting threads.
*/
#ifdef PROFILE_LOCKS
#endif
};
struct _MDFileDesc {
* - For stdin, stdout, and stderr, we are using
* the libc file handle (0, 1, 2), which is an int.
* - For files and pipes, we are using OS/2 handles,
* which is a void*.
* - For sockets, we are using int
*/
};
struct _MDProcess {
};
/* --- Misc stuff --- */
/* --- IO stuff --- */
/* --- Socket IO stuff --- */
/* The ones that don't map directly may need to be re-visited... */
#ifdef XP_OS2_VACPP
#endif
#ifndef INADDR_LOOPBACK /* For some reason this is not defined in OS2 tcpip */
/* #define INADDR_LOOPBACK INADDR_ANY */
#endif
extern void _MD_MakeNonblock(PRFileDesc *f);
#ifdef XP_OS2_VACPP
#else
#endif
#ifdef _PR_HAVE_ATOMIC_OPS
#define _MD_INIT_ATOMIC()
#endif
/* --- Scheduler stuff --- */
/* #define _MD_PAUSE_CPU _PR_MD_PAUSE_CPU */
#define _MD_PAUSE_CPU
/* --- DIR stuff --- */
/* --- Segment stuff --- */
#define _MD_INIT_SEGS()
/* --- Environment Stuff --- */
/* --- Threading Stuff --- */
#define _MD_BEGIN_SUSPEND_ALL()
#define _MD_BEGIN_RESUME_ALL()
#define _MD_END_SUSPEND_ALL()
#define _MD_END_RESUME_ALL()
/* --- Lock stuff --- */
extern void
#ifdef USE_RAMSEM
} else { \
} \
#else
} else { \
} \
#endif
/* --- lock and cv waiting --- */
/* --- CVar ------------------- */
/* XXXMB- the IOQ stuff is certainly not working correctly yet. */
/* extern struct _MDLock _pr_ioq_lock; */
#define _MD_IOQ_LOCK()
#define _MD_IOQ_UNLOCK()
/* --- Initialization stuff --- */
#define _MD_START_INTERRUPTS()
#define _MD_STOP_INTERRUPTS()
#define _MD_DISABLE_CLOCK_INTERRUPTS()
#define _MD_ENABLE_CLOCK_INTERRUPTS()
#define _MD_BLOCK_CLOCK_INTERRUPTS()
#define _MD_UNBLOCK_CLOCK_INTERRUPTS()
#define _MD_FINAL_INIT()
#define _MD_INIT_CPUS()
struct PRProcess;
struct PRProcessAttr;
extern struct PRProcess * _PR_CreateOS2ProcessEx(
const char *path,
char *const *argv,
char *const *envp,
const struct PRProcessAttr *attr,
);
extern struct PRProcess * _PR_CreateOS2Process(
const char *path,
char *const *argv,
char *const *envp,
const struct PRProcessAttr *attr
);
/* --- Wait for a child process to terminate --- */
#define _MD_CLEANUP_BEFORE_EXIT()
#define _MD_SWITCH_CONTEXT
#define _MD_RESTORE_CONTEXT
/* --- Intervals --- */
/* --- Native-Thread Specific Definitions ------------------------------- */
typedef struct __NSPR_TLS
{
} _NSPR_TLS;
extern _NSPR_TLS* pThreadLocalStorage;
NSPR_API(void) _PR_MD_ENSURE_TLS(void);
extern struct PRThread * _MD_CURRENT_THREAD(void);
#define _MD_SET_CURRENT_THREAD(_thread) _PR_MD_ENSURE_TLS(); pThreadLocalStorage->_pr_currentThread = (_thread)
#define _MD_SET_LAST_THREAD(_thread) _PR_MD_ENSURE_TLS(); pThreadLocalStorage->_pr_thread_last_run = (_thread)
/* lth. #define _MD_SET_INTSOFF(_val) (_pr_ints_off = (_val)) */
/* lth. #define _MD_GET_INTSOFF() _pr_ints_off */
/* lth. #define _MD_INCREMENT_INTSOFF() (_pr_ints_off++) */
/* lth. #define _MD_DECREMENT_INTSOFF() (_pr_ints_off--) */
/* --- Scheduler stuff --- */
#define LOCK_SCHEDULER() 0
#define UNLOCK_SCHEDULER() 0
#define _PR_LockSched() 0
#define _PR_UnlockSched() 0
/* --- Initialization stuff --- */
#define _MD_INIT_LOCKS()
/* --- Stack stuff --- */
/* --- Memory-mapped files stuff --- not implemented on OS/2 */
struct _MDFileMap {
};
extern PRInt32 _MD_GetMemMapAlignment(void);
/* Some stuff for setting up thread contexts */
/* The following definitions and two structures are new in OS/2 Warp 4.0.
*/
#ifndef CONTEXT_CONTROL
#pragma pack(2)
typedef struct _FPREG {
} FPREG;
typedef struct _CONTEXTRECORD {
#pragma pack()
#endif
/*
#define _pr_tid (((PTIB2)_getTIBvalue(offsetof(TIB, tib_ptib2)))->tib2_ultid)
#define _pr_current_Thread (_system_tls[_pr_tid-1].__pr_current_thread)
*/
/* Some simple mappings of Windows API's to OS/2 API's to make our lives a
* little bit easier. Only add one here if it is a DIRECT mapping. We are
* not emulating anything. Just mapping.
*/
#define OutputDebugString(x)
extern int _MD_os2_get_nonblocking_connect_error(int osfd);
#endif /* nspr_os2_defs_h___ */