From 4ba6d1c3e2c8fc01c1e0f87c1417f9350b2ccf80 Mon Sep 17 00:00:00 2001 From: Michael Koch Date: Tue, 11 Nov 2003 11:49:12 +0000 Subject: natPipeImpl.cc, [...]: Removed 2003-11-11 Michael Koch * gnu/java/nio/natPipeImpl.cc, gnu/java/nio/natSelectorImpl.cc: Removed * gnu/java/nio/natPipeImplEcos.cc, gnu/java/nio/natPipeImplPosix.cc, gnu/java/nio/natPipeImplWin32.cc, gnu/java/nio/natSelectorImplEcos.cc, gnu/java/nio/natSelectorImplPosix.cc, gnu/java/nio/natSelectorImplWin32.cc: New files * configure.in: Create links for gnu/java/nio/natPipeImpl.cc and gnu/java/nio/natSelectorImpl.cc * configure: Regenerated. From-SVN: r73446 --- libjava/gnu/java/nio/natPipeImpl.cc | 38 ------------ libjava/gnu/java/nio/natPipeImplEcos.cc | 25 ++++++++ libjava/gnu/java/nio/natPipeImplPosix.cc | 38 ++++++++++++ libjava/gnu/java/nio/natPipeImplWin32.cc | 38 ++++++++++++ libjava/gnu/java/nio/natSelectorImpl.cc | 91 ---------------------------- libjava/gnu/java/nio/natSelectorImplEcos.cc | 25 ++++++++ libjava/gnu/java/nio/natSelectorImplPosix.cc | 91 ++++++++++++++++++++++++++++ libjava/gnu/java/nio/natSelectorImplWin32.cc | 91 ++++++++++++++++++++++++++++ 8 files changed, 308 insertions(+), 129 deletions(-) delete mode 100644 libjava/gnu/java/nio/natPipeImpl.cc create mode 100644 libjava/gnu/java/nio/natPipeImplEcos.cc create mode 100644 libjava/gnu/java/nio/natPipeImplPosix.cc create mode 100644 libjava/gnu/java/nio/natPipeImplWin32.cc delete mode 100644 libjava/gnu/java/nio/natSelectorImpl.cc create mode 100644 libjava/gnu/java/nio/natSelectorImplEcos.cc create mode 100644 libjava/gnu/java/nio/natSelectorImplPosix.cc create mode 100644 libjava/gnu/java/nio/natSelectorImplWin32.cc (limited to 'libjava/gnu/java') diff --git a/libjava/gnu/java/nio/natPipeImpl.cc b/libjava/gnu/java/nio/natPipeImpl.cc deleted file mode 100644 index caae89c..0000000 --- a/libjava/gnu/java/nio/natPipeImpl.cc +++ /dev/null @@ -1,38 +0,0 @@ -// natPipeImpl.cc - -/* Copyright (C) 2003 Free Software Foundation - - 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 -#include - -#include -#include -#include - -#include -//#include -//#include -#include -#include - -void -gnu::java::nio::PipeImpl::nativeInit (::java::nio::channels::spi::SelectorProvider* /*provider*/) -{ - int filedes [2]; - - if (_Jv_pipe (filedes) < 0) - throw new ::java::io::IOException (JvNewStringUTF (strerror (errno))); - - /* FIXME - source = new gnu::java::nio::PipeImpl$SourceChannelImpl - (this, provider, filedes [0]); - sink = new gnu::java::nio::PipeImpl$SinkChannelImpl - (this, provider, filedes [1]); - */ -} diff --git a/libjava/gnu/java/nio/natPipeImplEcos.cc b/libjava/gnu/java/nio/natPipeImplEcos.cc new file mode 100644 index 0000000..7c6b4b5 --- /dev/null +++ b/libjava/gnu/java/nio/natPipeImplEcos.cc @@ -0,0 +1,25 @@ +// natPipeImplEcos.cc + +/* Copyright (C) 2003 Free Software Foundation + + 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 +#include + +#include +#include +#include + +#include +#include + +void +gnu::java::nio::PipeImpl::nativeInit (::java::nio::channels::spi::SelectorProvider*) +{ + throw new ::java::io::IOException (JvNewStringUTF ("nativeInit() not implemented")); +} diff --git a/libjava/gnu/java/nio/natPipeImplPosix.cc b/libjava/gnu/java/nio/natPipeImplPosix.cc new file mode 100644 index 0000000..b847faa --- /dev/null +++ b/libjava/gnu/java/nio/natPipeImplPosix.cc @@ -0,0 +1,38 @@ +// natPipeImplPosix.cc + +/* Copyright (C) 2003 Free Software Foundation + + 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 +#include + +#include +#include +#include + +#include +//#include +//#include +#include +#include + +void +gnu::java::nio::PipeImpl::nativeInit (::java::nio::channels::spi::SelectorProvider* /*provider*/) +{ + int filedes [2]; + + if (_Jv_pipe (filedes) < 0) + throw new ::java::io::IOException (JvNewStringUTF (strerror (errno))); + + /* FIXME + source = new gnu::java::nio::PipeImpl$SourceChannelImpl + (this, provider, filedes [0]); + sink = new gnu::java::nio::PipeImpl$SinkChannelImpl + (this, provider, filedes [1]); + */ +} diff --git a/libjava/gnu/java/nio/natPipeImplWin32.cc b/libjava/gnu/java/nio/natPipeImplWin32.cc new file mode 100644 index 0000000..4f48972 --- /dev/null +++ b/libjava/gnu/java/nio/natPipeImplWin32.cc @@ -0,0 +1,38 @@ +// natPipeImplWin32.cc + +/* Copyright (C) 2003 Free Software Foundation + + 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 +#include + +#include +#include +#include + +#include +//#include +//#include +#include +#include + +void +gnu::java::nio::PipeImpl::nativeInit (::java::nio::channels::spi::SelectorProvider* /*provider*/) +{ + int filedes [2]; + + if (_Jv_pipe (filedes) < 0) + throw new ::java::io::IOException (JvNewStringUTF (strerror (errno))); + + /* FIXME + source = new gnu::java::nio::PipeImpl$SourceChannelImpl + (this, provider, filedes [0]); + sink = new gnu::java::nio::PipeImpl$SinkChannelImpl + (this, provider, filedes [1]); + */ +} diff --git a/libjava/gnu/java/nio/natSelectorImpl.cc b/libjava/gnu/java/nio/natSelectorImpl.cc deleted file mode 100644 index 764167a..0000000 --- a/libjava/gnu/java/nio/natSelectorImpl.cc +++ /dev/null @@ -1,91 +0,0 @@ -// natSelectorImpl.cc - -/* Copyright (C) 2002, 2003 Free Software Foundation - - 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 -#include - -#include -#include - -#include -#include - -void -helper_put_filedescriptors (jintArray fdArray, fd_set& fds, int& max_fd) -{ - jint* tmpFDArray = elements (fdArray); - - for (int index = 0; index < JvGetArrayLength (fdArray); index++) - { - FD_SET (tmpFDArray [index], &fds); - - if (tmpFDArray [index] > max_fd) - max_fd = tmpFDArray [index]; - } -} - -void -helper_get_filedescriptors (jintArray& fdArray, fd_set fds) -{ - jint* tmpFDArray = elements (fdArray); - - for (int index = 0; index < JvGetArrayLength (fdArray); index++) - if (!FD_ISSET (tmpFDArray [index], &fds)) - tmpFDArray [index] = 0; -} - -jint -gnu::java::nio::SelectorImpl::implSelect (jintArray read, jintArray write, - jintArray except, jlong timeout) -{ - jint result; - int max_fd = 0; - fd_set read_fds; - fd_set write_fds; - fd_set except_fds; - struct timeval real_time_data; - struct timeval *time_data = NULL; - - real_time_data.tv_sec = 0; - real_time_data.tv_usec = timeout; - - // If not legal timeout value is given, use NULL. - // This means an infinite timeout. - if (timeout >= 0) - { - time_data = &real_time_data; - } - - // Reset all fd_set structures - FD_ZERO (&read_fds); - FD_ZERO (&write_fds); - FD_ZERO (&except_fds); - - // Fill the fd_set data structures for the _Jv_select() call. - helper_put_filedescriptors (read, read_fds, max_fd); - helper_put_filedescriptors (write, write_fds, max_fd); - helper_put_filedescriptors (except, except_fds, max_fd); - - // Actually do the select - result = _Jv_select (max_fd + 1, &read_fds, &write_fds, &except_fds, time_data); - - if (result < 0) - { - char* strerr = strerror (errno); - throw new ::java::io::IOException (JvNewStringUTF (strerr)); - } - - // Set the file descriptors according to the values returned from select(). - helper_get_filedescriptors (read, read_fds); - helper_get_filedescriptors (write, write_fds); - helper_get_filedescriptors (except, except_fds); - - return result; -} diff --git a/libjava/gnu/java/nio/natSelectorImplEcos.cc b/libjava/gnu/java/nio/natSelectorImplEcos.cc new file mode 100644 index 0000000..a733686 --- /dev/null +++ b/libjava/gnu/java/nio/natSelectorImplEcos.cc @@ -0,0 +1,25 @@ +// natSelectorImplEcos.cc + +/* Copyright (C) 2003 Free Software Foundation + + 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 +#include + +#include +#include + +#include +#include + +jint +gnu::java::nio::SelectorImpl::implSelect (jintArray read, jintArray write, + jintArray except, jlong timeout) +{ + throw new ::java::io::IOException (JvNewStringUTF ("implSelect() not implemented")); +} diff --git a/libjava/gnu/java/nio/natSelectorImplPosix.cc b/libjava/gnu/java/nio/natSelectorImplPosix.cc new file mode 100644 index 0000000..8a5112f --- /dev/null +++ b/libjava/gnu/java/nio/natSelectorImplPosix.cc @@ -0,0 +1,91 @@ +// natSelectorImplPosix.cc + +/* Copyright (C) 2002, 2003 Free Software Foundation + + 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 +#include + +#include +#include + +#include +#include + +void +helper_put_filedescriptors (jintArray fdArray, fd_set& fds, int& max_fd) +{ + jint* tmpFDArray = elements (fdArray); + + for (int index = 0; index < JvGetArrayLength (fdArray); index++) + { + FD_SET (tmpFDArray [index], &fds); + + if (tmpFDArray [index] > max_fd) + max_fd = tmpFDArray [index]; + } +} + +void +helper_get_filedescriptors (jintArray& fdArray, fd_set fds) +{ + jint* tmpFDArray = elements (fdArray); + + for (int index = 0; index < JvGetArrayLength (fdArray); index++) + if (!FD_ISSET (tmpFDArray [index], &fds)) + tmpFDArray [index] = 0; +} + +jint +gnu::java::nio::SelectorImpl::implSelect (jintArray read, jintArray write, + jintArray except, jlong timeout) +{ + jint result; + int max_fd = 0; + fd_set read_fds; + fd_set write_fds; + fd_set except_fds; + struct timeval real_time_data; + struct timeval *time_data = NULL; + + real_time_data.tv_sec = 0; + real_time_data.tv_usec = timeout; + + // If not legal timeout value is given, use NULL. + // This means an infinite timeout. + if (timeout >= 0) + { + time_data = &real_time_data; + } + + // Reset all fd_set structures + FD_ZERO (&read_fds); + FD_ZERO (&write_fds); + FD_ZERO (&except_fds); + + // Fill the fd_set data structures for the _Jv_select() call. + helper_put_filedescriptors (read, read_fds, max_fd); + helper_put_filedescriptors (write, write_fds, max_fd); + helper_put_filedescriptors (except, except_fds, max_fd); + + // Actually do the select + result = _Jv_select (max_fd + 1, &read_fds, &write_fds, &except_fds, time_data); + + if (result < 0) + { + char* strerr = strerror (errno); + throw new ::java::io::IOException (JvNewStringUTF (strerr)); + } + + // Set the file descriptors according to the values returned from select(). + helper_get_filedescriptors (read, read_fds); + helper_get_filedescriptors (write, write_fds); + helper_get_filedescriptors (except, except_fds); + + return result; +} diff --git a/libjava/gnu/java/nio/natSelectorImplWin32.cc b/libjava/gnu/java/nio/natSelectorImplWin32.cc new file mode 100644 index 0000000..c82c2aa --- /dev/null +++ b/libjava/gnu/java/nio/natSelectorImplWin32.cc @@ -0,0 +1,91 @@ +// natSelectorImplWin32.cc + +/* Copyright (C) 2003 Free Software Foundation + + 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 +#include + +#include +#include + +#include +#include + +void +helper_put_filedescriptors (jintArray fdArray, fd_set& fds, int& max_fd) +{ + jint* tmpFDArray = elements (fdArray); + + for (int index = 0; index < JvGetArrayLength (fdArray); index++) + { + FD_SET (tmpFDArray [index], &fds); + + if (tmpFDArray [index] > max_fd) + max_fd = tmpFDArray [index]; + } +} + +void +helper_get_filedescriptors (jintArray& fdArray, fd_set fds) +{ + jint* tmpFDArray = elements (fdArray); + + for (int index = 0; index < JvGetArrayLength (fdArray); index++) + if (!FD_ISSET (tmpFDArray [index], &fds)) + tmpFDArray [index] = 0; +} + +jint +gnu::java::nio::SelectorImpl::implSelect (jintArray read, jintArray write, + jintArray except, jlong timeout) +{ + jint result; + int max_fd = 0; + fd_set read_fds; + fd_set write_fds; + fd_set except_fds; + struct timeval real_time_data; + struct timeval *time_data = NULL; + + real_time_data.tv_sec = 0; + real_time_data.tv_usec = timeout; + + // If not legal timeout value is given, use NULL. + // This means an infinite timeout. + if (timeout >= 0) + { + time_data = &real_time_data; + } + + // Reset all fd_set structures + FD_ZERO (&read_fds); + FD_ZERO (&write_fds); + FD_ZERO (&except_fds); + + // Fill the fd_set data structures for the _Jv_select() call. + helper_put_filedescriptors (read, read_fds, max_fd); + helper_put_filedescriptors (write, write_fds, max_fd); + helper_put_filedescriptors (except, except_fds, max_fd); + + // Actually do the select + result = _Jv_select (max_fd + 1, &read_fds, &write_fds, &except_fds, time_data); + + if (result < 0) + { + char* strerr = strerror (errno); + throw new ::java::io::IOException (JvNewStringUTF (strerr)); + } + + // Set the file descriptors according to the values returned from select(). + helper_get_filedescriptors (read, read_fds); + helper_get_filedescriptors (write, write_fds); + helper_get_filedescriptors (except, except_fds); + + return result; +} -- cgit v1.1