Enable OS/2 builds with IBM's compiler (Visualage) and gcc port of OS/2 (emx).

Checkin for Eric Olson <Eric.Olson@Sympatico.CA> and Henry <sobotka@axess.com>.
This commit is contained in:
srinivas%netscape.com 1998-11-19 22:20:31 +00:00
Родитель 4c81f7917c
Коммит 61317ea209
45 изменённых файлов: 634 добавлений и 217 удалений

Просмотреть файл

@ -61,6 +61,15 @@ ifeq ($(OS_ARCH), HP-UX)
endif
endif
ifdef XP_OS2_EMX
XCFLAGS = $(OS_EXE_CFLAGS)
XLDOPTS = -Zlinker /PM:VIO
endif
ifeq ($(MOZ_OS2_TOOLS),VACPP)
OS_CFLAGS = $(OS_EXE_CFLAGS)
endif
include $(MOD_DEPTH)/config/rules.mk
PROGS = $(OBJDIR)/now$(PROG_SUFFIX)
@ -81,5 +90,8 @@ export:: $(TARGETS)
$(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.$(OBJ_SUFFIX)
@$(MAKE_OBJDIR)
ifeq ($(MOZ_OS2_TOOLS),VACPP)
$(LINK) $(EXEFLAGS) $<
else
$(CC) $(XCFLAGS) $< $(XLDOPTS) -o $@
endif

Просмотреть файл

@ -26,6 +26,17 @@
# the macro OS_CFLAGS is set to OS_EXE_CFLAGS inside of the
# makefile for the pr/tests directory. ... Hack.
# Specify toolset. Default to EMX.
ifeq ($(MOZ_OS2_TOOLS),VACPP)
XP_OS2_VACPP = 1
else
ifeq ($(MOZ_OS2_TOOLS),PGCC)
XP_OS2_EMX = 1
else
MOZ_OS2_TOOLS = EMX
XP_OS2_EMX = 1
endif
endif
#
# On OS/2 we proudly support gbash...
@ -34,54 +45,100 @@ SHELL = GBASH.EXE
CC = icc -q -DXP_OS2 -N10
CCC = icc -q -DXP_OS2 -DOS2=4 -N10
LINK = flipper ilink
AR = flipper ilibo //noignorecase //nologo $@
RANLIB = echo
BSDECHO = echo
NSINSTALL = nsinstall
INSTALL = $(NSINSTALL)
MAKE_OBJDIR = mkdir $(OBJDIR)
IMPLIB = flipper implib -nologo -noignorecase
FILTER = flipper cppfilt -q
RC = rc.exe
LINK = ilink
AR = ilib /noignorecase /nologo $(subst /,\\,$@)
RANLIB = @echo RANLIB
BSDECHO = @echo BSDECHO
NSINSTALL = nsinstall
INSTALL = $(NSINSTALL)
MAKE_OBJDIR = if test ! -d $(OBJDIR); then mkdir $(OBJDIR); fi
IMPLIB = implib -nologo -noignorecase
FILTER = cppfilt -b -p -q
RC = rc.exe
GARBAGE =
XP_DEFINE = -DXP_PC
OBJ_SUFFIX = obj
LIB_SUFFIX = lib
DLL_SUFFIX = dll
XP_DEFINE = -DXP_PC
LIB_SUFFIX = lib
DLL_SUFFIX = dll
OBJ_SUFFIX = obj
OS_CFLAGS = -I. -W3 -gm -gd+ -sd- -su4 -ge-
OS_EXE_CFLAGS = -I. -W3 -gm -gd+ -sd- -su4
AR_EXTRA_ARGS = ,,
OS_CFLAGS = -W3 -Wcnd- -gm -gd+ -sd- -su4 -ge-
OS_EXE_CFLAGS = -W3 -Wcnd- -gm -gd+ -sd- -su4
AR_EXTRA_ARGS = ,,
ifdef BUILD_OPT
OPTIMIZER = -O+ -Oi
DEFINES = -UDEBUG -U_DEBUG -DNDEBUG
DLLFLAGS = -DLL -OUT:$@ -MAP:$(@:.dll=.map)
OBJDIR_TAG = _OPT
OPTIMIZER = -O+ -Oi
DEFINES = -UDEBUG -U_DEBUG -DNDEBUG
DLLFLAGS = -DLL -OUT:$@ -MAP:$(@:.dll=.map)
EXEFLAGS = -PMTYPE:VIO -OUT:$@ -MAP:$(@:.exe=.map) -nologo -NOE
OBJDIR_TAG = _OPT
else
OPTIMIZER = -Ti+
DEFINES = -DDEBUG -D_DEBUG -UNDEBUG
DLLFLAGS = -DEBUG -DLL -OUT:$@ -MAP:$(@:.dll=.map)
OBJDIR_TAG = _DBG
LDFLAGS = -DEBUG
OPTIMIZER = -Ti+ -DE
DEFINES = -DDEBUG -D_DEBUG -DDEBUGPRINTS
DLLFLAGS = -DEBUG -DLL -OUT:$@ -MAP:$(@:.dll=.map)
EXEFLAGS = -DEBUG -PMTYPE:VIO -OUT:$@ -MAP:$(@:.exe=.map) -nologo -NOE
OBJDIR_TAG = _DBG
LDFLAGS = -DEBUG
endif
DEFINES += -DOS2=4 -DBSD_SELECT
DEFINES += -DOS2=4
DEFINES += -D_X86_
DEFINES += -D_PR_GLOBAL_THREADS_ONLY
DEFINES += -D_PR_GLOBAL_THREADS_ONLY -DBSD_SELECT
# Name of the binary code directories
ifeq ($(CPU_ARCH),x86)
ifdef MOZ_LITE
OBJDIR_NAME = $(subst OS2,NAV,$(OS_CONFIG))$(OBJDIR_TAG).OBJ
OBJDIR_NAME = $(subst OS2,NAV,$(OS_CONFIG))_$(MOZ_OS2_TOOLS)$(OBJDIR_TAG).OBJ
else
OBJDIR_NAME = $(OS_CONFIG)$(OBJDIR_TAG).OBJ
endif
else
OBJDIR_NAME = $(OS_CONFIG)$(CPU_ARCH)$(OBJDIR_TAG).OBJ
OBJDIR_NAME = $(OS_CONFIG)_$(MOZ_OS2_TOOLS)$(OBJDIR_TAG).OBJ
endif
OS_DLLFLAGS = -nologo -DLL -FREE -NOE
OS_DLLFLAGS = -nologo -DLL -FREE -NOE
ifdef XP_OS2_VACPP
OS_LIBS = so32dll.lib tcp32dll.lib
DEFINES += -DXP_OS2_VACPP
else
CC = gcc
CCC = gcc
LINK = gcc
RC = rc.exe
FILTER = emxexp
IMPLIB = emximp -o
# Determine which object format to use. Two choices:
# a.out and omf. We default to omf.
ifeq ($(MOZ_OS2_EMX_OBJECTFORMAT), A.OUT)
AR = ar -q $@
LIB_SUFFIX = a
else
OMF_FLAG = -Zomf
AR = emxomfar r $@
LIB_SUFFIX = lib
endif
OS_LIBS = -lsocket -lemxio
DEFINES += -DXP_OS2 -DXP_OS2_EMX -DOS2EMX_PLAIN_CHAR #-DHAVE_SIGNED_CHAR
OS_CFLAGS = $(OMF_FLAG) -Wall -Wno-unused -Zmtd
OS_EXE_CFLAGS = $(OMF_FLAG) -Wall -Wno-unused -Zmtd
OS_DLLFLAGS = $(OMF_FLAG) -Zmt -Zdll -Zcrtdll -o $@
ifdef BUILD_OPT
OPTIMIZER = -O3
DLLFLAGS =
EXEFLAGS = -Zmtd -o $@
else
OPTIMIZER = -g
DLLFLAGS = -g
EXEFLAGS = -g $(OMF_FLAG) -Zmtd -L$(DIST)/lib -o $@
endif
AR_EXTRA_ARGS =
endif

Просмотреть файл

@ -101,6 +101,15 @@ ifeq ($(OS_ARCH)$(OS_RELEASE),OSF1V4.0)
endif
endif
#
# Handle uname variants for OS/2.
#
ifeq ($(OS_ARCH),OS_2)
OS_ARCH := OS2
OS_RELEASE := 4.0
endif
#######################################################################
# Master "Core Components" macros for getting the OS target #
#######################################################################
@ -135,7 +144,7 @@ ifeq ($(OS_ARCH),Windows_95)
OS_ARCH := Windows_NT
OS_TARGET := WIN95
endif
ifeq ($(OS_ARCH), OS2)
ifeq ($(OS_ARCH),OS2)
OS_ARCH := WINNT
OS_TARGET := OS2
endif
@ -145,7 +154,11 @@ endif
#
ifeq ($(OS_ARCH), WINNT)
CPU_ARCH := $(shell uname -p)
ifneq ($(subst /,_,$(shell uname -s)),OS_2)
CPU_ARCH := $(shell uname -p)
else
CPU_ARCH := $(shell uname -m)
endif
ifeq ($(CPU_ARCH),I386)
CPU_ARCH = x86
endif

Просмотреть файл

@ -19,9 +19,9 @@
#include <stdio.h>
#include <stdlib.h>
#if defined(XP_UNIX)
#if defined(XP_UNIX) || defined(XP_OS2_EMX)
#include <sys/time.h>
#elif defined(WIN32)
#elif defined(WIN32) || defined(XP_OS2_VACPP)
#include <sys/timeb.h>
#else
#error "Architecture not supported"
@ -41,7 +41,7 @@ int main(int argc, char **argv)
* of this program and omit the library build time
* in PRVersionDescription.
*/
#elif defined(XP_UNIX)
#elif defined(XP_UNIX) || defined(XP_OS2_EMX)
long long now;
struct timeval tv;
#ifdef HAVE_SVID_GETTOD
@ -58,12 +58,40 @@ int main(int argc, char **argv)
#elif defined(WIN32)
__int64 now;
long long now;
struct timeb b;
ftime(&b);
now = b.time;
now *= 1000000;
now += (1000 * b.millitm);
fprintf(stdout, "%I64d", now);
#elif defined(XP_OS2_VACPP)
/* no long long or i64 so we use a string */
#include <string.h>
char buf[24];
char tbuf[7];
time_t now;
long mtime;
int i;
struct timeb b;
ftime(&b);
now = b.time;
_ltoa(now, buf, 10);
mtime = b.millitm * 1000;
if (mtime == 0){
++now;
strcat(buf, "000000");
} else {
_ltoa(mtime, tbuf, 10);
for (i = strlen(tbuf); i < 6; ++i)
strcat(buf, "0");
strcat(buf, tbuf);
}
fprintf(stdout, "%s", buf);
#else
#error "Architecture not supported"
#endif

Просмотреть файл

@ -72,13 +72,13 @@ ifeq ($(OS_ARCH), WINNT)
# other platforms do not.
#
ifeq (,$(filter-out WIN16 OS2,$(OS_TARGET)))
LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION)_s.lib
SHARED_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).dll
IMPORT_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).lib
LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION)_s.$(LIB_SUFFIX)
SHARED_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
IMPORT_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX)
else
LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION)_s.lib
SHARED_LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).dll
IMPORT_LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).lib
LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION)_s.$(LIB_SUFFIX)
SHARED_LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
IMPORT_LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX)
endif
else
@ -235,7 +235,11 @@ endif
$(LIBRARY): $(OBJS)
@$(MAKE_OBJDIR)
rm -f $@
ifdef XP_OS2_VACPP
$(AR) $(subst /,\\,$(OBJS)) $(AR_EXTRA_ARGS)
else
$(AR) $(OBJS) $(AR_EXTRA_ARGS)
endif
$(RANLIB) $@
ifeq ($(OS_TARGET), WIN16)
@ -285,8 +289,8 @@ ifeq ($(OS_TARGET), OS2)
@cmd /C "echo CODE LOADONCALL MOVEABLE DISCARDABLE >>$@.def"
@cmd /C "echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >>$@.def"
@cmd /C "echo EXPORTS >>$@.def"
@cmd /C "$(FILTER) -B -P $(LIBRARY) >> $@.def"
$(LINK_DLL) -MAP $(DLLBASE) $(OS_LIBS) $(EXTRA_LIBS) $(OBJS) $@.def
@cmd /C "$(FILTER) $(LIBRARY) >> $@.def"
$(LINK_DLL) $(DLLBASE) $(OBJS) $(OS_LIBS) $(EXTRA_LIBS) $@.def
else
$(LINK_DLL) -MAP $(DLLBASE) $(OS_LIBS) $(EXTRA_LIBS) $(OBJS)
endif
@ -317,9 +321,11 @@ endif
$(OBJDIR)/%.$(OBJ_SUFFIX): %.cpp
@$(MAKE_OBJDIR)
ifeq ($(OS_ARCH), WINNT)
ifndef XP_OS2_EMX
$(CCC) -Fo$@ -c $(CCCFLAGS) $<
else
$(CCC) -o $@ -c $(CCCFLAGS) $<
$(CCC) -o $@ -c $(CFLAGS) $<
endif
endif
WCCFLAGS1 = $(subst /,\\,$(CFLAGS))
@ -334,7 +340,11 @@ ifeq ($(OS_TARGET), WIN16)
$(CC) -zq -fo$(OBJDIR)\\$*.$(OBJ_SUFFIX) @w16wccf $*.c
rm w16wccf
else
ifndef XP_OS2_EMX
$(CC) -Fo$@ -c $(CFLAGS) $*.c
else
$(CC) -o $@ -c $(CFLAGS) $*.c
endif
endif
else
$(CC) -o $@ -c $(CFLAGS) $*.c

