summaryrefslogtreecommitdiff
path: root/libjava/classpath/native/jni/java-lang
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /libjava/classpath/native/jni/java-lang
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'libjava/classpath/native/jni/java-lang')
-rw-r--r--libjava/classpath/native/jni/java-lang/.cvsignore8
-rw-r--r--libjava/classpath/native/jni/java-lang/Makefile.am20
-rw-r--r--libjava/classpath/native/jni/java-lang/Makefile.in642
-rw-r--r--libjava/classpath/native/jni/java-lang/gnu_java_lang_management_VMOperatingSystemMXBeanImpl.c65
-rw-r--r--libjava/classpath/native/jni/java-lang/java_lang_VMDouble.c455
-rw-r--r--libjava/classpath/native/jni/java-lang/java_lang_VMFloat.c71
-rw-r--r--libjava/classpath/native/jni/java-lang/java_lang_VMMath.c225
-rw-r--r--libjava/classpath/native/jni/java-lang/java_lang_VMProcess.c409
-rw-r--r--libjava/classpath/native/jni/java-lang/java_lang_VMSystem.c189
-rw-r--r--libjava/classpath/native/jni/java-lang/java_lang_reflect_VMArray.c62
10 files changed, 2146 insertions, 0 deletions
diff --git a/libjava/classpath/native/jni/java-lang/.cvsignore b/libjava/classpath/native/jni/java-lang/.cvsignore
new file mode 100644
index 000000000..e9f2658a6
--- /dev/null
+++ b/libjava/classpath/native/jni/java-lang/.cvsignore
@@ -0,0 +1,8 @@
+*.o
+*.a
+*.lo
+*.la
+.libs
+.deps
+Makefile
+Makefile.in
diff --git a/libjava/classpath/native/jni/java-lang/Makefile.am b/libjava/classpath/native/jni/java-lang/Makefile.am
new file mode 100644
index 000000000..e1bc7ce71
--- /dev/null
+++ b/libjava/classpath/native/jni/java-lang/Makefile.am
@@ -0,0 +1,20 @@
+nativeexeclib_LTLIBRARIES = libjavalang.la libjavalangreflect.la libjavalangmanagement.la
+
+libjavalang_la_SOURCES = java_lang_VMSystem.c \
+ java_lang_VMFloat.c \
+ java_lang_VMDouble.c \
+ java_lang_VMMath.c \
+ java_lang_VMProcess.c
+
+libjavalang_la_LIBADD = $(top_builddir)/native/fdlibm/libfdlibm.la \
+ $(top_builddir)/native/jni/classpath/jcl.lo \
+ $(top_builddir)/native/jni/native-lib/libclasspathnative.la
+
+libjavalangreflect_la_SOURCES = java_lang_reflect_VMArray.c
+
+libjavalangmanagement_la_SOURCES = gnu_java_lang_management_VMOperatingSystemMXBeanImpl.c
+
+AM_LDFLAGS = @CLASSPATH_MODULE@
+AM_CPPFLAGS = @CLASSPATH_INCLUDES@ -I$(top_srcdir)/native/fdlibm
+AM_CFLAGS = @WARNING_CFLAGS@ @STRICT_WARNING_CFLAGS@ @ERROR_CFLAGS@ \
+ @EXTRA_CFLAGS@
diff --git a/libjava/classpath/native/jni/java-lang/Makefile.in b/libjava/classpath/native/jni/java-lang/Makefile.in
new file mode 100644
index 000000000..148ba7f8c
--- /dev/null
+++ b/libjava/classpath/native/jni/java-lang/Makefile.in
@@ -0,0 +1,642 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = native/jni/java-lang
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
+ $(top_srcdir)/../../config/lead-dot.m4 \
+ $(top_srcdir)/../../config/lib-ld.m4 \
+ $(top_srcdir)/../../config/lib-link.m4 \
+ $(top_srcdir)/../../config/lib-prefix.m4 \
+ $(top_srcdir)/../../config/multi.m4 \
+ $(top_srcdir)/../../config/no-executables.m4 \
+ $(top_srcdir)/../../config/override.m4 \
+ $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/../../ltoptions.m4 \
+ $(top_srcdir)/../../ltsugar.m4 \
+ $(top_srcdir)/../../ltversion.m4 \
+ $(top_srcdir)/../../lt~obsolete.m4 \
+ $(top_srcdir)/m4/ac_prog_antlr.m4 \
+ $(top_srcdir)/m4/ac_prog_java.m4 \
+ $(top_srcdir)/m4/ac_prog_java_works.m4 \
+ $(top_srcdir)/m4/ac_prog_javac.m4 \
+ $(top_srcdir)/m4/ac_prog_javac_works.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
+ $(top_srcdir)/m4/acinclude.m4 \
+ $(top_srcdir)/m4/ax_create_stdint_h.m4 \
+ $(top_srcdir)/m4/ax_func_which_gethostbyname_r.m4 \
+ $(top_srcdir)/m4/gcc_attribute.m4 $(top_srcdir)/m4/iconv.m4 \
+ $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/../../mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__installdirs = "$(DESTDIR)$(nativeexeclibdir)"
+LTLIBRARIES = $(nativeexeclib_LTLIBRARIES)
+libjavalang_la_DEPENDENCIES = \
+ $(top_builddir)/native/fdlibm/libfdlibm.la \
+ $(top_builddir)/native/jni/classpath/jcl.lo \
+ $(top_builddir)/native/jni/native-lib/libclasspathnative.la
+am_libjavalang_la_OBJECTS = java_lang_VMSystem.lo java_lang_VMFloat.lo \
+ java_lang_VMDouble.lo java_lang_VMMath.lo \
+ java_lang_VMProcess.lo
+libjavalang_la_OBJECTS = $(am_libjavalang_la_OBJECTS)
+libjavalangmanagement_la_LIBADD =
+am_libjavalangmanagement_la_OBJECTS = \
+ gnu_java_lang_management_VMOperatingSystemMXBeanImpl.lo
+libjavalangmanagement_la_OBJECTS = \
+ $(am_libjavalangmanagement_la_OBJECTS)
+libjavalangreflect_la_LIBADD =
+am_libjavalangreflect_la_OBJECTS = java_lang_reflect_VMArray.lo
+libjavalangreflect_la_OBJECTS = $(am_libjavalangreflect_la_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/../../depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libjavalang_la_SOURCES) \
+ $(libjavalangmanagement_la_SOURCES) \
+ $(libjavalangreflect_la_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+ANTLR = @ANTLR@
+ANTLR_JAR = @ANTLR_JAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CAIRO_CFLAGS = @CAIRO_CFLAGS@
+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@
+CP = @CP@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATE = @DATE@
+DEFAULT_PREFS_PEER = @DEFAULT_PREFS_PEER@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+ECJ_JAR = @ECJ_JAR@
+EGREP = @EGREP@
+ERROR_CFLAGS = @ERROR_CFLAGS@
+EXAMPLESDIR = @EXAMPLESDIR@
+EXEEXT = @EXEEXT@
+EXTRA_CFLAGS = @EXTRA_CFLAGS@
+FGREP = @FGREP@
+FIND = @FIND@
+FREETYPE2_CFLAGS = @FREETYPE2_CFLAGS@
+FREETYPE2_LIBS = @FREETYPE2_LIBS@
+GCONF_CFLAGS = @GCONF_CFLAGS@
+GCONF_LIBS = @GCONF_LIBS@
+GDK_CFLAGS = @GDK_CFLAGS@
+GDK_LIBS = @GDK_LIBS@
+GJDOC = @GJDOC@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_LIBS = @GLIB_LIBS@
+GMP_CFLAGS = @GMP_CFLAGS@
+GMP_LIBS = @GMP_LIBS@
+GREP = @GREP@
+GSTREAMER_BASE_CFLAGS = @GSTREAMER_BASE_CFLAGS@
+GSTREAMER_BASE_LIBS = @GSTREAMER_BASE_LIBS@
+GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@
+GSTREAMER_FILE_READER = @GSTREAMER_FILE_READER@
+GSTREAMER_LIBS = @GSTREAMER_LIBS@
+GSTREAMER_MIXER_PROVIDER = @GSTREAMER_MIXER_PROVIDER@
+GSTREAMER_PLUGINS_BASE_CFLAGS = @GSTREAMER_PLUGINS_BASE_CFLAGS@
+GSTREAMER_PLUGINS_BASE_LIBS = @GSTREAMER_PLUGINS_BASE_LIBS@
+GST_PLUGIN_LDFLAGS = @GST_PLUGIN_LDFLAGS@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_LIBS = @GTK_LIBS@
+INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JAR = @JAR@
+JAVA = @JAVA@
+JAVAC = @JAVAC@
+JAVAC_IS_GCJ = @JAVAC_IS_GCJ@
+JAVAC_MEM_OPT = @JAVAC_MEM_OPT@
+JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION = @JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION@
+JAY = @JAY@
+JAY_SKELETON = @JAY_SKELETON@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBDEBUG = @LIBDEBUG@
+LIBICONV = @LIBICONV@
+LIBMAGIC = @LIBMAGIC@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBVERSION = @LIBVERSION@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MKDIR = @MKDIR@
+MKDIR_P = @MKDIR_P@
+MOC = @MOC@
+MOZILLA_CFLAGS = @MOZILLA_CFLAGS@
+MOZILLA_LIBS = @MOZILLA_LIBS@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
+PANGOFT2_LIBS = @PANGOFT2_LIBS@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PATH_TO_ESCHER = @PATH_TO_ESCHER@
+PATH_TO_GLIBJ_ZIP = @PATH_TO_GLIBJ_ZIP@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PLUGIN_DIR = @PLUGIN_DIR@
+QT_CFLAGS = @QT_CFLAGS@
+QT_LIBS = @QT_LIBS@
+RANLIB = @RANLIB@
+REMOVE = @REMOVE@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
+STRIP = @STRIP@
+TOOLSDIR = @TOOLSDIR@
+USER_JAVAH = @USER_JAVAH@
+VERSION = @VERSION@
+WANT_NATIVE_BIG_INTEGER = @WANT_NATIVE_BIG_INTEGER@
+WARNING_CFLAGS = @WARNING_CFLAGS@
+XMKMF = @XMKMF@
+XML_CFLAGS = @XML_CFLAGS@
+XML_LIBS = @XML_LIBS@
+XSLT_CFLAGS = @XSLT_CFLAGS@
+XSLT_LIBS = @XSLT_LIBS@
+XTEST_LIBS = @XTEST_LIBS@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ZIP = @ZIP@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_ANTLR = @ac_ct_ANTLR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+default_toolkit = @default_toolkit@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
+host = @host@
+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@
+multi_basedir = @multi_basedir@
+nativeexeclibdir = @nativeexeclibdir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+toolexeclibdir = @toolexeclibdir@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+uudecode = @uudecode@
+vm_classes = @vm_classes@
+nativeexeclib_LTLIBRARIES = libjavalang.la libjavalangreflect.la libjavalangmanagement.la
+libjavalang_la_SOURCES = java_lang_VMSystem.c \
+ java_lang_VMFloat.c \
+ java_lang_VMDouble.c \
+ java_lang_VMMath.c \
+ java_lang_VMProcess.c
+
+libjavalang_la_LIBADD = $(top_builddir)/native/fdlibm/libfdlibm.la \
+ $(top_builddir)/native/jni/classpath/jcl.lo \
+ $(top_builddir)/native/jni/native-lib/libclasspathnative.la
+
+libjavalangreflect_la_SOURCES = java_lang_reflect_VMArray.c
+libjavalangmanagement_la_SOURCES = gnu_java_lang_management_VMOperatingSystemMXBeanImpl.c
+AM_LDFLAGS = @CLASSPATH_MODULE@
+AM_CPPFLAGS = @CLASSPATH_INCLUDES@ -I$(top_srcdir)/native/fdlibm
+AM_CFLAGS = @WARNING_CFLAGS@ @STRICT_WARNING_CFLAGS@ @ERROR_CFLAGS@ \
+ @EXTRA_CFLAGS@
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu native/jni/java-lang/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu native/jni/java-lang/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(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
+$(am__aclocal_m4_deps):
+install-nativeexeclibLTLIBRARIES: $(nativeexeclib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(nativeexeclibdir)" || $(MKDIR_P) "$(DESTDIR)$(nativeexeclibdir)"
+ @list='$(nativeexeclib_LTLIBRARIES)'; test -n "$(nativeexeclibdir)" || list=; \
+ list2=; for p in $$list; do \
+ if test -f $$p; then \
+ list2="$$list2 $$p"; \
+ else :; fi; \
+ done; \
+ test -z "$$list2" || { \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(nativeexeclibdir)'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(nativeexeclibdir)"; \
+ }
+
+uninstall-nativeexeclibLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(nativeexeclib_LTLIBRARIES)'; test -n "$(nativeexeclibdir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(nativeexeclibdir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(nativeexeclibdir)/$$f"; \
+ done
+
+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 $(nativeexeclibdir) $(libjavalang_la_OBJECTS) $(libjavalang_la_LIBADD) $(LIBS)
+libjavalangmanagement.la: $(libjavalangmanagement_la_OBJECTS) $(libjavalangmanagement_la_DEPENDENCIES)
+ $(LINK) -rpath $(nativeexeclibdir) $(libjavalangmanagement_la_OBJECTS) $(libjavalangmanagement_la_LIBADD) $(LIBS)
+libjavalangreflect.la: $(libjavalangreflect_la_OBJECTS) $(libjavalangreflect_la_DEPENDENCIES)
+ $(LINK) -rpath $(nativeexeclibdir) $(libjavalangreflect_la_OBJECTS) $(libjavalangreflect_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnu_java_lang_management_VMOperatingSystemMXBeanImpl.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/java_lang_VMDouble.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/java_lang_VMFloat.Plo@am__quote@
+@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_VMArray.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+ for dir in "$(DESTDIR)$(nativeexeclibdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-nativeexeclibLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-nativeexeclibLTLIBRARIES
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-nativeexeclibLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-nativeexeclibLTLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags dvi dvi-am html html-am info info-am install \
+ install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-nativeexeclibLTLIBRARIES install-pdf install-pdf-am \
+ install-ps install-ps-am 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-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.
+.NOEXPORT:
diff --git a/libjava/classpath/native/jni/java-lang/gnu_java_lang_management_VMOperatingSystemMXBeanImpl.c b/libjava/classpath/native/jni/java-lang/gnu_java_lang_management_VMOperatingSystemMXBeanImpl.c
new file mode 100644
index 000000000..d6f99ae9f
--- /dev/null
+++ b/libjava/classpath/native/jni/java-lang/gnu_java_lang_management_VMOperatingSystemMXBeanImpl.c
@@ -0,0 +1,65 @@
+/* VMOperatingSystemMXBeanImpl.c - gnu.java.lang.management native functions
+ Copyright (C) 2006
+ Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <config.h>
+
+#if defined HAVE_SYS_LOADAVG_H /* Get getloadavg() on Solaris 9 */
+#include <sys/loadavg.h>
+#else
+#include <stdlib.h>
+#endif
+
+#include "gnu_java_lang_management_VMOperatingSystemMXBeanImpl.h"
+
+/*
+ * Class: gnu_java_lang_management_VMOperatingSystemMXBeanImpl
+ * Method: getSystemLoadAverage
+ * Signature: ()D
+ */
+JNIEXPORT jdouble JNICALL
+Java_gnu_java_lang_management_VMOperatingSystemMXBeanImpl_getSystemLoadAverage (JNIEnv * env __attribute__ ((__unused__)), jclass cls __attribute__ ((__unused__)))
+{
+#ifdef HAVE_GETLOADAVG
+ double avg[1];
+ int nos = getloadavg(avg, 1);
+ if (nos == 1)
+ return avg[0];
+ else
+#endif
+ return -1;
+}
diff --git a/libjava/classpath/native/jni/java-lang/java_lang_VMDouble.c b/libjava/classpath/native/jni/java-lang/java_lang_VMDouble.c
new file mode 100644
index 000000000..e915a3089
--- /dev/null
+++ b/libjava/classpath/native/jni/java-lang/java_lang_VMDouble.c
@@ -0,0 +1,455 @@
+/* VMDouble.c - java.lang.VMDouble native functions
+ Copyright (C) 1998, 1999, 2001, 2003, 2004, 2005, 2006, 2007
+ Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include <assert.h>
+#include <config.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "mprec.h"
+#include "fdlibm.h"
+#include "jcl.h"
+
+#include "java_lang_VMDouble.h"
+
+static jclass clsDouble;
+static jmethodID isNaNID;
+static jdouble NEGATIVE_INFINITY;
+static jdouble POSITIVE_INFINITY;
+static jdouble NaN;
+
+/*
+ * Class: java_lang_VMDouble
+ * Method: initIDs
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL
+Java_java_lang_VMDouble_initIDs (JNIEnv * env, jclass cls __attribute__ ((__unused__)))
+{
+ jfieldID negInfID;
+ jfieldID posInfID;
+ jfieldID nanID;
+
+ clsDouble = (*env)->FindClass (env, "java/lang/Double");
+ if (clsDouble == NULL)
+ {
+ DBG ("unable to get class java.lang.Double\n") return;
+ }
+ clsDouble = (*env)->NewGlobalRef(env, clsDouble);
+ if (clsDouble == NULL)
+ {
+ DBG ("unable to register class java.lang.Double as global ref\n") return;
+ }
+ isNaNID = (*env)->GetStaticMethodID (env, clsDouble, "isNaN", "(D)Z");
+ if (isNaNID == NULL)
+ {
+ DBG ("unable to determine method id of isNaN\n") return;
+ }
+ negInfID = (*env)->GetStaticFieldID (env, clsDouble, "NEGATIVE_INFINITY", "D");
+ if (negInfID == NULL)
+ {
+ DBG ("unable to determine field id of NEGATIVE_INFINITY\n") return;
+ }
+ posInfID = (*env)->GetStaticFieldID (env, clsDouble, "POSITIVE_INFINITY", "D");
+ if (posInfID == NULL)
+ {
+ DBG ("unable to determine field id of POSITIVE_INFINITY\n") return;
+ }
+ nanID = (*env)->GetStaticFieldID (env, clsDouble, "NaN", "D");
+ if (posInfID == NULL)
+ {
+ DBG ("unable to determine field id of NaN\n") return;
+ }
+ POSITIVE_INFINITY = (*env)->GetStaticDoubleField (env, clsDouble, posInfID);
+ NEGATIVE_INFINITY = (*env)->GetStaticDoubleField (env, clsDouble, negInfID);
+ NaN = (*env)->GetStaticDoubleField (env, clsDouble, nanID);
+
+#ifdef DEBUG
+ fprintf (stderr, "java.lang.Double.initIDs() POSITIVE_INFINITY = %g\n",
+ POSITIVE_INFINITY);
+ fprintf (stderr, "java.lang.Double.initIDs() NEGATIVE_INFINITY = %g\n",
+ NEGATIVE_INFINITY);
+ fprintf (stderr, "java.lang.Double.initIDs() NaN = %g\n", NaN);
+#endif
+}
+
+/*
+ * Class: java_lang_VMDouble
+ * Method: doubleToRawLongBits
+ * Signature: (D)J
+ */
+JNIEXPORT jlong JNICALL
+Java_java_lang_VMDouble_doubleToRawLongBits
+ (JNIEnv * env __attribute__ ((__unused__)),
+ jclass cls __attribute__ ((__unused__)), jdouble doubleValue)
+{
+ jvalue val;
+
+ val.d = doubleValue;
+
+#if defined(__IEEE_BYTES_LITTLE_ENDIAN)
+ /* On little endian ARM processors when using FPA, word order of
+ doubles is still big endian. So take that into account here. When
+ using VFP, word order of doubles follows byte order. */
+
+#define SWAP_DOUBLE(a) (((a) << 32) | (((a) >> 32) & 0x00000000ffffffff))
+
+ val.j = SWAP_DOUBLE(val.j);
+#endif
+
+ return val.j;
+}
+
+/*
+ * Class: java_lang_VMDouble
+ * Method: longBitsToDouble
+ * Signature: (J)D
+ */
+JNIEXPORT jdouble JNICALL
+Java_java_lang_VMDouble_longBitsToDouble
+ (JNIEnv * env __attribute__ ((__unused__)),
+ jclass cls __attribute__ ((__unused__)), jlong longValue)
+{
+ jvalue val;
+
+ val.j = longValue;
+
+#if defined(__IEEE_BYTES_LITTLE_ENDIAN)
+ val.j = SWAP_DOUBLE(val.j);
+#endif
+
+ return val.d;
+}
+
+/**
+ * Parse a double from a char array.
+ */
+static jdouble
+parseDoubleFromChars(JNIEnv * env, const char * buf)
+{
+ char *endptr;
+ jdouble val = 0.0;
+ const char *p = buf, *end, *last_non_ws, *temp;
+ int ok = 1;
+
+#ifdef DEBUG
+ fprintf (stderr, "java.lang.VMDouble.parseDouble (%s)\n", buf);
+#endif
+
+ /* Trim the buffer, similar to String.trim(). First the leading
+ characters. */
+ while (*p && *p <= ' ')
+ ++p;
+
+ /* Find the last non-whitespace character. This method is safe
+ even with multi-byte UTF-8 characters. */
+ end = p;
+ last_non_ws = NULL;
+ while (*end)
+ {
+ if (*end > ' ')
+ last_non_ws = end;
+ ++end;
+ }
+
+ if (last_non_ws == NULL)
+ last_non_ws = p + strlen (p);
+ else
+ {
+ /* Skip past the last non-whitespace character. */
+ ++last_non_ws;
+ }
+
+ /* Check for infinity and NaN */
+ temp = p;
+ if (temp[0] == '+' || temp[0] == '-')
+ temp++;
+ if (strncmp ("Infinity", temp, (size_t) 8) == 0)
+ {
+ if (p[0] == '-')
+ return NEGATIVE_INFINITY;
+ return POSITIVE_INFINITY;
+ }
+ if (strncmp ("NaN", temp, (size_t) 3) == 0)
+ return NaN;
+
+ /* Skip a trailing `f' or `d'. */
+ if (last_non_ws > p
+ && (last_non_ws[-1] == 'f'
+ || last_non_ws[-1] == 'F'
+ || last_non_ws[-1] == 'd' || last_non_ws[-1] == 'D'))
+ --last_non_ws;
+
+ if (last_non_ws > p)
+ {
+ struct _Jv_reent reent;
+ memset (&reent, 0, sizeof reent);
+
+ val = _strtod_r (&reent, p, &endptr);
+
+#ifdef DEBUG
+ fprintf (stderr, "java.lang.VMDouble.parseDouble val = %g\n", val);
+ fprintf (stderr, "java.lang.VMDouble.parseDouble %p != %p ???\n",
+ endptr, last_non_ws);
+#endif
+ if (endptr != last_non_ws)
+ ok = 0;
+ }
+ else
+ ok = 0;
+
+ if (!ok)
+ {
+ val = 0.0;
+ JCL_ThrowException (env,
+ "java/lang/NumberFormatException",
+ "unable to parse double");
+ }
+
+ return val;
+}
+
+#define MAXIMAL_DECIMAL_STRING_LENGTH 64
+
+/**
+ * Use _dtoa to print a double or a float as a string with the given precision.
+ */
+static void
+dtoa_toString
+(char * buffer, jdouble value, jint precision, jboolean isFloat)
+{
+ const int DTOA_MODE = 2;
+ char result[MAXIMAL_DECIMAL_STRING_LENGTH];
+ int decpt, sign;
+ char *s, *d;
+ int i;
+
+ /* use mode 2 to get at the digit stream, all other modes are useless
+ *
+ * since mode 2 only gives us as many digits as we need in precision, we need to
+ * add the digits in front of the floating point to it, if there is more than one
+ * to be printed. That's the case if the value is going to be printed using the
+ * normal notation, i.e. if it is 0 or >= 1.0e-3 and < 1.0e7.
+ */
+ int digits_in_front_of_floating_point = ceil(log10(value));
+
+ if (digits_in_front_of_floating_point > 1 && digits_in_front_of_floating_point < 7)
+ precision += digits_in_front_of_floating_point;
+
+ _dtoa (value, DTOA_MODE, precision, &decpt, &sign, NULL, buffer, (int) isFloat);
+
+ value = fabs (value);
+
+ s = buffer;
+ d = result;
+
+ /* Handle negative sign */
+ if (sign)
+ *d++ = '-';
+
+ /* Handle normal represenation */
+ if ((value >= 1e-3 && value < 1e7) || (value == 0))
+ {
+ if (decpt <= 0)
+ *d++ = '0';
+ else
+ {
+ for (i = 0; i < decpt; i++)
+ if (*s)
+ *d++ = *s++;
+ else
+ *d++ = '0';
+ }
+
+ *d++ = '.';
+
+ if (*s == 0)
+ {
+ *d++ = '0';
+ decpt++;
+ }
+
+ while (decpt++ < 0)
+ *d++ = '0';
+
+ while (*s)
+ *d++ = *s++;
+
+ *d = 0;
+
+ }
+ /* Handle scientific representaiton */
+ else
+ {
+ *d++ = *s++;
+ decpt--;
+ *d++ = '.';
+
+ if (*s == 0)
+ *d++ = '0';
+
+ while (*s)
+ *d++ = *s++;
+
+ *d++ = 'E';
+
+ if (decpt < 0)
+ {
+ *d++ = '-';
+ decpt = -decpt;
+ }
+
+ {
+ char exp[4];
+ char *e = exp + sizeof exp;
+
+ *--e = 0;
+ do
+ {
+ *--e = '0' + decpt % 10;
+ decpt /= 10;
+ }
+ while (decpt > 0);
+
+ while (*e)
+ *d++ = *e++;
+ }
+
+ *d = 0;
+ }
+
+ /* copy the result into the buffer */
+ memcpy(buffer, result, MAXIMAL_DECIMAL_STRING_LENGTH);
+}
+
+/*
+ * Class: java_lang_VMDouble
+ * Method: toString
+ * Signature: (DZ)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL
+Java_java_lang_VMDouble_toString
+ (JNIEnv * env, jclass cls __attribute__ ((__unused__)), jdouble value, jboolean isFloat)
+{
+ char buf[MAXIMAL_DECIMAL_STRING_LENGTH];
+ const jint MAXIMAL_FLOAT_PRECISION = 10;
+ const jint MAXIMAL_DOUBLE_PRECISION = 19;
+
+ jint maximal_precision;
+ jint least_necessary_precision = 2;
+ jboolean parsed_value_unequal;
+
+ if ((*env)->CallStaticBooleanMethod (env, clsDouble, isNaNID, value))
+ return (*env)->NewStringUTF (env, "NaN");
+
+ if (value == POSITIVE_INFINITY)
+ return (*env)->NewStringUTF (env, "Infinity");
+
+ if (value == NEGATIVE_INFINITY)
+ return (*env)->NewStringUTF (env, "-Infinity");
+
+ if (isFloat)
+ maximal_precision = MAXIMAL_FLOAT_PRECISION;
+ else
+ maximal_precision = MAXIMAL_DOUBLE_PRECISION;
+
+ /* Try to find the 'good enough' precision,
+ * that results in enough digits being printed to be able to
+ * convert the number back into the original double, but no
+ * further digits.
+ */
+
+ do {
+ jdouble parsed_value;
+
+ assert(least_necessary_precision <= maximal_precision);
+
+ /* Convert the value to a string and back. */
+ dtoa_toString(buf, value, least_necessary_precision, isFloat);
+
+ parsed_value = parseDoubleFromChars(env, buf);
+
+ /* Check whether the original value, and the value after conversion match. */
+ /* We need to cast floats to float to make sure that our ineqality check works
+ * well for floats as well as for doubles.
+ */
+ parsed_value_unequal = ( isFloat ?
+ (float) parsed_value != (float) value :
+ parsed_value != value);
+
+ least_necessary_precision++;
+ }
+ while (parsed_value_unequal);
+
+ return (*env)->NewStringUTF (env, buf);
+}
+
+/*
+ * Class: java_lang_VMDouble
+ * Method: parseDouble
+ * Signature: (Ljava/lang/String;)D
+ */
+JNIEXPORT jdouble JNICALL
+Java_java_lang_VMDouble_parseDouble
+ (JNIEnv * env, jclass cls __attribute__ ((__unused__)), jstring str)
+{
+ jboolean isCopy;
+ const char *buf;
+ jdouble val = 0.0;
+
+ if (str == NULL)
+ {
+ JCL_ThrowException (env, "java/lang/NullPointerException", "null");
+ return val;
+ }
+
+ buf = (*env)->GetStringUTFChars (env, str, &isCopy);
+ if (buf == NULL)
+ {
+ /* OutOfMemoryError already thrown */
+ }
+ else
+ {
+ val = parseDoubleFromChars(env, buf);
+ (*env)->ReleaseStringUTFChars (env, str, buf);
+ }
+
+ return val;
+}
diff --git a/libjava/classpath/native/jni/java-lang/java_lang_VMFloat.c b/libjava/classpath/native/jni/java-lang/java_lang_VMFloat.c
new file mode 100644
index 000000000..acd07ffa5
--- /dev/null
+++ b/libjava/classpath/native/jni/java-lang/java_lang_VMFloat.c
@@ -0,0 +1,71 @@
+/* VMFloat.c - java.lang.VMFloat native functions
+ Copyright (C) 1998, 1999, 2003, 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include <config.h>
+
+#include "java_lang_VMFloat.h"
+
+/*
+ * Class: java_lang_VMFloat
+ * Method: floatToRawIntBits
+ * Signature: (F)I
+ */
+JNIEXPORT jint JNICALL
+Java_java_lang_VMFloat_floatToRawIntBits
+ (JNIEnv * env __attribute__ ((__unused__)),
+ jclass cls __attribute__ ((__unused__)), jfloat value)
+{
+ jvalue u;
+ u.f = value;
+ return u.i;
+}
+
+/*
+ * Class: java_lang_VMFloat
+ * Method: intBitsToFloat
+ * Signature: (I)F
+ */
+JNIEXPORT jfloat JNICALL
+Java_java_lang_VMFloat_intBitsToFloat
+ (JNIEnv * env __attribute__ ((__unused__)),
+ jclass cls __attribute__ ((__unused__)), jint bits)
+{
+ jvalue u;
+ u.i = bits;
+ return u.f;
+}
diff --git a/libjava/classpath/native/jni/java-lang/java_lang_VMMath.c b/libjava/classpath/native/jni/java-lang/java_lang_VMMath.c
new file mode 100644
index 000000000..de7851f9b
--- /dev/null
+++ b/libjava/classpath/native/jni/java-lang/java_lang_VMMath.c
@@ -0,0 +1,225 @@
+/* VMMath.c - java.lang.VMMath native functions
+ Copyright (C) 1998, 1999, 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include <config.h>
+#include <java_lang_VMMath.h>
+#include <fdlibm.h>
+
+JNIEXPORT jdouble JNICALL
+Java_java_lang_VMMath_sin
+ (JNIEnv * env __attribute__ ((__unused__)),
+ jclass cls __attribute__ ((__unused__)), jdouble x)
+{
+ return sin (x);
+}
+
+JNIEXPORT jdouble JNICALL
+Java_java_lang_VMMath_cos
+ (JNIEnv * env __attribute__ ((__unused__)),
+ jclass cls __attribute__ ((__unused__)), jdouble x)
+{
+ return cos (x);
+}
+
+JNIEXPORT jdouble JNICALL
+Java_java_lang_VMMath_tan
+ (JNIEnv * env __attribute__ ((__unused__)),
+ jclass cls __attribute__ ((__unused__)), jdouble x)
+{
+ return tan (x);
+}
+
+JNIEXPORT jdouble JNICALL
+Java_java_lang_VMMath_asin
+ (JNIEnv * env __attribute__ ((__unused__)),
+ jclass cls __attribute__ ((__unused__)), jdouble x)
+{
+ return asin (x);
+}
+
+JNIEXPORT jdouble JNICALL
+Java_java_lang_VMMath_acos
+ (JNIEnv * env __attribute__ ((__unused__)),
+ jclass cls __attribute__ ((__unused__)), jdouble x)
+{
+ return acos (x);
+}
+
+JNIEXPORT jdouble JNICALL
+Java_java_lang_VMMath_atan
+ (JNIEnv * env __attribute__ ((__unused__)),
+ jclass cls __attribute__ ((__unused__)), jdouble x)
+{
+ return atan (x);
+}
+
+JNIEXPORT jdouble JNICALL
+Java_java_lang_VMMath_atan2
+ (JNIEnv * env __attribute__ ((__unused__)),
+ jclass cls __attribute__ ((__unused__)), jdouble y, jdouble x)
+{
+ return atan2 (y, x);
+}
+
+JNIEXPORT jdouble JNICALL
+Java_java_lang_VMMath_exp
+ (JNIEnv * env __attribute__ ((__unused__)),
+ jclass cls __attribute__ ((__unused__)), jdouble x)
+{
+ return exp (x);
+}
+
+JNIEXPORT jdouble JNICALL
+Java_java_lang_VMMath_log
+ (JNIEnv * env __attribute__ ((__unused__)),
+ jclass cls __attribute__ ((__unused__)), jdouble x)
+{
+ return log (x);
+}
+
+JNIEXPORT jdouble JNICALL
+Java_java_lang_VMMath_sqrt
+ (JNIEnv * env __attribute__ ((__unused__)),
+ jclass cls __attribute__ ((__unused__)), jdouble x)
+{
+ return sqrt (x);
+}
+
+JNIEXPORT jdouble JNICALL
+Java_java_lang_VMMath_pow
+ (JNIEnv * env __attribute__ ((__unused__)),
+ jclass cls __attribute__ ((__unused__)), jdouble x, jdouble y)
+{
+ return pow (x, y);
+}
+
+JNIEXPORT jdouble JNICALL
+Java_java_lang_VMMath_IEEEremainder
+ (JNIEnv * env __attribute__ ((__unused__)),
+ jclass cls __attribute__ ((__unused__)), jdouble x, jdouble y)
+{
+ return remainder (x, y);
+}
+
+JNIEXPORT jdouble JNICALL
+Java_java_lang_VMMath_ceil
+ (JNIEnv * env __attribute__ ((__unused__)),
+ jclass cls __attribute__ ((__unused__)), jdouble x)
+{
+ return ceil (x);
+}
+
+JNIEXPORT jdouble JNICALL
+Java_java_lang_VMMath_floor
+ (JNIEnv * env __attribute__ ((__unused__)),
+ jclass cls __attribute__ ((__unused__)), jdouble x)
+{
+ return floor (x);
+}
+
+JNIEXPORT jdouble JNICALL
+Java_java_lang_VMMath_rint
+ (JNIEnv * env __attribute__ ((__unused__)),
+ jclass cls __attribute__ ((__unused__)), jdouble x)
+{
+ return rint (x);
+}
+
+JNIEXPORT jdouble JNICALL
+Java_java_lang_VMMath_cbrt
+ (JNIEnv * env __attribute__ ((__unused__)),
+ jclass cls __attribute__ ((__unused__)), jdouble x)
+{
+ return cbrt (x);
+}
+
+JNIEXPORT jdouble JNICALL
+Java_java_lang_VMMath_cosh
+ (JNIEnv * env __attribute__ ((__unused__)),
+ jclass cls __attribute__ ((__unused__)), jdouble x)
+{
+ return cosh (x);
+}
+
+JNIEXPORT jdouble JNICALL
+Java_java_lang_VMMath_expm1
+ (JNIEnv * env __attribute__ ((__unused__)),
+ jclass cls __attribute__ ((__unused__)), jdouble x)
+{
+ return expm1 (x);
+}
+
+JNIEXPORT jdouble JNICALL
+Java_java_lang_VMMath_hypot
+ (JNIEnv * env __attribute__ ((__unused__)),
+ jclass cls __attribute__ ((__unused__)), jdouble x, jdouble y)
+{
+ return hypot (x, y);
+}
+
+JNIEXPORT jdouble JNICALL
+Java_java_lang_VMMath_log10
+ (JNIEnv * env __attribute__ ((__unused__)),
+ jclass cls __attribute__ ((__unused__)), jdouble x)
+{
+ return log10 (x);
+}
+
+JNIEXPORT jdouble JNICALL
+Java_java_lang_VMMath_log1p
+ (JNIEnv * env __attribute__ ((__unused__)),
+ jclass cls __attribute__ ((__unused__)), jdouble x)
+{
+ return log1p (x);
+}
+
+JNIEXPORT jdouble JNICALL
+Java_java_lang_VMMath_sinh
+ (JNIEnv * env __attribute__ ((__unused__)),
+ jclass cls __attribute__ ((__unused__)), jdouble x)
+{
+ return sinh (x);
+}
+
+JNIEXPORT jdouble JNICALL
+Java_java_lang_VMMath_tanh
+ (JNIEnv * env __attribute__ ((__unused__)),
+ jclass cls __attribute__ ((__unused__)), jdouble x)
+{
+ return tanh (x);
+}
diff --git a/libjava/classpath/native/jni/java-lang/java_lang_VMProcess.c b/libjava/classpath/native/jni/java-lang/java_lang_VMProcess.c
new file mode 100644
index 000000000..a6076f2ae
--- /dev/null
+++ b/libjava/classpath/native/jni/java-lang/java_lang_VMProcess.c
@@ -0,0 +1,409 @@
+/* java_lang_VMProcess.c -- native code for java.lang.VMProcess
+ Copyright (C) 1998, 1999, 2000, 2002, 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <config.h>
+
+#include "java_lang_VMProcess.h"
+#include "gnu_java_nio_FileChannelImpl.h"
+
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+
+#include "cpnative.h"
+#include "cpproc.h"
+
+/* Internal functions */
+static char *copy_string (JNIEnv * env, jobject string);
+static char *copy_elem (JNIEnv * env, jobject stringArray, jint i);
+
+/*
+ * Internal helper function to copy a String in UTF-8 format.
+ */
+static char *
+copy_string (JNIEnv * env, jobject string)
+{
+ const char *utf;
+ jclass clazz;
+ char *copy;
+
+ /* Check for null */
+ if (string == NULL)
+ {
+ clazz = (*env)->FindClass (env, "java/lang/NullPointerException");
+ if ((*env)->ExceptionOccurred (env))
+ return NULL;
+ (*env)->ThrowNew (env, clazz, NULL);
+ (*env)->DeleteLocalRef (env, clazz);
+ return NULL;
+ }
+
+ /* Extract UTF-8 */
+ utf = (*env)->GetStringUTFChars (env, string, NULL);
+ if ((*env)->ExceptionOccurred (env))
+ return NULL;
+
+ /* Copy it */
+ if ((copy = strdup (utf)) == NULL)
+ {
+ clazz = (*env)->FindClass (env, "java/lang/InternalError");
+ if ((*env)->ExceptionOccurred (env))
+ return NULL;
+ (*env)->ThrowNew (env, clazz, "strdup returned NULL");
+ (*env)->DeleteLocalRef (env, clazz);
+ }
+
+ /* Done */
+ (*env)->ReleaseStringUTFChars (env, string, utf);
+ return copy;
+}
+
+/*
+ * Internal helper function to copy a String[] element in UTF-8 format.
+ */
+static char *
+copy_elem (JNIEnv * env, jobject stringArray, jint i)
+{
+ jobject elem;
+ char *rtn;
+
+ elem = (*env)->GetObjectArrayElement (env, stringArray, i);
+ if ((*env)->ExceptionOccurred (env))
+ return NULL;
+ if ((rtn = copy_string (env, elem)) == NULL)
+ return NULL;
+ (*env)->DeleteLocalRef (env, elem);
+ return rtn;
+}
+
+/*
+ * private final native void nativeSpawn(String[], String[], File)
+ * throws java/io/IOException
+ */
+JNIEXPORT void JNICALL
+Java_java_lang_VMProcess_nativeSpawn (JNIEnv * env, jobject this,
+ jobjectArray cmdArray,
+ jobjectArray envArray, jobject dirFile,
+ jboolean redirect)
+{
+ int fds[CPIO_EXEC_NUM_PIPES];
+ jobject streams[CPIO_EXEC_NUM_PIPES] = { NULL, NULL, NULL };
+ jobject dirString = NULL;
+ char **newEnviron = NULL;
+ jsize cmdArrayLen = 0;
+ jsize envArrayLen = 0;
+ char **strings = NULL;
+ int num_strings = 0;
+ char *dir = NULL;
+ pid_t pid = -1;
+ char errbuf[64];
+ jmethodID method, vmmethod;
+ jclass clazz, vmclazz;
+ int i;
+ int pipe_count = redirect ? 2 : 3;
+ int err;
+
+ /* Check for null */
+ if (cmdArray == NULL)
+ goto null_pointer_exception;
+
+ /* Invoke dirFile.getPath() */
+ if (dirFile != NULL)
+ {
+ clazz = (*env)->FindClass (env, "java/io/File");
+ if ((*env)->ExceptionOccurred (env))
+ return;
+ method = (*env)->GetMethodID (env,
+ clazz, "getPath", "()Ljava/lang/String;");
+ if ((*env)->ExceptionOccurred (env))
+ return;
+ dirString = (*env)->CallObjectMethod (env, dirFile, method);
+ if ((*env)->ExceptionOccurred (env))
+ return;
+ (*env)->DeleteLocalRef (env, clazz);
+ }
+
+ /*
+ * Allocate array of C strings. We put all the C strings we need to
+ * handle the command parameters, the new environment, and the new
+ * directory into a single array for simplicity of (de)allocation.
+ */
+ cmdArrayLen = (*env)->GetArrayLength (env, cmdArray);
+ if (cmdArrayLen == 0)
+ goto null_pointer_exception;
+ if (envArray != NULL)
+ envArrayLen = (*env)->GetArrayLength (env, envArray);
+ if ((strings = malloc (((cmdArrayLen + 1)
+ + (envArray != NULL ? envArrayLen + 1 : 0)
+ + (dirString !=
+ NULL ? 1 : 0)) * sizeof (*strings))) == NULL)
+ {
+ strncpy (errbuf, "malloc failed", sizeof(errbuf));
+ goto out_of_memory;
+ }
+
+ /* Extract C strings from the various String parameters */
+ for (i = 0; i < cmdArrayLen; i++)
+ {
+ if ((strings[num_strings++] = copy_elem (env, cmdArray, i)) == NULL)
+ goto done;
+ }
+ strings[num_strings++] = NULL; /* terminate array with NULL */
+ if (envArray != NULL)
+ {
+ newEnviron = strings + num_strings;
+ for (i = 0; i < envArrayLen; i++)
+ {
+ if ((strings[num_strings++] = copy_elem (env, envArray, i)) == NULL)
+ goto done;
+ }
+ strings[num_strings++] = NULL; /* terminate array with NULL */
+ }
+ if (dirString != NULL)
+ {
+ if ((dir = copy_string (env, dirString)) == NULL)
+ goto done;
+ }
+
+ /* Create inter-process pipes */
+ err = cpproc_forkAndExec(strings, newEnviron, fds, pipe_count, &pid, dir);
+ if (err != 0)
+ {
+ strncpy(errbuf, cpnative_getErrorString (err), sizeof(errbuf));
+ goto system_error;
+ }
+
+ /* Create Input/OutputStream objects around parent file descriptors */
+ vmclazz = (*env)->FindClass (env, "gnu/java/nio/VMChannel");
+ clazz = (*env)->FindClass (env, "gnu/java/nio/FileChannelImpl");
+ if ((*env)->ExceptionOccurred (env))
+ goto done;
+ vmmethod = (*env)->GetMethodID (env, vmclazz, "<init>", "(I)V");
+ method = (*env)->GetMethodID (env, clazz, "<init>", "(Lgnu/java/nio/VMChannel;I)V");
+ if ((*env)->ExceptionOccurred (env))
+ goto done;
+ 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];
+ const int mode = ((i == CPIO_EXEC_STDIN) ? 2 : 1);
+ jclass sclazz;
+ jmethodID smethod;
+
+ jobject vmchannel;
+ jobject channel;
+ vmchannel = (*env)->NewObject (env, vmclazz, vmmethod, fd);
+ if ((*env)->ExceptionOccurred (env))
+ goto done;
+ channel = (*env)->NewObject (env, clazz, method, vmchannel, mode);
+ if ((*env)->ExceptionOccurred (env))
+ goto done;
+
+ if (mode == gnu_java_nio_FileChannelImpl_WRITE)
+ sclazz = (*env)->FindClass (env, "java/io/FileOutputStream");
+ else
+ sclazz = (*env)->FindClass (env, "java/io/FileInputStream");
+ if ((*env)->ExceptionOccurred (env))
+ goto done;
+
+ smethod = (*env)->GetMethodID (env, sclazz, "<init>",
+ "(Lgnu/java/nio/FileChannelImpl;)V");
+ if ((*env)->ExceptionOccurred (env))
+ goto done;
+
+ streams[i] = (*env)->NewObject (env, sclazz, smethod, channel);
+ if ((*env)->ExceptionOccurred (env))
+ goto done;
+
+ (*env)->DeleteLocalRef (env, sclazz);
+ }
+ (*env)->DeleteLocalRef (env, clazz);
+
+ /* Invoke VMProcess.setProcessInfo() to update VMProcess object */
+ method = (*env)->GetMethodID (env,
+ (*env)->GetObjectClass (env, this),
+ "setProcessInfo",
+ "(Ljava/io/OutputStream;Ljava/io/InputStream;Ljava/io/InputStream;J)V");
+ if ((*env)->ExceptionOccurred (env))
+ goto done;
+ (*env)->CallVoidMethod (env, this, method,
+ streams[CPIO_EXEC_STDIN],
+ streams[CPIO_EXEC_STDOUT],
+ streams[CPIO_EXEC_STDERR],
+ (jlong) pid);
+ if ((*env)->ExceptionOccurred (env))
+ goto done;
+
+done:
+ /*
+ * We get here in both the success and failure cases in the
+ * parent process. Our goal is to clean up the mess we created.
+ */
+
+ /*
+ * Close parent's ends of pipes if Input/OutputStreams never got created.
+ * This can only happen in a failure case. If a Stream object
+ * 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 < pipe_count; i++)
+ {
+ const int fd = fds[i];
+
+ if (fd != -1 && streams[i] == NULL)
+ close (fd);
+ }
+
+ /* Free C strings */
+ while (num_strings > 0)
+ free (strings[--num_strings]);
+ free (strings);
+ if (dir != NULL)
+ free(dir);
+ /* Done */
+ return;
+
+null_pointer_exception:
+ clazz = (*env)->FindClass (env, "java/lang/NullPointerException");
+ if ((*env)->ExceptionOccurred (env))
+ goto done;
+ (*env)->ThrowNew (env, clazz, NULL);
+ (*env)->DeleteLocalRef (env, clazz);
+ goto done;
+
+out_of_memory:
+ clazz = (*env)->FindClass (env, "java/lang/InternalError");
+ if ((*env)->ExceptionOccurred (env))
+ goto done;
+ (*env)->ThrowNew (env, clazz, errbuf);
+ (*env)->DeleteLocalRef (env, clazz);
+ goto done;
+
+system_error:
+ clazz = (*env)->FindClass (env, "java/io/IOException");
+ if ((*env)->ExceptionOccurred (env))
+ goto done;
+ (*env)->ThrowNew (env, clazz, errbuf);
+ (*env)->DeleteLocalRef (env, clazz);
+ goto done;
+}
+
+/*
+ * private static final native boolean nativeReap()
+ */
+JNIEXPORT jboolean JNICALL
+Java_java_lang_VMProcess_nativeReap (JNIEnv * env, jclass clazz)
+{
+ char ebuf[64];
+ jfieldID field;
+ jint status;
+ pid_t pid;
+ int err;
+
+ /* Try to reap a child process, but don't block */
+ err = cpproc_waitpid((pid_t)-1, &status, &pid, WNOHANG);
+ if (err == 0 && pid == 0)
+ return JNI_FALSE;
+
+ /* Check result from waitpid() */
+ if (err != 0)
+ {
+ if (err == ECHILD || err == EINTR)
+ return JNI_FALSE;
+ snprintf(ebuf, sizeof (ebuf), "waitpid(%ld): %s",
+ (long) pid, cpnative_getErrorString(errno));
+ clazz = (*env)->FindClass (env, "java/lang/InternalError");
+ if ((*env)->ExceptionOccurred (env))
+ return JNI_FALSE;
+ (*env)->ThrowNew (env, clazz, ebuf);
+ (*env)->DeleteLocalRef (env, clazz);
+ return JNI_FALSE;
+ }
+
+ /* Get exit code; for signal termination return negative signal value XXX */
+ if (WIFEXITED (status))
+ status = (jint) (jbyte) WEXITSTATUS (status);
+ else if (WIFSIGNALED (status))
+ status = -(jint) WTERMSIG (status);
+ else
+ return JNI_FALSE; /* process merely stopped; ignore */
+
+ /* Return process pid and exit status */
+ field = (*env)->GetStaticFieldID (env, clazz, "reapedPid", "J");
+ if ((*env)->ExceptionOccurred (env))
+ return JNI_FALSE;
+ (*env)->SetStaticLongField (env, clazz, field, (jlong) pid);
+ if ((*env)->ExceptionOccurred (env))
+ return JNI_FALSE;
+ field = (*env)->GetStaticFieldID (env, clazz, "reapedExitValue", "I");
+ if ((*env)->ExceptionOccurred (env))
+ return JNI_FALSE;
+ (*env)->SetStaticIntField (env, clazz, field, status);
+ if ((*env)->ExceptionOccurred (env))
+ return JNI_FALSE;
+
+ /* Done */
+ return JNI_TRUE;
+}
+
+/*
+ * private static final native void nativeKill(long)
+ */
+JNIEXPORT void JNICALL
+Java_java_lang_VMProcess_nativeKill (JNIEnv * env, jclass clazz, jlong pid)
+{
+ char ebuf[64];
+ int err;
+
+ err = cpproc_kill((pid_t) pid, SIGKILL);
+ if (err != 0)
+ {
+ snprintf (ebuf, sizeof (ebuf), "kill(%ld): %s",
+ (long) pid, cpnative_getErrorString (err));
+ clazz = (*env)->FindClass (env, "java/lang/InternalError");
+ if ((*env)->ExceptionOccurred (env))
+ return;
+ (*env)->ThrowNew (env, clazz, ebuf);
+ (*env)->DeleteLocalRef (env, clazz);
+ }
+}
diff --git a/libjava/classpath/native/jni/java-lang/java_lang_VMSystem.c b/libjava/classpath/native/jni/java-lang/java_lang_VMSystem.c
new file mode 100644
index 000000000..d20322791
--- /dev/null
+++ b/libjava/classpath/native/jni/java-lang/java_lang_VMSystem.c
@@ -0,0 +1,189 @@
+/* System.c -- native code for java.lang.System
+ Copyright (C) 1998, 1999, 2000, 2002, 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include "java_lang_VMSystem.h"
+
+#include <jcl.h>
+
+#include <sys/time.h>
+#include <stdlib.h>
+
+/*
+ * Class: java_lang_VMSystem
+ * Method: setIn0
+ * Signature: (Ljava/io/InputStream;)V
+ */
+JNIEXPORT void JNICALL
+Java_java_lang_VMSystem_setIn (JNIEnv * env,
+ jclass thisClass __attribute__ ((__unused__)),
+ jobject obj)
+{
+ jclass cls;
+ jfieldID field;
+
+ cls = JCL_FindClass (env, "java/lang/System");
+ if (!cls)
+ return;
+
+ field = (*env)->GetStaticFieldID (env, cls, "in", "Ljava/io/InputStream;");
+ if (!field)
+ return;
+ (*env)->SetStaticObjectField (env, cls, field, obj);
+}
+
+/*
+ * Class: java_lang_VMSystem
+ * Method: setOut0
+ * Signature: (Ljava/io/PrintStream;)V
+ */
+JNIEXPORT void JNICALL
+Java_java_lang_VMSystem_setOut (JNIEnv * env,
+ jclass thisClass __attribute__ ((__unused__)),
+ jobject obj)
+{
+ jclass cls;
+ jfieldID field;
+
+ cls = JCL_FindClass (env, "java/lang/System");
+ if (!cls)
+ return;
+
+ field = (*env)->GetStaticFieldID (env, cls, "out", "Ljava/io/PrintStream;");
+ if (!field)
+ return;
+ (*env)->SetStaticObjectField (env, cls, field, obj);
+}
+
+/*
+ * Class: java_lang_VMSystem
+ * Method: setErr0
+ * Signature: (Ljava/io/PrintStream;)V
+ */
+JNIEXPORT void JNICALL
+Java_java_lang_VMSystem_setErr (JNIEnv * env,
+ jclass thisClass __attribute__ ((__unused__)),
+ jobject obj)
+{
+ jclass cls;
+ jfieldID field;
+
+ cls = JCL_FindClass (env, "java/lang/System");
+ if (!cls)
+ return;
+
+ field = (*env)->GetStaticFieldID (env, cls, "err", "Ljava/io/PrintStream;");
+ if (!field)
+ return;
+ (*env)->SetStaticObjectField (env, cls, field, obj);
+}
+
+/*
+ * Class: java_lang_VMSystem
+ * Method: nanoTime
+ * Signature: ()J
+ */
+JNIEXPORT jlong JNICALL
+Java_java_lang_VMSystem_nanoTime
+ (JNIEnv * env __attribute__ ((__unused__)),
+ jclass thisClass __attribute__ ((__unused__)))
+{
+ /* Note: this implementation copied directly from Japhar's, by Chris Toshok. */
+ jlong result;
+ struct timeval tp;
+
+ if (gettimeofday (&tp, NULL) == -1)
+ (*env)->FatalError (env, "gettimeofday call failed.");
+
+ result = (jlong) tp.tv_sec;
+ result *= (jlong)1000000L;
+ result += (jlong)tp.tv_usec;
+ result *= (jlong)1000;
+
+ return result;
+}
+
+JNIEXPORT jstring JNICALL
+Java_java_lang_VMSystem_getenv (JNIEnv * env,
+ jclass klass __attribute__ ((__unused__)),
+ jstring jname)
+{
+ const char *cname;
+ const char *envname;
+
+ cname = JCL_jstring_to_cstring (env, jname);
+ if (cname == NULL)
+ return NULL;
+
+ envname = getenv (cname);
+ if (envname == NULL)
+ return NULL;
+
+ 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_VMArray.c b/libjava/classpath/native/jni/java-lang/java_lang_reflect_VMArray.c
new file mode 100644
index 000000000..2db68ebf9
--- /dev/null
+++ b/libjava/classpath/native/jni/java-lang/java_lang_reflect_VMArray.c
@@ -0,0 +1,62 @@
+/* java.lang.reflect.Array native functions
+ Copyright (C) 1998, 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+/*
+ * java.lang.reflect.Array native functions.
+ * Author: John Keiser
+ * Version: 1.1.0
+ * Date: 2 Jun 1998
+ */
+
+#include <config.h>
+#include <stddef.h>
+
+#include "java_lang_reflect_VMArray.h"
+
+/*
+ * Class: java_lang_reflect_Array
+ * Method: createObjectArray
+ * Signature: (Ljava/lang/Class;I)Ljava/lang/Object;
+ */
+JNIEXPORT jobject JNICALL
+Java_java_lang_reflect_VMArray_createObjectArray
+ (JNIEnv * env,
+ jclass thisClass __attribute__ ((__unused__)),
+ jclass arrayType, jint arrayLength)
+{
+ return (jobject) (*env)->NewObjectArray (env, arrayLength, arrayType, NULL);
+}