src/os/posix/vm/os_posix.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File osx-cores2 Sdiff src/os/posix/vm

src/os/posix/vm/os_posix.cpp

Print this page




  16 * 2 along with this work; if not, write to the Free Software Foundation,
  17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18 *
  19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20 * or visit www.oracle.com if you need additional information or have any
  21 * questions.
  22 *
  23 */
  24 
  25 #include "prims/jvm.h"
  26 #include "runtime/os.hpp"
  27 #include "utilities/vmError.hpp"
  28 
  29 #include <unistd.h>
  30 #include <sys/resource.h>
  31 #include <sys/utsname.h>
  32 
  33 
  34 // Check core dump limit and report possible place where core can be found
  35 void os::check_or_create_dump(void* exceptionRecord, void* contextRecord, char* buffer, size_t bufferSize) {

  36   struct rlimit rlim;
  37   static char cwd[O_BUFLEN];
  38   bool success;
  39 
  40   get_current_directory(cwd, sizeof(cwd));
  41 
  42   if (getrlimit(RLIMIT_CORE, &rlim) != 0) {
  43     jio_snprintf(buffer, bufferSize, "%s/core or core.%d (may not exist)", cwd, current_process_id());
  44     success = true;
  45   } else {
  46     switch(rlim.rlim_cur) {
  47       case RLIM_INFINITY:
  48         jio_snprintf(buffer, bufferSize, "%s/core or core.%d", cwd, current_process_id());
  49         success = true;
  50         break;
  51       case 0:
  52         jio_snprintf(buffer, bufferSize, "Core dumps have been disabled. To enable core dumping, try \"ulimit -c unlimited\" before starting Java again");
  53         success = false;
  54         break;
  55       default:
  56         jio_snprintf(buffer, bufferSize, "%s/core or core.%d (max size %lu kB). To ensure a full core dump, try \"ulimit -c unlimited\" before starting Java again", cwd, current_process_id(), (unsigned long)(rlim.rlim_cur >> 10));
  57         success = true;
  58         break;
  59     }
  60   }
  61   VMError::report_coredump_status(buffer, success);
  62 }
  63 
  64 int os::get_last_error() {
  65   return errno;
  66 }
  67 
  68 bool os::is_debugger_attached() {
  69   // not implemented
  70   return false;
  71 }
  72 
  73 void os::wait_for_keypress_at_exit(void) {
  74   // don't do anything on posix platforms
  75   return;
  76 }




  16 * 2 along with this work; if not, write to the Free Software Foundation,
  17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18 *
  19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20 * or visit www.oracle.com if you need additional information or have any
  21 * questions.
  22 *
  23 */
  24 
  25 #include "prims/jvm.h"
  26 #include "runtime/os.hpp"
  27 #include "utilities/vmError.hpp"
  28 
  29 #include <unistd.h>
  30 #include <sys/resource.h>
  31 #include <sys/utsname.h>
  32 
  33 
  34 // Check core dump limit and report possible place where core can be found
  35 void os::check_or_create_dump(void* exceptionRecord, void* contextRecord, char* buffer, size_t bufferSize) {
  36   int n;
  37   struct rlimit rlim;

  38   bool success;
  39 
  40   n = get_core_path(buffer, bufferSize);
  41 
  42   if (getrlimit(RLIMIT_CORE, &rlim) != 0) {
  43     jio_snprintf(buffer + n, bufferSize - n, "/core or core.%d (may not exist)", current_process_id());
  44     success = true;
  45   } else {
  46     switch(rlim.rlim_cur) {
  47       case RLIM_INFINITY:
  48         jio_snprintf(buffer + n, bufferSize - n, "/core or core.%d", current_process_id());
  49         success = true;
  50         break;
  51       case 0:
  52         jio_snprintf(buffer, bufferSize, "Core dumps have been disabled. To enable core dumping, try \"ulimit -c unlimited\" before starting Java again");
  53         success = false;
  54         break;
  55       default:
  56         jio_snprintf(buffer + n, bufferSize - n, "/core or core.%d (max size %lu kB). To ensure a full core dump, try \"ulimit -c unlimited\" before starting Java again", current_process_id(), (unsigned long)(rlim.rlim_cur >> 10));
  57         success = true;
  58         break;
  59     }
  60   }
  61   VMError::report_coredump_status(buffer, success);
  62 }
  63 
  64 int os::get_last_error() {
  65   return errno;
  66 }
  67 
  68 bool os::is_debugger_attached() {
  69   // not implemented
  70   return false;
  71 }
  72 
  73 void os::wait_for_keypress_at_exit(void) {
  74   // don't do anything on posix platforms
  75   return;
  76 }


src/os/posix/vm/os_posix.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File