Просмотреть файл

@ -46,7 +46,11 @@ HEADERS = \
ifeq ($(OS_ARCH), WINNT)
ifeq (,$(filter-out WIN16 OS2,$(OS_TARGET)))
# OS_CFLAGS = $(OS_EXE_CFLAGS)
EXTRA_LIBS = $(DIST)/lib/nspr$(MOD_VERSION).lib
ifdef XP_OS2_EMX
EXTRA_LIBS = -L$(DIST)/lib -lnspr$(MOD_VERSION)
else
EXTRA_LIBS = $(DIST)/lib/nspr$(MOD_VERSION).$(LIB_SUFFIX)
endif
else
DLLBASE=/BASE:0x30000000
RES=$(OBJDIR)/ds.res

Просмотреть файл

@ -15,6 +15,14 @@
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#if defined(XP_OS2)
#define INCL_DOSEXCEPTIONS
#define INCL_WIN
#include <os2.h>
#define PostMessage WinPostMsg
#define DefWindowProc WinDefWindowProc
typedef MPARAM WPARAM,LPARAM;
#endif
#include "plevent.h"
#include "prmem.h"
#include "prcmon.h"
@ -22,7 +30,7 @@
#if !defined(WIN32)
#include <errno.h>
#include <stddef.h>
#if !defined(OS2)
#if !defined(XP_OS2)
#include <unistd.h>
#endif
#endif
@ -63,12 +71,17 @@ static PRStatus _pl_NativeNotify(PLEventQueue* self);
static PRStatus _pl_AcknowledgeNativeNotify(PLEventQueue* self);
#if defined(_WIN32) || defined(WIN16)
#if defined(_WIN32) || defined(WIN16) || defined(XP_OS2)
PLEventQueue * _pr_main_event_queue;
UINT _pr_PostEventMsgId;
HWND _pr_eventReceiverWindow;
#if defined(OS2)
BOOL rc;
ULONG _pr_PostEventMsgId;
#else
UINT _pr_PostEventMsgId;
static char *_pr_eventWindowClass = "NSPR:EventWindow";
#endif
#endif
/*******************************************************************************
* Event Queue Operations
@ -537,23 +550,32 @@ _pl_NativeNotify(PLEventQueue* self)
self->notifyCount++;
return (count == 1) ? PR_SUCCESS : PR_FAILURE;
#elif defined(XP_PC) && ( defined(WINNT) || defined(WIN95) || defined(WIN16))
#elif defined(XP_PC)
/*
** Post a message to the NSPR window on the main thread requesting
** it to process the pending events. This is only necessary for the
** main event queue, since the main thread is waiting for OS events.
*/
#ifndef XP_OS2
if (self == _pr_main_event_queue) {
PostMessage( _pr_eventReceiverWindow, _pr_PostEventMsgId,
(WPARAM)0, (LPARAM)self);
}
return PR_SUCCESS;
#elif defined(XP_MAC)
#else
if (self == _pr_main_event_queue) {
rc = WinPostMsg(_pr_eventReceiverWindow, _pr_PostEventMsgId,
0, MPFROMP(self));
}
return (rc == TRUE) ? PR_SUCCESS : PR_FAILURE;
#endif
#else
#if defined(XP_MAC)
#pragma unused (self)
return PR_SUCCESS; /* XXX can fail? */
#endif
#endif
}
@ -650,7 +672,7 @@ BOOL WINAPI DllMain (HINSTANCE hDLL, DWORD dwReason, LPVOID lpReserved)
#endif
#if defined(WIN16) || defined(_WIN32)
#if defined(WIN16) || defined(_WIN32) || defined(XP_OS2)
PR_IMPLEMENT(PLEventQueue *)
PL_GetMainEventQueue()
{
@ -658,12 +680,16 @@ PL_GetMainEventQueue()
return _pr_main_event_queue;
}
#ifdef XP_OS2
MRESULT EXPENTRY
_md_EventReceiverProc(HWND hwnd, ULONG uMsg, MPARAM wParam, MPARAM lParam)
#else
LRESULT CALLBACK
#if defined(WIN16)
__loadds
#endif
_md_EventReceiverProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
#endif
{
if (_pr_PostEventMsgId == uMsg )
{
@ -673,15 +699,46 @@ _md_EventReceiverProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
if (queue == PL_GetMainEventQueue())
{
PR_ProcessPendingEvents(queue);
#ifdef XP_OS2
return MRFROMLONG(TRUE);
#else
return TRUE;
#endif
}
}
#ifdef XP_OS2
return WinDefWindowProc(hwnd, uMsg, wParam, lParam);
#else
return DefWindowProc(hwnd, uMsg, wParam, lParam);
#endif
}
PR_IMPLEMENT(void)
PL_InitializeEventsLib(char *name)
{
#ifdef XP_OS2
PSZ _pr_eventWindowClass;
_pr_main_event_queue = PL_CreateEventQueue(name, PR_GetCurrentThread());
WinRegisterClass( WinQueryAnchorBlock( HWND_DESKTOP),
_pr_eventWindowClass,
_md_EventReceiverProc,
0, 0);
_pr_eventReceiverWindow = WinCreateWindow( HWND_DESKTOP,
_pr_eventWindowClass,
"", 0,
0, 0, 0, 0,
HWND_DESKTOP,
HWND_TOP,
0,
NULL,
NULL);
_pr_PostEventMsgId = WinAddAtom(WinQuerySystemAtomTable(),
"NSPR_PostEvent");
#else
WNDCLASS wc;
_pr_main_event_queue = PL_CreateEventQueue(name, PR_GetCurrentThread());
@ -711,19 +768,20 @@ PL_InitializeEventsLib(char *name)
NULL, NULL, _pr_hInstance,
NULL);
PR_ASSERT(_pr_eventReceiverWindow);
#endif
}
#endif
#if defined(_WIN32) || defined(WIN16)
#if defined(_WIN32) || defined(WIN16) || defined(XP_OS2)
PR_IMPLEMENT(HWND)
PR_GetEventReceiverWindow()
{
if(_pr_eventReceiverWindow != NULL)
if(_pr_eventReceiverWindow != 0)
{
return _pr_eventReceiverWindow;
}
return NULL;
return 0;
}
#endif

Просмотреть файл

@ -175,6 +175,8 @@ and to ensure that no more events will be delivered for that owner.
#include <windef.h>
#elif defined(WIN16)
#include <windows.h>
#elif defined(XP_OS2)
#include <os2.h>
#endif
PR_BEGIN_EXTERN_C
@ -373,7 +375,7 @@ PL_DestroyEvent(PLEvent* self);
PR_EXTERN(void)
PL_DequeueEvent(PLEvent* self, PLEventQueue* queue);
#if defined(_WIN32) || defined(WIN16)
#if defined(_WIN32) || defined(WIN16) || defined(XP_OS2)
PR_EXTERN(HWND)
PR_GetEventReceiverWindow();
#endif

Просмотреть файл

@ -32,7 +32,15 @@ typedef PRUint32 PLHashNumber;
#define PL_HASH_BITS 32 /* Number of bits in PLHashNumber */
typedef PLHashNumber (PR_CALLBACK *PLHashFunction)(const void *key);
typedef PRIntn (PR_CALLBACK *PLHashComparator)(const void *v1, const void *v2);
typedef PRIntn (PR_CALLBACK *PLHashEnumerator)(PLHashEntry *he, PRIntn index, void *arg);
#if defined(XP_OS2_VACPP) && defined(VACPP_FLIP) /* for nsSpaceManager.cpp */
PR_END_EXTERN_C /* and nsHTMLDocument.cpp */
#endif
typedef PRIntn (PR_CALLBACK *PLHashEnumerator)(PLHashEntry *he, PRIntn i, void *arg);
#if defined(XP_OS2_VACPP) && defined(VACPP_FLIP)
PR_BEGIN_EXTERN_C
#endif
/* Flag bits in PLHashEnumerator's return value */
#define HT_ENUMERATE_NEXT 0 /* continue enumerating entries */

