< prev index next >

src/hotspot/os/linux/os_linux.cpp

Print this page




  46 #include "runtime/arguments.hpp"
  47 #include "runtime/atomic.hpp"
  48 #include "runtime/extendedPC.hpp"
  49 #include "runtime/globals.hpp"
  50 #include "runtime/interfaceSupport.inline.hpp"
  51 #include "runtime/init.hpp"
  52 #include "runtime/java.hpp"
  53 #include "runtime/javaCalls.hpp"
  54 #include "runtime/mutexLocker.hpp"
  55 #include "runtime/objectMonitor.hpp"
  56 #include "runtime/orderAccess.hpp"
  57 #include "runtime/osThread.hpp"
  58 #include "runtime/perfMemory.hpp"
  59 #include "runtime/sharedRuntime.hpp"
  60 #include "runtime/statSampler.hpp"
  61 #include "runtime/stubRoutines.hpp"
  62 #include "runtime/thread.inline.hpp"
  63 #include "runtime/threadCritical.hpp"
  64 #include "runtime/threadSMR.hpp"
  65 #include "runtime/timer.hpp"
  66 #include "runtime/vm_version.hpp"
  67 #include "semaphore_posix.hpp"
  68 #include "services/attachListener.hpp"
  69 #include "services/memTracker.hpp"
  70 #include "services/runtimeService.hpp"
  71 #include "utilities/align.hpp"
  72 #include "utilities/decoder.hpp"
  73 #include "utilities/defaultStream.hpp"
  74 #include "utilities/events.hpp"
  75 #include "utilities/elfFile.hpp"
  76 #include "utilities/growableArray.hpp"
  77 #include "utilities/macros.hpp"
  78 #include "utilities/vmError.hpp"
  79 
  80 // put OS-includes here
  81 # include <sys/types.h>
  82 # include <sys/mman.h>
  83 # include <sys/stat.h>
  84 # include <sys/select.h>
  85 # include <pthread.h>
  86 # include <signal.h>


 211   return avail_mem;
 212 }
 213 
 214 julong os::physical_memory() {
 215   jlong phys_mem = 0;
 216   if (OSContainer::is_containerized()) {
 217     jlong mem_limit;
 218     if ((mem_limit = OSContainer::memory_limit_in_bytes()) > 0) {
 219       log_trace(os)("total container memory: " JLONG_FORMAT, mem_limit);
 220       return mem_limit;
 221     }
 222     log_debug(os, container)("container memory limit %s: " JLONG_FORMAT ", using host value",
 223                             mem_limit == OSCONTAINER_ERROR ? "failed" : "unlimited", mem_limit);
 224   }
 225 
 226   phys_mem = Linux::physical_memory();
 227   log_trace(os)("total system memory: " JLONG_FORMAT, phys_mem);
 228   return phys_mem;
 229 }
 230 
 231 static uint64_t initial_total_ticks = 0;
 232 static uint64_t initial_steal_ticks = 0;
 233 static bool     has_initial_tick_info = false;
 234 
 235 static void next_line(FILE *f) {
 236   int c;
 237   do {
 238     c = fgetc(f);
 239   } while (c != '\n' && c != EOF);
 240 }
 241 
 242 bool os::Linux::get_tick_information(CPUPerfTicks* pticks, int which_logical_cpu) {
 243   FILE*         fh;
 244   uint64_t      userTicks, niceTicks, systemTicks, idleTicks;
 245   // since at least kernel 2.6 : iowait: time waiting for I/O to complete
 246   // irq: time  servicing interrupts; softirq: time servicing softirqs
 247   uint64_t      iowTicks = 0, irqTicks = 0, sirqTicks= 0;
 248   // steal (since kernel 2.6.11): time spent in other OS when running in a virtualized environment
 249   uint64_t      stealTicks = 0;
 250   // guest (since kernel 2.6.24): time spent running a virtual CPU for guest OS under the
 251   // control of the Linux kernel
 252   uint64_t      guestNiceTicks = 0;
 253   int           logical_cpu = -1;
 254   const int     required_tickinfo_count = (which_logical_cpu == -1) ? 4 : 5;
 255   int           n;
 256 
 257   memset(pticks, 0, sizeof(CPUPerfTicks));
 258 
 259   if ((fh = fopen("/proc/stat", "r")) == NULL) {
 260     return false;
 261   }
 262 
 263   if (which_logical_cpu == -1) {
 264     n = fscanf(fh, "cpu " UINT64_FORMAT " " UINT64_FORMAT " " UINT64_FORMAT " "
 265             UINT64_FORMAT " " UINT64_FORMAT " " UINT64_FORMAT " " UINT64_FORMAT " "
 266             UINT64_FORMAT " " UINT64_FORMAT " ",
 267             &userTicks, &niceTicks, &systemTicks, &idleTicks,
 268             &iowTicks, &irqTicks, &sirqTicks,
 269             &stealTicks, &guestNiceTicks);
 270   } else {
 271     // Move to next line
 272     next_line(fh);
 273 
 274     // find the line for requested cpu faster to just iterate linefeeds?
 275     for (int i = 0; i < which_logical_cpu; i++) {
 276       next_line(fh);
 277     }
 278 
 279     n = fscanf(fh, "cpu%u " UINT64_FORMAT " " UINT64_FORMAT " " UINT64_FORMAT " "
 280                UINT64_FORMAT " " UINT64_FORMAT " " UINT64_FORMAT " " UINT64_FORMAT " "
 281                UINT64_FORMAT " " UINT64_FORMAT " ",
 282                &logical_cpu, &userTicks, &niceTicks,
 283                &systemTicks, &idleTicks, &iowTicks, &irqTicks, &sirqTicks,
 284                &stealTicks, &guestNiceTicks);
 285   }
 286 
 287   fclose(fh);
 288   if (n < required_tickinfo_count || logical_cpu != which_logical_cpu) {
 289     return false;
 290   }
 291   pticks->used       = userTicks + niceTicks;
 292   pticks->usedKernel = systemTicks + irqTicks + sirqTicks;
 293   pticks->total      = userTicks + niceTicks + systemTicks + idleTicks +
 294                        iowTicks + irqTicks + sirqTicks + stealTicks + guestNiceTicks;
 295 
 296   if (n > required_tickinfo_count + 3) {
 297     pticks->steal = stealTicks;
 298     pticks->has_steal_ticks = true;
 299   } else {
 300     pticks->steal = 0;
 301     pticks->has_steal_ticks = false;
 302   }
 303 
 304   return true;
 305 }
 306 
 307 // Return true if user is running as root.
 308 
 309 bool os::have_special_privileges() {
 310   static bool init = false;
 311   static bool privileges = false;
 312   if (!init) {
 313     privileges = (getuid() != geteuid()) || (getgid() != getegid());
 314     init = true;
 315   }
 316   return privileges;
 317 }
 318 
 319 
 320 #ifndef SYS_gettid
 321 // i386: 224, ia64: 1105, amd64: 186, sparc 143
 322   #ifdef __ia64__
 323     #define SYS_gettid 1105
 324   #else
 325     #ifdef __i386__
 326       #define SYS_gettid 224


