Bugzilla bug 215581: build with GCC 3.2.2 for OS/2. The patch is

contributed by Javier Pedemonte <pedemont@us.ibm.com>.  r=wtc.
This commit is contained in:
wtc%netscape.com 2003-09-16 01:58:03 +00:00
Родитель ad386572e3
Коммит 17575e1042
23 изменённых файлов: 269 добавлений и 251 удалений

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

@ -379,7 +379,9 @@ ifeq ($(OS_ARCH),OS2)
echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $@
echo EXPORTS >> $@
grep -v ';+' $< | grep -v ';-' | \
sed -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,,' >> $@
sed -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,,' -e 's,\([\t ]*\),\1_,' | \
awk 'BEGIN {ord=1;} { print($$0 " @" ord " RESIDENTNAME"); ord++;}' >> $@
$(ADD_TO_DEF_FILE)
endif
#

57
nsprpub/configure поставляемый
Просмотреть файл

@ -4649,29 +4649,28 @@ EOF
cat >> confdefs.h <<\EOF
#define OS2 1
EOF
cat >> confdefs.h <<\EOF
#define TCPV40HDRS 1
EOF
AR=emxomfar
AR_FLAGS='-p256 r $@'
CFLAGS="$CFLAGS -Wall -Zmtd -Zomf"
CXXFLAGS="$CFLAGS -Wall -Zmtd -Zomf"
AR_FLAGS='r $@'
CFLAGS="$CFLAGS -Wall -Zomf"
CXXFLAGS="$CFLAGS -Wall -Zomf"
MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
DSO_CFLAGS=
DSO_LDOPTS='-Zomf -Zdll -Zmtd'
DSO_LDOPTS='-Zomf -Zdll'
_OPTIMIZE_FLAGS="-O2 -s"
_DEBUG_FLAGS="-g -fno-inline"
if test -n "$MOZ_OPTIMIZE"; then
DSO_LDOPTS="$DSO_LDOPTS -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
fi
OS_LIBS="-lsocket -lemxio"
OS_LIBS="-lsocket"
IMPLIB='emximp -o'
FILTER='emxexp -o'
if test -z "$EMXOMFLD_LINKER"; then
# using LINK386.EXE
DSO_LDOPTS="$DSO_LDOPTS -Zlinker /NOO"
fi
# GCC for OS/2 currently predefines these, but we don't want them
DEFINES="$DEFINES -Uunix -U__unix -U__unix__"
@ -4747,7 +4746,7 @@ case $target in
;;
*)
echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
echo "configure:4751: checking for dlopen in -ldl" >&5
echo "configure:4750: checking for dlopen in -ldl" >&5
ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -4755,7 +4754,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldl $LIBS"
cat > conftest.$ac_ext <<EOF
#line 4759 "configure"
#line 4758 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -4766,7 +4765,7 @@ int main() {
dlopen()
; return 0; }
EOF
if { (eval echo configure:4770: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:4769: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -4783,17 +4782,17 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
ac_safe=`echo "dlfcn.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for dlfcn.h""... $ac_c" 1>&6
echo "configure:4787: checking for dlfcn.h" >&5
echo "configure:4786: checking for dlfcn.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 4792 "configure"
#line 4791 "configure"
#include "confdefs.h"
#include <dlfcn.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:4797: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:4796: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@ -4826,13 +4825,13 @@ esac
if test $ac_cv_prog_gcc = yes; then
echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
echo "configure:4830: checking whether ${CC-cc} needs -traditional" >&5
echo "configure:4829: checking whether ${CC-cc} needs -traditional" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_pattern="Autoconf.*'x'"
cat > conftest.$ac_ext <<EOF
#line 4836 "configure"
#line 4835 "configure"
#include "confdefs.h"
#include <sgtty.h>
Autoconf TIOCGETP
@ -4850,7 +4849,7 @@ rm -f conftest*
if test $ac_cv_prog_gcc_traditional = no; then
cat > conftest.$ac_ext <<EOF
#line 4854 "configure"
#line 4853 "configure"
#include "confdefs.h"
#include <termio.h>
Autoconf TCGETA
@ -4874,12 +4873,12 @@ fi
for ac_func in lchown strerror
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:4878: checking for $ac_func" >&5
echo "configure:4877: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 4883 "configure"
#line 4882 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@ -4902,7 +4901,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:4906: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:4905: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@ -4941,7 +4940,7 @@ hpux*)
if test -z "$GNU_CC"; then
echo $ac_n "checking for +Olit support""... $ac_c" 1>&6
echo "configure:4945: checking for +Olit support" >&5
echo "configure:4944: checking for +Olit support" >&5
if eval "test \"`echo '$''{'ac_cv_hpux_usable_olit_option'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -4975,7 +4974,7 @@ esac
echo $ac_n "checking for pthread_create in -lpthreads""... $ac_c" 1>&6
echo "configure:4979: checking for pthread_create in -lpthreads" >&5
echo "configure:4978: checking for pthread_create in -lpthreads" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
@ -4997,7 +4996,7 @@ echo "
echo "$ac_t""no" 1>&6
echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6
echo "configure:5001: checking for pthread_create in -lpthread" >&5
echo "configure:5000: checking for pthread_create in -lpthread" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
@ -5019,7 +5018,7 @@ echo "
echo "$ac_t""no" 1>&6
echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6
echo "configure:5023: checking for pthread_create in -lc_r" >&5
echo "configure:5022: checking for pthread_create in -lc_r" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
@ -5041,7 +5040,7 @@ echo "
echo "$ac_t""no" 1>&6
echo $ac_n "checking for pthread_create in -lc""... $ac_c" 1>&6
echo "configure:5045: checking for pthread_create in -lc" >&5
echo "configure:5044: checking for pthread_create in -lc" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
@ -5193,7 +5192,7 @@ if test -n "$USE_PTHREADS"; then
rm -f conftest*
ac_cv_have_dash_pthread=no
echo $ac_n "checking whether ${CC-cc} accepts -pthread""... $ac_c" 1>&6
echo "configure:5197: checking whether ${CC-cc} accepts -pthread" >&5
echo "configure:5196: checking whether ${CC-cc} accepts -pthread" >&5
echo 'int main() { return 0; }' | cat > conftest.c
${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
if test $? -eq 0; then
@ -5216,7 +5215,7 @@ echo "configure:5197: checking whether ${CC-cc} accepts -pthread" >&5
ac_cv_have_dash_pthreads=no
if test "$ac_cv_have_dash_pthread" = "no"; then
echo $ac_n "checking whether ${CC-cc} accepts -pthreads""... $ac_c" 1>&6
echo "configure:5220: checking whether ${CC-cc} accepts -pthreads" >&5
echo "configure:5219: checking whether ${CC-cc} accepts -pthreads" >&5
echo 'int main() { return 0; }' | cat > conftest.c
${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
if test $? -eq 0; then

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

@ -1802,27 +1802,23 @@ mips-sony-newsos*)
if test -n "$GNU_CC"; then
AC_DEFINE(XP_OS2_EMX)
AC_DEFINE(OS2)
AC_DEFINE(TCPV40HDRS)
AR=emxomfar
AR_FLAGS='-p256 r $@'
CFLAGS="$CFLAGS -Wall -Zmtd -Zomf"
CXXFLAGS="$CFLAGS -Wall -Zmtd -Zomf"
AR_FLAGS='r $@'
CFLAGS="$CFLAGS -Wall -Zomf"
CXXFLAGS="$CFLAGS -Wall -Zomf"
MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
DSO_CFLAGS=
DSO_LDOPTS='-Zomf -Zdll -Zmtd'
DSO_LDOPTS='-Zomf -Zdll'
_OPTIMIZE_FLAGS="-O2 -s"
_DEBUG_FLAGS="-g -fno-inline"
if test -n "$MOZ_OPTIMIZE"; then
DSO_LDOPTS="$DSO_LDOPTS -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
fi
OS_LIBS="-lsocket -lemxio"
OS_LIBS="-lsocket"
IMPLIB='emximp -o'
FILTER='emxexp -o'
if test -z "$EMXOMFLD_LINKER"; then
# using LINK386.EXE
DSO_LDOPTS="$DSO_LDOPTS -Zlinker /NOO"
fi
# GCC for OS/2 currently predefines these, but we don't want them
DEFINES="$DEFINES -Uunix -U__unix -U__unix__"

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

@ -75,19 +75,6 @@ APIRET _Optlink SemRequest486(PRAMSEM, ULONG);
APIRET _Optlink SemReleasex86(PRAMSEM, ULONG);
#endif
#ifdef XP_OS2_EMX
/*
* EMX-specific tweaks:
* o Use errno rather than sock_errno()
* o Use close rather than soclose
* o Ignore sock_init calls.
*/
#define sock_errno() errno
#define soclose close
#define sock_init()
#include <string.h>
#endif
/*
* Internal configuration macros
*/
@ -294,19 +281,12 @@ 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_SOCKETPAIR(s, type, proto, sv) -1
#define _MD_SOCKETPAIR (_PR_MD_SOCKETPAIR)
#define _MD_GETSOCKNAME (_PR_MD_GETSOCKNAME)
#define _MD_GETPEERNAME (_PR_MD_GETPEERNAME)
#define _MD_GETSOCKOPT (_PR_MD_GETSOCKOPT)
#define _MD_SETSOCKOPT (_PR_MD_SETSOCKOPT)
#ifdef XP_OS2_EMX
extern PRInt32 _MD_SELECT(int nfds, fd_set *readfds, fd_set *writefds,
fd_set *exceptfds, struct timeval *timeout);
#else
#define _MD_SELECT select
#endif
#define _MD_FSYNC _PR_MD_FSYNC
#define _MD_SET_FD_INHERITABLE (_PR_MD_SET_FD_INHERITABLE)

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

@ -127,6 +127,9 @@ NSPR_API(void) _MD_os2_map_listen_error(PRInt32 err);
NSPR_API(void) _MD_os2_map_shutdown_error(PRInt32 err);
#define _PR_MD_MAP_SHUTDOWN_ERROR _MD_os2_map_shutdown_error
NSPR_API(void) _MD_os2_map_socketpair_error(int err);
#define _PR_MD_MAP_SOCKETPAIR_ERROR _MD_os2_map_socketpair_error
NSPR_API(void) _MD_os2_map_getsockname_error(PRInt32 err);
#define _PR_MD_MAP_GETSOCKNAME_ERROR _MD_os2_map_getsockname_error

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

@ -194,7 +194,7 @@ union PRNetAddr {
PRIPv6Addr ip; /* the actual 128 bits of address */
PRUint32 scope_id; /* set of interfaces for a scope */
} ipv6;
#if defined(XP_UNIX)
#if defined(XP_UNIX) || defined(XP_OS2)
struct { /* Unix domain socket address */
PRUint16 family; /* address family (AF_UNIX) */
char path[104]; /* null-terminated pathname */

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

@ -1395,7 +1395,7 @@ extern PRUintn _PR_NetAddrSize(const PRNetAddr* addr);
** struct sockaddr_in6.
*/
#if defined(XP_UNIX)
#if defined(XP_UNIX) || defined(XP_OS2)
#define PR_NETADDR_SIZE(_addr) \
((_addr)->raw.family == PR_AF_INET \
? sizeof((_addr)->inet) \
@ -1411,7 +1411,7 @@ extern PRUintn _PR_NetAddrSize(const PRNetAddr* addr);
#else
#if defined(XP_UNIX)
#if defined(XP_UNIX) || defined(XP_OS2)
#define PR_NETADDR_SIZE(_addr) \
((_addr)->raw.family == PR_AF_INET \
? sizeof((_addr)->inet) \

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

@ -143,6 +143,7 @@ endif
ifeq ($(OS_ARCH),OS2)
MAPFILE = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).def
ADD_TO_DEF_FILE = cat $(srcdir)/os2extra.def >> $(MAPFILE)
GARBAGE += $(MAPFILE)
MKSHLIB += $(MAPFILE)
endif

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

@ -493,8 +493,7 @@ PR_IMPLEMENT(void) PR_Abort(void)
#include <builtin.h>
static void DebugBreak(void) { _interrupt(3); }
#elif defined(XP_OS2_EMX)
/* Force a trap */
static void DebugBreak(void) { int *pTrap=NULL; *pTrap = 1; }
static void DebugBreak(void) { asm("int $3"); }
#else
static void DebugBreak(void) { }
#endif

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

@ -44,7 +44,7 @@
PRBool IsValidNetAddr(const PRNetAddr *addr)
{
if ((addr != NULL)
#ifdef XP_UNIX
#if defined(XP_UNIX) || defined(XP_OS2)
&& (addr->raw.family != PR_AF_LOCAL)
#endif
&& (addr->raw.family != PR_AF_INET6)
@ -61,7 +61,7 @@ static PRBool IsValidNetAddrLen(const PRNetAddr *addr, PRInt32 addr_len)
* is not uniform, so we don't check it.
*/
if ((addr != NULL)
#ifdef XP_UNIX
#if defined(XP_UNIX) || defined(XP_OS2)
&& (addr->raw.family != AF_UNIX)
#endif
&& (PR_NETADDR_SIZE(addr) != addr_len)) {
@ -1273,7 +1273,7 @@ PR_IMPLEMENT(PRFileDesc*) PR_Socket(PRInt32 domain, PRInt32 type, PRInt32 proto)
if (!_pr_initialized) _PR_ImplicitInitialization();
if (PR_AF_INET != domain
&& PR_AF_INET6 != domain
#if defined(XP_UNIX)
#if defined(XP_UNIX) || defined(XP_OS2)
&& PR_AF_LOCAL != domain
#endif
) {

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

@ -162,7 +162,7 @@ struct _imcb *IAC$GL_IMAGE_LIST = NULL;
* On these platforms, symbols have a leading '_'.
*/
#if defined(SUNOS4) || defined(DARWIN) || defined(NEXTSTEP) \
|| defined(WIN16) \
|| defined(WIN16) || defined(XP_OS2) \
|| ((defined(OPENBSD) || defined(NETBSD)) && !defined(__ELF__))
#define NEED_LEADING_UNDERSCORE
#endif
@ -939,8 +939,7 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags)
UCHAR pszError[_MAX_PATH];
ULONG ulRc = NO_ERROR;
retry:
ulRc = DosLoadModule(pszError, _MAX_PATH, (PSZ) name, &h);
ulRc = DosLoadModule(pszError, _MAX_PATH, (PSZ) name, &h);
if (ulRc != NO_ERROR) {
oserr = ulRc;
PR_DELETE(lm);
@ -1432,6 +1431,9 @@ static void*
pr_FindSymbolInLib(PRLibrary *lm, const char *name)
{
void *f = NULL;
#ifdef XP_OS2
int rc;
#endif
if (lm->staticTable != NULL) {
const PRStaticLinkTable* tp;
@ -1451,7 +1453,17 @@ pr_FindSymbolInLib(PRLibrary *lm, const char *name)
}
#ifdef XP_OS2
DosQueryProcAddr(lm->dlh, 0, (PSZ) name, (PFN *) &f);
rc = DosQueryProcAddr(lm->dlh, 0, (PSZ) name, (PFN *) &f);
#if defined(NEED_LEADING_UNDERSCORE)
/*
* Older plugins (not built using GCC) will have symbols that are not
* underscore prefixed. We check for that here.
*/
if (rc != NO_ERROR) {
name++;
DosQueryProcAddr(lm->dlh, 0, (PSZ) name, (PFN *) &f);
}
#endif
#endif /* XP_OS2 */
#if defined(WIN32) || defined(WIN16)

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

@ -63,7 +63,7 @@ ASFILES = os2vacpp.asm
endif
ifeq ($(MOZ_OS2_TOOLS),EMX)
ASFILES = os2emx.s
ASFILES = os2emx.s os2vaclegacy.s
endif
TARGETS = $(OBJS)

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

@ -53,7 +53,7 @@ ASFILES = os2vacpp.asm
endif
ifeq ($(MOZ_OS2_TOOLS),EMX)
ASFILES = os2emx.s
ASFILES = os2emx.s os2vaclegacy.s
endif
OBJS += $(addprefix md/os2/$(OBJDIR)/,$(CSRCS:.c=.$(OBJ_SUFFIX))) \

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

@ -875,6 +875,30 @@ void _MD_os2_map_shutdown_error(PRInt32 err)
}
}
void _MD_os2_map_socketpair_error(PRInt32 err)
{
switch (err) {
case ENOMEM:
PR_SetError(PR_INSUFFICIENT_RESOURCES_ERROR, err);
break;
case EAFNOSUPPORT:
PR_SetError(PR_ADDRESS_NOT_SUPPORTED_ERROR, err);
break;
case EPROTONOSUPPORT:
PR_SetError(PR_PROTOCOL_NOT_SUPPORTED_ERROR, err);
break;
case EOPNOTSUPP:
PR_SetError(PR_NOT_TCP_SOCKET_ERROR, err);
break;
case EPROTOTYPE:
PR_SetError(PR_ADDRESS_NOT_SUPPORTED_ERROR, err);
break;
default:
_MD_os2_map_default_error(err);
return;
}
}
void _MD_os2_map_getsockname_error(PRInt32 err)
{
switch (err) {

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

@ -242,7 +242,7 @@ retry:
tvp = &tv;
}
ready = _MD_SELECT(maxfd + 1, &rd, &wt, &ex, tvp);
ready = bsdselect(maxfd + 1, &rd, &wt, &ex, tvp);
#else
switch (timeout)
{
@ -262,7 +262,7 @@ retry:
for( i = rd+wt, j = npds*2; j < npds*2+ex; i++,j++ )
socks[i] = socks[j];
ready = _MD_SELECT(socks, rd, wt, ex, msecs);
ready = os2_select(socks, rd, wt, ex, msecs);
#endif
if (ready == -1 && errno == EINTR)
@ -378,151 +378,3 @@ retry:
return ready;
}
#ifdef XP_OS2_EMX
HMTX thread_select_mutex = 0; /* because EMX's select is not thread safe - duh! */
typedef struct _thread_select_st {
int nfds;
int isrdfds;
struct _fd_set *readfds;
int iswrfds;
struct _fd_set *writefds;
int isexfds;
struct _fd_set *exceptfds;
int istimeout;
struct timeval timeout;
volatile HEV event;
int result;
int select_errno;
volatile int done;
} *pthread_select_t;
void _thread_select(void * arg)
{
pthread_select_t self = arg;
int result, chkstdin;
struct _fd_set readfds;
struct _fd_set writefds;
struct _fd_set exceptfds;
HEV event = self->event;
chkstdin = (self->isrdfds && FD_ISSET(0,self->readfds))?1:0;
do {
struct timeval timeout = {0L,0L};
if (self->isrdfds) readfds = *self->readfds;
if (self->iswrfds) writefds = *self->writefds;
if (self->isexfds) exceptfds = *self->exceptfds;
if (chkstdin) FD_CLR(0,&readfds);
if (!thread_select_mutex)
DosCreateMutexSem(NULL,&thread_select_mutex,0,1);
else
DosRequestMutexSem(thread_select_mutex,SEM_INDEFINITE_WAIT);
result = select(
self->nfds,
self->isrdfds?&readfds:NULL,
self->iswrfds?&writefds:NULL,
self->isexfds?&exceptfds:NULL,
&timeout);
DosReleaseMutexSem(thread_select_mutex);
if (chkstdin) {
int charcount = 0, res;
res = ioctl(0,FIONREAD,&charcount);
if (res==0 && charcount>0) FD_SET(0,&readfds);
}
if (result>0) {
self->done++;
if (self->isrdfds) *self->readfds = readfds;
if (self->iswrfds) *self->writefds = writefds;
if (self->isexfds) *self->exceptfds = exceptfds;
} else
if (result) self->done++;
else DosSleep(1);
} while (self->event!=0 && self->done==0);
if (self->event) {
self->select_errno = (result < 0)?errno:0;
self->result = result;
self->done = 3;
DosPostEventSem(event);
} else {
self->done = 3;
free(self);
}
}
PRInt32
_MD_SELECT(int nfds, fd_set *readfds, fd_set *writefds,
fd_set *exceptfds, struct timeval *timeout)
{
pthread_select_t sel;
HEV ev = 0;
HTIMER timer = 0;
int result = 0;
APIRET rc;
unsigned long msecs = SEM_INDEFINITE_WAIT;
if (timeout) {
if (timeout->tv_sec != 0 || timeout->tv_usec != 0)
msecs = (timeout->tv_sec * 1000L) + (timeout->tv_usec / 1000L);
else
msecs = SEM_IMMEDIATE_RETURN;
};
if (!(sel = (pthread_select_t) malloc(sizeof(struct _thread_select_st)))) {
result = -1;
errno = ENOMEM;
} else {
sel->nfds = nfds;
sel->isrdfds = readfds?1:0;
if (sel->isrdfds) sel->readfds = readfds;
sel->iswrfds = writefds?1:0;
if (sel->iswrfds) sel->writefds = writefds;
sel->isexfds = exceptfds?1:0;
if (sel->isexfds) sel->exceptfds = exceptfds;
sel->istimeout = timeout?1:0;
if (sel->istimeout) sel->timeout = *timeout;
rc = DosCreateEventSem(NULL,&ev,0,FALSE);
sel->event = ev;
if (msecs == SEM_IMMEDIATE_RETURN)
sel->done = 1;
else
sel->done = 0;
if (_beginthread(_thread_select,NULL,65536,(void *)sel) == -1) {
result = -1; sel->event = 0;
DosCloseEventSem(ev);
} else {
rc = DosWaitEventSem(ev,msecs);
if ((!sel->done) && (msecs != SEM_IMMEDIATE_RETURN)) { /* Interrupted by other thread or timeout */
sel->event = 0;
result = 0;
errno = ETIMEDOUT;
} else {
while (sel->done && sel->done != 3) {
DosSleep(1);
}
sel->event = 0;
result = sel->result;
if (sel->select_errno) errno = sel->select_errno;
free(sel);
}
rc = DosCloseEventSem(ev);
}
}
return (result);
}
#endif

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

@ -100,7 +100,7 @@ _MD_SocketAvailable(PRFileDesc *fd)
{
PRInt32 result;
if (ioctl(fd->secret->md.osfd, FIONREAD, (char *) &result, sizeof(result)) < 0) {
if (so_ioctl(fd->secret->md.osfd, FIONREAD, (char *) &result, sizeof(result)) < 0) {
PR_SetError(PR_BAD_DESCRIPTOR_ERROR, sock_errno());
return -1;
}
@ -139,17 +139,17 @@ socket_io_wait( PRInt32 osfd, PRInt32 fd_type, PRIntervalTime timeout )
do {
FD_SET(osfd, &rd_wr);
if (fd_type == READ_FD)
rv = _MD_SELECT(osfd + 1, &rd_wr, NULL, NULL, &tv);
rv = bsdselect(osfd + 1, &rd_wr, NULL, NULL, &tv);
else
rv = _MD_SELECT(osfd + 1, NULL, &rd_wr, NULL, &tv);
rv = bsdselect(osfd + 1, NULL, &rd_wr, NULL, &tv);
#else
lTimeout = _PR_INTERRUPT_CHECK_INTERVAL_SECS * 1000;
do {
socks[0] = osfd;
if (fd_type == READ_FD)
rv = _MD_SELECT(socks, 1, 0, 0, lTimeout);
rv = os2_select(socks, 1, 0, 0, lTimeout);
else
rv = _MD_SELECT(socks, 0, 1, 0, lTimeout);
rv = os2_select(socks, 0, 1, 0, lTimeout);
#endif
if (rv == -1 && (syserror = sock_errno()) != EINTR) {
_PR_MD_MAP_SELECT_ERROR(syserror);
@ -171,7 +171,7 @@ socket_io_wait( PRInt32 osfd, PRInt32 fd_type, PRIntervalTime timeout )
#endif
do {
/*
* We block in _MD_SELECT for at most
* We block in select for at most
* _PR_INTERRUPT_CHECK_INTERVAL_SECS seconds,
* so that there is an upper limit on the delay
* before the interrupt bit is checked.
@ -190,9 +190,9 @@ socket_io_wait( PRInt32 osfd, PRInt32 fd_type, PRIntervalTime timeout )
}
FD_SET(osfd, &rd_wr);
if (fd_type == READ_FD)
rv = _MD_SELECT(osfd + 1, &rd_wr, NULL, NULL, &tv);
rv = bsdselect(osfd + 1, &rd_wr, NULL, NULL, &tv);
else
rv = _MD_SELECT(osfd + 1, NULL, &rd_wr, NULL, &tv);
rv = bsdselect(osfd + 1, NULL, &rd_wr, NULL, &tv);
#else
wait_for_remaining = PR_TRUE;
lTimeout = PR_IntervalToMilliseconds(remaining);
@ -202,9 +202,9 @@ socket_io_wait( PRInt32 osfd, PRInt32 fd_type, PRIntervalTime timeout )
}
socks[0] = osfd;
if (fd_type == READ_FD)
rv = _MD_SELECT(socks, 1, 0, 0, lTimeout);
rv = os2_select(socks, 1, 0, 0, lTimeout);
else
rv = _MD_SELECT(socks, 0, 1, 0, lTimeout);
rv = os2_select(socks, 0, 1, 0, lTimeout);
#endif
/*
* we don't consider EINTR a real error
@ -220,12 +220,12 @@ socket_io_wait( PRInt32 osfd, PRInt32 fd_type, PRIntervalTime timeout )
break;
}
/*
* We loop again if _MD_SELECT timed out or got interrupted
* We loop again if select timed out or got interrupted
* by a signal, and the timeout deadline has not passed yet.
*/
if (rv == 0 || (rv == -1 && syserror == EINTR)) {
/*
* If _MD_SELECT timed out, we know how much time
* If select timed out, we know how much time
* we spent in blocking, so we can avoid a
* PR_IntervalNow() call.
*/
@ -539,7 +539,7 @@ _PR_MD_WRITEV(PRFileDesc *fd, const PRIOVec *iov, PRInt32 iov_size,
}
}
while ((rv = writev(osfd, (const struct iovec*)iov, iov_size)) == -1) {
while ((rv = so_writev(osfd, (const struct iovec*)iov, iov_size)) == -1) {
err = sock_errno();
if ((err == EWOULDBLOCK)) {
if (fd->secret->nonblocking) {
@ -584,6 +584,20 @@ _PR_MD_SHUTDOWN(PRFileDesc *fd, PRIntn how)
return rv;
}
PRInt32
_PR_MD_SOCKETPAIR(int af, int type, int flags, PRInt32 *osfd)
{
PRInt32 rv, err;
rv = socketpair(af, type, flags, osfd);
if (rv < 0) {
err = _MD_ERRNO();
_PR_MD_MAP_SOCKETPAIR_ERROR(err);
}
return rv;
}
PRStatus
_PR_MD_GETSOCKNAME(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen)
{
@ -652,7 +666,7 @@ _MD_MakeNonblock(PRFileDesc *fd)
return;
}
err = ioctl( osfd, FIONBIO, (char *) &one, sizeof(one));
err = so_ioctl( osfd, FIONBIO, (char *) &one, sizeof(one));
if ( err != 0 )
{
err = sock_errno();

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

@ -111,11 +111,10 @@ _PR_MD_CREATE_THREAD(PRThread *thread,
PRThreadState state,
PRUint32 stackSize)
{
thread->md.handle = thread->id = (TID) _beginthread(
(void(* _Optlink)(void*))start,
NULL,
thread->stack->stackSize,
thread);
thread->md.handle = thread->id = (TID) _beginthread(start,
NULL,
thread->stack->stackSize,
thread);
if(thread->md.handle == -1) {
return PR_FAILURE;
}

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

@ -0,0 +1,74 @@
/ -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/
/ 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 http://www.mozilla.org/MPL/
/
/ 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 InnoTek
/ Systemberatung GmbH.
/ Portions created by the Initial Developer are Copyright (C) 2003
/ the Initial Developer. All Rights Reserved.
/
/ Contributor(s):
/ InnoTek Systemberatung GmbH / Knut St. Osmundsen
/
/ Alternatively, the contents of this file may be used under the
/ terms of the GNU General Public License Version 2 or later (the
/ "GPL"), in which case the provisions of the GPL are applicable
/ instead of those above. If you wish to allow use of your
/ version of this file only under the terms of the GPL and not to
/ allow others to use your version of this file under the MPL,
/ indicate your decision by deleting the provisions above and
/ replace them with the notice and other provisions required by
/ the GPL. If you do not delete the provisions above, a recipient
/ may use your version of this file under either the MPL or the
/ GPL.
/
.text
.align 4
.globl PR_NewMonitor
PR_NewMonitor:
jmp _PR_NewMonitor
.align 4
.globl PR_EnterMonitor
PR_EnterMonitor:
mov %eax, 4(%esp)
jmp _PR_EnterMonitor
.align 4
.globl PR_ExitMonitor
PR_ExitMonitor:
mov %eax, 4(%esp)
jmp _PR_ExitMonitor
.align 4
.globl PR_AttachThread
PR_AttachThread:
mov %eax, 4(%esp)
mov %edx, 8(%esp)
mov %ecx, 12(%esp)
jmp _PR_AttachThread
.align 4
.globl PR_DetachThread
PR_DetachThread:
jmp _PR_DetachThread
.align 4
.globl PR_GetCurrentThread
PR_GetCurrentThread:
jmp _PR_GetCurrentThread

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

@ -1373,7 +1373,7 @@ PRUintn _PR_NetAddrSize(const PRNetAddr* addr)
#else
addrsize = sizeof(addr->ipv6);
#endif
#if defined(XP_UNIX)
#if defined(XP_UNIX) || defined(XP_OS2)
else if (AF_UNIX == addr->raw.family)
addrsize = sizeof(addr->local);
#endif

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

@ -0,0 +1,11 @@
;
; Support plugins that were explicitly linked to the Visual Age
; version of nspr4.dll.
;
PR_NewMonitor
PR_EnterMonitor
PR_ExitMonitor
PR_GetCurrentThread
PR_AttachThread
PR_DetachThread

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

@ -235,7 +235,7 @@ ifeq ($(MOZ_OS2_TOOLS),VACPP)
LDOPTS = -NOE -DEBUG -nologo -PMTYPE:VIO
else
EXTRA_LIBS = $(OS_LIBS)
LDOPTS = -Zmtd -Zomf -Zlinker /PM:VIO -Zlinker /ST:0x30000
LDOPTS = -Zomf -Zlinker /PM:VIO -Zlinker /ST:0x64000
endif
endif

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

@ -78,12 +78,11 @@ ifeq (,$(filter-out WINNT OS2,$(OS_ARCH)))
IMPORT_LIBRARY = $(OBJDIR)/my.$(LIB_SUFFIX)
SHARED_LIBRARY = $(OBJDIR)/my.dll
ifeq ($(OS_ARCH), OS2)
LIBRARY = $(OBJDIR)/my_s.lib
# XXX $(LIBRARY) probably doesn't need to be added to TARGETS.
TARGETS = $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY)
else
TARGETS = $(SHARED_LIBRARY) $(IMPORT_LIBRARY)
MAPFILE = $(OBJDIR)/my.def
GARBAGE += $(MAPFILE)
MKSHLIB += $(MAPFILE)
endif
TARGETS = $(SHARED_LIBRARY) $(IMPORT_LIBRARY)
else
ifdef MKSHLIB
SHARED_LIBRARY = $(OBJDIR)/libmy.$(DLL_SUFFIX)

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

@ -0,0 +1,53 @@
;+#
;+# 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 http://www.mozilla.org/MPL/
;+#
;+# 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 Netscape are
;+# Copyright (C) 2002-2003 Netscape Communications Corporation. All
;+# Rights Reserved.
;+#
;+# Contributor(s):
;+#
;+# Alternatively, the contents of this file may be used under the
;+# terms of the GNU General Public License Version 2 or later (the
;+# "GPL"), in which case the provisions of the GPL are applicable
;+# instead of those above. If you wish to allow use of your
;+# version of this file only under the terms of the GPL and not to
;+# allow others to use your version of this file under the MPL,
;+# indicate your decision by deleting the provisions above and
;+# replace them with the notice and other provisions required by
;+# the GPL. If you do not delete the provisions above, a recipient
;+# may use your version of this file under either the MPL or the
;+# GPL.
;+#
;+# OK, this file is meant to support SUN, LINUX, AIX, OS/2 and WINDOWS
;+# 1. For all unix platforms, the string ";-" means "remove this line"
;+# 2. For all unix platforms, the string " DATA " will be removed from any
;+# line on which it occurs.
;+# 3. Lines containing ";+" will have ";+" removed on SUN and LINUX.
;+# On AIX, lines containing ";+" will be removed.
;+# 4. For all unix platforms, the string ";;" will thave the ";;" removed.
;+# 5. For all unix platforms, after the above processing has taken place,
;+# all characters after the first ";" on the line will be removed.
;+# And for AIX, the first ";" will also be removed.
;+# This file is passed directly to windows. Since ';' is a comment, all UNIX
;+# directives are hidden behind ";", ";+", and ";-"
;+#
;+MY_1.0 {
;+ global:
LIBRARY my ;-
EXPORTS ;-
My_GetValue;
My_SetValue;
;+ local: *;
;+};