--- a/nsprpub/config/prdepend.h
+++ b/nsprpub/config/prdepend.h
@@ -37,8 +37,9 @@
/*
* A dummy header file that is a dependency for all the object files.
* Used to force a full recompilation of NSPR in Mozilla's Tinderbox
* depend builds. See comments in rules.mk.
*/
#error "Do not include this header file."
+
--- a/nsprpub/configure
+++ b/nsprpub/configure
@@ -3351,32 +3351,34 @@ EOF
cat >> confdefs.h <<\EOF
#define HAVE_BSD_FLOCK 1
EOF
cat >> confdefs.h <<\EOF
#define HAVE_SOCKLEN_T 1
EOF
- CFLAGS="$CFLAGS -Wmost -fno-common"
+ AS='$(CC) -x assembler-with-cpp'
+ CFLAGS="$CFLAGS -Wall -fno-common"
case "${target_cpu}" in
i*86*)
if test -n "$USE_64"; then
CPU_ARCH=x86_64
CC="$CC -arch x86_64"
else
CPU_ARCH=i386
fi
;;
*)
CPU_ARCH=ppc
;;
esac
DSO_CFLAGS=-fPIC
DSO_LDOPTS='-dynamiclib -compatibility_version 1 -current_version 1 -all_load -install_name @executable_path/$@ -headerpad_max_install_names'
+ _OPTIMIZE_FLAGS=-O2
MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
STRIP="$STRIP -x -S"
DLL_SUFFIX=dylib
USE_PTHREADS=1
MDCPUCFG_H=_darwin.cfg
PR_MD_CSRCS=darwin.c
PR_MD_ASFILES=os_Darwin.s
@@ -4054,23 +4056,18 @@ EOF
#define _DEBUG 1
EOF
else
DEFINES="$DEFINES -U_DEBUG"
fi
if test -n "$MOZ_OPTIMIZE"; then
- if test -n "$MOZ_PROFILE"; then
- _OPTIMIZE_FLAGS="$_OPTIMIZE_FLAGS -Z7"
- fi
if test -n "$MOZ_DEBUG_SYMBOLS"; then
_OPTIMIZE_FLAGS="$_OPTIMIZE_FLAGS -Zi"
- fi
- if test -n "$MOZ_PROFILE" -o -n "$MOZ_DEBUG_SYMBOLS"; then
DLLFLAGS="$DLLFLAGS -DEBUG -OPT:REF"
LDFLAGS="$LDFLAGS -DEBUG -OPT:REF"
fi
fi
if test -n "$MOZ_DEBUG"; then
DLLFLAGS="$DLLFLAGS -DEBUG"
LDFLAGS="$LDFLAGS -DEBUG"
@@ -4540,27 +4537,27 @@ EOF
if test -z "$GNU_CC"; then
CC="$CC -std1 -ieee_with_inexact"
if test "$OS_RELEASE" != "V2.0"; then
CC="$CC -readonly_strings"
fi
_OPTIMIZE_FLAGS="$_OPTIMIZE_FLAGS -Olimit 4000"
ac_safe=`echo "machine/builtins.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for machine/builtins.h""... $ac_c" 1>&6
-echo "configure:4549: checking for machine/builtins.h" >&5
+echo "configure:4546: checking for machine/builtins.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 4554 "configure"
+#line 4551 "configure"
#include "confdefs.h"
#include <machine/builtins.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4559: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4556: \"$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*
eval "ac_cv_header_$ac_safe=yes"
else
echo "$ac_err" >&5
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
@@ -5199,63 +5196,63 @@ if test -z "$SKIP_LIBRARY_CHECKS"; then
case $target in
*-darwin*|*-beos*)
;;
*)
echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:5208: checking for dlopen in -ldl" >&5
+echo "configure:5205: 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
else
ac_save_LIBS="$LIBS"
LIBS="-ldl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 5216 "configure"
+#line 5213 "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
builtin and then its argument prototype would still apply. */
char dlopen();
int main() {
dlopen()
; return 0; }
EOF
-if { (eval echo configure:5227: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5224: \"$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
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"
fi
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:5244: checking for dlfcn.h" >&5
+echo "configure:5241: 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 5249 "configure"
+#line 5246 "configure"
#include "confdefs.h"
#include <dlfcn.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5254: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5251: \"$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*
eval "ac_cv_header_$ac_safe=yes"
else
echo "$ac_err" >&5
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
@@ -5278,23 +5275,23 @@ fi
;;
esac
if test $ac_cv_prog_gcc = yes; then
echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
-echo "configure:5287: checking whether ${CC-cc} needs -traditional" >&5
+echo "configure:5284: 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 5293 "configure"
+#line 5290 "configure"
#include "confdefs.h"
#include <sgtty.h>
Autoconf TIOCGETP
EOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
egrep "$ac_pattern" >/dev/null 2>&1; then
rm -rf conftest*
ac_cv_prog_gcc_traditional=yes
@@ -5302,17 +5299,17 @@ else
rm -rf conftest*
ac_cv_prog_gcc_traditional=no
fi
rm -f conftest*
if test $ac_cv_prog_gcc_traditional = no; then
cat > conftest.$ac_ext <<EOF
-#line 5311 "configure"
+#line 5308 "configure"
#include "confdefs.h"
#include <termio.h>
Autoconf TCGETA
EOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
egrep "$ac_pattern" >/dev/null 2>&1; then
rm -rf conftest*
ac_cv_prog_gcc_traditional=yes
@@ -5326,22 +5323,22 @@ echo "$ac_t""$ac_cv_prog_gcc_traditional
if test $ac_cv_prog_gcc_traditional = yes; then
CC="$CC -traditional"
fi
fi
for ac_func in lchown strerror
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5335: checking for $ac_func" >&5
+echo "configure:5332: 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 5340 "configure"
+#line 5337 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
#include <assert.h>
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char $ac_func();
@@ -5354,17 +5351,17 @@ int main() {
#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
choke me
#else
$ac_func();
#endif
; return 0; }
EOF
-if { (eval echo configure:5363: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5360: \"$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
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_func_$ac_func=no"
fi
@@ -5395,17 +5392,17 @@ if test "${enable_strip+set}" = set; the
fi
case "${target_os}" in
hpux*)
if test -z "$GNU_CC"; then
echo $ac_n "checking for +Olit support""... $ac_c" 1>&6
-echo "configure:5404: checking for +Olit support" >&5
+echo "configure:5401: 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
ac_cv_hpux_usable_olit_option=no
rm -f conftest*
echo 'int main() { return 0; }' | cat > conftest.c
${CC-cc} ${CFLAGS} +Olit=all -o conftest conftest.c > conftest.out 2>&1
if test $? -eq 0; then
@@ -5434,17 +5431,17 @@ esac
case "$target_os" in
darwin*)
_HAVE_PTHREADS=1
;;
*)
echo $ac_n "checking for pthread_create in -lpthreads""... $ac_c" 1>&6
-echo "configure:5443: checking for pthread_create in -lpthreads" >&5
+echo "configure:5440: checking for pthread_create in -lpthreads" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
int main() {
pthread_t t;
if (!pthread_create(&t, 0, &foo, 0)) {
pthread_join(t, 0);
}
@@ -5456,17 +5453,17 @@ echo "
rm -f dummy.c dummy${ac_exeext} ;
if test "$_res" = "0"; then
echo "$ac_t""yes" 1>&6
_HAVE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads"
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6
-echo "configure:5465: checking for pthread_create in -lpthread" >&5
+echo "configure:5462: checking for pthread_create in -lpthread" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
int main() {
pthread_t t;
if (!pthread_create(&t, 0, &foo, 0)) {
pthread_join(t, 0);
}
@@ -5478,17 +5475,17 @@ echo "
rm -f dummy.c dummy${ac_exeext} ;
if test "$_res" = "0"; then
echo "$ac_t""yes" 1>&6
_HAVE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread"
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6
-echo "configure:5487: checking for pthread_create in -lc_r" >&5
+echo "configure:5484: checking for pthread_create in -lc_r" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
int main() {
pthread_t t;
if (!pthread_create(&t, 0, &foo, 0)) {
pthread_join(t, 0);
}
@@ -5500,17 +5497,17 @@ echo "
rm -f dummy.c dummy${ac_exeext} ;
if test "$_res" = "0"; then
echo "$ac_t""yes" 1>&6
_HAVE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r"
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for pthread_create in -lc""... $ac_c" 1>&6
-echo "configure:5509: checking for pthread_create in -lc" >&5
+echo "configure:5506: checking for pthread_create in -lc" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
int main() {
pthread_t t;
if (!pthread_create(&t, 0, &foo, 0)) {
pthread_join(t, 0);
}
@@ -5632,17 +5629,17 @@ EOF
fi
fi
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:5641: checking whether ${CC-cc} accepts -pthread" >&5
+echo "configure:5638: 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
if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
ac_cv_have_dash_pthread=yes
case "$target_os" in
freebsd*)
# Freebsd doesn't use -pthread for compiles, it uses them for linking
@@ -5655,17 +5652,17 @@ echo "configure:5641: checking whether $
fi
fi
rm -f conftest*
echo "$ac_t""$ac_cv_have_dash_pthread" 1>&6
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:5664: checking whether ${CC-cc} accepts -pthreads" >&5
+echo "configure:5661: 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
if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
ac_cv_have_dash_pthreads=yes
CFLAGS="$CFLAGS -pthreads"
CXXFLAGS="$CXXFLAGS -pthreads"
fi
--- a/nsprpub/configure.in
+++ b/nsprpub/configure.in
@@ -991,32 +991,34 @@ case "$target" in
;;
*-darwin*)
AC_DEFINE(XP_UNIX)
AC_DEFINE(DARWIN)
AC_DEFINE(HAVE_BSD_FLOCK)
AC_DEFINE(HAVE_SOCKLEN_T)
- CFLAGS="$CFLAGS -Wmost -fno-common"
+ AS='$(CC) -x assembler-with-cpp'
+ CFLAGS="$CFLAGS -Wall -fno-common"
case "${target_cpu}" in
i*86*)
if test -n "$USE_64"; then
CPU_ARCH=x86_64
CC="$CC -arch x86_64"
else
CPU_ARCH=i386
fi
;;
*)
CPU_ARCH=ppc
;;
esac
DSO_CFLAGS=-fPIC
DSO_LDOPTS='-dynamiclib -compatibility_version 1 -current_version 1 -all_load -install_name @executable_path/$@ -headerpad_max_install_names'
+ _OPTIMIZE_FLAGS=-O2
MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
STRIP="$STRIP -x -S"
DLL_SUFFIX=dylib
USE_PTHREADS=1
MDCPUCFG_H=_darwin.cfg
PR_MD_CSRCS=darwin.c
PR_MD_ASFILES=os_Darwin.s
@@ -1563,23 +1565,18 @@ tools are selected during the Xcode/Deve
if test -n "$MOZ_DEBUG"; then
AC_DEFINE(_DEBUG)
else
DEFINES="$DEFINES -U_DEBUG"
fi
if test -n "$MOZ_OPTIMIZE"; then
- if test -n "$MOZ_PROFILE"; then
- _OPTIMIZE_FLAGS="$_OPTIMIZE_FLAGS -Z7"
- fi
if test -n "$MOZ_DEBUG_SYMBOLS"; then
_OPTIMIZE_FLAGS="$_OPTIMIZE_FLAGS -Zi"
- fi
- if test -n "$MOZ_PROFILE" -o -n "$MOZ_DEBUG_SYMBOLS"; then
DLLFLAGS="$DLLFLAGS -DEBUG -OPT:REF"
LDFLAGS="$LDFLAGS -DEBUG -OPT:REF"
fi
fi
if test -n "$MOZ_DEBUG"; then
DLLFLAGS="$DLLFLAGS -DEBUG"
LDFLAGS="$LDFLAGS -DEBUG"
--- a/nsprpub/pr/include/prlong.h
+++ b/nsprpub/pr/include/prlong.h
@@ -61,17 +61,18 @@ PR_BEGIN_EXTERN_C
***********************************************************************/
NSPR_API(PRInt64) LL_MaxInt(void);
NSPR_API(PRInt64) LL_MinInt(void);
NSPR_API(PRInt64) LL_Zero(void);
NSPR_API(PRUint64) LL_MaxUint(void);
#if defined(HAVE_LONG_LONG)
-#if PR_BYTES_PER_LONG == 8
+/* Keep this in sync with prtypes.h. */
+#if PR_BYTES_PER_LONG == 8 && !defined(__APPLE__)
#define LL_MAXINT 9223372036854775807L
#define LL_MININT (-LL_MAXINT - 1L)
#define LL_ZERO 0L
#define LL_MAXUINT 18446744073709551615UL
#define LL_INIT(hi, lo) ((hi ## L << 32) + lo ## L)
#elif defined(WIN32) && !defined(__GNUC__)
#define LL_MAXINT 9223372036854775807i64
#define LL_MININT (-LL_MAXINT - 1i64)
--- a/nsprpub/pr/include/prtypes.h
+++ b/nsprpub/pr/include/prtypes.h
@@ -349,16 +349,17 @@ typedef long PRInt32;
** DESCRIPTION:
** The int64 types are known to be 64 bits each. Care must be used when
** declaring variables of type PRUint64 or PRInt64. Different hardware
** architectures and even different compilers have varying support for
** 64 bit values. The only guaranteed portability requires the use of
** the LL_ macros (see prlong.h).
************************************************************************/
#ifdef HAVE_LONG_LONG
+/* Keep this in sync with prlong.h. */
/*
* On 64-bit Mac OS X, uint64 needs to be defined as unsigned long long to
* match uint64_t, otherwise our uint64 typedef conflicts with the uint64
* typedef in cssmconfig.h, which CoreServices.h includes indirectly.
*/
#if PR_BYTES_PER_LONG == 8 && !defined(__APPLE__)
typedef long PRInt64;
typedef unsigned long PRUint64;
--- a/nsprpub/pr/src/md/unix/unix.c
+++ b/nsprpub/pr/src/md/unix/unix.c
@@ -2644,17 +2644,17 @@ PRInt32 _MD_getopenfileinfo64(const PRFi
PRInt32 rv = _md_iovector._fstat64(fd->secret->md.osfd, &sb);
if (rv < 0)
_PR_MD_MAP_FSTAT_ERROR(_MD_ERRNO());
else if (NULL != info)
rv = _MD_convert_stat64_to_fileinfo64(&sb, info);
return rv;
}
-struct _MD_IOVector _md_iovector = { open };
+struct _MD_IOVector _md_iovector;
/*
** These implementations are to emulate large file routines on systems that
** don't have them. Their goal is to check in case overflow occurs. Otherwise
** they will just operate as normal using 32-bit file routines.
**
** The checking might be pre- or post-op, depending on the semantics.
*/
--- a/nsprpub/pr/src/md/unix/uxproces.c
+++ b/nsprpub/pr/src/md/unix/uxproces.c
@@ -276,17 +276,17 @@ ForkAndExec(
}
}
}
}
#endif /* VMS */
#ifdef AIX
process->md.pid = (*pr_wp.forkptr)();
-#elif defined(NTO)
+#elif defined(NTO) || defined(SYMBIAN)
/*
* fork() & exec() does not work in a multithreaded process.
* Use spawn() instead.
*/
{
int fd_map[3] = { 0, 1, 2 };
if (attr) {
@@ -307,17 +307,22 @@ ForkAndExec(
flags = fcntl(fd_map[2], F_GETFL, 0);
if (flags & O_NONBLOCK)
fcntl(fd_map[2], F_SETFL, flags & ~O_NONBLOCK);
}
PR_ASSERT(attr->currentDirectory == NULL); /* not implemented */
}
+#ifdef SYMBIAN
+ /* In Symbian OS, we use posix_spawn instead of fork() and exec() */
+ posix_spawn(&(process->md.pid), path, NULL, NULL, argv, childEnvp);
+#else
process->md.pid = spawn(path, 3, fd_map, NULL, argv, childEnvp);
+#endif
if (fd_map[0] != 0)
close(fd_map[0]);
if (fd_map[1] != 1)
close(fd_map[1]);
if (fd_map[2] != 2)
close(fd_map[2]);
}
@@ -334,17 +339,17 @@ ForkAndExec(
} else if (0 == process->md.pid) { /* the child process */
/*
* If the child process needs to exit, it must call _exit().
* Do not call exit(), because exit() will flush and close
* the standard I/O file descriptors, and hence corrupt
* the parent process's standard I/O data structures.
*/
-#if !defined(NTO)
+#if !defined(NTO) && !defined(SYMBIAN)
#ifdef VMS
/* OpenVMS has already handled all this above */
#else
if (attr) {
/* the osfd's to redirect stdin, stdout, and stderr to */
int in_osfd = -1, out_osfd = -1, err_osfd = -1;
if (attr->stdinFd
@@ -975,16 +980,21 @@ done:
return retVal;
} /* _MD_WaitUnixProcess */
PRStatus _MD_KillUnixProcess(PRProcess *process)
{
PRErrorCode prerror;
PRInt32 oserror;
+#ifdef SYMBIAN
+ /* In Symbian OS, we can not kill other process with Open C */
+ PR_SetError(PR_OPERATION_NOT_SUPPORTED_ERROR, oserror);
+ return PR_FAILURE;
+#else
if (kill(process->md.pid, SIGKILL) == 0) {
return PR_SUCCESS;
}
oserror = errno;
switch (oserror) {
case EPERM:
prerror = PR_NO_ACCESS_RIGHTS_ERROR;
break;
@@ -992,9 +1002,10 @@ PRStatus _MD_KillUnixProcess(PRProcess *
prerror = PR_INVALID_ARGUMENT_ERROR;
break;
default:
prerror = PR_UNKNOWN_ERROR;
break;
}
PR_SetError(prerror, oserror);
return PR_FAILURE;
+#endif
} /* _MD_KillUnixProcess */
--- a/nsprpub/pr/src/md/unix/uxshm.c
+++ b/nsprpub/pr/src/md/unix/uxshm.c
@@ -258,17 +258,22 @@ extern PRStatus _MD_DeleteSharedMemory(
if ( -1 == key )
{
rc = PR_FAILURE;
_PR_MD_MAP_DEFAULT_ERROR( errno );
PR_LOG( _pr_shm_lm, PR_LOG_DEBUG,
("_MD_DeleteSharedMemory(): ftok() failed on name: %s", ipcname));
}
+#ifdef SYMBIAN
+ /* In Symbian OS the system imposed minimum is 1 byte, instead of ZERO */
+ id = shmget( key, 1, 0 );
+#else
id = shmget( key, 0, 0 );
+#endif
if ( -1 == id ) {
_PR_MD_MAP_DEFAULT_ERROR( errno );
PR_LOG( _pr_shm_lm, PR_LOG_DEBUG,
("_MD_DeleteSharedMemory(): shmget() failed, errno: %d", errno));
return(PR_FAILURE);
}
urc = shmctl( id, IPC_RMID, NULL );
@@ -510,17 +515,22 @@ extern PRFileMap* _md_OpenAnonFileMap(
PRInt64 size64; /* 64-bit version of 'size' */
/*
** generate a filename from input and runtime environment
** open the file, unlink the file.
** make maxTries number of attempts at uniqueness in the filename
*/
for ( incr = 0; incr < maxTries ; incr++ ) {
- genName = PR_smprintf( "%s/.NSPR-AFM-%d-%p.%d",
+#if defined(SYMBIAN)
+#define NSPR_AFM_FILENAME "%s\\NSPR-AFM-%d-%p.%d"
+#else
+#define NSPR_AFM_FILENAME "%s/.NSPR-AFM-%d-%p.%d"
+#endif
+ genName = PR_smprintf( NSPR_AFM_FILENAME,
dirName, (int) pid, tid, incr );
if ( NULL == genName ) {
PR_LOG( _pr_shma_lm, PR_LOG_DEBUG,
("_md_OpenAnonFileMap(): PR_snprintf(): failed, generating filename"));
goto Finished;
}
/* create the file */
@@ -544,17 +554,23 @@ extern PRFileMap* _md_OpenAnonFileMap(
if ( incr == maxTries ) {
PR_ASSERT( -1 == osfd );
PR_ASSERT( EEXIST == errno );
_PR_MD_MAP_OPEN_ERROR( errno );
goto Finished;
}
urc = unlink( genName );
+#if defined(SYMBIAN) && defined(__WINS__)
+ /* If it is being used by the system or another process, Symbian OS
+ * Emulator(WINS) considers this an error. */
+ if ( -1 == urc && EACCES != errno ) {
+#else
if ( -1 == urc ) {
+#endif
_PR_MD_MAP_UNLINK_ERROR( errno );
PR_LOG( _pr_shma_lm, PR_LOG_DEBUG,
("_md_OpenAnonFileMap(): failed on unlink(), errno: %d", errno));
PR_smprintf_free( genName );
close( osfd );
goto Finished;
}
PR_LOG( _pr_shma_lm, PR_LOG_DEBUG,
--- a/nsprpub/pr/src/misc/prnetdb.c
+++ b/nsprpub/pr/src/misc/prnetdb.c
@@ -591,16 +591,35 @@ static PRStatus CopyHostent(
} else {
memcpy(to->h_addr_list[na], *ap, to->h_length);
}
}
to->h_addr_list[na] = 0;
return PR_SUCCESS;
}
+#ifdef SYMBIAN
+/* Set p_aliases by hand because Symbian's getprotobyname() returns NULL. */
+static void AssignAliases(struct protoent *Protoent, char** aliases)
+{
+ if (NULL == Protoent->p_aliases) {
+ if (0 == strcmp(Protoent->p_name, "ip"))
+ aliases[0] = "IP";
+ else if (0 == strcmp(Protoent->p_name, "tcp"))
+ aliases[0] = "TCP";
+ else if (0 == strcmp(Protoent->p_name, "udp"))
+ aliases[0] = "UDP";
+ else
+ aliases[0] = "UNKNOWN";
+ aliases[1] = NULL;
+ Protoent->p_aliases = aliases;
+ }
+}
+#endif
+
#if !defined(_PR_HAVE_GETPROTO_R)
/*
** Copy a protoent, and all of the memory that it refers to into
** (hopefully) stacked buffers.
*/
static PRStatus CopyProtoent(
struct protoent *from, char *buf, PRIntn bufsize, PRProtoEnt *to)
{
@@ -1248,16 +1267,20 @@ PR_IMPLEMENT(PRStatus) PR_GetProtoByName
staticBuf = getprotobyname_r(name);
if (NULL == staticBuf)
{
rv = PR_FAILURE;
PR_SetError(PR_DIRECTORY_LOOKUP_ERROR, _MD_ERRNO());
}
else
{
+#if defined(SYMBIAN)
+ char* aliases[2];
+ AssignAliases(staticBuf, aliases);
+#endif
rv = CopyProtoent(staticBuf, buffer, buflen, result);
if (PR_FAILURE == rv)
PR_SetError(PR_INSUFFICIENT_RESOURCES_ERROR, 0);
}
PR_Unlock(_getproto_lock);
}
#endif /* all that */
return rv;
@@ -1328,16 +1351,20 @@ PR_IMPLEMENT(PRStatus) PR_GetProtoByNumb
staticBuf = getprotobynumber_r(number);
if (NULL == staticBuf)
{
rv = PR_FAILURE;
PR_SetError(PR_DIRECTORY_LOOKUP_ERROR, _MD_ERRNO());
}
else
{
+#if defined(SYMBIAN)
+ char* aliases[2];
+ AssignAliases(staticBuf, aliases);
+#endif
rv = CopyProtoent(staticBuf, buffer, buflen, result);
if (PR_FAILURE == rv)
PR_SetError(PR_INSUFFICIENT_RESOURCES_ERROR, 0);
}
PR_Unlock(_getproto_lock);
}
#endif /* all that crap */
return rv;
--- a/nsprpub/pr/src/pthreads/ptio.c
+++ b/nsprpub/pr/src/pthreads/ptio.c
@@ -2092,31 +2092,31 @@ static PRInt32 pt_RecvFrom(PRFileDesc *f
op.arg4.flags = flags;
op.arg5.addr = addr;
op.timeout = timeout;
op.function = pt_recvfrom_cont;
op.event = POLLIN | POLLPRI;
bytes = pt_Continue(&op);
syserrno = op.syserrno;
}
-#ifdef _PR_HAVE_SOCKADDR_LEN
if (bytes >= 0)
{
+#ifdef _PR_HAVE_SOCKADDR_LEN
/* ignore the sa_len field of struct sockaddr */
if (addr)
{
addr->raw.family = ((struct sockaddr*)addr)->sa_family;
}
- }
#endif /* _PR_HAVE_SOCKADDR_LEN */
#ifdef _PR_INET6
- if (addr && (AF_INET6 == addr->raw.family))
- addr->raw.family = PR_AF_INET6;
+ if (addr && (AF_INET6 == addr->raw.family))
+ addr->raw.family = PR_AF_INET6;
#endif
- if (bytes < 0)
+ }
+ else
pt_MapError(_PR_MD_MAP_RECVFROM_ERROR, syserrno);
return bytes;
} /* pt_RecvFrom */
#ifdef AIX
#ifndef HAVE_SEND_FILE
static pthread_once_t pt_aix_sendfile_once_block = PTHREAD_ONCE_INIT;
--- a/nsprpub/pr/src/pthreads/ptthread.c
+++ b/nsprpub/pr/src/pthreads/ptthread.c
@@ -1154,16 +1154,17 @@ static void null_signal_handler(PRIntn s
/*
* Linux pthreads use SIGUSR1 and SIGUSR2 internally, which
* conflict with the use of these two signals in our GC support.
* So we don't know how to support GC on Linux pthreads.
*/
static void init_pthread_gc_support(void)
{
+#ifndef SYMBIAN
PRIntn rv;
#if defined(_PR_DCETHREADS)
rv = sigemptyset(&javagc_vtalarm_sigmask);
PR_ASSERT(0 == rv);
rv = sigaddset(&javagc_vtalarm_sigmask, SIGVTALRM);
PR_ASSERT(0 == rv);
#else /* defined(_PR_DCETHREADS) */
@@ -1190,16 +1191,17 @@ static void init_pthread_gc_support(void
sigact_null.sa_handler = null_signal_handler;
sigact_null.sa_flags = SA_RESTART;
sigemptyset (&sigact_null.sa_mask);
rv = sigaction (SIGUSR1, &sigact_null, NULL);
PR_ASSERT(0 ==rv);
}
#endif /* defined(PT_NO_SIGTIMEDWAIT) */
#endif /* defined(_PR_DCETHREADS) */
+#endif /* SYMBIAN */
}
PR_IMPLEMENT(void) PR_SetThreadGCAble(void)
{
PR_Lock(pt_book.ml);
PR_GetCurrentThread()->state |= PT_THREAD_GCABLE;
PR_Unlock(pt_book.ml);
}
@@ -1341,17 +1343,18 @@ static void suspend_signal_handler(PRInt
* now, block current thread
*/
#if defined(PT_NO_SIGTIMEDWAIT)
pthread_cond_signal(&me->suspendResumeCV);
while (me->suspend & PT_THREAD_SUSPENDED)
{
#if !defined(FREEBSD) && !defined(NETBSD) && !defined(OPENBSD) \
&& !defined(BSDI) && !defined(VMS) && !defined(UNIXWARE) \
- && !defined(DARWIN) && !defined(RISCOS) /*XXX*/
+ && !defined(DARWIN) && !defined(RISCOS) \
+ && !defined(SYMBIAN) /*XXX*/
PRIntn rv;
sigwait(&sigwait_set, &rv);
#endif
}
me->suspend |= PT_THREAD_RESUMED;
pthread_cond_signal(&me->suspendResumeCV);
#else /* defined(PT_NO_SIGTIMEDWAIT) */
while (me->suspend & PT_THREAD_SUSPENDED)
@@ -1387,16 +1390,19 @@ static void pt_SuspendSet(PRThread *thre
PR_ASSERT((thred->suspend & PT_THREAD_SUSPENDED) == 0);
PR_LOG(_pr_gc_lm, PR_LOG_ALWAYS,
("doing pthread_kill in pt_SuspendSet thred %p tid = %X\n",
thred, thred->id));
#if defined(VMS)
rv = thread_suspend(thred);
+#elif defined(SYMBIAN)
+ /* All signal group functions are not implemented in Symbian OS */
+ rv = 0;
#else
rv = pthread_kill (thred->id, SIGUSR2);
#endif
PR_ASSERT(0 == rv);
}
static void pt_SuspendTest(PRThread *thred)
{
@@ -1443,16 +1449,18 @@ static void pt_ResumeSet(PRThread *thred
PR_ASSERT(thred->suspend & PT_THREAD_SUSPENDED);
thred->suspend &= ~PT_THREAD_SUSPENDED;
#if defined(PT_NO_SIGTIMEDWAIT)
#if defined(VMS)
thread_resume(thred);
+#elif defined(SYMBIAN)
+ /* All signal group functions are not implemented in Symbian OS */
#else
pthread_kill(thred->id, SIGUSR1);
#endif
#endif
} /* pt_ResumeSet */
static void pt_ResumeTest(PRThread *thred)