diff options
author | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-02-07 18:59:52 +0000 |
---|---|---|
committer | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-02-07 18:59:52 +0000 |
commit | dc5c09344a6ac8a625b2d0c5b2d2bbdbe0e96994 (patch) | |
tree | 445027a01135cb59b020bba496158a0fc253ef73 /libjava/posix.cc | |
parent | 9b2e8d38d4384c026086079b4a4b13662f719aac (diff) | |
download | gcc-dc5c09344a6ac8a625b2d0c5b2d2bbdbe0e96994.tar.gz |
* 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/posix.cc')
-rw-r--r-- | libjava/posix.cc | 25 |
1 files changed, 21 insertions, 4 deletions
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; |