* 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.
From-SVN: r49583
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.
// 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.
#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);
#undef __INSIDE_CYGWIN__
#include <winsock.h>
-LONG CALLBACK win32_exception_handler (LPEXCEPTION_POINTERS e);
+extern void _Jv_platform_initialize (void);
#endif /* __JV_WIN32_H__ */
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;
}
// 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.
#include "posix.h"
#include <errno.h>
+#include <signal.h>
#include <jvm.h>
#include <java/lang/Thread.h>
// gettimeofday implementation.
void
-_Jv_gettimeofday (struct timeval *tv)
+_Jv_platform_gettimeofday (struct timeval *tv)
{
#if defined (HAVE_GETTIMEOFDAY)
gettimeofday (tv, NULL);
#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,
struct timeval end, delay;
if (timeout)
{
- _Jv_gettimeofday (&end);
+ _Jv_platform_gettimeofday (&end);
end.tv_usec += timeout->tv_usec;
if (end.tv_usec >= 1000000)
{
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;
// 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.
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 ();
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)
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);
+}