1923   if (fd == -1) {
1924     return false;
1925   }
1926 
1927   if (hdr != NULL) {
1928     st->print_cr("%s", hdr);
1929   }
1930 
1931   char buf[33];
1932   int bytes;
1933   buf[32] = '\0';
1934   while ((bytes = ::read(fd, buf, sizeof(buf)-1)) > 0) {
1935     st->print_raw(buf, bytes);
1936   }
1937 
1938   ::close(fd);
1939 
1940   return true;
1941 }
1942 





























1943 void os::print_dll_info(outputStream *st) {
1944   st->print_cr("Dynamic libraries:");
1945 
1946   char fname[32];
1947   pid_t pid = os::Linux::gettid();
1948 
1949   jio_snprintf(fname, sizeof(fname), "/proc/%d/maps", pid);
1950 
1951   if (!_print_ascii_file(fname, st)) {
1952     st->print("Can not get library information for pid = %d\n", pid);
1953   }
1954 }
1955 
1956 int os::get_loaded_modules_info(os::LoadedModulesCallbackFunc callback, void *param) {
1957   FILE *procmapsFile = NULL;
1958 
1959   // Open the procfs maps file for the current process
1960   if ((procmapsFile = fopen("/proc/self/maps", "r")) != NULL) {
1961     // Allocate PATH_MAX for file name plus a reasonable size for other fields.
1962     char line[PATH_MAX + 100];


2007   // Print warning if unsafe chroot environment detected
2008   if (unsafe_chroot_detected) {
2009     st->print("WARNING!! ");
2010     st->print_cr("%s", unstable_chroot_error);
2011   }
2012 
2013   os::Linux::print_libversion_info(st);
2014 
2015   os::Posix::print_rlimit_info(st);
2016 
2017   os::Posix::print_load_average(st);
2018 
2019   os::Linux::print_full_memory_info(st);
2020 
2021   os::Linux::print_proc_sys_info(st);
2022 
2023   os::Linux::print_ld_preload_file(st);
2024 
2025   os::Linux::print_container_info(st);
2026 
2027   VM_Version::print_platform_virtualization_info(st);
2028 
2029   os::Linux::print_steal_info(st);
2030 }
2031 
2032 // Try to identify popular distros.
2033 // Most Linux distributions have a /etc/XXX-release file, which contains
2034 // the OS version string. Newer Linux distributions have a /etc/lsb-release
2035 // file that also contains the OS version string. Some have more than one
2036 // /etc/XXX-release file (e.g. Mandrake has both /etc/mandrake-release and
2037 // /etc/redhat-release.), so the order is important.
2038 // Any Linux that is based on Redhat (i.e. Oracle, Mandrake, Sun JDS...) have
2039 // their own specific XXX-release file as well as a redhat-release file.
2040 // Because of this the XXX-release file needs to be searched for before the
2041 // redhat-release file.
2042 // Since Red Hat and SuSE have an lsb-release file that is not very descriptive the
2043 // search for redhat-release / SuSE-release needs to be before lsb-release.
2044 // Since the lsb-release file is the new standard it needs to be searched
2045 // before the older style release files.
2046 // Searching system-release (Red Hat) and os-release (other Linuxes) are a
2047 // next to last resort.  The os-release file is a new standard that contains
2048 // distribution information and the system-release file seems to be an old
2049 // standard that has been replaced by the lsb-release and os-release files.


2264   }
2265 
2266   j = OSContainer::OSContainer::memory_usage_in_bytes();
2267   st->print("memory_usage_in_bytes: ");
2268   if (j > 0) {
2269     st->print(JLONG_FORMAT "\n", j);
2270   } else {
2271     st->print("%s\n", j == OSCONTAINER_ERROR ? "not supported" : "unlimited");
2272   }
2273 
2274   j = OSContainer::OSContainer::memory_max_usage_in_bytes();
2275   st->print("memory_max_usage_in_bytes: ");
2276   if (j > 0) {
2277     st->print(JLONG_FORMAT "\n", j);
2278   } else {
2279     st->print("%s\n", j == OSCONTAINER_ERROR ? "not supported" : "unlimited");
2280   }
2281   st->cr();
2282 }
2283 
2284 void os::Linux::print_steal_info(outputStream* st) {
2285   if (has_initial_tick_info) {
2286     CPUPerfTicks pticks;
2287     bool res = os::Linux::get_tick_information(&pticks, -1);
2288 
2289     if (res && pticks.has_steal_ticks) {
2290       uint64_t steal_ticks_difference = pticks.steal - initial_steal_ticks;
2291       uint64_t total_ticks_difference = pticks.total - initial_total_ticks;
2292       double steal_ticks_perc = 0.0;
2293       if (total_ticks_difference != 0) {
2294         steal_ticks_perc = (double) steal_ticks_difference / total_ticks_difference;
2295       }
2296       st->print_cr("Steal ticks since vm start: " UINT64_FORMAT, steal_ticks_difference);
2297       st->print_cr("Steal ticks percentage since vm start:%7.3f", steal_ticks_perc);
2298     }















2299   }

2300 }
2301 
2302 void os::print_memory_info(outputStream* st) {
2303 
2304   st->print("Memory:");
2305   st->print(" %dk page", os::vm_page_size()>>10);
2306 
2307   // values in struct sysinfo are "unsigned long"
2308   struct sysinfo si;
2309   sysinfo(&si);
2310 
2311   st->print(", physical " UINT64_FORMAT "k",
2312             os::physical_memory() >> 10);
2313   st->print("(" UINT64_FORMAT "k free)",
2314             os::available_memory() >> 10);
2315   st->print(", swap " UINT64_FORMAT "k",
2316             ((jlong)si.totalswap * si.mem_unit) >> 10);
2317   st->print("(" UINT64_FORMAT "k free)",
2318             ((jlong)si.freeswap * si.mem_unit) >> 10);
2319   st->cr();


5005                          char* format, ...);
5006 
5007 // this is called _before_ most of the global arguments have been parsed
5008 void os::init(void) {
5009   char dummy;   // used to get a guess on initial stack address
5010 
5011   clock_tics_per_sec = sysconf(_SC_CLK_TCK);
5012 
5013   init_random(1234567);
5014 
5015   Linux::set_page_size(sysconf(_SC_PAGESIZE));
5016   if (Linux::page_size() == -1) {
5017     fatal("os_linux.cpp: os::init: sysconf failed (%s)",
5018           os::strerror(errno));
5019   }
5020   init_page_sizes((size_t) Linux::page_size());
5021 
5022   Linux::initialize_system_info();
5023 
5024   Linux::initialize_os_info();
5025 
5026   os::Linux::CPUPerfTicks pticks;
5027   bool res = os::Linux::get_tick_information(&pticks, -1);
5028 
5029   if (res && pticks.has_steal_ticks) {
5030     has_initial_tick_info = true;
5031     initial_total_ticks = pticks.total;
5032     initial_steal_ticks = pticks.steal;
5033   }
5034 
5035   // _main_thread points to the thread that created/loaded the JVM.
5036   Linux::_main_thread = pthread_self();
5037 
5038   // retrieve entry point for pthread_setname_np
5039   Linux::_pthread_setname_np =
5040     (int(*)(pthread_t, const char*))dlsym(RTLD_DEFAULT, "pthread_setname_np");
5041 
5042   os::Posix::init();
5043 
5044   initial_time_count = javaTimeNanos();
5045 
5046   // Always warn if no monotonic clock available
5047   if (!os::Posix::supports_monotonic_clock()) {
5048     warning("No monotonic clock was available - timed services may "    \
5049             "be adversely affected if the time-of-day clock changes");
5050   }
5051 }
5052 
5053 // To install functions for atexit system call




  46 #include "runtime/arguments.hpp"
  47 #include "runtime/atomic.hpp"
  48 #include "runtime/extendedPC.hpp"
  49 #include "runtime/globals.hpp"
  50 #include "runtime/interfaceSupport.inline.hpp"
  51 #include "runtime/init.hpp"
  52 #include "runtime/java.hpp"
  53 #include "runtime/javaCalls.hpp"
  54 #include "runtime/mutexLocker.hpp"
  55 #include "runtime/objectMonitor.hpp"
  56 #include "runtime/orderAccess.hpp"
  57 #include "runtime/osThread.hpp"
  58 #include "runtime/perfMemory.hpp"
  59 #include "runtime/sharedRuntime.hpp"
  60 #include "runtime/statSampler.hpp"
  61 #include "runtime/stubRoutines.hpp"
  62 #include "runtime/thread.inline.hpp"
  63 #include "runtime/threadCritical.hpp"
  64 #include "runtime/threadSMR.hpp"
  65 #include "runtime/timer.hpp"

  66 #include "semaphore_posix.hpp"
  67 #include "services/attachListener.hpp"
  68 #include "services/memTracker.hpp"
  69 #include "services/runtimeService.hpp"
  70 #include "utilities/align.hpp"
  71 #include "utilities/decoder.hpp"
  72 #include "utilities/defaultStream.hpp"
  73 #include "utilities/events.hpp"
  74 #include "utilities/elfFile.hpp"
  75 #include "utilities/growableArray.hpp"
  76 #include "utilities/macros.hpp"
  77 #include "utilities/vmError.hpp"
  78 
  79 // put OS-includes here
  80 # include <sys/types.h>
  81 # include <sys/mman.h>
  82 # include <sys/stat.h>
  83 # include <sys/select.h>
  84 # include <pthread.h>
  85 # include <signal.h>


 210   return avail_mem;
 211 }
 212 
 213 julong os::physical_memory() {
 214   jlong phys_mem = 0;
 215   if (OSContainer::is_containerized()) {
 216     jlong mem_limit;
 217     if ((mem_limit = OSContainer::memory_limit_in_bytes()) > 0) {
 218       log_trace(os)("total container memory: " JLONG_FORMAT, mem_limit);
 219       return mem_limit;
 220     }
 221     log_debug(os, container)("container memory limit %s: " JLONG_FORMAT ", using host value",
 222                             mem_limit == OSCONTAINER_ERROR ? "failed" : "unlimited", mem_limit);
 223   }
 224 
 225   phys_mem = Linux::physical_memory();
 226   log_trace(os)("total system memory: " JLONG_FORMAT, phys_mem);
 227   return phys_mem;
 228 }
 229 












































































 230 // Return true if user is running as root.
 231 
 232 bool os::have_special_privileges() {
 233   static bool init = false;
 234   static bool privileges = false;
 235   if (!init) {
 236     privileges = (getuid() != geteuid()) || (getgid() != getegid());
 237     init = true;
 238   }
 239   return privileges;
 240 }
 241 
 242 
 243 #ifndef SYS_gettid
 244 // i386: 224, ia64: 1105, amd64: 186, sparc 143
 245   #ifdef __ia64__
 246     #define SYS_gettid 1105
 247   #else
 248     #ifdef __i386__
 249       #define SYS_gettid 224


