aboutsummaryrefslogtreecommitdiff
path: root/libjava/java
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2000-08-02 21:54:04 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2000-08-02 21:54:04 +0000
commit8e7328b6e0cc88f98dc25570d244833add8c296b (patch)
tree03fe690813ad84c550ddb18c4058221d6290e55a /libjava/java
parent7559fcc7808b8568071c82e0d494fc297ac613ad (diff)
* Makefile.in: Rebuilt.
* Makefile.am (libgcj_la_SOURCES): Added posix.cc. * java/net/natPlainSocketImpl.cc: Include posix.h. (accept): Use _Jv_select. * java/net/natPlainDatagramSocketImpl.cc: Include posix.h. (receive): Use _Jv_select. * java/io/natFileDescriptorPosix.cc: Include posix.h. (available): Use _Jv_select. * java/lang/natSystem.cc: Include posix.h. (currentTimeMillis): Use _Jv_gettimeofday. * include/posix.h: New file. * posix.cc: New file. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@35435 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java')
-rw-r--r--libjava/java/io/natFileDescriptorPosix.cc11
-rw-r--r--libjava/java/lang/natSystem.cc32
-rw-r--r--libjava/java/net/natPlainDatagramSocketImpl.cc10
-rw-r--r--libjava/java/net/natPlainSocketImpl.cc10
4 files changed, 11 insertions, 52 deletions
diff --git a/libjava/java/io/natFileDescriptorPosix.cc b/libjava/java/io/natFileDescriptorPosix.cc
index 6e06a034dd9..059eeb96564 100644
--- a/libjava/java/io/natFileDescriptorPosix.cc
+++ b/libjava/java/io/natFileDescriptorPosix.cc
@@ -10,16 +10,11 @@ details. */
#include <config.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
+#include "posix.h"
+
#include <errno.h>
#include <stdio.h>
#include <string.h>
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-#include <sys/types.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <fcntl.h>
@@ -309,7 +304,7 @@ java::io::FileDescriptor::available (void)
struct timeval tv;
tv.tv_sec = 0;
tv.tv_usec = 0;
- r = ::select (fd + 1, &rd, NULL, NULL, &tv);
+ r = _Jv_select (fd + 1, &rd, NULL, NULL, &tv);
if (r == -1)
goto posix_error;
num = r == 0 ? 0 : 1;
diff --git a/libjava/java/lang/natSystem.cc b/libjava/java/lang/natSystem.cc
index e376ec2f84c..2d82c896a07 100644
--- a/libjava/java/lang/natSystem.cc
+++ b/libjava/java/lang/natSystem.cc
@@ -11,16 +11,9 @@ details. */
#include <config.h>
#include <string.h>
-#include <time.h>
#include <stdlib.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
+#include "posix.h"
#ifdef HAVE_PWD_H
#include <pwd.h>
@@ -48,10 +41,6 @@ extern java::lang::Class SystemClass;
-#if defined (ECOS)
-extern "C" unsigned long long _clock (void);
-#endif
-
void
java::lang::System::setErr (java::io::PrintStream *newErr)
{
@@ -152,24 +141,9 @@ java::lang::System::currentTimeMillis (void)
{
jlong r;
-#if defined (HAVE_GETTIMEOFDAY)
struct timeval tv;
- gettimeofday (&tv, NULL);
- r = (jlong) tv.tv_sec * 1000 + tv.tv_usec / 1000;
-#elif defined (HAVE_TIME)
- r = time (NULL) * 1000;
-#elif defined (HAVE_FTIME)
- struct timeb t;
- ftime (&t);
- r = t.time * 1000 + t.millitm;
-#elif defined (ECOS)
- r = _clock();
-#else
- // In the absence of any function, time remains forever fixed.
- r = 23;
-#endif
-
- return r;
+ _Jv_gettimeofday (&tv);
+ return (jlong) tv.tv_sec * 1000 + tv.tv_usec / 1000;
}
jint
diff --git a/libjava/java/net/natPlainDatagramSocketImpl.cc b/libjava/java/net/natPlainDatagramSocketImpl.cc
index 94383f8309d..fe83b1053f6 100644
--- a/libjava/java/net/natPlainDatagramSocketImpl.cc
+++ b/libjava/java/net/natPlainDatagramSocketImpl.cc
@@ -17,16 +17,10 @@ details. */
#define ENOPROTOOPT 109
#endif
#else /* USE_WINSOCK */
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
+#include "posix.h"
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
-#include <sys/time.h>
-#ifdef HAVE_SYS_SELECT_H
-#include <sys/select.h>
-#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
@@ -314,7 +308,7 @@ java::net::PlainDatagramSocketImpl::receive (java::net::DatagramPacket *p)
tv.tv_sec = timeout / 1000;
tv.tv_usec = (timeout % 1000) * 1000;
int retval;
- if ((retval = select (fnum + 1, &rset, NULL, NULL, &tv)) < 0)
+ if ((retval = _Jv_select (fnum + 1, &rset, NULL, NULL, &tv)) < 0)
goto error;
else if (retval == 0)
JvThrow (new java::io::InterruptedIOException ());
diff --git a/libjava/java/net/natPlainSocketImpl.cc b/libjava/java/net/natPlainSocketImpl.cc
index 52187461f49..18fd74ba447 100644
--- a/libjava/java/net/natPlainSocketImpl.cc
+++ b/libjava/java/net/natPlainSocketImpl.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000 Free Software Foundation
This file is part of libgcj.
@@ -19,12 +19,8 @@ details. */
#define ENOPROTOOPT 109
#endif
#else /* USE_WINSOCK */
-#include <sys/types.h>
+#include "posix.h"
#include <sys/socket.h>
-#include <sys/time.h>
-#ifdef HAVE_SYS_SELECT_H
-#include <sys/select.h>
-#endif
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <errno.h>
@@ -249,7 +245,7 @@ java::net::PlainSocketImpl::accept (java::net::PlainSocketImpl *s)
tv.tv_sec = timeout / 1000;
tv.tv_usec = (timeout % 1000) * 1000;
int retval;
- if ((retval = select (fnum + 1, &rset, NULL, NULL, &tv)) < 0)
+ if ((retval = _Jv_select (fnum + 1, &rset, NULL, NULL, &tv)) < 0)
goto error;
else if (retval == 0)
JvThrow (new java::io::InterruptedIOException (