summaryrefslogtreecommitdiffstats
path: root/libjava
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2002-02-07 18:59:52 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2002-02-07 18:59:52 +0000
commitdc5c09344a6ac8a625b2d0c5b2d2bbdbe0e96994 (patch)
tree445027a01135cb59b020bba496158a0fc253ef73 /libjava
parent9b2e8d38d4384c026086079b4a4b13662f719aac (diff)
downloadppe42-gcc-dc5c09344a6ac8a625b2d0c5b2d2bbdbe0e96994.tar.gz
ppe42-gcc-dc5c09344a6ac8a625b2d0c5b2d2bbdbe0e96994.zip
* prims.cc (_Jv_CreateJavaVM): Call _Jv_platform_initialize.
* win32.cc (win32_exception_handler): Now static. * include/win32.h (_Jv_platform_initialize): Declare. (win32_exception_handler): Don't declare. * java/lang/natSystem.cc (currentTimeMillis): Use _Jv_platform_gettimeofday. * posix.cc (_Jv_platform_gettimeofday): Renamed. (_Jv_select): Use new name. (_Jv_platform_initialize): New function. * include/posix.h (_Jv_platform_gettimeofday): Renamed from _Jv_gettimeofday. (_Jv_platform_initialize): Declare. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@49583 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava')
-rw-r--r--libjava/ChangeLog13
-rw-r--r--libjava/include/posix.h5
-rw-r--r--libjava/include/win32.h2
-rw-r--r--libjava/java/lang/natSystem.cc2
-rw-r--r--libjava/posix.cc25
-rw-r--r--libjava/prims.cc20
-rw-r--r--libjava/win32.cc18
7 files changed, 57 insertions, 28 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index fe7c7a6798c..d0ca38e2e5f 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,5 +1,18 @@
2002-02-07 Tom Tromey <tromey@redhat.com>
+ * prims.cc (_Jv_CreateJavaVM): Call _Jv_platform_initialize.
+ * win32.cc (win32_exception_handler): Now static.
+ * include/win32.h (_Jv_platform_initialize): Declare.
+ (win32_exception_handler): Don't declare.
+ * java/lang/natSystem.cc (currentTimeMillis): Use
+ _Jv_platform_gettimeofday.
+ * posix.cc (_Jv_platform_gettimeofday): Renamed.
+ (_Jv_select): Use new name.
+ (_Jv_platform_initialize): New function.
+ * include/posix.h (_Jv_platform_gettimeofday): Renamed from
+ _Jv_gettimeofday.
+ (_Jv_platform_initialize): Declare.
+
* configure: Rebuilt.
* configure.in: Removed unnecessary parens.
diff --git a/libjava/include/posix.h b/libjava/include/posix.h
index e7ba3174354..bbfb0b244e7 100644
--- a/libjava/include/posix.h
+++ b/libjava/include/posix.h
@@ -1,6 +1,6 @@
// posix.h -- Helper functions for POSIX-flavored OSs.
-/* Copyright (C) 2000 Free Software Foundation
+/* Copyright (C) 2000, 2002 Free Software Foundation
This file is part of libgcj.
@@ -29,4 +29,5 @@ details. */
#endif
extern int _Jv_select (int n, fd_set *, fd_set *, fd_set *, struct timeval *);
-extern void _Jv_gettimeofday (struct timeval *);
+extern void _Jv_platform_gettimeofday (struct timeval *);
+extern void _Jv_platform_initialize (void);
diff --git a/libjava/include/win32.h b/libjava/include/win32.h
index 677f5d34529..82c7f157e20 100644
--- a/libjava/include/win32.h
+++ b/libjava/include/win32.h
@@ -17,6 +17,6 @@ details. */
#undef __INSIDE_CYGWIN__
#include <winsock.h>
-LONG CALLBACK win32_exception_handler (LPEXCEPTION_POINTERS e);
+extern void _Jv_platform_initialize (void);
#endif /* __JV_WIN32_H__ */
diff --git a/libjava/java/lang/natSystem.cc b/libjava/java/lang/natSystem.cc
index 5844246b7a9..28ef04dd778 100644
--- a/libjava/java/lang/natSystem.cc
+++ b/libjava/java/lang/natSystem.cc
@@ -159,7 +159,7 @@ jlong
java::lang::System::currentTimeMillis (void)
{
struct timeval tv;
- _Jv_gettimeofday (&tv);
+ _Jv_platform_gettimeofday (&tv);
return (jlong) tv.tv_sec * 1000 + tv.tv_usec / 1000;
}
diff --git a/libjava/posix.cc b/libjava/posix.cc
index 1f5b037f704..66443d21e11 100644
--- a/libjava/posix.cc
+++ b/libjava/posix.cc
@@ -1,6 +1,6 @@
// posix.cc -- Helper functions for POSIX-flavored OSs.
-/* Copyright (C) 2000, 2001 Free Software Foundation
+/* Copyright (C) 2000, 2001, 2002 Free Software Foundation
This file is part of libgcj.
@@ -13,6 +13,7 @@ details. */
#include "posix.h"
#include <errno.h>
+#include <signal.h>
#include <jvm.h>
#include <java/lang/Thread.h>
@@ -24,7 +25,7 @@ extern "C" unsigned long long _clock (void);
// gettimeofday implementation.
void
-_Jv_gettimeofday (struct timeval *tv)
+_Jv_platform_gettimeofday (struct timeval *tv)
{
#if defined (HAVE_GETTIMEOFDAY)
gettimeofday (tv, NULL);
@@ -47,6 +48,22 @@ _Jv_gettimeofday (struct timeval *tv)
#endif
}
+// Platform-specific VM initialization.
+void
+_Jv_platform_initialize (void)
+{
+#if defined (HAVE_SIGACTION)
+ // We only want this on POSIX systems.
+ struct sigaction act;
+ act.sa_handler = SIG_IGN;
+ sigemptyset (&act.sa_mask);
+ act.sa_flags = 0;
+ sigaction (SIGPIPE, &act, NULL);
+#else
+ signal (SIGPIPE, SIG_IGN);
+#endif
+}
+
// A wrapper for select() which ignores EINTR.
int
_Jv_select (int n, fd_set *readfds, fd_set *writefds,
@@ -57,7 +74,7 @@ _Jv_select (int n, fd_set *readfds, fd_set *writefds,
struct timeval end, delay;
if (timeout)
{
- _Jv_gettimeofday (&end);
+ _Jv_platform_gettimeofday (&end);
end.tv_usec += timeout->tv_usec;
if (end.tv_usec >= 1000000)
{
@@ -87,7 +104,7 @@ _Jv_select (int n, fd_set *readfds, fd_set *writefds,
struct timeval after;
if (timeout)
{
- _Jv_gettimeofday (&after);
+ _Jv_platform_gettimeofday (&after);
// Now compute new timeout argument.
delay.tv_usec = end.tv_usec - after.tv_usec;
delay.tv_sec = end.tv_sec - after.tv_sec;
diff --git a/libjava/prims.cc b/libjava/prims.cc
index 995206cb16f..e351e236308 100644
--- a/libjava/prims.cc
+++ b/libjava/prims.cc
@@ -1,6 +1,6 @@
// prims.cc - Code for core of runtime environment.
-/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation
This file is part of libgcj.
@@ -928,23 +928,7 @@ _Jv_CreateJavaVM (void* /*vm_args*/)
LTDL_SET_PRELOADED_SYMBOLS ();
#endif
-#ifdef WIN32
- // Initialise winsock for networking
- WSADATA data;
- if (WSAStartup (MAKEWORD (1, 1), &data))
- MessageBox (NULL, "Error initialising winsock library.", "Error", MB_OK | MB_ICONEXCLAMATION);
- // Install exception handler
- SetUnhandledExceptionFilter (win32_exception_handler);
-#elif defined(HAVE_SIGACTION)
- // We only want this on POSIX systems.
- struct sigaction act;
- act.sa_handler = SIG_IGN;
- sigemptyset (&act.sa_mask);
- act.sa_flags = 0;
- sigaction (SIGPIPE, &act, NULL);
-#else
- signal (SIGPIPE, SIG_IGN);
-#endif
+ _Jv_platform_initialize ();
_Jv_JNI_Init ();
diff --git a/libjava/win32.cc b/libjava/win32.cc
index daccf0f94fb..e54d926b0ef 100644
--- a/libjava/win32.cc
+++ b/libjava/win32.cc
@@ -9,9 +9,10 @@ Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
#include <config.h>
-#include <windows.h>
-LONG CALLBACK
+#include "platform.h"
+
+static LONG CALLBACK
win32_exception_handler (LPEXCEPTION_POINTERS e)
{
if (e->ExceptionRecord->ExceptionCode == EXCEPTION_ACCESS_VIOLATION)
@@ -21,3 +22,16 @@ win32_exception_handler (LPEXCEPTION_POINTERS e)
else
return EXCEPTION_CONTINUE_SEARCH;
}
+
+// Platform-specific VM initialization.
+void
+_Jv_platform_initialize (void)
+{
+ // Initialise winsock for networking
+ WSADATA data;
+ if (WSAStartup (MAKEWORD (1, 1), &data))
+ MessageBox (NULL, "Error initialising winsock library.", "Error",
+ MB_OK | MB_ICONEXCLAMATION);
+ // Install exception handler
+ SetUnhandledExceptionFilter (win32_exception_handler);
+}
OpenPOWER on IntegriCloud