src/os/bsd/vm/os_bsd.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 8025942 Sdiff src/os/bsd/vm

src/os/bsd/vm/os_bsd.cpp

Print this page




 140 static bool check_signals = true;
 141 
 142 static pid_t _initial_pid = 0;
 143 
 144 /* Signal number used to suspend/resume a thread */
 145 
 146 /* do not use any signal number less than SIGSEGV, see 4355769 */
 147 static int SR_signum = SIGUSR2;
 148 sigset_t SR_sigset;
 149 
 150 
 151 ////////////////////////////////////////////////////////////////////////////////
 152 // utility functions
 153 
 154 static int SR_initialize();
 155 
 156 julong os::available_memory() {
 157   return Bsd::available_memory();
 158 }
 159 

 160 julong os::Bsd::available_memory() {
 161   // XXXBSD: this is just a stopgap implementation
 162   return physical_memory() >> 2;








 163 }
 164 
 165 julong os::physical_memory() {
 166   return Bsd::physical_memory();
 167 }
 168 
 169 ////////////////////////////////////////////////////////////////////////////////
 170 // environment support
 171 
 172 bool os::getenv(const char* name, char* buf, int len) {
 173   const char* val = ::getenv(name);
 174   if (val != NULL && strlen(val) < (size_t)len) {
 175     strcpy(buf, val);
 176     return true;
 177   }
 178   if (len > 0) buf[0] = 0;  // return a null string
 179   return false;
 180 }
 181 
 182 




 140 static bool check_signals = true;
 141 
 142 static pid_t _initial_pid = 0;
 143 
 144 /* Signal number used to suspend/resume a thread */
 145 
 146 /* do not use any signal number less than SIGSEGV, see 4355769 */
 147 static int SR_signum = SIGUSR2;
 148 sigset_t SR_sigset;
 149 
 150 
 151 ////////////////////////////////////////////////////////////////////////////////
 152 // utility functions
 153 
 154 static int SR_initialize();
 155 
 156 julong os::available_memory() {
 157   return Bsd::available_memory();
 158 }
 159 
 160 // available here means free
 161 julong os::Bsd::available_memory() {
 162   uint64_t available = physical_memory() >> 2;
 163 #ifdef __APPLE__
 164   mach_msg_type_number_t count = HOST_VM_INFO64_COUNT;
 165   vm_statistics64_data_t vmstat;
 166   kern_return_t kerr = host_statistics64(mach_host_self(), HOST_VM_INFO64, (host_info64_t)&vmstat, &count);
 167   if (kerr == KERN_SUCCESS) {
 168     available = vmstat.free_count * os::vm_page_size();
 169   }
 170 #endif
 171   return available;
 172 }
 173 
 174 julong os::physical_memory() {
 175   return Bsd::physical_memory();
 176 }
 177 
 178 ////////////////////////////////////////////////////////////////////////////////
 179 // environment support
 180 
 181 bool os::getenv(const char* name, char* buf, int len) {
 182   const char* val = ::getenv(name);
 183   if (val != NULL && strlen(val) < (size_t)len) {
 184     strcpy(buf, val);
 185     return true;
 186   }
 187   if (len > 0) buf[0] = 0;  // return a null string
 188   return false;
 189 }
 190 
 191 


src/os/bsd/vm/os_bsd.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File