< prev index next >

src/os/solaris/vm/os_solaris.cpp

Print this page




2078 size_t os::lasterror(char *buf, size_t len) {
2079   if (errno == 0)  return 0;
2080 
2081   const char *s = os::strerror(errno);
2082   size_t n = ::strlen(s);
2083   if (n >= len) {
2084     n = len - 1;
2085   }
2086   ::strncpy(buf, s, n);
2087   buf[n] = '\0';
2088   return n;
2089 }
2090 
2091 
2092 // sun.misc.Signal
2093 
2094 extern "C" {
2095   static void UserHandler(int sig, void *siginfo, void *context) {
2096     // Ctrl-C is pressed during error reporting, likely because the error
2097     // handler fails to abort. Let VM die immediately.
2098     if (sig == SIGINT && is_error_reported()) {
2099       os::die();
2100     }
2101 
2102     os::signal_notify(sig);
2103     // We do not need to reinstate the signal handler each time...
2104   }
2105 }
2106 
2107 void* os::user_handler() {
2108   return CAST_FROM_FN_PTR(void*, UserHandler);
2109 }
2110 
2111 struct timespec PosixSemaphore::create_timespec(unsigned int sec, int nsec) {
2112   struct timespec ts;
2113   unpackTime(&ts, false, (sec * NANOSECS_PER_SEC) + nsec);
2114 
2115   return ts;
2116 }
2117 
2118 extern "C" {




2078 size_t os::lasterror(char *buf, size_t len) {
2079   if (errno == 0)  return 0;
2080 
2081   const char *s = os::strerror(errno);
2082   size_t n = ::strlen(s);
2083   if (n >= len) {
2084     n = len - 1;
2085   }
2086   ::strncpy(buf, s, n);
2087   buf[n] = '\0';
2088   return n;
2089 }
2090 
2091 
2092 // sun.misc.Signal
2093 
2094 extern "C" {
2095   static void UserHandler(int sig, void *siginfo, void *context) {
2096     // Ctrl-C is pressed during error reporting, likely because the error
2097     // handler fails to abort. Let VM die immediately.
2098     if (sig == SIGINT && VMError::is_error_reported()) {
2099       os::die();
2100     }
2101 
2102     os::signal_notify(sig);
2103     // We do not need to reinstate the signal handler each time...
2104   }
2105 }
2106 
2107 void* os::user_handler() {
2108   return CAST_FROM_FN_PTR(void*, UserHandler);
2109 }
2110 
2111 struct timespec PosixSemaphore::create_timespec(unsigned int sec, int nsec) {
2112   struct timespec ts;
2113   unpackTime(&ts, false, (sec * NANOSECS_PER_SEC) + nsec);
2114 
2115   return ts;
2116 }
2117 
2118 extern "C" {


< prev index next >