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

src/os/posix/vm/os_posix.cpp

Print this page




  76     return fr.pc();
  77   } else {
  78     return NULL;
  79   }
  80 }
  81 
  82 int os::get_last_error() {
  83   return errno;
  84 }
  85 
  86 bool os::is_debugger_attached() {
  87   // not implemented
  88   return false;
  89 }
  90 
  91 void os::wait_for_keypress_at_exit(void) {
  92   // don't do anything on posix platforms
  93   return;
  94 }
  95 

































  96 void os::Posix::print_load_average(outputStream* st) {
  97   st->print("load average:");
  98   double loadavg[3];
  99   os::loadavg(loadavg, 3);
 100   st->print("%0.02f %0.02f %0.02f", loadavg[0], loadavg[1], loadavg[2]);
 101   st->cr();
 102 }
 103 
 104 void os::Posix::print_rlimit_info(outputStream* st) {
 105   st->print("rlimit:");
 106   struct rlimit rlim;
 107 
 108   st->print(" STACK ");
 109   getrlimit(RLIMIT_STACK, &rlim);
 110   if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
 111   else st->print("%uk", rlim.rlim_cur >> 10);
 112 
 113   st->print(", CORE ");
 114   getrlimit(RLIMIT_CORE, &rlim);
 115   if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");




  76     return fr.pc();
  77   } else {
  78     return NULL;
  79   }
  80 }
  81 
  82 int os::get_last_error() {
  83   return errno;
  84 }
  85 
  86 bool os::is_debugger_attached() {
  87   // not implemented
  88   return false;
  89 }
  90 
  91 void os::wait_for_keypress_at_exit(void) {
  92   // don't do anything on posix platforms
  93   return;
  94 }
  95 
  96 char* os::reserve_memory_aligned(size_t bytes, size_t alignment) {
  97   size_t size = align_size_up(bytes, alignment);
  98   size_t extra_size = size + alignment;
  99   char* extra_base = os::reserve_memory(extra_size, NULL, alignment);
 100 
 101   if (extra_base == NULL) {
 102     return NULL;
 103   }
 104 
 105   // Do manual alignment
 106   char* aligned_base = (char*) align_size_up((uintptr_t) extra_base, alignment);
 107 
 108   // [  |                                       |  ]
 109   // ^ extra_base
 110   //    ^ extra_base + begin_offset == aligned_base
 111   //     extra_base + begin_offset + size       ^
 112   //                       extra_base + extra_size ^
 113   // |<>| == begin_offset
 114   //                              end_offset == |<>|
 115   size_t begin_offset = aligned_base - extra_base;
 116   size_t end_offset = (extra_base + extra_size) - (aligned_base + size);
 117 
 118   if (begin_offset > 0) {
 119       os::release_memory(extra_base, begin_offset);
 120   }
 121 
 122   if (end_offset > 0) {
 123       os::release_memory(extra_base + begin_offset + size, end_offset);
 124   }
 125 
 126   return aligned_base;
 127 }
 128 
 129 void os::Posix::print_load_average(outputStream* st) {
 130   st->print("load average:");
 131   double loadavg[3];
 132   os::loadavg(loadavg, 3);
 133   st->print("%0.02f %0.02f %0.02f", loadavg[0], loadavg[1], loadavg[2]);
 134   st->cr();
 135 }
 136 
 137 void os::Posix::print_rlimit_info(outputStream* st) {
 138   st->print("rlimit:");
 139   struct rlimit rlim;
 140 
 141   st->print(" STACK ");
 142   getrlimit(RLIMIT_STACK, &rlim);
 143   if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
 144   else st->print("%uk", rlim.rlim_cur >> 10);
 145 
 146   st->print(", CORE ");
 147   getrlimit(RLIMIT_CORE, &rlim);
 148   if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");


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