Просмотреть файл

@ -54,7 +54,11 @@ RELEASE_LIBS = $(TARGETS)
ifeq ($(OS_ARCH),WINNT)
ifeq (,$(filter-out WIN16 OS2,$(OS_TARGET)))
ifdef XP_OS2_EMX
EXTRA_LIBS = -L$(DIST)/lib -lnspr$(MOD_VERSION)
else
EXTRA_LIBS = $(DIST)/lib/nspr$(MOD_VERSION).lib
endif
else
DLLBASE=/BASE:0x30000000
RES=$(OBJDIR)/plc.res
@ -101,17 +105,27 @@ include $(MOD_DEPTH)/config/rules.mk
#
ECHO = echo
TINC = $(OBJDIR)/_pl_bld.h
PROD = libplc$(MOD_VERSION).$(DLL_SUFFIX)
ifeq ($(OS_TARGET),OS2)
PROD = nspr$(MOD_VERSION).$(DLL_SUFFIX)
else
PROD = plc$(MOD_VERSION).$(DLL_SUFFIX)
endif
NOW = $(MOD_DEPTH)/config/$(OBJDIR)/now
SH_DATE = $(shell date)
SH_NOW = $(shell $(NOW))
ifeq ($(OS_ARCH), WINNT)
ifeq ($(OS_TARGET),OS2)
SUF =
else
SUF = i64
endif
else
SUF = LL
endif
GARBAGE += $(TINC)
$(TINC):
@$(MAKE_OBJDIR)
@$(ECHO) '#define _BUILD_STRING "$(SH_DATE)"' > $(TINC)
@ -147,4 +161,3 @@ ifeq ($(MOZ_BITS),16)
endif
install:: export

Просмотреть файл

@ -38,7 +38,7 @@ else
ifeq ($(OS_TARGET), WIN16)
MDCPUCFG_H = _win16.cfg
else
ifeq ($(OS_TARGET), OS2)
ifeq ($(OS_TARGET),OS2)
MDCPUCFG_H = _os2.cfg
else
MDCPUCFG_H = _winnt.cfg

Просмотреть файл