1846   if (fd == -1) {
1847     return false;
1848   }
1849 
1850   if (hdr != NULL) {
1851     st->print_cr("%s", hdr);
1852   }
1853 
1854   char buf[33];
1855   int bytes;
1856   buf[32] = '\0';
1857   while ((bytes = ::read(fd, buf, sizeof(buf)-1)) > 0) {
1858     st->print_raw(buf, bytes);
1859   }
1860 
1861   ::close(fd);
1862 
1863   return true;
1864 }
1865 
1866 #if defined(S390) || defined(PPC64)
1867 // keywords_to_match - NULL terminated array of keywords
1868 static bool print_matching_lines_from_file(const char* filename, outputStream* st, const char* keywords_to_match[]) {
1869   char* line = NULL;
1870   size_t length = 0;
1871   FILE* fp = fopen(filename, "r");
1872   if (fp == NULL) {
1873     return false;
1874   }
1875 
1876   st->print_cr("Virtualization information:");
1877   while (getline(&line, &length, fp) != -1) {
1878     int i = 0;
1879     while (keywords_to_match[i] != NULL) {
1880       if (strncmp(line, keywords_to_match[i], strlen(keywords_to_match[i])) == 0) {
1881         st->print("%s", line);
1882         break;
1883       }
1884       i++;
1885     }
1886   }
1887 
1888   free(line);
1889   fclose(fp);
1890 
1891   return true;
1892 }
1893 #endif
1894 
1895 void os::print_dll_info(outputStream *st) {
1896   st->print_cr("Dynamic libraries:");
1897 
1898   char fname[32];
1899   pid_t pid = os::Linux::gettid();
1900 
1901   jio_snprintf(fname, sizeof(fname), "/proc/%d/maps", pid);
1902 
1903   if (!_print_ascii_file(fname, st)) {
1904     st->print("Can not get library information for pid = %d\n", pid);
1905   }
1906 }
1907 
1908 int os::get_loaded_modules_info(os::LoadedModulesCallbackFunc callback, void *param) {
1909   FILE *procmapsFile = NULL;
1910 
1911   // Open the procfs maps file for the current process
1912   if ((procmapsFile = fopen("/proc/self/maps", "r")) != NULL) {
1913     // Allocate PATH_MAX for file name plus a reasonable size for other fields.
1914     char line[PATH_MAX + 100];


1959   // Print warning if unsafe chroot environment detected
1960   if (unsafe_chroot_detected) {
1961     st->print("WARNING!! ");
1962     st->print_cr("%s", unstable_chroot_error);
1963   }
1964 
1965   os::Linux::print_libversion_info(st);
1966 
1967   os::Posix::print_rlimit_info(st);
1968 
1969   os::Posix::print_load_average(st);
1970 
1971   os::Linux::print_full_memory_info(st);
1972 
1973   os::Linux::print_proc_sys_info(st);
1974 
1975   os::Linux::print_ld_preload_file(st);
1976 
1977   os::Linux::print_container_info(st);
1978 
1979   os::Linux::print_virtualization_info(st);


1980 }
1981 
1982 // Try to identify popular distros.
1983 // Most Linux distributions have a /etc/XXX-release file, which contains
1984 // the OS version string. Newer Linux distributions have a /etc/lsb-release
1985 // file that also contains the OS version string. Some have more than one
1986 // /etc/XXX-release file (e.g. Mandrake has both /etc/mandrake-release and
1987 // /etc/redhat-release.), so the order is important.
1988 // Any Linux that is based on Redhat (i.e. Oracle, Mandrake, Sun JDS...) have
1989 // their own specific XXX-release file as well as a redhat-release file.
1990 // Because of this the XXX-release file needs to be searched for before the
1991 // redhat-release file.
1992 // Since Red Hat and SuSE have an lsb-release file that is not very descriptive the
1993 // search for redhat-release / SuSE-release needs to be before lsb-release.
1994 // Since the lsb-release file is the new standard it needs to be searched
1995 // before the older style release files.
1996 // Searching system-release (Red Hat) and os-release (other Linuxes) are a
1997 // next to last resort.  The os-release file is a new standard that contains
1998 // distribution information and the system-release file seems to be an old
1999 // standard that has been replaced by the lsb-release and os-release files.


2214   }
2215 
2216   j = OSContainer::OSContainer::memory_usage_in_bytes();
2217   st->print("memory_usage_in_bytes: ");
2218   if (j > 0) {
2219     st->print(JLONG_FORMAT "\n", j);
2220   } else {
2221     st->print("%s\n", j == OSCONTAINER_ERROR ? "not supported" : "unlimited");
2222   }
2223 
2224   j = OSContainer::OSContainer::memory_max_usage_in_bytes();
2225   st->print("memory_max_usage_in_bytes: ");
2226   if (j > 0) {
2227     st->print(JLONG_FORMAT "\n", j);
2228   } else {
2229     st->print("%s\n", j == OSCONTAINER_ERROR ? "not supported" : "unlimited");
2230   }
2231   st->cr();
2232 }
2233 
2234 void os::Linux::print_virtualization_info(outputStream* st) {
2235 #if defined(S390)
2236   // /proc/sysinfo contains interesting information about
2237   // - LPAR
2238   // - whole "Box" (CPUs )
2239   // - z/VM / KVM (VM<nn>); this is not available in an LPAR-only setup
2240   const char* kw[] = { "LPAR", "CPUs", "VM", NULL };
2241   const char* info_file = "/proc/sysinfo";
2242 
2243   if (!print_matching_lines_from_file(info_file, st, kw)) {
2244     st->print_cr("  <%s Not Available>", info_file);
2245   }
2246 #elif defined(PPC64)
2247   const char* info_file = "/proc/ppc64/lparcfg";
2248   const char* kw[] = { "system_type=", // qemu indicates PowerKVM
2249                        "partition_entitled_capacity=", // entitled processor capacity percentage
2250                        "partition_max_entitled_capacity=",
2251                        "capacity_weight=", // partition CPU weight
2252                        "partition_active_processors=",
2253                        "partition_potential_processors=",
2254                        "entitled_proc_capacity_available=",
2255                        "capped=", // 0 - uncapped, 1 - vcpus capped at entitled processor capacity percentage
2256                        "shared_processor_mode=", // (non)dedicated partition
2257                        "system_potential_processors=",
2258                        "pool=", // CPU-pool number
2259                        "pool_capacity=",
2260                        "NumLpars=", // on non-KVM machines, NumLpars is not found for full partition mode machines
2261                        NULL };
2262   if (!print_matching_lines_from_file(info_file, st, kw)) {
2263     st->print_cr("  <%s Not Available>", info_file);
2264   }
2265 #endif
2266 }
2267 
2268 void os::print_memory_info(outputStream* st) {
2269 
2270   st->print("Memory:");
2271   st->print(" %dk page", os::vm_page_size()>>10);
2272 
2273   // values in struct sysinfo are "unsigned long"
2274   struct sysinfo si;
2275   sysinfo(&si);
2276 
2277   st->print(", physical " UINT64_FORMAT "k",
2278             os::physical_memory() >> 10);
2279   st->print("(" UINT64_FORMAT "k free)",
2280             os::available_memory() >> 10);
2281   st->print(", swap " UINT64_FORMAT "k",
2282             ((jlong)si.totalswap * si.mem_unit) >> 10);
2283   st->print("(" UINT64_FORMAT "k free)",
2284             ((jlong)si.freeswap * si.mem_unit) >> 10);
2285   st->cr();


4971                          char* format, ...);
4972 
4973 // this is called _before_ most of the global arguments have been parsed
4974 void os::init(void) {
4975   char dummy;   // used to get a guess on initial stack address
4976 
4977   clock_tics_per_sec = sysconf(_SC_CLK_TCK);
4978 
4979   init_random(1234567);
4980 
4981   Linux::set_page_size(sysconf(_SC_PAGESIZE));
4982   if (Linux::page_size() == -1) {
4983     fatal("os_linux.cpp: os::init: sysconf failed (%s)",
4984           os::strerror(errno));
4985   }
4986   init_page_sizes((size_t) Linux::page_size());
4987 
4988   Linux::initialize_system_info();
4989 
4990   Linux::initialize_os_info();









4991 
4992   // _main_thread points to the thread that created/loaded the JVM.
4993   Linux::_main_thread = pthread_self();
4994 
4995   // retrieve entry point for pthread_setname_np
4996   Linux::_pthread_setname_np =
4997     (int(*)(pthread_t, const char*))dlsym(RTLD_DEFAULT, "pthread_setname_np");
4998 
4999   os::Posix::init();
5000 
5001   initial_time_count = javaTimeNanos();
5002 
5003   // Always warn if no monotonic clock available
5004   if (!os::Posix::supports_monotonic_clock()) {
5005     warning("No monotonic clock was available - timed services may "    \
5006             "be adversely affected if the time-of-day clock changes");
5007   }
5008 }
5009 
5010 // To install functions for atexit system call


< prev index next >