summaryrefslogtreecommitdiff
path: root/libjava/classpath/native/jni/java-io
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-io
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-io')
-rw-r--r--libjava/classpath/native/jni/java-io/.cvsignore8
-rw-r--r--libjava/classpath/native/jni/java-io/Makefile.am13
-rw-r--r--libjava/classpath/native/jni/java-io/Makefile.in617
-rw-r--r--libjava/classpath/native/jni/java-io/java_io_VMFile.c1214
-rw-r--r--libjava/classpath/native/jni/java-io/java_io_VMObjectInputStream.c69
-rw-r--r--libjava/classpath/native/jni/java-io/java_io_VMObjectStreamClass.c381
6 files changed, 2302 insertions, 0 deletions
diff --git a/libjava/classpath/native/jni/java-io/.cvsignore b/libjava/classpath/native/jni/java-io/.cvsignore
new file mode 100644
index 000000000..e9f2658a6
--- /dev/null
+++ b/libjava/classpath/native/jni/java-io/.cvsignore
@@ -0,0 +1,8 @@
+*.o
+*.a
+*.lo
+*.la
+.libs
+.deps
+Makefile
+Makefile.in
diff --git a/libjava/classpath/native/jni/java-io/Makefile.am b/libjava/classpath/native/jni/java-io/Makefile.am
new file mode 100644
index 000000000..58bd973e2
--- /dev/null
+++ b/libjava/classpath/native/jni/java-io/Makefile.am
@@ -0,0 +1,13 @@
+nativeexeclib_LTLIBRARIES = libjavaio.la
+
+libjavaio_la_SOURCES = java_io_VMFile.c \
+ java_io_VMObjectInputStream.c \
+ java_io_VMObjectStreamClass.c
+
+libjavaio_la_LIBADD = $(top_builddir)/native/jni/classpath/jcl.lo \
+ $(top_builddir)/native/jni/native-lib/libclasspathnative.la
+
+AM_LDFLAGS = @CLASSPATH_MODULE@
+AM_CPPFLAGS = @CLASSPATH_INCLUDES@
+AM_CFLAGS = @WARNING_CFLAGS@ @STRICT_WARNING_CFLAGS@ @ERROR_CFLAGS@ \
+ @EXTRA_CFLAGS@
diff --git a/libjava/classpath/native/jni/java-io/Makefile.in b/libjava/classpath/native/jni/java-io/Makefile.in
new file mode 100644
index 000000000..beb9ce6c7
--- /dev/null
+++ b/libjava/classpath/native/jni/java-io/Makefile.in
@@ -0,0 +1,617 @@
+# 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-io
+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)
+libjavaio_la_DEPENDENCIES = \
+ $(top_builddir)/native/jni/classpath/jcl.lo \
+ $(top_builddir)/native/jni/native-lib/libclasspathnative.la
+am_libjavaio_la_OBJECTS = java_io_VMFile.lo \
+ java_io_VMObjectInputStream.lo java_io_VMObjectStreamClass.lo
+libjavaio_la_OBJECTS = $(am_libjavaio_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 = $(libjavaio_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 = libjavaio.la
+libjavaio_la_SOURCES = java_io_VMFile.c \
+ java_io_VMObjectInputStream.c \
+ java_io_VMObjectStreamClass.c
+
+libjavaio_la_LIBADD = $(top_builddir)/native/jni/classpath/jcl.lo \
+ $(top_builddir)/native/jni/native-lib/libclasspathnative.la
+
+AM_LDFLAGS = @CLASSPATH_MODULE@
+AM_CPPFLAGS = @CLASSPATH_INCLUDES@
+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-io/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu native/jni/java-io/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
+libjavaio.la: $(libjavaio_la_OBJECTS) $(libjavaio_la_DEPENDENCIES)
+ $(LINK) -rpath $(nativeexeclibdir) $(libjavaio_la_OBJECTS) $(libjavaio_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/java_io_VMFile.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/java_io_VMObjectInputStream.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/java_io_VMObjectStreamClass.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-io/java_io_VMFile.c b/libjava/classpath/native/jni/java-io/java_io_VMFile.c
new file mode 100644
index 000000000..a15cec769
--- /dev/null
+++ b/libjava/classpath/native/jni/java-io/java_io_VMFile.c
@@ -0,0 +1,1214 @@
+/* java_io_VMFile.c - Native methods for java.io.File class
+ Copyright (C) 1998, 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. */
+
+/* do not move; needed here because of some macro definitions */
+#include <config.h>
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#if defined (HAVE_LSTAT) && defined (HAVE_READLINK)
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#endif
+
+#include <jni.h>
+#include <jcl.h>
+#include "cpio.h"
+#include "cpnative.h"
+
+#include "java_io_VMFile.h"
+
+/* ***** PRIVATE FUNCTIONS DELCARATION ***** */
+
+/**
+ * Enables of disables the passed permission bit of a file.
+ */
+static jboolean set_file_permissions (JNIEnv *env, jstring name,
+ jboolean enable,
+ jboolean ownerOnly,
+ int permissions);
+
+/* ***** END: PRIVATE FUNCTIONS DELCARATION ***** */
+
+/*************************************************************************/
+
+/*
+ * Method to create an empty file.
+ *
+ * Class: java_io_VMFile
+ * Method: create
+ * Signature: (Ljava/lang/String;)Z
+ */
+
+JNIEXPORT jboolean JNICALL
+Java_java_io_VMFile_create (JNIEnv * env,
+ jclass clazz __attribute__ ((__unused__)),
+ jstring name)
+{
+#ifndef WITHOUT_FILESYSTEM
+ const char *filename;
+ int fd;
+ int result;
+
+ filename = JCL_jstring_to_cstring (env, name);
+ if (filename == NULL)
+ {
+ return 0;
+ }
+
+ result = cpio_openFile (filename, &fd, CPFILE_FLAG_CREATE|CPFILE_FLAG_WRITE, CPFILE_PERMISSION_NORMAL);
+ if (result != CPNATIVE_OK)
+ {
+ if (result != EEXIST)
+ JCL_ThrowException (env,
+ "java/io/IOException",
+ cpnative_getErrorString (result));
+ JCL_free_cstring (env, name, filename);
+ return 0;
+ }
+ cpio_closeFile (fd);
+
+ JCL_free_cstring (env, name, filename);
+ return 1;
+#else /* not WITHOUT_FILESYSTEM */
+ return 0;
+#endif /* not WITHOUT_FILESYSTEM */
+}
+
+/*************************************************************************/
+
+/*
+ * This method checks to see if we have read permission on a file.
+ *
+ * Class: java_io_VMFile
+ * Method: canRead
+ * Signature: (Ljava/lang/String;)Z
+ */
+
+JNIEXPORT jboolean JNICALL
+Java_java_io_VMFile_canRead (JNIEnv * env,
+ jclass clazz __attribute__ ((__unused__)),
+ jstring name)
+{
+#ifndef WITHOUT_FILESYSTEM
+ const char *filename;
+ int result;
+
+ /* Don't use the JCL convert function because it throws an exception
+ on failure */
+ filename = (*env)->GetStringUTFChars (env, name, 0);
+ if (filename == NULL)
+ {
+ return JNI_FALSE;
+ }
+
+ result = cpio_checkAccess (filename, CPFILE_FLAG_READ);
+
+ (*env)->ReleaseStringUTFChars (env, name, filename);
+ if (result != CPNATIVE_OK)
+ return JNI_FALSE;
+
+ return JNI_TRUE;
+#else /* not WITHOUT_FILESYSTEM */
+ return JNI_FALSE;
+#endif /* not WITHOUT_FILESYSTEM */
+}
+
+/*************************************************************************/
+
+/*
+ * This method checks to see if we have write permission on a file.
+ *
+ * Class: java_io_VMFile
+ * Method: canWrite
+ * Signature: (Ljava/lang/String;)Z
+ */
+
+JNIEXPORT jboolean JNICALL
+Java_java_io_VMFile_canWrite (JNIEnv * env,
+ jclass clazz __attribute__ ((__unused__)),
+ jstring name)
+{
+#ifndef WITHOUT_FILESYSTEM
+ const char *filename;
+ int result;
+
+ /* Don't use the JCL convert function because it throws an exception
+ on failure */
+ filename = (*env)->GetStringUTFChars (env, name, 0);
+ if (filename == NULL)
+ {
+ return JNI_FALSE;
+ }
+
+ result = cpio_checkAccess (filename, CPFILE_FLAG_WRITE);
+
+ (*env)->ReleaseStringUTFChars (env, name, filename);
+ if (result != CPNATIVE_OK)
+ {
+ return JNI_FALSE;
+ }
+
+ return JNI_TRUE;
+#else /* not WITHOUT_FILESYSTEM */
+ return JNI_FALSE;
+#endif /* not WITHOUT_FILESYSTEM */
+}
+
+/*************************************************************************/
+
+JNIEXPORT jboolean JNICALL
+Java_java_io_VMFile_canWriteDirectory (JNIEnv *env, jclass clazz, jstring path)
+{
+ /* this is only valid on *nix systems */
+ return Java_java_io_VMFile_canWrite(env, clazz, path);
+}
+
+/*************************************************************************/
+
+/*
+ * This method checks to see if we have execute permission on a file.
+ *
+ * Class: java_io_VMFile
+ * Method: canExecute
+ * Signature: (Ljava/lang/String;)Z
+ */
+
+JNIEXPORT jboolean JNICALL
+Java_java_io_VMFile_canExecute (JNIEnv * env,
+ jclass clazz __attribute__ ((__unused__)),
+ jstring name)
+{
+#ifndef WITHOUT_FILESYSTEM
+ const char *filename;
+ int result;
+
+ /* Don't use the JCL convert function because it throws an exception
+ on failure */
+ filename = (*env)->GetStringUTFChars (env, name, 0);
+ if (filename == NULL)
+ {
+ return JNI_FALSE;
+ }
+
+ result = cpio_checkAccess (filename, CPFILE_FLAG_EXEC);
+
+ (*env)->ReleaseStringUTFChars (env, name, filename);
+ if (result != CPNATIVE_OK)
+ return JNI_FALSE;
+
+ return JNI_TRUE;
+#else /* not WITHOUT_FILESYSTEM */
+ return JNI_FALSE;
+#endif /* not WITHOUT_FILESYSTEM */
+}
+
+
+/*************************************************************************/
+
+/*
+ * This method makes a file read only.
+ *
+ * Class: java_io_VMFile
+ * Method: setReadOnly
+ * Signature: (Ljava/lang/String;)Z
+ */
+
+JNIEXPORT jboolean JNICALL
+Java_java_io_VMFile_setReadOnly (JNIEnv * env,
+ jclass clazz __attribute__ ((__unused__)),
+ jstring name)
+{
+#ifndef WITHOUT_FILESYSTEM
+ const char *filename;
+ int result;
+
+ /* Don't use the JCL convert function because it throws an exception
+ on failure */
+ filename = (*env)->GetStringUTFChars (env, name, 0);
+ if (filename == NULL)
+ {
+ return 0;
+ }
+
+ result = cpio_setFileReadonly (filename);
+ (*env)->ReleaseStringUTFChars (env, name, filename);
+
+ return result == CPNATIVE_OK ? 1 : 0;
+#else /* not WITHOUT_FILESYSTEM */
+ return 0;
+#endif /* not WITHOUT_FILESYSTEM */
+}
+
+/*************************************************************************/
+
+/*
+ * This method changes the read permission bit of a file.
+ *
+ * Class: java_io_VMFile
+ * Method: setReadable
+ * Signature: (Ljava/lang/String;ZZ)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_java_io_VMFile_setReadable (JNIEnv *env,
+ jclass clazz __attribute__ ((__unused__)),
+ jstring name,
+ jboolean readable,
+ jboolean ownerOnly)
+{
+ return set_file_permissions (env, name, readable, ownerOnly,
+ CPFILE_FLAG_READ);
+}
+
+
+/*************************************************************************/
+
+/*
+ * This method changes the write permission bit of a file.
+ *
+ * Class: java_io_VMFile
+ * Method: setWritable
+ * Signature: (Ljava/lang/String;ZZ)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_java_io_VMFile_setWritable (JNIEnv *env,
+ jclass clazz __attribute__ ((__unused__)),
+ jstring name,
+ jboolean writable,
+ jboolean ownerOnly)
+{
+ return set_file_permissions (env, name, writable, ownerOnly,
+ CPFILE_FLAG_WRITE);
+}
+
+/*************************************************************************/
+
+/*
+ * This method changes the execute permission bit of a file.
+ *
+ * Class: java_io_VMFile
+ * Method: setExecutable
+ * Signature: (Ljava/lang/String;ZZ)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_java_io_VMFile_setExecutable (JNIEnv *env,
+ jclass clazz __attribute__ ((__unused__)),
+ jstring name,
+ jboolean executable,
+ jboolean ownerOnly)
+{
+ return set_file_permissions (env, name, executable, ownerOnly,
+ CPFILE_FLAG_EXEC);
+}
+
+/*************************************************************************/
+
+JNIEXPORT jlong JNICALL
+Java_java_io_VMFile_getTotalSpace (JNIEnv *env,
+ jclass clazz __attribute__ ((__unused__)),
+ jstring path)
+{
+#ifndef WITHOUT_FILESYSTEM
+
+ jlong result;
+ const char *_path = NULL;
+
+ _path = (*env)->GetStringUTFChars (env, path, 0);
+ if (_path == NULL)
+ {
+ return 0L;
+ }
+
+ result = cpio_df (_path, TOTAL);
+
+ (*env)->ReleaseStringUTFChars (env, path, _path);
+
+ return result;
+
+#else /* not WITHOUT_FILESYSTEM */
+ return 0L;
+#endif /* not WITHOUT_FILESYSTEM */
+}
+
+/*************************************************************************/
+
+JNIEXPORT jlong JNICALL
+Java_java_io_VMFile_getFreeSpace (JNIEnv *env,
+ jclass clazz __attribute__ ((__unused__)),
+ jstring path)
+{
+#ifndef WITHOUT_FILESYSTEM
+
+ jlong result;
+ const char *_path = NULL;
+
+ _path = (*env)->GetStringUTFChars (env, path, 0);
+ if (_path == NULL)
+ {
+ return 0L;
+ }
+
+ result = cpio_df (_path, FREE);
+
+ (*env)->ReleaseStringUTFChars (env, path, _path);
+
+ return result;
+
+#else /* not WITHOUT_FILESYSTEM */
+ return 0L;
+#endif /* not WITHOUT_FILESYSTEM */
+}
+
+/*************************************************************************/
+
+JNIEXPORT jlong JNICALL
+Java_java_io_VMFile_getUsableSpace (JNIEnv *env,
+ jclass clazz __attribute__ ((__unused__)),
+ jstring path)
+{
+#ifndef WITHOUT_FILESYSTEM
+
+ jlong result;
+ const char *_path = NULL;
+
+ _path = (*env)->GetStringUTFChars (env, path, 0);
+ if (_path == NULL)
+ {
+ return 0L;
+ }
+
+ result = cpio_df (_path, USABLE);
+
+ (*env)->ReleaseStringUTFChars (env, path, _path);
+
+ return result;
+
+#else /* not WITHOUT_FILESYSTEM */
+ return 0L;
+#endif /* not WITHOUT_FILESYSTEM */
+}
+
+/*************************************************************************/
+
+/*
+ * This method checks to see if a file exists.
+ *
+ * Class: java_io_VMFile
+ * Method: exists
+ * Signature: (Ljava/lang/String;)Z
+ */
+
+JNIEXPORT jboolean JNICALL
+Java_java_io_VMFile_exists (JNIEnv * env,
+ jclass clazz __attribute__ ((__unused__)),
+ jstring name)
+{
+#ifndef WITHOUT_FILESYSTEM
+ const char *filename;
+ int result;
+
+ /* Don't use the JCL convert function because it throws an exception
+ on failure */
+ filename = (*env)->GetStringUTFChars (env, name, 0);
+ if (filename == NULL)
+ {
+ return 0;
+ }
+
+ result = cpio_isFileExists (filename);
+ (*env)->ReleaseStringUTFChars (env, name, filename);
+
+ return result == CPNATIVE_OK ? 1 : 0;
+#else /* not WITHOUT_FILESYSTEM */
+ return 0;
+#endif /* not WITHOUT_FILESYSTEM */
+}
+
+/*************************************************************************/
+
+/*
+ * This method checks to see if a file is a "plain" file; that is, not
+ * a directory, pipe, etc.
+ *
+ * Class: java_io_VMFile
+ * Method: isFile
+ * Signature: (Ljava/lang/String;)Z
+ */
+
+JNIEXPORT jboolean JNICALL
+Java_java_io_VMFile_isFile (JNIEnv * env,
+ jclass clazz __attribute__ ((__unused__)),
+ jstring name)
+{
+#ifndef WITHOUT_FILESYSTEM
+ const char *filename;
+ int result;
+ jint entryType;
+
+ /* Don't use the JCL convert function because it throws an exception
+ on failure */
+ filename = (*env)->GetStringUTFChars (env, name, 0);
+ if (filename == NULL)
+ {
+ return 0;
+ }
+
+ result = cpio_checkType (filename, &entryType);
+ (*env)->ReleaseStringUTFChars (env, name, filename);
+
+ return result == CPNATIVE_OK && entryType == CPFILE_FILE ? 1 : 0;
+#else /* not WITHOUT_FILESYSTEM */
+ return 0;
+#endif /* not WITHOUT_FILESYSTEM */
+}
+
+/*************************************************************************/
+
+/*
+ * This method checks to see if a file is a directory or not.
+ *
+ * Class: java_io_VMFile
+ * Method: isDirectory
+ * Signature: (Ljava/lang/String;)Z
+ */
+
+JNIEXPORT jboolean JNICALL
+Java_java_io_VMFile_isDirectory (JNIEnv * env,
+ jclass clazz __attribute__ ((__unused__)),
+ jstring name)
+{
+#ifndef WITHOUT_FILESYSTEM
+ const char *filename;
+ int result;
+ jint entryType;
+
+ /* Don't use the JCL convert function because it throws an exception
+ on failure */
+ filename = (*env)->GetStringUTFChars (env, name, 0);
+ if (filename == NULL)
+ {
+ return 0;
+ }
+
+ result = cpio_checkType (filename, &entryType);
+ (*env)->ReleaseStringUTFChars (env, name, filename);
+
+ return result == CPNATIVE_OK && entryType == CPFILE_DIRECTORY ? 1 : 0;
+#else /* not WITHOUT_FILESYSTEM */
+ return 0;
+#endif /* not WITHOUT_FILESYSTEM */
+}
+
+/*************************************************************************/
+
+/*
+ * This method returns the length of the file.
+ *
+ * Class: java_io_VMFile
+ * Method: length
+ * Signature: (Ljava/lang/String;)J
+ */
+
+JNIEXPORT jlong JNICALL
+Java_java_io_VMFile_length (JNIEnv * env,
+ jclass clazz __attribute__ ((__unused__)),
+ jstring name)
+{
+#ifndef WITHOUT_FILESYSTEM
+ const char *filename;
+ int tmpfd;
+ jlong length;
+ int result;
+
+ /* Don't use the JCL convert function because it throws an exception
+ on failure */
+ filename = (*env)->GetStringUTFChars (env, name, 0);
+ if (filename == NULL)
+ return 0;
+
+ /* open file for reading, get size and close file */
+ result = cpio_openFile (filename, &tmpfd, CPFILE_FLAG_READ, 0);
+ if (result != CPNATIVE_OK)
+ return 0;
+
+ result = cpio_getFileSize (tmpfd, &length);
+ if (result != CPNATIVE_OK)
+ {
+ cpio_closeFile (tmpfd);
+ return 0;
+ }
+
+ result = cpio_closeFile (tmpfd);
+ (*env)->ReleaseStringUTFChars (env, name, filename);
+
+ return result == CPNATIVE_OK ? length : 0;
+#else /* not WITHOUT_FILESYSTEM */
+ return 0;
+#endif /* not WITHOUT_FILESYSTEM */
+}
+
+/*************************************************************************/
+
+/*
+ * This method returns the modification date of the file.
+ *
+ * Class: java_io_VMFile
+ * Method: lastModified
+ * Signature: (Ljava/lang/String;)J
+ */
+
+JNIEXPORT jlong JNICALL
+Java_java_io_VMFile_lastModified (JNIEnv * env,
+ jclass clazz __attribute__ ((__unused__)),
+ jstring name)
+{
+#ifndef WITHOUT_FILESYSTEM
+ const char *filename;
+ jlong mtime;
+ int result;
+
+ /* Don't use the JCL convert function because it throws an exception
+ on failure */
+ filename = (*env)->GetStringUTFChars (env, name, 0);
+ if (filename == NULL)
+ {
+ return 0;
+ }
+
+ result = cpio_getModificationTime (filename, &mtime);
+ (*env)->ReleaseStringUTFChars (env, name, filename);
+
+ return result == CPNATIVE_OK ? mtime : 0;
+#else /* not WITHOUT_FILESYSTEM */
+ return 0;
+#endif /* not WITHOUT_FILESYSTEM */
+}
+
+/*************************************************************************/
+
+/*
+ * This method sets the modification date of the file.
+ *
+ * Class: java_io_VMFile
+ * Method: setLastModified
+ * Signature: (Ljava/lang/String;J)Z
+ */
+
+JNIEXPORT jboolean JNICALL
+Java_java_io_VMFile_setLastModified (JNIEnv * env,
+ jclass clazz __attribute__ ((__unused__)),
+ jstring name, jlong newtime)
+{
+#ifndef WITHOUT_FILESYSTEM
+ const char *filename;
+ int result;
+
+ /* Don't use the JCL convert function because it throws an exception
+ on failure */
+ filename = (*env)->GetStringUTFChars (env, name, 0);
+ if (filename == NULL)
+ {
+ return 0;
+ }
+
+ result = cpio_setModificationTime (filename, newtime);
+ (*env)->ReleaseStringUTFChars (env, name, filename);
+
+ return result == CPNATIVE_OK ? 1 : 0;
+#else /* not WITHOUT_FILESYSTEM */
+ return 0;
+#endif /* not WITHOUT_FILESYSTEM */
+}
+
+/*************************************************************************/
+
+/*
+ * This method deletes a file (actually a name for a file - additional
+ * links could exist).
+ *
+ * Class: java_io_VMFile
+ * Method: delete
+ * Signature: (Ljava/lang/String;)Z
+ */
+
+JNIEXPORT jboolean JNICALL
+Java_java_io_VMFile_delete (JNIEnv * env,
+ jclass clazz __attribute__ ((__unused__)),
+ jstring name)
+{
+#ifndef WITHOUT_FILESYSTEM
+ const char *filename;
+ int result;
+
+ /* Don't use the JCL convert function because it throws an exception
+ on failure */
+ filename = (*env)->GetStringUTFChars (env, name, 0);
+ if (filename == NULL)
+ {
+ return 0;
+ }
+
+ result = cpio_removeFile (filename);
+ (*env)->ReleaseStringUTFChars (env, name, filename);
+
+ return result == CPNATIVE_OK ? 1 : 0;
+#else /* not WITHOUT_FILESYSTEM */
+ return 0;
+#endif /* not WITHOUT_FILESYSTEM */
+}
+
+/*************************************************************************/
+
+/*
+ * This method creates a directory.
+ *
+ * Class: java_io_VMFile
+ * Method: mkdir
+ * Signature: (Ljava/lang/String;)Z
+ */
+
+JNIEXPORT jboolean JNICALL
+Java_java_io_VMFile_mkdir (JNIEnv * env,
+ jclass clazz __attribute__ ((__unused__)),
+ jstring name)
+{
+#ifndef WITHOUT_FILESYSTEM
+ const char *pathname;
+ int result;
+
+ /* Don't use the JCL convert function because it throws an exception
+ on failure */
+ pathname = (*env)->GetStringUTFChars (env, name, 0);
+ if (pathname == NULL)
+ {
+ return 0;
+ }
+
+ result = cpio_mkdir (pathname);
+ (*env)->ReleaseStringUTFChars (env, name, pathname);
+
+ return (result == CPNATIVE_OK) ? 1 : 0;
+#else /* not WITHOUT_FILESYSTEM */
+ return 0;
+#endif /* not WITHOUT_FILESYSTEM */
+}
+
+/*************************************************************************/
+
+/*
+ * This method renames a (link to a) file.
+ *
+ * Class: java_io_VMFile
+ * Method: renameTo
+ * Signature: (Ljava/lang/String;Ljava/lang/String;)Z
+ */
+
+JNIEXPORT jboolean JNICALL
+Java_java_io_VMFile_renameTo (JNIEnv * env,
+ jclass clazz __attribute__ ((__unused__)),
+ jstring t, jstring d)
+{
+#ifndef WITHOUT_FILESYSTEM
+ const char *old_filename, *new_filename;
+ int result;
+
+ /* Don't use the JCL convert function because it throws an exception
+ on failure */
+ old_filename = (*env)->GetStringUTFChars (env, t, 0);
+ if (old_filename == NULL)
+ {
+ return 0;
+ }
+
+ new_filename = (*env)->GetStringUTFChars (env, d, 0);
+ if (new_filename == NULL)
+ {
+ (*env)->ReleaseStringUTFChars (env, t, old_filename);
+ return 0;
+ }
+
+ result = cpio_rename (old_filename, new_filename);
+ (*env)->ReleaseStringUTFChars (env, d, new_filename);
+ (*env)->ReleaseStringUTFChars (env, t, old_filename);
+
+ return (result == CPNATIVE_OK) ? 1 : 0;
+#else /* not WITHOUT_FILESYSTEM */
+ return 0;
+#endif /* not WITHOUT_FILESYSTEM */
+}
+
+/*************************************************************************/
+
+/*
+ * This method returns an array of String representing all the files
+ * in a directory except "." and "..".
+ *
+ * Class: java_io_VMFile
+ * Method: list
+ * Signature: (Ljava/lang/String;)[Ljava/lang/String;
+ */
+
+JNIEXPORT jobjectArray JNICALL
+Java_java_io_VMFile_list (JNIEnv * env,
+ jclass clazz __attribute__ ((__unused__)),
+ jstring name)
+{
+#ifndef WITHOUT_FILESYSTEM
+ const int REALLOC_SIZE = 10;
+
+ const char *dirname;
+ int result;
+ char **filelist;
+ void *handle;
+ char *filename = (char *) JCL_malloc (env, FILENAME_MAX);
+ unsigned long int filelist_count, max_filelist_count;
+ char **tmp_filelist;
+ jclass str_clazz;
+ jobjectArray filearray;
+ unsigned long int i;
+ jstring str;
+
+ /* Don't use the JCL convert function because it throws an exception
+ on failure */
+ dirname = (*env)->GetStringUTFChars (env, name, 0);
+ if (dirname == NULL)
+ {
+ return 0;
+ }
+
+ /* open directory for reading */
+ result = cpio_openDir (dirname, &handle);
+
+ (*env)->ReleaseStringUTFChars (env, name, dirname);
+
+ if (result != CPNATIVE_OK)
+ {
+ return 0;
+ }
+
+ /* allocate filelist */
+ filelist = (char **) JCL_malloc (env, sizeof (char *) * REALLOC_SIZE);
+ if (filelist == NULL)
+ {
+ result = cpio_closeDir (handle);
+ return 0;
+ }
+ filelist_count = 0;
+ max_filelist_count = REALLOC_SIZE;
+
+ /* read the files from the directory */
+ result = cpio_readDir (handle, filename);
+ while (result == CPNATIVE_OK)
+ {
+ if ((strcmp (filename, ".") != 0) && (strcmp (filename, "..") != 0))
+ {
+ /* allocate more memory if necessary */
+ if (filelist_count >= max_filelist_count)
+ {
+ tmp_filelist = (char **) JCL_realloc (env,
+ filelist,
+ (max_filelist_count +
+ REALLOC_SIZE) *
+ sizeof (char *));
+ if (tmp_filelist == NULL)
+ {
+ for (i = 0; i < filelist_count; i++)
+ {
+ JCL_free (env, filelist[i]);
+ }
+ JCL_free (env, filelist);
+ result = cpio_closeDir (handle);
+ return 0;
+ }
+ filelist = tmp_filelist;
+ max_filelist_count += REALLOC_SIZE;
+ }
+
+ /* save entry in list (avoid strdup, because it is not ANSI C, thus difficult to port) */
+ filelist[filelist_count] =
+ (char *) JCL_malloc (env, strlen (filename) + 1);
+ assert (filelist[filelist_count] != NULL);
+ strcpy (filelist[filelist_count], filename);
+ filelist_count++;
+ }
+
+ /* read next directory entry */
+ result = cpio_readDir (handle, filename);
+ }
+
+ JCL_free (env, filename);
+
+ /* close directory */
+ result = cpio_closeDir (handle);
+
+ /* put the list of files into a Java String array and return it */
+ str_clazz = (*env)->FindClass (env, "java/lang/String");
+ if (str_clazz == NULL)
+ {
+ for (i = 0; i < filelist_count; i++)
+ {
+ JCL_free (env, filelist[i]);
+ }
+ JCL_free (env, filelist);
+ return 0;
+ }
+ filearray = (*env)->NewObjectArray (env, filelist_count, str_clazz, 0);
+ if (filearray == NULL)
+ {
+ for (i = 0; i < filelist_count; i++)
+ {
+ JCL_free (env, filelist[i]);
+ }
+ JCL_free (env, filelist);
+ return 0;
+ }
+
+ (*env)->DeleteLocalRef (env, str_clazz);
+
+ for (i = 0; i < filelist_count; i++)
+ {
+ /* create new string */
+ str = (*env)->NewStringUTF (env, filelist[i]);
+ if (str == NULL)
+ {
+ /* We don't clean up everything here, but if this failed,
+ something serious happened anyway */
+ for (i = 0; i < filelist_count; i++)
+ {
+ JCL_free (env, filelist[i]);
+ }
+ JCL_free (env, filelist);
+ return 0;
+ }
+
+ /* save into array */
+ (*env)->SetObjectArrayElement (env, filearray, i, str);
+
+ /* delete local reference */
+ (*env)->DeleteLocalRef (env, str);
+ }
+
+ /* free resources */
+ for (i = 0; i < filelist_count; i++)
+ {
+ JCL_free (env, filelist[i]);
+ }
+ JCL_free (env, filelist);
+
+ return filearray;
+#else /* not WITHOUT_FILESYSTEM */
+ return 0;
+#endif /* not WITHOUT_FILESYSTEM */
+}
+
+/*************************************************************************/
+
+/*
+ * These two methods are used to maintain dynamically allocated
+ * buffers for getCanonicalPath without the overhead of calling
+ * realloc every time a buffer is modified. Buffers are sized
+ * at the smallest multiple of CHUNKSIZ that is greater than or
+ * equal to the desired length. The default CHUNKSIZ is 256,
+ * longer than most paths, so in most cases a getCanonicalPath
+ * will require only one malloc per buffer.
+ */
+
+#define CHUNKLOG 8
+#define CHUNKSIZ (1 << CHUNKLOG)
+
+static int
+nextChunkSize (int size)
+{
+ return ((size >> CHUNKLOG) + ((size & (CHUNKSIZ - 1)) ? 1 : 0)) << CHUNKLOG;
+}
+
+static char *
+maybeGrowBuf (JNIEnv *env, char *buf, int *size, int required)
+{
+ if (required > *size)
+ {
+ *size = nextChunkSize (required);
+ buf = JCL_realloc (env, buf, *size);
+ }
+ return buf;
+}
+
+/*************************************************************************/
+
+/*
+ * This method converts a path to canonical form on GNU/Posix systems.
+ * This involves the removal of redundant separators, references to
+ * "." and "..", and symbolic links.
+ *
+ * The conversion proceeds on a component-by-component basis: symbolic
+ * links and references to ".." are resolved as and when they occur.
+ * This means that if "/foo/bar" is a symbolic link to "/baz" then the
+ * canonical form of "/foo/bar/.." is "/" and not "/foo".
+ *
+ * In order to mimic the behaviour of proprietary JVMs, non-existant
+ * path components are allowed (a departure from the normal GNU system
+ * convention). This means that if "/foo/bar" is a symbolic link to
+ * "/baz", the canonical form of "/non-existant-directory/../foo/bar"
+ * is "/baz".
+ *
+ * Class: java_io_VMFile
+ * Method: toCanonicalForm
+ * Signature: (Ljava/lang/String)Ljava/lang/String
+ */
+
+JNIEXPORT jstring JNICALL
+Java_java_io_VMFile_toCanonicalForm (JNIEnv *env,
+ jclass class __attribute__ ((__unused__)),
+ jstring jpath)
+{
+#ifndef WITHOUT_FILESYSTEM
+ const char *path;
+ char *src, *dst;
+ int srci, dsti;
+ int srcl, dstl;
+ int len;
+ int fschecks;
+#if defined (HAVE_LSTAT) && defined (HAVE_READLINK)
+ struct stat sb;
+#endif /* HAVE_LSTAT && HAVE_READLINK */
+
+ path = JCL_jstring_to_cstring (env, jpath);
+ if (path == NULL)
+ return NULL;
+
+ /* It is the caller's responsibility to ensure the path is absolute. */
+ if (path[0] == 0 || path[0] != '/')
+ {
+ JCL_free_cstring (env, jpath, path);
+ JCL_ThrowException (env, "java/lang/RuntimeException", "Not absolute");
+ return NULL;
+ }
+
+ len = strlen (path);
+ srcl = nextChunkSize (len + 1);
+ src = JCL_malloc (env, srcl);
+ if (src == NULL)
+ {
+ JCL_free_cstring (env, jpath, path);
+ return NULL;
+ }
+ strcpy (src, path);
+ JCL_free_cstring (env, jpath, path);
+ srci = 1;
+
+ dstl = nextChunkSize (2);
+ dst = JCL_malloc (env, dstl);
+ if (dst == NULL)
+ {
+ JCL_free (env, src);
+ return NULL;
+ }
+ dst[0] = '/';
+ dsti = 1;
+
+ fschecks = JNI_TRUE;
+
+ while (src[srci] != '\0')
+ {
+ int tmpi, dsti_save;
+
+ /* Skip slashes. */
+ while (src[srci] == '/')
+ srci++;
+ tmpi = srci;
+ /* Find next slash. */
+ while (src[srci] != '/' && src[srci] != '\0')
+ srci++;
+ if (srci == tmpi)
+ /* We hit the end. */
+ break;
+ len = srci - tmpi;
+
+ /* Handle "." and "..". */
+ if (len == 1 && src[tmpi] == '.')
+ continue;
+ if (len == 2 && src[tmpi] == '.' && src[tmpi + 1] == '.')
+ {
+ while (dsti > 1 && dst[dsti - 1] != '/')
+ dsti--;
+ if (dsti != 1)
+ dsti--;
+ /* Reenable filesystem checking if disabled, as we might
+ * have reversed over whatever caused the problem before.
+ * At least one proprietary JVM has inconsistencies because
+ * it does not do this.
+ */
+ fschecks = JNI_TRUE;
+ continue;
+ }
+
+ /* Handle real path components. */
+ dst = maybeGrowBuf (env,
+ dst, &dstl, dsti + (dsti > 1 ? 1 : 0) + len + 1);
+ if (dst == NULL)
+ {
+ JCL_free (env, src);
+ return NULL;
+ }
+ dsti_save = dsti;
+ if (dsti > 1)
+ dst[dsti++] = '/';
+ strncpy (&dst[dsti], &src[tmpi], len);
+ dsti += len;
+ if (fschecks == JNI_FALSE)
+ continue;
+
+#if defined (HAVE_LSTAT) && defined (HAVE_READLINK)
+ dst[dsti] = '\0';
+ if (lstat (dst, &sb) == 0)
+ {
+ if (S_ISLNK (sb.st_mode))
+ {
+ int tmpl = CHUNKSIZ;
+ char *tmp = JCL_malloc (env, tmpl);
+ if (tmp == NULL)
+ {
+ JCL_free (env, src);
+ JCL_free (env, dst);
+ return NULL;
+ }
+
+ while (1)
+ {
+ tmpi = readlink (dst, tmp, tmpl);
+ if (tmpi < 1)
+ {
+ JCL_free (env, src);
+ JCL_free (env, dst);
+ JCL_free (env, tmp);
+ JCL_ThrowException (env, "java/io/IOException",
+ "readlink failed");
+ return NULL;
+ }
+ if (tmpi < tmpl)
+ break;
+ tmpl += CHUNKSIZ;
+ tmp = JCL_realloc (env, tmp, tmpl);
+ }
+
+ /* Prepend the link's path to src. */
+ tmp = maybeGrowBuf (env,
+ tmp, &tmpl, tmpi + strlen (&src[srci]) + 1);
+ if (tmp == NULL)
+ {
+ JCL_free (env, src);
+ JCL_free (env, dst);
+ return NULL;
+ }
+
+ strcpy (&tmp[tmpi], &src[srci]);
+ JCL_free (env, src);
+ src = tmp;
+ srcl = tmpl;
+ srci = 0;
+
+ /* Either replace or append dst depending on whether the
+ * link is relative or absolute.
+ */
+ dsti = src[0] == '/' ? 1 : dsti_save;
+ }
+ }
+ else
+ {
+ /* Something doesn't exist, or we don't have permission to
+ * read it, or a previous path component is a directory, or
+ * a symlink is looped. Whatever, we can't check the
+ * filesystem any more.
+ */
+ fschecks = JNI_FALSE;
+ }
+#endif /* HAVE_LSTAT && HAVE_READLINK */
+ }
+ dst[dsti] = '\0';
+
+ jpath = (*env)->NewStringUTF (env, dst);
+ JCL_free (env, src);
+ JCL_free (env, dst);
+ return jpath;
+#else /* not WITHOUT_FILESYSTEM */
+ return NULL;
+#endif /* not WITHOUT_FILESYSTEM */
+}
+
+/*************************************************************************/
+
+/* ***** PRIVATE FUNCTIONS IMPLEMENTATION ***** */
+
+static jboolean set_file_permissions (JNIEnv *env, jstring name,
+ jboolean enable,
+ jboolean ownerOnly,
+ int permissions)
+{
+#ifndef WITHOUT_FILESYSTEM
+ const char *filename;
+ int result = JNI_FALSE;
+
+ /* Don't use the JCL convert function because it throws an exception
+ on failure */
+ filename = (*env)->GetStringUTFChars (env, name, 0);
+ if (filename == NULL)
+ {
+ return JNI_FALSE;
+ }
+
+ if (ownerOnly)
+ {
+ permissions |= CPFILE_FLAG_USR;
+ }
+
+ if (!enable)
+ {
+ permissions |= CPFILE_FLAG_OFF;
+ }
+
+ result = cpio_chmod (filename, permissions);
+ (*env)->ReleaseStringUTFChars (env, name, filename);
+
+ return result == CPNATIVE_OK ? JNI_TRUE : JNI_FALSE;
+
+#else /* not WITHOUT_FILESYSTEM */
+ return JNI_FALSE;
+#endif /* not WITHOUT_FILESYSTEM */
+}
diff --git a/libjava/classpath/native/jni/java-io/java_io_VMObjectInputStream.c b/libjava/classpath/native/jni/java-io/java_io_VMObjectInputStream.c
new file mode 100644
index 000000000..d8d807149
--- /dev/null
+++ b/libjava/classpath/native/jni/java-io/java_io_VMObjectInputStream.c
@@ -0,0 +1,69 @@
+/* java_io_VMObjectInputStream.c -- Native methods for ObjectInputStream class
+ Copyright (C) 1998, 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. */
+
+
+/* TODO: check exceptions */
+/* comments */
+
+/* do not move; needed here because of some macro definitions */
+#include <config.h>
+
+#include <jni.h>
+#include <jcl.h>
+
+#include "java_io_VMObjectInputStream.h"
+
+/*
+ * Class: java_io_VMObjectInputStream
+ * Method: allocateObject
+ * Signature: (Ljava/lang/Class;)Ljava/lang/Object;
+ */
+JNIEXPORT jobject JNICALL
+Java_java_io_VMObjectInputStream_allocateObject (JNIEnv * env,
+ jclass clazz
+ __attribute__((__unused__)),
+ jclass target_clazz,
+ jclass constr_clazz,
+ jobject constructor)
+{
+ jobject obj = (*env)->AllocObject (env, target_clazz);
+ jmethodID id = (*env)->FromReflectedMethod (env, constructor);
+
+ (*env)->CallNonvirtualVoidMethod (env, obj, constr_clazz, id);
+
+ return obj;
+}
diff --git a/libjava/classpath/native/jni/java-io/java_io_VMObjectStreamClass.c b/libjava/classpath/native/jni/java-io/java_io_VMObjectStreamClass.c
new file mode 100644
index 000000000..f5d785ecd
--- /dev/null
+++ b/libjava/classpath/native/jni/java-io/java_io_VMObjectStreamClass.c
@@ -0,0 +1,381 @@
+/* java_io_VMObjectStreamClass.c -- Native methods for VMObjectStreamClass.java
+ Copyright (C) 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 <jni.h>
+#include <jcl.h>
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "java_io_VMObjectStreamClass.h"
+
+/*
+ * Class: java_io_VMObjectOutputStream
+ * Method: hasClassInitializer
+ * Signature: (Ljava/lang/Class;)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_java_io_VMObjectStreamClass_hasClassInitializer (JNIEnv * env,
+ jclass vmosklass
+ __attribute__ ((__unused__)), jclass klass)
+{
+ jmethodID mid = (*env)->GetStaticMethodID (env, klass, "<clinit>", "()V");
+ if (mid == NULL)
+ {
+ (*env)->ExceptionClear (env);
+ return JNI_FALSE;
+ }
+ return JNI_TRUE;
+}
+
+static void
+throwInternalError (JNIEnv * env)
+{
+ jclass internalErrorClass;
+ jthrowable previousException, newException;
+ jmethodID initException, getMessageID, initCauseID;
+ jstring message;
+
+ internalErrorClass = (*env)->FindClass (env, "java/lang/InternalError");
+ /** Just give up if this also fails. */
+ if (internalErrorClass == NULL)
+ return;
+
+ previousException = (*env)->ExceptionOccurred (env);
+
+ if (previousException == NULL)
+ {
+ (*env)->ThrowNew (env, internalErrorClass,
+ "Unknown error raised by the VM");
+ return;
+ }
+
+ initException = (*env)->GetMethodID
+ (env, internalErrorClass, "<init>", "(Ljava/lang/String;)V");
+ getMessageID = (*env)->GetMethodID
+ (env, (*env)->GetObjectClass (env, previousException),
+ "getMessage", "()Ljava/lang/String;");
+ initCauseID = (*env)->GetMethodID
+ (env, internalErrorClass, "initCause", "(Ljava/lang/Throwable;)V");
+
+ message = (*env)->CallObjectMethod (env, previousException, getMessageID);
+
+ newException = (*env)->NewObject (env, internalErrorClass, initException,
+ message);
+ (*env)->CallVoidMethod (env, newException, initCauseID, previousException);
+
+ (*env)->ExceptionClear (env);
+ (*env)->Throw (env, newException);
+}
+
+static jfieldID
+getFieldReference (JNIEnv * env, jobject field, const char *type)
+{
+ jclass classClass;
+ jclass fieldClass;
+ jclass declaringClass;
+ jclass typeClass;
+ jfieldID fid;
+ const char *field_name;
+ const char *type_name;
+ int type_len;
+ jmethodID mid;
+ jstring name;
+ jstring tname;
+ int i;
+
+ fieldClass = (*env)->GetObjectClass (env, field);
+
+ mid =
+ (*env)->GetMethodID (env, fieldClass, "getName", "()Ljava/lang/String;");
+ if (mid == NULL || (*env)->ExceptionOccurred (env) != NULL)
+ {
+ throwInternalError (env);
+ return NULL;
+ }
+
+ name = (*env)->CallObjectMethod (env, field, mid);
+ field_name = (*env)->GetStringUTFChars (env, name, NULL);
+
+ mid = (*env)->GetMethodID (env, fieldClass,
+ "getDeclaringClass", "()Ljava/lang/Class;");
+ if (mid == NULL || (*env)->ExceptionOccurred (env) != NULL)
+ {
+ throwInternalError (env);
+ return NULL;
+ }
+
+ declaringClass = (*env)->CallObjectMethod (env, field, mid);
+
+ /* Do we need to find out the exact type descriptor of the field? */
+ if (type == NULL)
+ {
+ char *the_type;
+
+ mid = (*env)->GetMethodID (env, fieldClass,
+ "getType", "()Ljava/lang/Class;");
+
+ if (mid == NULL || (*env)->ExceptionOccurred (env) != NULL)
+ {
+ throwInternalError (env);
+ return NULL;
+ }
+
+ typeClass = (*env)->CallObjectMethod (env, field, mid);
+ classClass = (*env)->FindClass (env, "java/lang/Class");
+
+ mid = (*env)->GetMethodID (env, classClass,
+ "getName", "()Ljava/lang/String;");
+
+ if (mid == NULL || (*env)->ExceptionOccurred (env) != NULL)
+ {
+ throwInternalError (env);
+ return NULL;
+ }
+
+ tname = (*env)->CallObjectMethod (env, typeClass, mid);
+ type_name = (*env)->GetStringUTFChars (env, tname, NULL);
+
+ /*
+ * If it isn't an array class then the actual field type descriptor
+ * starts with 'L', ends with ';' and has '/' instead of '.'.
+ */
+ type_len = strlen (type_name);
+ if (type_name[0] != '[')
+ {
+ /* XXX - FIXME - should not use dynamic allocation in core lib. */
+ the_type = (char *) malloc (type_len + 3);
+ the_type[0] = 'L';
+ the_type[type_len + 1] = ';';
+ the_type[type_len + 2] = '\0';
+ the_type++;
+ }
+ else
+ {
+ /* XXX - FIXME - should not use dynamic allocation in core lib. */
+ the_type = (char *) malloc (type_len + 1);
+ the_type[type_len] = '\0';
+ }
+
+ for (i = 0; i < type_len; i++)
+ if (type_name[i] == '.')
+ the_type[i] = '/';
+ else
+ the_type[i] = type_name[i];
+
+ if (type_name[0] != '[')
+ the_type--;
+
+ (*env)->ReleaseStringUTFChars (env, tname, type_name);
+ fid = (*env)->GetFieldID (env, declaringClass, field_name, the_type);
+ free (the_type);
+ }
+ else
+ {
+ type_len = -1;
+ fid = (*env)->GetFieldID (env, declaringClass, field_name, type);
+ }
+
+ if (fid == NULL)
+ {
+ throwInternalError (env);
+ return NULL;
+ }
+ (*env)->ReleaseStringUTFChars (env, name, field_name);
+
+ return fid;
+}
+
+/*
+ * Class: java_io_VMObjectOutputStream
+ * Method: setBooleanNative
+ * Signature: (Ljava/lang/reflect/Field;Ljava/lang/Object;Z)V
+ */
+JNIEXPORT void JNICALL
+Java_java_io_VMObjectStreamClass_setBooleanNative (JNIEnv * env,
+ jclass vmosklass
+ __attribute__ ((__unused__)), jobject field, jobject object, jboolean value)
+{
+ jfieldID fid = getFieldReference (env, field, "Z");
+
+ if (fid != NULL)
+ (*env)->SetBooleanField (env, object, fid, value);
+}
+
+/*
+ * Class: java_io_VMObjectOutputStream
+ * Method: setCharNative
+ * Signature: (Ljava/lang/reflect/Field;Ljava/lang/Object;C)V
+ */
+JNIEXPORT void JNICALL
+Java_java_io_VMObjectStreamClass_setCharNative (JNIEnv * env,
+ jclass vmosklass
+ __attribute__ ((__unused__)),
+ jobject field,
+ jobject object, jchar value)
+{
+ jfieldID fid = getFieldReference (env, field, "C");
+
+ if (fid != NULL)
+ (*env)->SetCharField (env, object, fid, value);
+}
+
+/*
+ * Class: java_io_VMObjectOutputStream
+ * Method: setByteNative
+ * Signature: (Ljava/lang/reflect/Field;Ljava/lang/Object;B)V
+ */
+JNIEXPORT void JNICALL
+Java_java_io_VMObjectStreamClass_setByteNative (JNIEnv * env,
+ jclass vmosklass
+ __attribute__ ((__unused__)),
+ jobject field,
+ jobject object, jbyte value)
+{
+ jfieldID fid = getFieldReference (env, field, "B");
+
+ if (fid != NULL)
+ (*env)->SetByteField (env, object, fid, value);
+}
+
+
+/*
+ * Class: java_io_VMObjectOutputStream
+ * Method: setShortNative
+ * Signature: (Ljava/lang/reflect/Field;Ljava/lang/Object;S)V
+ */
+JNIEXPORT void JNICALL
+Java_java_io_VMObjectStreamClass_setShortNative (JNIEnv * env,
+ jclass vmosklass
+ __attribute__ ((__unused__)),
+ jobject field,
+ jobject object, jshort value)
+{
+ jfieldID fid = getFieldReference (env, field, "S");
+
+ if (fid != NULL)
+ (*env)->SetShortField (env, object, fid, value);
+}
+
+/*
+ * Class: java_io_VMObjectOutputStream
+ * Method: setIntNative
+ * Signature: (Ljava/lang/reflect/Field;Ljava/lang/Object;I)V
+ */
+JNIEXPORT void JNICALL
+Java_java_io_VMObjectStreamClass_setIntNative (JNIEnv * env,
+ jclass vmosklass
+ __attribute__ ((__unused__)),
+ jobject field,
+ jobject object, jint value)
+{
+ jfieldID fid = getFieldReference (env, field, "I");
+
+ if (fid != NULL)
+ (*env)->SetIntField (env, object, fid, value);
+}
+
+
+/*
+ * Class: java_io_VMObjectOutputStream
+ * Method: setLongNative
+ * Signature: (Ljava/lang/reflect/Field;Ljava/lang/Object;J)V
+ */
+JNIEXPORT void JNICALL
+Java_java_io_VMObjectStreamClass_setLongNative (JNIEnv * env,
+ jclass vmosklass
+ __attribute__ ((__unused__)),
+ jobject field,
+ jobject object, jlong value)
+{
+ jfieldID fid = getFieldReference (env, field, "J");
+
+ if (fid != NULL)
+ (*env)->SetLongField (env, object, fid, value);
+}
+
+
+/*
+ * Class: java_io_VMObjectOutputStream
+ * Method: setFloatNative
+ * Signature: (Ljava/lang/reflect/Field;Ljava/lang/Object;F)V
+ */
+JNIEXPORT void JNICALL
+Java_java_io_VMObjectStreamClass_setFloatNative (JNIEnv * env,
+ jclass vmosklass
+ __attribute__ ((__unused__)),
+ jobject field,
+ jobject object, jfloat value)
+{
+ jfieldID fid = getFieldReference (env, field, "F");
+
+ if (fid != NULL)
+ (*env)->SetFloatField (env, object, fid, value);
+}
+
+/*
+ * Class: java_io_VMObjectOutputStream
+ * Method: setDoubleNative
+ * Signature: (Ljava/lang/reflect/Field;Ljava/lang/Object;D)V
+ */
+JNIEXPORT void JNICALL
+Java_java_io_VMObjectStreamClass_setDoubleNative (JNIEnv * env,
+ jclass vmosklass
+ __attribute__ ((__unused__)), jobject field, jobject object, jdouble value)
+{
+ jfieldID fid = getFieldReference (env, field, "D");
+
+ if (fid != NULL)
+ (*env)->SetDoubleField (env, object, fid, value);
+}
+
+/*
+ * Class: java_io_VMObjectOutputStream
+ * Method: setObjectNative
+ * Signature: (Ljava/lang/reflect/Field;Ljava/lang/Object;Ljava/lang/Object;)V
+ */
+JNIEXPORT void JNICALL
+Java_java_io_VMObjectStreamClass_setObjectNative (JNIEnv * env,
+ jclass vmosklass
+ __attribute__ ((__unused__)), jobject field, jobject object, jobject value)
+{
+ jfieldID fid = getFieldReference (env, field, NULL);
+
+ if (fid != NULL)
+ (*env)->SetObjectField (env, object, fid, value);
+}