@ -20,18 +20,31 @@
#define nspr_os2_defs_h___
#define INCL_DOS
#define INCL_DOSPROCESS
#define INCL_DOSERRORS
#define INCL_WIN
#define INCL_WPS
#define TID OS2TID /* global rename in OS2 H's! */
#include <os2.h>
#undef TID /* and restore */
#include <sys/select.h>
#include "prio.h"
#include <errno.h>
#ifdef XP_OS2_EMX
/*
* EMX-specific tweaks:
* o Use stricmp instead of strcmpi.
* o Use errno rather than sock_errno()
* o Use close rather than soclose
* o Ignore sock_init calls.
*/
#define strcmpi stricmp
#define sock_errno() errno
#define soclose close
#define sock_init()
#endif
/*
* Internal configuration macros
*/
@ -44,11 +57,7 @@
#undef HAVE_THREAD_AFFINITY
#define HAVE_SOCKET_REUSEADDR
#define HAVE_SOCKET_KEEPALIVE
/*********************************************
/* We don't have atomic ops on OS/2 natively */
/* #define _PR_HAVE_ATOMIC_OPS */
/*********************************************/
#undef _PR_HAVE_ATOMIC_OPS
#define HANDLE unsigned long
#define HINSTANCE HMODULE
@ -73,8 +82,6 @@ typedef int (*FARPROC)();
#define _MD_MAGIC_DIR 0x55555555
#define _MD_MAGIC_CV 0x66666666
#define CALLBACK
typedef struct _MDSemaphore
{
HEV sem;
@ -91,7 +98,7 @@ struct _MDThread {
PRBool inCVWaitQueue; /* PR_TRUE if the thread is in the
* wait queue of some cond var.
* PR_FALSE otherwise. */
OS2TID handle; /* OS/2 thread handle */
TID handle; /* OS/2 thread handle */
void *sp; /* only valid when suspended */
PRUint32 magic; /* for debugging */
PR_CONTEXT_TYPE gcContext; /* Thread context for GC */
@ -176,32 +183,35 @@ struct _MDProcess {
/* --- IO stuff --- */
#define _MD_OPEN _PR_MD_OPEN
#define _MD_READ _PR_MD_READ
#define _MD_WRITE _PR_MD_WRITE
#define _MD_WRITEV _PR_MD_WRITEV
#define _MD_LSEEK _PR_MD_LSEEK
#define _MD_LSEEK64 _PR_MD_LSEEK64
#define _MD_OPEN (_PR_MD_OPEN)
#define _MD_READ (_PR_MD_READ)
#define _MD_WRITE (_PR_MD_WRITE)
#define _MD_WRITEV (_PR_MD_WRITEV)
#define _MD_LSEEK (_PR_MD_LSEEK)
#define _MD_LSEEK64 (_PR_MD_LSEEK64)
extern PRInt32 _MD_CloseFile(PRInt32 osfd);
#define _MD_CLOSE_FILE _MD_CloseFile
#define _MD_GETFILEINFO _PR_MD_GETFILEINFO
#define _MD_GETOPENFILEINFO _PR_MD_GETOPENFILEINFO
#define _MD_GETOPENFILEINFO64(a, b) _PR_MD_GETOPENFILEINFO64(a, b)
#define _MD_STAT _PR_MD_STAT
#define _MD_RENAME _PR_MD_RENAME
#define _MD_ACCESS _PR_MD_ACCESS
#define _MD_DELETE _PR_MD_DELETE
#define _MD_MKDIR _PR_MD_MKDIR
#define _MD_RMDIR _PR_MD_RMDIR
#define _MD_LOCKFILE _PR_MD_LOCKFILE
#define _MD_TLOCKFILE _PR_MD_TLOCKFILE
#define _MD_UNLOCKFILE _PR_MD_UNLOCKFILE
#define _MD_GETFILEINFO (_PR_MD_GETFILEINFO)
#define _MD_GETFILEINFO64 (_PR_MD_GETFILEINFO64)
#define _MD_GETOPENFILEINFO (_PR_MD_GETOPENFILEINFO)
#define _MD_GETOPENFILEINFO64 (_PR_MD_GETOPENFILEINFO64)
#define _MD_STAT (_PR_MD_STAT)
#define _MD_RENAME (_PR_MD_RENAME)
#define _MD_ACCESS (_PR_MD_ACCESS)
#define _MD_DELETE (_PR_MD_DELETE)
#define _MD_MKDIR (_PR_MD_MKDIR)
#define _MD_RMDIR (_PR_MD_RMDIR)
#define _MD_LOCKFILE (_PR_MD_LOCKFILE)
#define _MD_TLOCKFILE (_PR_MD_TLOCKFILE)
#define _MD_UNLOCKFILE (_PR_MD_UNLOCKFILE)
/* --- Socket IO stuff --- */
/* The ones that don't map directly may need to be re-visited... */
#ifdef XP_OS2_VACPP
#define EPIPE EBADF
#define EIO ECONNREFUSED
#endif
#define _MD_EACCES EACCES
#define _MD_EADDRINUSE EADDRINUSE
#define _MD_EADDRNOTAVAIL EADDRNOTAVAIL
@ -229,17 +239,17 @@ extern PRInt32 _MD_CloseFile(PRInt32 osfd);
extern void _MD_MakeNonblock(PRFileDesc *f);
#define _MD_MAKE_NONBLOCK _MD_MakeNonblock
#define _MD_SHUTDOWN _PR_MD_SHUTDOWN
#define _MD_SHUTDOWN (_PR_MD_SHUTDOWN)
#define _MD_LISTEN(s, backlog) listen(s->secret->md.osfd,backlog)
extern PRInt32 _MD_CloseSocket(PRInt32 osfd);
#define _MD_CLOSE_SOCKET _MD_CloseSocket
#define _MD_SENDTO _PR_MD_SENDTO
#define _MD_RECVFROM _PR_MD_RECVFROM
#define _MD_SENDTO (_PR_MD_SENDTO)
#define _MD_RECVFROM (_PR_MD_RECVFROM)
#define _MD_SOCKETPAIR(s, type, proto, sv) -1
#define _MD_GETSOCKNAME _PR_MD_GETSOCKNAME
#define _MD_GETPEERNAME _PR_MD_GETPEERNAME
#define _MD_GETSOCKOPT _PR_MD_GETSOCKOPT
#define _MD_SETSOCKOPT _PR_MD_SETSOCKOPT
#define _MD_GETSOCKNAME (_PR_MD_GETSOCKNAME)
#define _MD_GETPEERNAME (_PR_MD_GETPEERNAME)
#define _MD_GETSOCKOPT (_PR_MD_GETSOCKOPT)
#define _MD_SETSOCKOPT (_PR_MD_SETSOCKOPT)
#define _MD_SELECT select
#define _MD_FSYNC _PR_MD_FSYNC
@ -249,21 +259,21 @@ extern PRInt32 _MD_CloseSocket(PRInt32 osfd);
#define _MD_ATOMIC_DECREMENT(x) _PR_MD_ATOMIC_DECREMENT(x)
#define _MD_ATOMIC_SET(x,y) _PR_MD_ATOMIC_SET(x, y)
#define _MD_INIT_IO _PR_MD_INIT_IO
#define _MD_TRANSMITFILE _PR_MD_TRANSMITFILE
#define _MD_INIT_IO (_PR_MD_INIT_IO)
#define _MD_TRANSMITFILE (_PR_MD_TRANSMITFILE)
#define _MD_PR_POLL (_PR_MD_PR_POLL)
/* win95 doesn't have async IO */
#define _MD_SOCKET _PR_MD_SOCKET
#define _MD_SOCKET (_PR_MD_SOCKET)
extern PRInt32 _MD_SocketAvailable(PRFileDesc *fd);
#define _MD_SOCKETAVAILABLE _MD_SocketAvailable
#define _MD_CONNECT _PR_MD_CONNECT
#define _MD_CONNECT (_PR_MD_CONNECT)
extern PRInt32 _MD_Accept(PRFileDesc *fd, PRNetAddr *raddr, PRUint32 *rlen,
PRIntervalTime timeout);
#define _MD_ACCEPT _MD_Accept
#define _MD_BIND _PR_MD_BIND
#define _MD_RECV _PR_MD_RECV
#define _MD_SEND _PR_MD_SEND
#define _MD_BIND (_PR_MD_BIND)
#define _MD_RECV (_PR_MD_RECV)
#define _MD_SEND (_PR_MD_SEND)
/* --- Scheduler stuff --- */
/* #define _MD_PAUSE_CPU _PR_MD_PAUSE_CPU */
@ -275,9 +285,9 @@ extern PRInt32 _MD_Accept(PRFileDesc *fd, PRNetAddr *raddr, PRUint32 *rlen,
#define PR_PATH_SEPARATOR ';'
#define PR_PATH_SEPARATOR_STR ";"
#define _MD_ERRNO() errno
#define _MD_OPEN_DIR _PR_MD_OPEN_DIR
#define _MD_CLOSE_DIR _PR_MD_CLOSE_DIR
#define _MD_READ_DIR _PR_MD_READ_DIR
#define _MD_OPEN_DIR (_PR_MD_OPEN_DIR)
#define _MD_CLOSE_DIR (_PR_MD_CLOSE_DIR)
#define _MD_READ_DIR (_PR_MD_READ_DIR)
/* --- Segment stuff --- */
#define _MD_INIT_SEGS()
@ -285,26 +295,26 @@ extern PRInt32 _MD_Accept(PRFileDesc *fd, PRNetAddr *raddr, PRUint32 *rlen,
#define _MD_FREE_SEGMENT(seg)
/* --- Environment Stuff --- */
#define _MD_GET_ENV _PR_MD_GET_ENV
#define _MD_PUT_ENV _PR_MD_PUT_ENV
#define _MD_GET_ENV (_PR_MD_GET_ENV)
#define _MD_PUT_ENV (_PR_MD_PUT_ENV)
/* --- Threading Stuff --- */
#define _MD_DEFAULT_STACK_SIZE 32767L
#define _MD_INIT_THREAD _PR_MD_INIT_THREAD
#define _MD_INIT_ATTACHED_THREAD _PR_MD_INIT_THREAD
#define _MD_INIT_PRIMORDIAL_THREAD _PR_MD_INIT_PRIMORDIAL_THREAD
#define _MD_CREATE_THREAD _PR_MD_CREATE_THREAD
#define _MD_YIELD _PR_MD_YIELD
#define _MD_SET_PRIORITY _PR_MD_SET_PRIORITY
#define _MD_CLEAN_THREAD _PR_MD_CLEAN_THREAD
#define _MD_SETTHREADAFFINITYMASK _PR_MD_SETTHREADAFFINITYMASK
#define _MD_GETTHREADAFFINITYMASK _PR_MD_GETTHREADAFFINITYMASK
#define _MD_EXIT_THREAD _PR_MD_EXIT_THREAD
#define _MD_SUSPEND_THREAD _PR_MD_SUSPEND_THREAD
#define _MD_RESUME_THREAD _PR_MD_RESUME_THREAD
#define _MD_SUSPEND_CPU _PR_MD_SUSPEND_CPU
#define _MD_RESUME_CPU _PR_MD_RESUME_CPU
#define _MD_WAKEUP_CPUS _PR_MD_WAKEUP_CPUS
#define _MD_INIT_THREAD (_PR_MD_INIT_THREAD)
#define _MD_INIT_ATTACHED_THREAD (_PR_MD_INIT_THREAD)
#define _MD_INIT_PRIMORDIAL_THREAD (_PR_MD_INIT_PRIMORDIAL_THREAD)
#define _MD_CREATE_THREAD (_PR_MD_CREATE_THREAD)
#define _MD_YIELD (_PR_MD_YIELD)
#define _MD_SET_PRIORITY (_PR_MD_SET_PRIORITY)
#define _MD_CLEAN_THREAD (_PR_MD_CLEAN_THREAD)
#define _MD_SETTHREADAFFINITYMASK (_PR_MD_SETTHREADAFFINITYMASK)
#define _MD_GETTHREADAFFINITYMASK (_PR_MD_GETTHREADAFFINITYMASK)
#define _MD_EXIT_THREAD (_PR_MD_EXIT_THREAD)
#define _MD_SUSPEND_THREAD (_PR_MD_SUSPEND_THREAD)
#define _MD_RESUME_THREAD (_PR_MD_RESUME_THREAD)
#define _MD_SUSPEND_CPU (_PR_MD_SUSPEND_CPU)
#define _MD_RESUME_CPU (_PR_MD_RESUME_CPU)
#define _MD_WAKEUP_CPUS (_PR_MD_WAKEUP_CPUS)
#define _MD_BEGIN_SUSPEND_ALL()
#define _MD_BEGIN_RESUME_ALL()
#define _MD_END_SUSPEND_ALL()
@ -318,18 +328,18 @@ extern PRInt32 _MD_Accept(PRFileDesc *fd, PRNetAddr *raddr, PRUint32 *rlen,
#define _MD_FREE_LOCK(lock) DosCloseMutexSem(((lock)->mutex))
#define _MD_LOCK(lock) DosRequestMutexSem(((lock)->mutex), SEM_INDEFINITE_WAIT)
#define _MD_TEST_AND_LOCK(lock) (DosRequestMutexSem(((lock)->mutex), SEM_INDEFINITE_WAIT),PR_SUCCESS)
#define _MD_UNLOCK _PR_MD_UNLOCK
#define _MD_UNLOCK (_PR_MD_UNLOCK)
/* --- lock and cv waiting --- */
#define _MD_WAIT _PR_MD_WAIT
#define _MD_WAKEUP_WAITER _PR_MD_WAKEUP_WAITER
#define _MD_WAIT (_PR_MD_WAIT)
#define _MD_WAKEUP_WAITER (_PR_MD_WAKEUP_WAITER)
/* --- CVar ------------------- */
#define _MD_WAIT_CV _PR_MD_WAIT_CV
#define _MD_NEW_CV _PR_MD_NEW_CV
#define _MD_FREE_CV _PR_MD_FREE_CV
#define _MD_NOTIFY_CV _PR_MD_NOTIFY_CV
#define _MD_NOTIFYALL_CV _PR_MD_NOTIFYALL_CV
#define _MD_WAIT_CV (_PR_MD_WAIT_CV)
#define _MD_NEW_CV (_PR_MD_NEW_CV)
#define _MD_FREE_CV (_PR_MD_FREE_CV)
#define _MD_NOTIFY_CV (_PR_MD_NOTIFY_CV )
#define _MD_NOTIFYALL_CV (_PR_MD_NOTIFYALL_CV)
/* XXXMB- the IOQ stuff is certainly not working correctly yet. */
/* extern struct _MDLock _pr_ioq_lock; */
@ -344,7 +354,7 @@ extern PRInt32 _MD_Accept(PRFileDesc *fd, PRNetAddr *raddr, PRUint32 *rlen,
#define _MD_ENABLE_CLOCK_INTERRUPTS()
#define _MD_BLOCK_CLOCK_INTERRUPTS()
#define _MD_UNBLOCK_CLOCK_INTERRUPTS()
#define _MD_EARLY_INIT _PR_MD_EARLY_INIT
#define _MD_EARLY_INIT (_PR_MD_EARLY_INIT)
#define _MD_FINAL_INIT()
#define _MD_INIT_CPUS()
#define _MD_INIT_RUNNING_CPU(cpu)
@ -372,14 +382,15 @@ extern PRStatus _PR_WaitOS2Process(struct PRProcess *process,
extern PRStatus _PR_KillOS2Process(struct PRProcess *process);
#define _MD_CLEANUP_BEFORE_EXIT()
#define _MD_EXIT (_PR_MD_EXIT)
#define _MD_INIT_CONTEXT
#define _MD_SWITCH_CONTEXT
#define _MD_RESTORE_CONTEXT
/* --- Intervals --- */
#define _MD_INTERVAL_INIT _PR_MD_INTERVAL_INIT
#define _MD_GET_INTERVAL _PR_MD_GET_INTERVAL
#define _MD_INTERVAL_PER_SEC _PR_MD_INTERVAL_PER_SEC
#define _MD_INTERVAL_INIT (_PR_MD_INTERVAL_INIT)
#define _MD_GET_INTERVAL (_PR_MD_GET_INTERVAL)
#define _MD_INTERVAL_PER_SEC (_PR_MD_INTERVAL_PER_SEC)
#define _MD_INTERVAL_PER_MILLISEC() (_PR_MD_INTERVAL_PER_SEC() / 1000)
#define _MD_INTERVAL_PER_MICROSEC() (_PR_MD_INTERVAL_PER_SEC() / 1000000)
@ -393,7 +404,7 @@ typedef struct __NSPR_TLS
} _NSPR_TLS;
extern _NSPR_TLS* pThreadLocalStorage;
PR_IMPLEMENT(void) _PR_MD_ENSURE_TLS();
PR_EXTERN(void) _PR_MD_ENSURE_TLS(void);
#define _MD_CURRENT_THREAD() pThreadLocalStorage->_pr_currentThread
#define _MD_SET_CURRENT_THREAD(_thread) _PR_MD_ENSURE_TLS(); pThreadLocalStorage->_pr_currentThread = (_thread)
@ -404,6 +415,11 @@ PR_IMPLEMENT(void) _PR_MD_ENSURE_TLS();
#define _MD_CURRENT_CPU() pThreadLocalStorage->_pr_currentCPU
#define _MD_SET_CURRENT_CPU(_cpu) _PR_MD_ENSURE_TLS(); pThreadLocalStorage->_pr_currentCPU = (_cpu)
/* 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
@ -437,10 +453,7 @@ extern PRStatus _MD_CloseFileMap(struct PRFileMap *fmap);
#define _MD_CLOSE_FILE_MAP _MD_CloseFileMap
/* Some stuff for setting up thread contexts */
#undef DWORD
#undef PDWORD
typedef unsigned long DWORD;
typedef unsigned long *PDWORD;
typedef ULONG DWORD, *PDWORD;
/* The following definitions and two structures are new in OS/2 Warp 4.0.
*/
@ -481,7 +494,7 @@ typedef struct _CONTEXTRECORD {
#pragma pack()
#endif
extern APIRET (* APIENTRY QueryThreadContext)(OS2TID, ULONG, PCONTEXTRECORD);
extern APIRET (* APIENTRY QueryThreadContext)(TID, ULONG, PCONTEXTRECORD);
/*
#define _pr_tid (((PTIB2)_getTIBvalue(offsetof(TIB, tib_ptib2)))->tib2_ultid)
@ -493,6 +506,6 @@ extern APIRET (* APIENTRY QueryThreadContext)(OS2TID, ULONG, PCONTEXTRECORD);
* not emulating anything. Just mapping.
*/
#define FreeLibrary(x) DosFreeModule(x)
#define OutputDebugString(str) ;
#define OutputDebugString(x)
#endif /* nspr_os2_defs_h___ */

Просмотреть файл

@ -23,7 +23,6 @@
#ifndef assert
#include <assert.h>
#endif
#include <nerrno.h>
PR_EXTERN(void) _MD_os2_map_opendir_error(PRInt32 err);
#define _PR_MD_MAP_OPENDIR_ERROR _MD_os2_map_opendir_error

Просмотреть файл

@ -42,11 +42,11 @@
** Routines for processing command line arguments
*/
PR_BEGIN_EXTERN_C
#ifndef XP_OS2_EMX
extern char *optarg;
extern int optind;
extern int getopt(int argc, char **argv, char *spec);
#endif
PR_END_EXTERN_C
#define gcmemcpy(a,b,c) memcpy(a,b,c)
@ -60,6 +60,9 @@ PR_END_EXTERN_C
#ifdef MOZ_BITS
#include <time.h>
#endif
#ifdef XP_OS2_EMX
#include <sys/types.h>
#endif
#include <sys/stat.h>
#include <io.h>
#include <fcntl.h> /* O_BINARY */

Просмотреть файл

@ -107,7 +107,11 @@
#define PR_IMPLEMENT_DATA(__type) __type
#define PR_CALLBACK
#define PR_CALLBACK_DECL
#define PR_STATIC_CALLBACK(__x) __x _Optlink
#ifndef XP_OS2_VACPP
#define PR_STATIC_CALLBACK(__x) static __x
#else
#define PR_STATIC_CALLBACK(__x) static __x _Optlink
#endif
#else /* Unix */
#define PR_EXTERN(__type) extern __type

Просмотреть файл

@ -131,7 +131,7 @@ endif
ifeq ($(OS_ARCH),WINNT)
ifeq ($(OS_TARGET),OS2)
OS_LIBS = so32dll.lib tcp32dll.lib
# We define this in os2.mk.
else
ifneq ($(OS_TARGET),WIN16)
OS_LIBS = wsock32.lib winmm.lib
@ -257,7 +257,7 @@ OBJS += md/windows/$(OBJDIR)/w95io.$(OBJ_SUFFIX) \
md/windows/$(OBJDIR)/w32poll.$(OBJ_SUFFIX) \
md/windows/$(OBJDIR)/w95dllmain.$(OBJ_SUFFIX)
else
ifeq ($(OS_TARGET), OS2)
ifeq ($(OS_TARGET),OS2)
OBJS += md/os2/$(OBJDIR)/os2io.$(OBJ_SUFFIX) \
md/os2/$(OBJDIR)/os2sock.$(OBJ_SUFFIX) \
md/os2/$(OBJDIR)/os2thred.$(OBJ_SUFFIX) \
@ -292,9 +292,7 @@ else
MD_DIR = md/unix/$(OBJDIR)
include md/unix/objs.mk
endif
endif
LIBRARY_NAME = nspr
LIBRARY_VERSION = $(MOD_VERSION)
@ -313,13 +311,21 @@ endif
ECHO = echo
INCLUDES = -I$(DIST)/include
TINC = $(OBJDIR)/_pr_bld.h
ifeq ($(OS_TARGET),OS2)
PROD = nspr$(MOD_VERSION).$(DLL_SUFFIX)
else
PROD = libnspr$(MOD_VERSION).$(DLL_SUFFIX)
endif
NOW = $(MOD_DEPTH)/config/$(OBJDIR)/now
SH_DATE = $(shell date)
SH_NOW = $(shell $(NOW))
ifeq ($(OS_ARCH), WINNT)
ifeq ($(OS_TARGET),OS2)
SUF =
else
SUF = i64
endif
else
SUF = LL
endif

Просмотреть файл

@ -52,7 +52,7 @@ static PRLock *_pr_logLock;
#endif
#ifdef XP_PC
#if defined(XP_PC) && !defined(XP_OS2_VACPP)
#define strcasecmp stricmp
#define strncasecmp strnicmp
#endif

Просмотреть файл

@ -406,7 +406,11 @@ static PRStatus PR_CALLBACK SocketBind(PRFileDesc *fd, const PRNetAddr *addr)
#ifdef HAVE_SOCKET_REUSEADDR
if ( setsockopt (fd->secret->md.osfd, (int)SOL_SOCKET, SO_REUSEADDR,
#ifdef XP_OS2_VACPP
(char *)&one, sizeof(one) ) < 0) {
#else
(const void *)&one, sizeof(one) ) < 0) {
#endif
return PR_FAILURE;
}
#endif
@ -1067,7 +1071,11 @@ PR_IMPLEMENT(PRFileDesc*) PR_Socket(PRInt32 domain, PRInt32 type, PRInt32 proto)
/* "Keep-alive" packets are specific to TCP. */
if (domain == AF_INET && type == SOCK_STREAM) {
if (setsockopt(osfd, (int)SOL_SOCKET, SO_KEEPALIVE,
#ifdef XP_OS2_VACPP
(char *)&one, sizeof(one) ) < 0) {
#else
(const void *) &one, sizeof(one) ) < 0) {
#endif
_PR_MD_CLOSE_SOCKET(osfd);
return 0;
}

Просмотреть файл

@ -447,11 +447,9 @@ PR_LoadLibrary(const char *name)
#ifdef XP_OS2 /* Why isn't all this stuff in MD code?! */
{
NODL_PROC *pfn;
HMODULE h;
UCHAR pszError[_MAX_PATH];
ULONG ulRc = NO_ERROR;
int first_try = 1;
retry:
ulRc = DosLoadModule(pszError, _MAX_PATH, (PSZ) name, &h);
@ -800,7 +798,7 @@ pr_FindSymbolInLib(PRLibrary *lm, const char *name)
}
#ifdef XP_OS2
DosQueryProcAddr(lm->dlh, 0, name, (PFN *) &f);
DosQueryProcAddr(lm->dlh, 0, (PSZ) name, (PFN *) &f);
#endif /* XP_OS2 */
#if defined(WIN32) || defined(WIN16)

Просмотреть файл

@ -362,9 +362,11 @@ void _MD_os2_map_read_error(PRInt32 err)
case ENOTSOCK:
PR_SetError(PR_NOT_SOCKET_ERROR, err);
break;
#ifdef SOCEFAULT
case SOCEFAULT:
PR_SetError(PR_ACCESS_FAULT_ERROR, err);
break;
#endif
default:
PR_SetError(PR_UNKNOWN_ERROR, err);
break;
@ -411,9 +413,11 @@ void _MD_os2_map_transmitfile_error(PRInt32 err)
case ENOTSOCK:
PR_SetError(PR_NOT_SOCKET_ERROR, err);
break;
#ifdef SOCEFAULT
case SOCEFAULT:
PR_SetError(PR_ACCESS_FAULT_ERROR, err);
break;
#endif
default:
PR_SetError(PR_UNKNOWN_ERROR, err);
break;
@ -471,9 +475,11 @@ void _MD_os2_map_write_error(PRInt32 err)
case EISCONN:
PR_SetError(PR_IS_CONNECTED_ERROR, err);
break;
#ifdef SOCEFAULT
case SOCEFAULT:
PR_SetError(PR_ACCESS_FAULT_ERROR, err);
break;
#endif
default:
PR_SetError(PR_UNKNOWN_ERROR, err);
break;
@ -568,9 +574,11 @@ void _MD_os2_map_recv_error(PRInt32 err)
case ENOTSOCK:
PR_SetError(PR_NOT_SOCKET_ERROR, err);
break;
#ifdef SOCEFAULT
case SOCEFAULT:
PR_SetError(PR_ACCESS_FAULT_ERROR, err);
break;
#endif
case ERROR_NETNAME_DELETED:
PR_SetError(PR_CONNECT_RESET_ERROR, err);
break;
@ -592,9 +600,11 @@ void _MD_os2_map_recvfrom_error(PRInt32 err)
case ENOTSOCK:
PR_SetError(PR_NOT_SOCKET_ERROR, err);
break;
#ifdef SOCEFAULT
case SOCEFAULT:
PR_SetError(PR_ACCESS_FAULT_ERROR, err);
break;
#endif
case ERROR_NETNAME_DELETED:
PR_SetError(PR_CONNECT_RESET_ERROR, err);
break;
@ -629,9 +639,11 @@ void _MD_os2_map_send_error(PRInt32 err)
case EISCONN:
PR_SetError(PR_IS_CONNECTED_ERROR, err);
break;
#ifdef SOCEFAULT
case SOCEFAULT:
PR_SetError(PR_ACCESS_FAULT_ERROR, err);
break;
#endif
case ERROR_NETNAME_DELETED:
PR_SetError(PR_CONNECT_RESET_ERROR, err);
break;
@ -666,9 +678,11 @@ void _MD_os2_map_sendto_error(PRInt32 err)
case EISCONN:
PR_SetError(PR_IS_CONNECTED_ERROR, err);
break;
#ifdef SOCEFAULT
case SOCEFAULT:
PR_SetError(PR_ACCESS_FAULT_ERROR, err);
break;
#endif
case ERROR_NETNAME_DELETED:
PR_SetError(PR_CONNECT_RESET_ERROR, err);
break;
@ -693,9 +707,11 @@ void _MD_os2_map_accept_error(PRInt32 err)
case EOPNOTSUPP:
PR_SetError(PR_NOT_TCP_SOCKET_ERROR, err);
break;
#ifdef SOCEFAULT
case SOCEFAULT:
PR_SetError(PR_ACCESS_FAULT_ERROR, err);
break;
#endif
case EMFILE:
PR_SetError(PR_PROC_DESC_TABLE_FULL_ERROR, err);
break;
@ -733,7 +749,9 @@ void _MD_os2_map_connect_error(PRInt32 err)
case EWOULDBLOCK:
PR_SetError(PR_WOULD_BLOCK_ERROR, err);
break;
case EINPROGRESS:
case EINPROGRESS:
PR_SetError(PR_IN_PROGRESS_ERROR, err);
break;
case EALREADY:
case EINVAL:
PR_SetError(PR_ALREADY_INITIATED_ERROR, err);
@ -765,9 +783,11 @@ void _MD_os2_map_connect_error(PRInt32 err)
case EISCONN:
PR_SetError(PR_IS_CONNECTED_ERROR, err);
break;
#ifdef SOCEFAULT
case SOCEFAULT:
PR_SetError(PR_ACCESS_FAULT_ERROR, err);
break;
#endif
default:
PR_SetError(PR_UNKNOWN_ERROR, err);
break;
@ -783,9 +803,11 @@ void _MD_os2_map_bind_error(PRInt32 err)
case ENOTSOCK:
PR_SetError(PR_NOT_SOCKET_ERROR, err);
break;
#ifdef SOCEFAULT
case SOCEFAULT:
PR_SetError(PR_ACCESS_FAULT_ERROR, err);
break;
#endif
case EADDRNOTAVAIL:
PR_SetError(PR_ADDRESS_NOT_AVAILABLE_ERROR, err);
break;
@ -849,9 +871,11 @@ void _MD_os2_map_getsockname_error(PRInt32 err)
case ENOTSOCK:
PR_SetError(PR_NOT_SOCKET_ERROR, err);
break;
#ifdef SOCEFAULT
case SOCEFAULT:
PR_SetError(PR_ACCESS_FAULT_ERROR, err);
break;
#endif
case ENOBUFS:
PR_SetError(PR_INSUFFICIENT_RESOURCES_ERROR, err);
break;
@ -874,9 +898,11 @@ void _MD_os2_map_getpeername_error(PRInt32 err)
case ENOTCONN:
PR_SetError(PR_NOT_CONNECTED_ERROR, err);
break;
#ifdef SOCEFAULT
case SOCEFAULT:
PR_SetError(PR_ACCESS_FAULT_ERROR, err);
break;
#endif
case ENOBUFS:
PR_SetError(PR_INSUFFICIENT_RESOURCES_ERROR, err);
break;
@ -898,9 +924,11 @@ void _MD_os2_map_getsockopt_error(PRInt32 err)
case ENOPROTOOPT:
PR_SetError(PR_INVALID_ARGUMENT_ERROR, err);
break;
#ifdef SOCEFAULT
case SOCEFAULT:
PR_SetError(PR_ACCESS_FAULT_ERROR, err);
break;
#endif
case EINVAL:
PR_SetError(PR_BUFFER_OVERFLOW_ERROR, err);
break;
@ -922,9 +950,11 @@ void _MD_os2_map_setsockopt_error(PRInt32 err)
case ENOPROTOOPT:
PR_SetError(PR_INVALID_ARGUMENT_ERROR, err);
break;
#ifdef SOCEFAULT
case SOCEFAULT:
PR_SetError(PR_ACCESS_FAULT_ERROR, err);
break;
#endif
case EINVAL:
PR_SetError(PR_BUFFER_OVERFLOW_ERROR, err);
break;
@ -990,9 +1020,11 @@ void _MD_os2_map_open_error(PRInt32 err)
void _MD_os2_map_gethostname_error(PRInt32 err)
{
switch (err) {
#ifdef SOCEFAULT
case SOCEFAULT:
PR_SetError(PR_ACCESS_FAULT_ERROR, err);
break;
#endif
case ENETDOWN:
case EINPROGRESS:
default:
@ -1016,9 +1048,11 @@ void _MD_os2_map_select_error(PRInt32 err)
case EINVAL:
prerror = PR_INVALID_ARGUMENT_ERROR;
break;
#ifdef SOCEFAULT
case SOCEFAULT:
prerror = PR_ACCESS_FAULT_ERROR;
break;
#endif
default:
prerror = PR_UNKNOWN_ERROR;
}

Просмотреть файл

@ -22,8 +22,6 @@
*/
#include "primpl.h"
extern APIRET (* APIENTRY QueryThreadContext)(OS2TID, ULONG, PCONTEXTRECORD);
PRWord *_MD_HomeGCRegisters(PRThread *t, int isCurrent, int *np)
{
CONTEXTRECORD context;

Просмотреть файл

@ -32,8 +32,6 @@ PRInt32 _os2_highMask = 0;
PR_IMPLEMENT(void)
_PR_MD_INTERVAL_INIT()
{
ULONG count;
if (DosTmrQueryFreq(&_os2_ticksPerSec) == NO_ERROR)
{
while(_os2_ticksPerSec > PR_INTERVAL_MAX) {

Просмотреть файл

@ -23,7 +23,15 @@
*/
#include "primpl.h"
#include "prio.h"
#include <ctype.h>
#ifdef XP_OS2_VACPP
#include <direct.h>
#else
#include <dirent.h>
#include <fcntl.h>
#include <io.h>
#endif
struct _MDLock _pr_ioq_lock;
@ -104,6 +112,7 @@ _PR_MD_OPEN(const char *name, PRIntn osflags, int mode)
ULONG CurMaxFH = 0;
LONG ReqCount = 1;
ULONG fattr;
if (osflags & PR_RDONLY)
access |= OPEN_ACCESS_READONLY;
@ -117,7 +126,11 @@ _PR_MD_OPEN(const char *name, PRIntn osflags, int mode)
flags &= ~OPEN_ACTION_OPEN_IF_EXISTS;
flags |= OPEN_ACTION_REPLACE_IF_EXISTS;
}
if (isxdigit(mode) == 0) /* file attribs are hex, UNIX modes octal */
fattr = ((ULONG)mode == FILE_HIDDEN) ? FILE_HIDDEN : FILE_NORMAL;
else fattr = FILE_NORMAL;
/* OS/2 sets the Max file handles per process to 20 by default */
DosSetRelMaxFH(&ReqCount, &CurMaxFH);
@ -125,7 +138,7 @@ _PR_MD_OPEN(const char *name, PRIntn osflags, int mode)
&file, /* file handle if successful */
&actionTaken, /* reason for failure */
0, /* initial size of new file */
FILE_NORMAL, /* file system attributes */
fattr, /* file system attributes */
flags, /* Open flags */
access, /* Open mode and rights */
0); /* OS/2 Extended Attributes */
@ -190,7 +203,7 @@ _PR_MD_WRITE(PRFileDesc *fd, const void *buf, PRInt32 len)
} /* --- end _PR_MD_WRITE() --- */
PRInt32
_PR_MD_LSEEK(PRFileDesc *fd, PRInt32 offset, int whence)
_PR_MD_LSEEK(PRFileDesc *fd, PRInt32 offset, PRSeekWhence whence)
{
PRInt32 rv;
PRUword newLocation;
@ -205,7 +218,7 @@ _PR_MD_LSEEK(PRFileDesc *fd, PRInt32 offset, int whence)
}
PRInt64
_PR_MD_LSEEK64(PRFileDesc *fd, PRInt64 offset, int whence)
_PR_MD_LSEEK64(PRFileDesc *fd, PRInt64 offset, PRSeekWhence whence)
{
PRInt64 result;
PRInt32 rv, low = offset.lo, hi = offset.hi;
@ -219,8 +232,8 @@ _PR_MD_LSEEK64(PRFileDesc *fd, PRInt64 offset, int whence)
hi = newLocation = -1;
}
result.lo = hi;
result.hi = newLocation;
result.lo = newLocation;
result.hi = hi;
return result;
}
@ -252,6 +265,7 @@ _MD_CloseFile(PRInt32 osfd)
/* --- DIR IO ------------------------------------------------------------ */
#define GetFileFromDIR(d) (d)->d_entry.achName
#define GetFileAttr(d) (d)->d_entry.attrFile
void FlipSlashes(char *cp, int len)
{
@ -296,13 +310,21 @@ _PR_MD_OPEN_DIR(_MDDir *d, const char *name)
char filename[ CCHMAXPATH ];
PRUword numEntries, rc;
numEntries = 1;
PR_snprintf(filename, CCHMAXPATH, "%s%s%s",
name, PR_DIRECTORY_SEPARATOR_STR, "*.*");
FlipSlashes( filename, strlen(filename) );
d->d_hdl = HDIR_CREATE;
rc = DosFindFirst( filename, &d->d_hdl, FILE_DIRECTORY, &(d->d_entry), sizeof(d->d_entry), &numEntries, FIL_STANDARD);
rc = DosFindFirst( filename,
&d->d_hdl,
FILE_DIRECTORY | FILE_HIDDEN,
&(d->d_entry),
sizeof(d->d_entry),
&numEntries,
FIL_STANDARD);
if ( rc != NO_ERROR ) {
_PR_MD_MAP_OPENDIR_ERROR(rc);
return PR_FAILURE;
@ -318,6 +340,7 @@ _PR_MD_READ_DIR(_MDDir *d, PRIntn flags)
PRUword numFiles = 1;
BOOL rv;
char *fileName;
USHORT fileAttr;
if ( d ) {
while (1) {
@ -325,12 +348,16 @@ _PR_MD_READ_DIR(_MDDir *d, PRIntn flags)
d->firstEntry = PR_FALSE;
rv = NO_ERROR;
} else {
rv = DosFindNext(d->d_hdl, &(d->d_entry), sizeof(d->d_entry), &numFiles);
rv = DosFindNext(d->d_hdl,
&(d->d_entry),
sizeof(d->d_entry),
&numFiles);
}
if (rv != NO_ERROR) {
break;
}
fileName = GetFileFromDIR(d);
fileAttr = GetFileAttr(d);
if ( (flags & PR_SKIP_DOT) &&
(fileName[0] == '.') && (fileName[1] == '\0'))
continue;
@ -342,7 +369,9 @@ _PR_MD_READ_DIR(_MDDir *d, PRIntn flags)
* XXX
* Is this the correct definition of a hidden file on OS/2?
*/
if ( (flags & PR_SKIP_HIDDEN) && (fileName[0] == '.'))
if ((flags & PR_SKIP_NONE) && (fileAttr & FILE_HIDDEN))
return fileName;
else if ((flags & PR_SKIP_HIDDEN) && (fileAttr & FILE_HIDDEN))
continue;
return fileName;
}
@ -370,8 +399,12 @@ PRInt32
_PR_MD_STAT(const char *fn, struct stat *info)
{
PRInt32 rv;
char filename[CCHMAXPATH];
rv = _stat((char*)fn, info);
PR_snprintf(filename, CCHMAXPATH, "%s", fn);
FlipSlashes(filename, strlen(filename));
rv = _stat((char*)filename, info);
if (-1 == rv) {
/*
* Check for MSVC runtime library _stat() bug.
@ -509,9 +542,9 @@ _PR_MD_RENAME(const char *from, const char *to)
}
PRInt32
_PR_MD_ACCESS(const char *name, PRIntn how)
_PR_MD_ACCESS(const char *name, PRAccessHow how)
{
PRInt32 rv;
PRInt32 rv;
switch (how) {
case PR_ACCESS_WRITE_OK:
rv = access(name, 02);
@ -536,7 +569,7 @@ _PR_MD_MKDIR(const char *name, PRIntn mode)
{
PRInt32 rc;
/* XXXMB - how to translate the "mode"??? */
if ((rc = DosCreateDir((char *)name, NULL)) == NO_ERROR) {
if ((rc = DosCreateDir((char *)name, NULL))== NO_ERROR) {
return 0;
} else {
_PR_MD_MAP_MKDIR_ERROR(rc);

Просмотреть файл

@ -20,6 +20,7 @@
* os2misc.c
*
*/
#include <string.h>
#include "primpl.h"
char *
@ -335,8 +336,6 @@ PRProcess * _PR_CreateOS2Process(
}
if (attr) {
PRBool redirected = PR_FALSE;
/* On OS/2, there is really no way to pass file handles for stdin, stdout,
* and stderr to a new process. Instead, we can make it a child process
* and make the given file handles a copy of our stdin, stdout, and stderr.
@ -434,7 +433,7 @@ PRStatus _PR_WaitOS2Process(PRProcess *process,
&pidEnded, process->md.pid);
if (ulRetVal != NO_ERROR) {
printf("\nDosWaitChild rc = %i\n", ulRetVal);
printf("\nDosWaitChild rc = %lu\n", ulRetVal);
PR_SetError(PR_UNKNOWN_ERROR, ulRetVal);
return PR_FAILURE;
}
@ -455,7 +454,6 @@ PRStatus _PR_KillOS2Process(PRProcess *process)
PRStatus _MD_OS2GetHostName(char *name, PRUint32 namelen)
{
PRIntn rv;
PRInt32 syserror;
rv = gethostname(name, (PRInt32) namelen);
if (0 == rv) {

Просмотреть файл

@ -20,6 +20,10 @@
* This file implements _PR_MD_PR_POLL for OS/2.
*/
#ifdef XP_OS2_EMX
#include <sys/time.h> /* For timeval. */
#endif
#include "primpl.h"
PRInt32 _PR_MD_PR_POLL(

Просмотреть файл

@ -28,6 +28,10 @@
#include "primpl.h"
#ifdef XP_OS2_EMX
#include <sys/time.h> /* For timeval. */
#endif
void
_PR_MD_INIT_IO()
{
@ -207,7 +211,7 @@ _PR_MD_CONNECT(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen,
if ((rv = connect(osfd, (struct sockaddr *) addr, addrlen)) == -1)
{
err = sock_errno();
if ((!fd->secret->nonblocking) && (err == EINPROGRESS) || (err == EWOULDBLOCK))
if ((!fd->secret->nonblocking) && ((err == EINPROGRESS) || (err == EWOULDBLOCK)))
{
#ifdef BSD_SELECT
if (timeout == PR_INTERVAL_NO_TIMEOUT)
@ -291,7 +295,6 @@ PRInt32
_PR_MD_BIND(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen)
{
PRInt32 rv;
int one = 1;
rv = bind(fd->secret->md.osfd, (struct sockaddr*) &(addr->inet), addrlen);

Просмотреть файл

@ -19,14 +19,21 @@
#include "primpl.h"
#include <process.h> /* for _beginthread() */
APIRET (* APIENTRY QueryThreadContext)(OS2TID, ULONG, PCONTEXTRECORD);
#ifdef XP_OS2_VACPP
#include <time.h> /* for _tzset() */
#endif
/* --- Declare these to avoid "implicit" warnings --- */
PR_EXTERN(void) _PR_MD_NEW_SEM(_MDSemaphore *md, PRUintn value);
PR_EXTERN(void) _PR_MD_DESTROY_SEM(_MDSemaphore *md);
/* --- globals ------------------------------------------------ */
_NSPR_TLS* pThreadLocalStorage = 0;
_PRInterruptTable _pr_interruptTable[] = { { 0 } };
APIRET (* APIENTRY QueryThreadContext)(TID, ULONG, PCONTEXTRECORD);
PR_IMPLEMENT(void)
_PR_MD_ENSURE_TLS()
_PR_MD_ENSURE_TLS(void)
{
if(!pThreadLocalStorage)
{
@ -47,6 +54,10 @@ _PR_MD_EARLY_INIT()
if (DosLoadModule(NULL, 0, "DOSCALL1.DLL", &hmod) == 0)
DosQueryProcAddr(hmod, 877, "DOSQUERYTHREADCONTEXT",
(PFN *)&QueryThreadContext);
#ifdef XP_OS2_VACPP
_tzset();
#endif
}
PR_IMPLEMENT(void)
@ -65,14 +76,12 @@ _PR_MD_INIT_PRIMORDIAL_THREAD(PRThread *thread)
PR_IMPLEMENT(PRStatus)
_PR_MD_INIT_THREAD(PRThread *thread)
{
APIRET rc;
if (thread->flags & _PR_PRIMORDIAL)
_PR_MD_INIT_PRIMORDIAL_THREAD(thread);
/* Create the blocking IO semaphore */
_PR_MD_NEW_SEM(&thread->md.blocked_sema, 1);
return (thread->md.blocked_sema.sem != NULL) ? PR_SUCCESS : PR_FAILURE;
return (thread->md.blocked_sema.sem != 0) ? PR_SUCCESS : PR_FAILURE;
}
PR_IMPLEMENT(PRStatus)
@ -83,7 +92,7 @@ _PR_MD_CREATE_THREAD(PRThread *thread,
PRThreadState state,
PRUint32 stackSize)
{
thread->md.handle = thread->id = (OS2TID) _beginthread(
thread->md.handle = thread->id = (TID) _beginthread(
(void(* _Optlink)(void*))start,
NULL,
thread->stack->stackSize,
@ -139,8 +148,14 @@ _PR_MD_SET_PRIORITY(_MDThread *thread, PRThreadPriority newPri)
PR_IMPLEMENT(void)
_PR_MD_CLEAN_THREAD(PRThread *thread)
{
/* Just call _PR_MD_EXIT_THREAD for now */
_PR_MD_EXIT_THREAD(thread);
if (&thread->md.blocked_sema) {
_PR_MD_DESTROY_SEM(&thread->md.blocked_sema);
}
if (thread->md.handle) {
DosKillThread(thread->md.handle);
thread->md.handle = 0;
}
}
PR_IMPLEMENT(void)
@ -160,7 +175,9 @@ _PR_MD_EXIT_THREAD(PRThread *thread)
DosKillThread( thread->md.handle );
DosResumeThread( thread->md.handle );
} else {
#ifndef XP_OS2_EMX
_endthread();
#endif
}
thread->md.handle = 0;
}

Просмотреть файл

@ -296,10 +296,18 @@ PR_IMPLEMENT(PRStatus) PR_GetHostByName(
}
else
{
#ifdef XP_OS2_VACPP
h = gethostbyname((char *)name);
#else
h = gethostbyname(name);
#endif
}
#else
#ifdef XP_OS2_VACPP
h = gethostbyname((char *)name);
#else
h = gethostbyname(name);
#endif
#endif /* _PR_INET6 */
if (NULL == h)
@ -347,8 +355,11 @@ PR_IMPLEMENT(PRStatus) PR_GetHostByAddr(
addr = &hostaddr->inet.ip;
addrlen = sizeof(hostaddr->inet.ip);
}
#ifdef XP_OS2_VACPP
h = gethostbyaddr((char *)addr, addrlen, hostaddr->raw.family);
#else
h = gethostbyaddr(addr, addrlen, hostaddr->raw.family);
#endif
if (NULL == h) PR_SetError(PR_DIRECTORY_LOOKUP_ERROR, _MD_GETHOST_ERRNO());
else
{
@ -382,7 +393,11 @@ PR_IMPLEMENT(PRStatus) PR_GetHostByAddr(
static struct protoent *getprotobyname_r(const char* name)
{
#ifdef XP_OS2_VACPP
return getprotobyname((char *)name);
#else
return getprotobyname(name);
#endif
} /* getprotobyname_r */
static struct protoent *getprotobynumber_r(PRInt32 number)
@ -721,7 +736,11 @@ PR_IMPLEMENT(PRStatus) PR_StringToNetAddr(const char *string, PRNetAddr *addr)
{
PRUint32 *ip = (PRUint32*)&addr->inet.ip;
#ifdef XP_OS2_VACPP
*ip = inet_addr((char *)string);
#else
*ip = inet_addr(string);
#endif
if ((PRUint32) -1 == *ip)
{
/*

Просмотреть файл

@ -80,6 +80,21 @@ PR_IMPLEMENT(PRStatus) PR_GetSystemInfo(PRSysInfo cmd, char *buf, PRUint32 bufle
(void)PR_snprintf(buf, buflen, info.release);
}
#endif
#if defined(XP_OS2)
{
ULONG os2ver[2] = {0};
DosQuerySysInfo(QSV_VERSION_MINOR, QSV_VERSION_REVISION,
&os2ver, sizeof(os2ver));
/* Formatting for normal usage (2.11, 3.0, 4.0); officially,
Warp 4 is version 2.40.00 */
if (os2ver[0] < 30)
(void)PR_snprintf(buf, buflen, "%s%lu",
"2.", os2ver[0]);
else
(void)PR_snprintf(buf, buflen, "%lu%s%lu",
os2ver[0]/10, ".", os2ver[1]);
}
#endif /* OS2 */
break;
case PR_SI_ARCHITECTURE:

Просмотреть файл

@ -576,6 +576,10 @@ static struct tm *MT_safe_localtime(const time_t *clock, struct tm *result)
* hence, does not recognize negative values of clock as pre-1/1/70.
* We have to manually check (WIN16 only) for negative value of
* clock and return NULL.
*
* With negative values of clock, emx returns the struct tm for
* clock plus ULONG_MAX. So we also have to check for the invalid
* structs returned for timezones west of Greenwich when clock == 0.
*/
#if defined(XP_MAC)
@ -584,8 +588,9 @@ static struct tm *MT_safe_localtime(const time_t *clock, struct tm *result)
tmPtr = localtime(clock);
#endif
#if defined(WIN16)
if ( (PRInt32) *clock < 0 )
#if defined(WIN16) || defined(XP_OS2_EMX)
if ( (PRInt32) *clock < 0 ||
( (PRInt32) *clock == 0 && tmPtr->tm_year != 70))
result = NULL;
else
*result = *tmPtr;

Просмотреть файл

@ -133,6 +133,15 @@ CSRCS = \
xnotify.c \
$(NULL)
ifeq ($(OS_TARGET),OS2)
CSRCS += \
servr_uu.c \
sleep.c \
stat.c \
yield.c \
$(NULL)
endif
ifeq ($(OS_ARCH), WINNT)
PROG_SUFFIX = .exe
else
@ -157,9 +166,13 @@ ifeq ($(OS_TARGET), WIN16)
LIBPLC= $(DIST)/lib/plc$(MOD_VERSION).lib
else
ifeq ($(OS_TARGET), OS2)
LDOPTS = -NOE -DEBUG -nologo -PMTYPE:VIO
ifdef XP_OS2_VACPP
LDOPTS =
LIBPR = $(DIST)/lib/nspr$(MOD_VERSION).lib
LIBPLC= $(DIST)/lib/plc$(MOD_VERSION).lib
else
LDOPTS = -Zlinker /PM:VIO
endif
else
LDOPTS = -NOLOGO -DEBUG -DEBUGTYPE:CV -INCREMENTAL:NO
LIBPR = $(DIST)/lib/libnspr$(MOD_VERSION).$(LIB_SUFFIX)
@ -423,7 +436,7 @@ ifeq ($(OS_TARGET),WIN16)
wlink @w16link.
else
ifeq ($(OS_TARGET),OS2)
$(LINK) $(LDOPTS) $< $(LIBPLC) $(LIBPR) so32dll.lib tcp32dll.lib -MAP:$(@:.exe=.map) -out:$@
$(LINK) $(EXEFLAGS) $(LDOPTS) $< $(LIBPLC) $(LIBPR) $(OS_LIBS) $(EXTRA_LIBS)
else
link $(LDOPTS) $< $(LIBPLC) $(LIBPR) wsock32.lib -out:$@
endif

Просмотреть файл

@ -64,6 +64,7 @@
#define INCL_DOS
#define INCL_ERRORS
#include <os2.h>
#include <process.h>
#endif
#define DEFAULT_COUNT 1000

Просмотреть файл

@ -124,7 +124,7 @@ PRIntn main(PRIntn argc, char **argv)
if (version)
{
#if defined(XP_UNIX)
#if defined(XP_UNIX) || defined(XP_OS2)
#define NSPR_LIB "nspr21"
#elif defined(WIN32)
#define NSPR_LIB "libnspr21"
@ -213,6 +213,7 @@ PRIntn main(PRIntn argc, char **argv)
{
PRIntn index = 0;
PRNetAddr address;
memset(&address, 0, sizeof(PRNetAddr));
PR_fprintf(err, "success .. enumerating results\n");
do
{

Просмотреть файл

@ -50,6 +50,8 @@
#define EXISTING_FILENAME "/bin/sh"
#elif defined(WIN32)
#define EXISTING_FILENAME "c:/boot.ini"
#elif defined(OS2)
#define EXISTING_FILENAME "c:/config.sys"
#else
#error "Unknown OS"
#endif
@ -64,7 +66,9 @@ int main(int argc, char **argv)
#endif
PR_STDIO_INIT();
t1 = PR_Open(EXISTING_FILENAME, PR_RDONLY, 0666);
if (t1 == NULL) {
printf ("error code is %d \n", PR_GetError());
printf ("File %s should be found\n",

Просмотреть файл

@ -199,7 +199,7 @@ _server_thread(void *arg_id)
goto done;
}
#ifdef DEBUG
fprintf(stdout, "server thread %d got connection\n", *id, newsock);
fprintf(stdout, "server thread %d got connection %d\n", *id, newsock);
#endif
@ -432,12 +432,12 @@ static void Measure(void (*func)(void), const char *msg)
main(int argc, char **argv)
{
#ifdef XP_UNIX
#if defined(XP_UNIX) || defined(XP_OS2_EMX)
int opt;
extern char *optarg;
#endif
#ifdef XP_UNIX
#if defined(XP_UNIX) || defined(XP_OS2_EMX)
while ( (opt = getopt(argc, argv, "c:s:i:t:v")) != EOF) {
switch(opt) {
case 'i':

Просмотреть файл

@ -41,6 +41,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#define PORT 8000
#define DEFAULT_COUNT 10

Просмотреть файл

@ -67,7 +67,6 @@ int ServerState;
PRLock *ServerStateCVLock;
PRCondVar *ServerStateCV;
#undef DEBUGPRINTS
#ifdef DEBUGPRINTS
#define DPRINTF printf
#else

Просмотреть файл

@ -67,7 +67,6 @@ int ServerState;
PRLock *ServerStateCVLock;
PRCondVar *ServerStateCV;
#undef DEBUGPRINTS
#ifdef DEBUGPRINTS
#define DPRINTF printf
#else

Просмотреть файл

@ -67,7 +67,6 @@ int ServerState;
PRLock *ServerStateCVLock;
PRCondVar *ServerStateCV;
#undef DEBUGPRINTS
#ifdef DEBUGPRINTS
#define DPRINTF printf
#else

Просмотреть файл

@ -67,7 +67,6 @@ int ServerState;
PRLock *ServerStateCVLock;
PRCondVar *ServerStateCV;
#undef DEBUGPRINTS
#ifdef DEBUGPRINTS
#define DPRINTF printf
#else

Просмотреть файл

@ -18,11 +18,13 @@
#include "nspr.h"
#if defined(XP_UNIX)
#if defined(XP_UNIX) || defined(XP_OS2)
#include <stdio.h>
#ifndef XP_OS2
#include <unistd.h>
#endif
#include <sys/time.h>
#if defined(HAVE_SVID_GETTOD)
@ -31,6 +33,11 @@
#define GTOD(_a) gettimeofday((_a), NULL)
#endif
#if defined (XP_OS2_VACPP)
#define INCL_DOSPROCESS
#include <os2.h>
#endif
static PRIntn rv = 0;
static void Other(void *unused)

Просмотреть файл

@ -18,7 +18,7 @@
/*
* Program to test different ways to get file info; right now it
* only works for solaris.
* only works for solaris and OS/2.
*
*/
#include "nspr.h"
@ -29,16 +29,28 @@
#include <stdlib.h>
#include <string.h>
#ifdef XP_OS2
#include <io.h>
#include <sys/types.h>
#include <sys/stat.h>
#endif
#define DEFAULT_COUNT 100000
PRInt32 count;
#ifndef XP_PC
char *filename = "/etc/passwd";
#else
char *filename = "..\\stat.c";
#endif
static void statPRStat(void)
{
PRFileInfo finfo;
PRInt32 index = count;
for (;index--;) {
PR_GetFileInfo("/etc/passwd", &finfo);
PR_GetFileInfo(filename, &finfo);
}
}
@ -48,7 +60,7 @@ static void statStat(void)
PRInt32 index = count;
for (;index--;) {
stat("/etc/passwd", &finfo);
stat(filename, &finfo);
}
}

Просмотреть файл

@ -27,7 +27,7 @@
static void Help(void)
{
PRFileDesc *err = PR_GetSpecialFD(PR_StandardError);
PR_fprintf(err, "Usage: /.strod [-c n] [-l n] [-h]\n");
PR_fprintf(err, "Usage: /.strod [-n n] [-l n] [-h]\n");
PR_fprintf(err, "\t-n n Number to translate (default: 1234567890123456789)\n");
PR_fprintf(err, "\t-l n Times to loop the test (default: 1)\n");
PR_fprintf(err, "\t-h This message and nothing else\n");

Просмотреть файл

@ -26,6 +26,14 @@
#include <windows.h>
#endif
#if defined(XP_OS2)
#define INCL_DOSFILEMGR
#include <os2.h>
#ifdef XP_OS2_EMX
#include <getopt.h>
#endif /* XP_OS2_EMX */
#endif /* XP_OS2 */
static int _debug_on = 0;
#ifdef XP_MAC
@ -68,7 +76,11 @@ typedef struct File_Rdwr_Param {
} File_Rdwr_Param;
#ifdef XP_PC
#ifdef XP_OS2
char *TEST_DIR = "prdir";
#else
char *TEST_DIR = "C:\\temp\\prdir";
#endif
char *FILE_NAME = "pr_testfile";
char *HIDDEN_FILE_NAME = "hidden_pr_testfile";
#else
@ -491,7 +503,7 @@ HANDLE hfile;
}
PR_Close(fd_file);
}
#if defined(XP_UNIX) || defined(XP_MAC) || (defined(XP_PC) && defined(WIN32))
#if defined(XP_UNIX) || defined(XP_MAC) || (defined(XP_PC) && defined(WIN32)) || defined(XP_OS2)
/*
* Create a hidden file - a platform-dependent operation
*/
@ -574,6 +586,16 @@ HANDLE hfile;
}
CloseHandle(hfile);
#elif defined(OS2)
DPRINTF(("Creating hidden test file %s\n",pathname));
fd_file = PR_Open(pathname, PR_RDWR | PR_CREATE_FILE, (int)FILE_HIDDEN);
if (fd_file == NULL) {
printf("testfile failed to create/open hidden file %s [%d, %d]\n",
pathname, PR_GetError(), PR_GetOSError());
return -1;
}
PR_Close(fd_file);
#endif /* XP _UNIX || XP_MAC*/
#endif /* XP_UNIX || XP_MAC ||(XP_PC && WIN32) */
@ -598,7 +620,7 @@ HANDLE hfile;
* List all files, including hidden files
*/
DPRINTF(("Listing all files in directory %s\n",TEST_DIR));
#if defined(XP_UNIX) || defined(XP_MAC) || (defined(XP_PC) && defined(WIN32))
#if defined(XP_UNIX) || defined(XP_MAC) || (defined(XP_PC) && defined(WIN32)) || defined(XP_OS2)
num_files = FILES_IN_DIR + 1;
#else
num_files = FILES_IN_DIR;
@ -634,7 +656,7 @@ HANDLE hfile;
PR_CloseDir(fd_dir);
#if defined(XP_UNIX) || defined(XP_MAC) || (defined(XP_PC) && defined(WIN32))
#if defined(XP_UNIX) || defined(XP_MAC) || (defined(XP_PC) && defined(WIN32)) || defined(XP_OS2)
/*
* List all files, except hidden files
@ -752,12 +774,12 @@ HANDLE hfile;
int main(int argc, char **argv)
{
#ifdef XP_UNIX
#if defined(XP_UNIX) || defined(XP_OS2_EMX)
int opt;
extern char *optarg;
extern int optind;
#endif
#ifdef XP_UNIX
#if defined(XP_UNIX) || defined(XP_OS2_EMX)
while ((opt = getopt(argc, argv, "d")) != EOF) {
switch(opt) {
case 'd':

Просмотреть файл

@ -47,7 +47,7 @@
#include <string.h>
/* for getcwd */
#if defined(XP_UNIX)
#if defined(XP_UNIX) || defined (XP_OS2_EMX)
#include <unistd.h>
#elif defined(XP_PC)
#include <direct.h>