mirror of
git://gcc.gnu.org/git/gcc.git
synced 2024-12-30 09:34:51 +08:00
27e934d8ba
* configure: Rebuilt. * configure.in: Build include/Makefile. * Makefile.in: Rebuilt. * Makefile.am (SUBDIRS): Added gcj and include. (install-data-local): New target. (extra_headers): New macro. * include/Makefile.in: New file. * include/Makefile.am: New file. * interpret.cc: Don't include gcj/field.h or gcj/cni.h. * java/lang/reflect/natField.cc: Don't include gcj/field.h or gcj/cni.h. * boehm.cc: Don't include java-threads.h or gcj/field.h. * resolve.cc: Include config.h. * defineclass.cc: Include config.h. * include/java-interp.h: Don't include config.h. * include/jvm.h: Include java-threads.h, Object.h, java-gc.h, cni.h. * gcj/javaprims.h: Regenerated namespace decls. * classes.pl (scan): Don't put `;' after closing brace. * Makefile.in: Rebuilt. * Makefile.am (INCLUDES): Added -I for top_srcdir. * configure.in: Create gcj/Makefile. * gcj/Makefile.in: New file. * gcj/Makefile.am: New file. * java/lang/Object.h: Don't include any other headers. * gcj/array.h: Renamed from include/java-array.h. * gcj/field.h: Renamed from include/java-field.h. * gcj/method.h: Renamed from include/java-method.h. * gcj/cni.h, gcj/javaprims.h: Moved from include/. Updated all files to reflect new include structure. From-SVN: r29278
133 lines
2.5 KiB
C++
133 lines
2.5 KiB
C++
// natFileDescriptor.cc - Native part of FileDescriptor class.
|
|
|
|
/* Copyright (C) 1998, 1999 Cygnus Solutions
|
|
|
|
This file is part of libgcj.
|
|
|
|
This software is copyrighted work licensed under the terms of the
|
|
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
|
|
details. */
|
|
|
|
#include <config.h>
|
|
|
|
#include <errno.h>
|
|
#include <string.h>
|
|
#include <sys/types.h>
|
|
#include <sys/stat.h>
|
|
#include <sys/param.h>
|
|
|
|
#include <gcj/cni.h>
|
|
#include <jvm.h>
|
|
#include <java/io/FileDescriptor.h>
|
|
#include <java/io/SyncFailedException.h>
|
|
#include <java/io/IOException.h>
|
|
#include <java/io/EOFException.h>
|
|
#include <java/lang/ArrayIndexOutOfBoundsException.h>
|
|
#include <java/lang/NullPointerException.h>
|
|
#include <java/lang/String.h>
|
|
#include <java/io/FileNotFoundException.h>
|
|
|
|
extern "C" void diag_write_char (char c);
|
|
|
|
static void
|
|
diag_write (char *data, int len)
|
|
{
|
|
while (len > 0)
|
|
{
|
|
diag_write_char (*data++);
|
|
len--;
|
|
}
|
|
}
|
|
|
|
#define NO_FSYNC_MESSAGE "sync unsupported"
|
|
|
|
jboolean
|
|
java::io::FileDescriptor::valid (void)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
void
|
|
java::io::FileDescriptor::sync (void)
|
|
{
|
|
// Some files don't support fsync. We don't bother reporting these
|
|
// as errors.
|
|
#ifdef HAVE_FSYNC
|
|
#else
|
|
JvThrow (new SyncFailedException (JvNewStringLatin1 (NO_FSYNC_MESSAGE)));
|
|
#endif
|
|
}
|
|
|
|
jint
|
|
java::io::FileDescriptor::open (jstring path, jint jflags)
|
|
{
|
|
return fd;
|
|
}
|
|
|
|
void
|
|
java::io::FileDescriptor::write (jint b)
|
|
{
|
|
char d = (char) b;
|
|
::diag_write (&d, 1);
|
|
}
|
|
|
|
void
|
|
java::io::FileDescriptor::write (jbyteArray b, jint offset, jint len)
|
|
{
|
|
if (! b)
|
|
JvThrow (new java::lang::NullPointerException);
|
|
if (offset < 0 || len < 0 || offset + len > JvGetArrayLength (b))
|
|
JvThrow (new java::lang::ArrayIndexOutOfBoundsException);
|
|
char *bytes = (char *)elements (b) + offset;
|
|
::diag_write (bytes, len);
|
|
}
|
|
|
|
void
|
|
java::io::FileDescriptor::close (void)
|
|
{
|
|
}
|
|
|
|
jint
|
|
java::io::FileDescriptor::seek (jlong pos, jint whence)
|
|
{
|
|
JvAssert (whence == SET || whence == CUR);
|
|
|
|
jlong len = length ();
|
|
jlong here = getFilePointer ();
|
|
|
|
if ((whence == SET && pos > len) || (whence == CUR && here + pos > len))
|
|
JvThrow (new EOFException);
|
|
|
|
return 0;
|
|
}
|
|
|
|
jlong
|
|
java::io::FileDescriptor::length (void)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
jlong
|
|
java::io::FileDescriptor::getFilePointer (void)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
jint
|
|
java::io::FileDescriptor::read (void)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
jint
|
|
java::io::FileDescriptor::read (jbyteArray buffer, jint offset, jint count)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
jint
|
|
java::io::FileDescriptor::available (void)
|
|
{
|
|
return 0;
|
|
}
|