aboutsummaryrefslogtreecommitdiff
path: root/libjava/classpath/native/jni/java-lang
diff options
context:
space:
mode:
authorMark Wielaard <mark@gcc.gnu.org>2006-05-18 17:29:21 +0000
committerMark Wielaard <mark@gcc.gnu.org>2006-05-18 17:29:21 +0000
commit4f9533c7722fa07511a94d005227961f4a4dec23 (patch)
tree9f9c470de62ee62fba1331a396450d728d2b1fad /libjava/classpath/native/jni/java-lang
parenteaec4980e139903ae9b274d1abcf3a13946603a8 (diff)
downloadgcc-4f9533c7722fa07511a94d005227961f4a4dec23.zip
gcc-4f9533c7722fa07511a94d005227961f4a4dec23.tar.gz
gcc-4f9533c7722fa07511a94d005227961f4a4dec23.tar.bz2
Imported GNU Classpath 0.90
Imported GNU Classpath 0.90 * scripts/makemake.tcl: LocaleData.java moved to gnu/java/locale. * sources.am: Regenerated. * gcj/javaprims.h: Regenerated. * Makefile.in: Regenerated. * gcj/Makefile.in: Regenerated. * include/Makefile.in: Regenerated. * testsuite/Makefile.in: Regenerated. * gnu/java/lang/VMInstrumentationImpl.java: New override. * gnu/java/net/local/LocalSocketImpl.java: Likewise. * gnu/classpath/jdwp/VMMethod.java: Likewise. * gnu/classpath/jdwp/VMVirtualMachine.java: Update to latest interface. * java/lang/Thread.java: Add UncaughtExceptionHandler. * java/lang/reflect/Method.java: Implements GenericDeclaration and isSynthetic(), * java/lang/reflect/Field.java: Likewise. * java/lang/reflect/Constructor.java * java/lang/Class.java: Implements Type, GenericDeclaration, getSimpleName() and getEnclosing*() methods. * java/lang/Class.h: Add new public methods. * java/lang/Math.java: Add signum(), ulp() and log10(). * java/lang/natMath.cc (log10): New function. * java/security/VMSecureRandom.java: New override. * java/util/logging/Logger.java: Updated to latest classpath version. * java/util/logging/LogManager.java: New override. From-SVN: r113887
Diffstat (limited to 'libjava/classpath/native/jni/java-lang')
-rw-r--r--libjava/classpath/native/jni/java-lang/Makefile.am4
-rw-r--r--libjava/classpath/native/jni/java-lang/Makefile.in77
-rw-r--r--libjava/classpath/native/jni/java-lang/java_lang_VMProcess.c47
-rw-r--r--libjava/classpath/native/jni/java-lang/java_lang_VMSystem.c32
-rw-r--r--libjava/classpath/native/jni/java-lang/java_lang_reflect_VMArray.c (renamed from libjava/classpath/native/jni/java-lang/java_lang_reflect_Array.c)4
5 files changed, 108 insertions, 56 deletions
diff --git a/libjava/classpath/native/jni/java-lang/Makefile.am b/libjava/classpath/native/jni/java-lang/Makefile.am
index db8a3a6a..06deb62 100644
--- a/libjava/classpath/native/jni/java-lang/Makefile.am
+++ b/libjava/classpath/native/jni/java-lang/Makefile.am
@@ -1,4 +1,4 @@
-nativelib_LTLIBRARIES = libjavalang.la libjavalangreflect.la
+nativeexeclib_LTLIBRARIES = libjavalang.la libjavalangreflect.la
libjavalang_la_SOURCES = java_lang_VMSystem.c \
java_lang_VMFloat.c \
@@ -9,7 +9,7 @@ libjavalang_la_SOURCES = java_lang_VMSystem.c \
libjavalang_la_LIBADD = $(wildcard $(top_builddir)/native/fdlibm/*.lo) \
$(top_builddir)/native/jni/classpath/jcl.lo
-libjavalangreflect_la_SOURCES = java_lang_reflect_Array.c
+libjavalangreflect_la_SOURCES = java_lang_reflect_VMArray.c
AM_LDFLAGS = @CLASSPATH_MODULE@
AM_CPPFLAGS = @CLASSPATH_INCLUDES@ -I$(top_srcdir)/native/fdlibm
diff --git a/libjava/classpath/native/jni/java-lang/Makefile.in b/libjava/classpath/native/jni/java-lang/Makefile.in
index bc26561..af83f9a 100644
--- a/libjava/classpath/native/jni/java-lang/Makefile.in
+++ b/libjava/classpath/native/jni/java-lang/Makefile.in
@@ -60,9 +60,9 @@ am__vpath_adj = case $$p in \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
-am__installdirs = "$(DESTDIR)$(nativelibdir)"
-nativelibLTLIBRARIES_INSTALL = $(INSTALL)
-LTLIBRARIES = $(nativelib_LTLIBRARIES)
+am__installdirs = "$(DESTDIR)$(nativeexeclibdir)"
+nativeexeclibLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(nativeexeclib_LTLIBRARIES)
libjavalang_la_DEPENDENCIES = $(wildcard \
$(top_builddir)/native/fdlibm/*.lo) \
$(top_builddir)/native/jni/classpath/jcl.lo
@@ -71,7 +71,7 @@ am_libjavalang_la_OBJECTS = java_lang_VMSystem.lo java_lang_VMFloat.lo \
java_lang_VMProcess.lo
libjavalang_la_OBJECTS = $(am_libjavalang_la_OBJECTS)
libjavalangreflect_la_LIBADD =
-am_libjavalangreflect_la_OBJECTS = java_lang_reflect_Array.lo
+am_libjavalangreflect_la_OBJECTS = java_lang_reflect_VMArray.lo
libjavalangreflect_la_OBJECTS = $(am_libjavalangreflect_la_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
depcomp = $(SHELL) $(top_srcdir)/depcomp
@@ -105,6 +105,7 @@ CAIRO_LIBS = @CAIRO_LIBS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
+CLASSPATH_CONVENIENCE = @CLASSPATH_CONVENIENCE@
CLASSPATH_INCLUDES = @CLASSPATH_INCLUDES@
CLASSPATH_MODULE = @CLASSPATH_MODULE@
COLLECTIONS_PREFIX = @COLLECTIONS_PREFIX@
@@ -144,6 +145,8 @@ ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
ECJ = @ECJ@
EGREP = @EGREP@
+ENABLE_LOCAL_SOCKETS_FALSE = @ENABLE_LOCAL_SOCKETS_FALSE@
+ENABLE_LOCAL_SOCKETS_TRUE = @ENABLE_LOCAL_SOCKETS_TRUE@
ERROR_CFLAGS = @ERROR_CFLAGS@
EXAMPLESDIR = @EXAMPLESDIR@
EXEEXT = @EXEEXT@
@@ -164,6 +167,7 @@ FREETYPE2_LIBS = @FREETYPE2_LIBS@
GCJ = @GCJ@
GCJX = @GCJX@
GJDOC = @GJDOC@
+GREP = @GREP@
GTK_CAIRO_ENABLED = @GTK_CAIRO_ENABLED@
GTK_CAIRO_FALSE = @GTK_CAIRO_FALSE@
GTK_CAIRO_TRUE = @GTK_CAIRO_TRUE@
@@ -211,6 +215,7 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
PANGOFT2_LIBS = @PANGOFT2_LIBS@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PATH_TO_GLIBJ_ZIP = @PATH_TO_GLIBJ_ZIP@
PERL = @PERL@
PKG_CONFIG = @PKG_CONFIG@
QT_CFLAGS = @QT_CFLAGS@
@@ -229,8 +234,11 @@ USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@
USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@
USER_SPECIFIED_JAVAH_FALSE = @USER_SPECIFIED_JAVAH_FALSE@
USER_SPECIFIED_JAVAH_TRUE = @USER_SPECIFIED_JAVAH_TRUE@
+USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@
+USE_PREBUILT_GLIBJ_ZIP_TRUE = @USE_PREBUILT_GLIBJ_ZIP_TRUE@
VERSION = @VERSION@
WARNING_CFLAGS = @WARNING_CFLAGS@
+XMKMF = @XMKMF@
XML_CFLAGS = @XML_CFLAGS@
XML_LIBS = @XML_LIBS@
XSLT_CFLAGS = @XSLT_CFLAGS@
@@ -242,8 +250,6 @@ X_PRE_LIBS = @X_PRE_LIBS@
ZIP = @ZIP@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
-ac_ct_RANLIB = @ac_ct_RANLIB@
-ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
@@ -260,7 +266,10 @@ build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
+datarootdir = @datarootdir@
default_toolkit = @default_toolkit@
+docdir = @docdir@
+dvidir = @dvidir@
exec_prefix = @exec_prefix@
glibjdir = @glibjdir@
host = @host@
@@ -268,18 +277,22 @@ host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
+htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
+localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
-nativelibdir = @nativelibdir@
+nativeexeclibdir = @nativeexeclibdir@
oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
+psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
@@ -289,7 +302,7 @@ target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
vm_classes = @vm_classes@
-nativelib_LTLIBRARIES = libjavalang.la libjavalangreflect.la
+nativeexeclib_LTLIBRARIES = libjavalang.la libjavalangreflect.la
libjavalang_la_SOURCES = java_lang_VMSystem.c \
java_lang_VMFloat.c \
java_lang_VMDouble.c \
@@ -299,7 +312,7 @@ libjavalang_la_SOURCES = java_lang_VMSystem.c \
libjavalang_la_LIBADD = $(wildcard $(top_builddir)/native/fdlibm/*.lo) \
$(top_builddir)/native/jni/classpath/jcl.lo
-libjavalangreflect_la_SOURCES = java_lang_reflect_Array.c
+libjavalangreflect_la_SOURCES = java_lang_reflect_VMArray.c
AM_LDFLAGS = @CLASSPATH_MODULE@
AM_CPPFLAGS = @CLASSPATH_INCLUDES@ -I$(top_srcdir)/native/fdlibm
AM_CFLAGS = @WARNING_CFLAGS@ @STRICT_WARNING_CFLAGS@ @ERROR_CFLAGS@
@@ -336,37 +349,37 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-install-nativelibLTLIBRARIES: $(nativelib_LTLIBRARIES)
+install-nativeexeclibLTLIBRARIES: $(nativeexeclib_LTLIBRARIES)
@$(NORMAL_INSTALL)
- test -z "$(nativelibdir)" || $(mkdir_p) "$(DESTDIR)$(nativelibdir)"
- @list='$(nativelib_LTLIBRARIES)'; for p in $$list; do \
+ test -z "$(nativeexeclibdir)" || $(mkdir_p) "$(DESTDIR)$(nativeexeclibdir)"
+ @list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
f=$(am__strip_dir) \
- echo " $(LIBTOOL) --mode=install $(nativelibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(nativelibdir)/$$f'"; \
- $(LIBTOOL) --mode=install $(nativelibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(nativelibdir)/$$f"; \
+ echo " $(LIBTOOL) --mode=install $(nativeexeclibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(nativeexeclibdir)/$$f'"; \
+ $(LIBTOOL) --mode=install $(nativeexeclibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(nativeexeclibdir)/$$f"; \
else :; fi; \
done
-uninstall-nativelibLTLIBRARIES:
+uninstall-nativeexeclibLTLIBRARIES:
@$(NORMAL_UNINSTALL)
- @set -x; list='$(nativelib_LTLIBRARIES)'; for p in $$list; do \
+ @set -x; list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \
p=$(am__strip_dir) \
- echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(nativelibdir)/$$p'"; \
- $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(nativelibdir)/$$p"; \
+ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(nativeexeclibdir)/$$p'"; \
+ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(nativeexeclibdir)/$$p"; \
done
-clean-nativelibLTLIBRARIES:
- -test -z "$(nativelib_LTLIBRARIES)" || rm -f $(nativelib_LTLIBRARIES)
- @list='$(nativelib_LTLIBRARIES)'; for p in $$list; do \
+clean-nativeexeclibLTLIBRARIES:
+ -test -z "$(nativeexeclib_LTLIBRARIES)" || rm -f $(nativeexeclib_LTLIBRARIES)
+ @list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
libjavalang.la: $(libjavalang_la_OBJECTS) $(libjavalang_la_DEPENDENCIES)
- $(LINK) -rpath $(nativelibdir) $(libjavalang_la_LDFLAGS) $(libjavalang_la_OBJECTS) $(libjavalang_la_LIBADD) $(LIBS)
+ $(LINK) -rpath $(nativeexeclibdir) $(libjavalang_la_LDFLAGS) $(libjavalang_la_OBJECTS) $(libjavalang_la_LIBADD) $(LIBS)
libjavalangreflect.la: $(libjavalangreflect_la_OBJECTS) $(libjavalangreflect_la_DEPENDENCIES)
- $(LINK) -rpath $(nativelibdir) $(libjavalangreflect_la_LDFLAGS) $(libjavalangreflect_la_OBJECTS) $(libjavalangreflect_la_LIBADD) $(LIBS)
+ $(LINK) -rpath $(nativeexeclibdir) $(libjavalangreflect_la_LDFLAGS) $(libjavalangreflect_la_OBJECTS) $(libjavalangreflect_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -379,7 +392,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/java_lang_VMMath.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/java_lang_VMProcess.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/java_lang_VMSystem.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/java_lang_reflect_Array.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/java_lang_reflect_VMArray.Plo@am__quote@
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@@ -491,7 +504,7 @@ check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES)
installdirs:
- for dir in "$(DESTDIR)$(nativelibdir)"; do \
+ for dir in "$(DESTDIR)$(nativeexeclibdir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
@@ -520,7 +533,7 @@ maintainer-clean-generic:
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
-clean-am: clean-generic clean-libtool clean-nativelibLTLIBRARIES \
+clean-am: clean-generic clean-libtool clean-nativeexeclibLTLIBRARIES \
mostlyclean-am
distclean: distclean-am
@@ -539,9 +552,9 @@ info: info-am
info-am:
-install-data-am: install-nativelibLTLIBRARIES
+install-data-am:
-install-exec-am:
+install-exec-am: install-nativeexeclibLTLIBRARIES
install-info: install-info-am
@@ -567,20 +580,20 @@ ps: ps-am
ps-am:
-uninstall-am: uninstall-info-am uninstall-nativelibLTLIBRARIES
+uninstall-am: uninstall-info-am uninstall-nativeexeclibLTLIBRARIES
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
- clean-libtool clean-nativelibLTLIBRARIES ctags distclean \
+ clean-libtool clean-nativeexeclibLTLIBRARIES ctags distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-exec \
install-exec-am install-info install-info-am install-man \
- install-nativelibLTLIBRARIES install-strip installcheck \
+ install-nativeexeclibLTLIBRARIES install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-info-am \
- uninstall-nativelibLTLIBRARIES
+ uninstall-nativeexeclibLTLIBRARIES
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/libjava/classpath/native/jni/java-lang/java_lang_VMProcess.c b/libjava/classpath/native/jni/java-lang/java_lang_VMProcess.c
index 169c785..f13a94f 100644
--- a/libjava/classpath/native/jni/java-lang/java_lang_VMProcess.c
+++ b/libjava/classpath/native/jni/java-lang/java_lang_VMProcess.c
@@ -38,6 +38,8 @@ exception statement from your version. */
#include <config.h>
#include "java_lang_VMProcess.h"
+#include "gnu_java_nio_channels_FileChannelImpl.h"
+
#include <sys/types.h>
#include <sys/wait.h>
#include <signal.h>
@@ -48,6 +50,8 @@ exception statement from your version. */
#include <fcntl.h>
#include <stdio.h>
+#include <jcl.h>
+
#include "target_native.h"
#include "target_native_misc.h"
@@ -55,17 +59,6 @@ exception statement from your version. */
static char *copy_string (JNIEnv * env, jobject string);
static char *copy_elem (JNIEnv * env, jobject stringArray, jint i);
-/* Some O/S's don't declare 'environ' */
-#if HAVE_CRT_EXTERNS_H
-/* Darwin does not have a variable named environ
- but has a function which you can get the environ
- variable with. */
-#include <crt_externs.h>
-#define environ (*_NSGetEnviron())
-#else
-extern char **environ;
-#endif /* HAVE_CRT_EXTERNS_H */
-
/*
* Internal helper function to copy a String in UTF-8 format.
*/
@@ -135,7 +128,8 @@ copy_elem (JNIEnv * env, jobject stringArray, jint i)
JNIEXPORT void JNICALL
Java_java_lang_VMProcess_nativeSpawn (JNIEnv * env, jobject this,
jobjectArray cmdArray,
- jobjectArray envArray, jobject dirFile)
+ jobjectArray envArray, jobject dirFile,
+ jboolean redirect)
{
int fds[3][2] = { {-1, -1}, {-1, -1}, {-1, -1} };
jobject streams[3] = { NULL, NULL, NULL };
@@ -151,6 +145,7 @@ Java_java_lang_VMProcess_nativeSpawn (JNIEnv * env, jobject this,
jmethodID method;
jclass clazz;
int i;
+ int pipe_count = redirect ? 2 : 3;
/* Check for null */
if (cmdArray == NULL)
@@ -218,7 +213,7 @@ Java_java_lang_VMProcess_nativeSpawn (JNIEnv * env, jobject this,
}
/* Create inter-process pipes */
- for (i = 0; i < 3; i++)
+ for (i = 0; i < pipe_count; i++)
{
if (pipe (fds[i]) == -1)
{
@@ -232,7 +227,8 @@ Java_java_lang_VMProcess_nativeSpawn (JNIEnv * env, jobject this,
/* Set close-on-exec flag for parent's ends of pipes */
(void) fcntl (fds[0][1], F_SETFD, 1);
(void) fcntl (fds[1][0], F_SETFD, 1);
- (void) fcntl (fds[2][0], F_SETFD, 1);
+ if (pipe_count == 3)
+ (void) fcntl (fds[2][0], F_SETFD, 1);
/* Fork into parent and child processes */
if ((pid = fork ()) == (pid_t) - 1)
@@ -267,7 +263,16 @@ Java_java_lang_VMProcess_nativeSpawn (JNIEnv * env, jobject this,
}
close (fds[1][1]);
}
- if (fds[2][1] != 2)
+ if (pipe_count == 2)
+ {
+ /* Duplicate stdout to stderr. */
+ if (dup2 (1, 2) == -1)
+ {
+ fprintf (stderr, "dup2: %s", strerror (errno));
+ exit (127);
+ }
+ }
+ else if (fds[2][1] != 2)
{
if (dup2 (fds[2][1], 2) == -1)
{
@@ -308,11 +313,13 @@ Java_java_lang_VMProcess_nativeSpawn (JNIEnv * env, jobject this,
method = (*env)->GetMethodID (env, clazz, "<init>", "(II)V");
if ((*env)->ExceptionOccurred (env))
goto done;
- for (i = 0; i < 3; i++)
+ for (i = 0; i < pipe_count; i++)
{
/* Mode is WRITE (2) for in and READ (1) for out and err. */
const int fd = fds[i][i == 0];
- const int mode = (i == 0) ? 2 : 1;
+ const int mode = ((i == 0)
+ ? gnu_java_nio_channels_FileChannelImpl_WRITE
+ : gnu_java_nio_channels_FileChannelImpl_READ);
jclass sclazz;
jmethodID smethod;
@@ -320,7 +327,7 @@ Java_java_lang_VMProcess_nativeSpawn (JNIEnv * env, jobject this,
if ((*env)->ExceptionOccurred (env))
goto done;
- if (mode == 2)
+ if (mode == gnu_java_nio_channels_FileChannelImpl_WRITE)
sclazz = (*env)->FindClass (env, "java/io/FileOutputStream");
else
sclazz = (*env)->FindClass (env, "java/io/FileInputStream");
@@ -359,7 +366,7 @@ done:
*/
/* Close child's ends of pipes */
- for (i = 0; i < 3; i++)
+ for (i = 0; i < pipe_count; i++)
{
const int fd = fds[i][i != 0];
@@ -373,7 +380,7 @@ done:
* was created for a file descriptor, we don't close it because it
* will get closed when the Stream object is finalized.
*/
- for (i = 0; i < 3; i++)
+ for (i = 0; i < pipe_count; i++)
{
const int fd = fds[i][i == 0];
diff --git a/libjava/classpath/native/jni/java-lang/java_lang_VMSystem.c b/libjava/classpath/native/jni/java-lang/java_lang_VMSystem.c
index 0edbb2e..05b0d96 100644
--- a/libjava/classpath/native/jni/java-lang/java_lang_VMSystem.c
+++ b/libjava/classpath/native/jni/java-lang/java_lang_VMSystem.c
@@ -154,3 +154,35 @@ Java_java_lang_VMSystem_getenv (JNIEnv * env,
JCL_free_cstring (env, jname, cname);
return (*env)->NewStringUTF (env, envname);
}
+
+JNIEXPORT jobject JNICALL
+Java_java_lang_VMSystem_environ (JNIEnv *env,
+ jclass klass __attribute__((__unused__)))
+{
+ char **env_pointer;
+ jobject variables;
+ jclass list_class;
+ jmethodID list_constructor;
+ jmethodID add;
+
+ list_class = (*env)->FindClass(env, "java/util/LinkedList");
+ if (list_class == NULL)
+ return NULL;
+ list_constructor = (*env)->GetMethodID(env, list_class, "<init>", "()V");
+ if (list_constructor == NULL)
+ return NULL;
+ variables = (*env)->NewObject(env, list_class, list_constructor);
+ if (variables == NULL)
+ return NULL;
+ add = (*env)->GetMethodID(env, list_class, "add", "(Ljava/lang/Object;)Z");
+ if (add == NULL)
+ return NULL;
+ env_pointer = environ;
+ while (*env_pointer != NULL)
+ {
+ jstring string = (*env)->NewStringUTF(env, *env_pointer);
+ (*env)->CallBooleanMethod(env, variables, add, string);
+ ++env_pointer;
+ }
+ return variables;
+}
diff --git a/libjava/classpath/native/jni/java-lang/java_lang_reflect_Array.c b/libjava/classpath/native/jni/java-lang/java_lang_reflect_VMArray.c
index 64ad202..2db68eb 100644
--- a/libjava/classpath/native/jni/java-lang/java_lang_reflect_Array.c
+++ b/libjava/classpath/native/jni/java-lang/java_lang_reflect_VMArray.c
@@ -45,7 +45,7 @@ exception statement from your version. */
#include <config.h>
#include <stddef.h>
-#include "java_lang_reflect_Array.h"
+#include "java_lang_reflect_VMArray.h"
/*
* Class: java_lang_reflect_Array
@@ -53,7 +53,7 @@ exception statement from your version. */
* Signature: (Ljava/lang/Class;I)Ljava/lang/Object;
*/
JNIEXPORT jobject JNICALL
-Java_java_lang_reflect_Array_createObjectArray
+Java_java_lang_reflect_VMArray_createObjectArray
(JNIEnv * env,
jclass thisClass __attribute__ ((__unused__)),
jclass arrayType, jint arrayLength)