Mercurial > hg > truffle
comparison src/os/bsd/vm/os_bsd.cpp @ 6080:7432b9db36ff
7165755: OS Information much longer on linux than other platforms
Reviewed-by: sla, dholmes
author | nloodin |
---|---|
date | Thu, 10 May 2012 15:44:19 +0200 |
parents | fdf4deca44ec |
children | d2a62e0f25eb |
comparison
equal
deleted
inserted
replaced
6079:9793f47cdebc | 6080:7432b9db36ff |
---|---|
2338 st->print("Can not get library information for pid = %d\n", pid); | 2338 st->print("Can not get library information for pid = %d\n", pid); |
2339 } | 2339 } |
2340 #endif | 2340 #endif |
2341 } | 2341 } |
2342 | 2342 |
2343 void os::print_os_info_brief(outputStream* st) { | |
2344 st->print("Bsd"); | |
2345 | |
2346 os::Posix::print_uname_info(st); | |
2347 } | |
2343 | 2348 |
2344 void os::print_os_info(outputStream* st) { | 2349 void os::print_os_info(outputStream* st) { |
2345 st->print("OS:"); | 2350 st->print("OS:"); |
2346 | 2351 st->print("Bsd"); |
2347 // Try to identify popular distros. | 2352 |
2348 // Most Bsd distributions have /etc/XXX-release file, which contains | 2353 os::Posix::print_uname_info(st); |
2349 // the OS version string. Some have more than one /etc/XXX-release file | 2354 |
2350 // (e.g. Mandrake has both /etc/mandrake-release and /etc/redhat-release.), | 2355 os::Posix::print_rlimit_info(st); |
2351 // so the order is important. | 2356 |
2352 if (!_print_ascii_file("/etc/mandrake-release", st) && | 2357 os::Posix::print_load_average(st); |
2353 !_print_ascii_file("/etc/sun-release", st) && | |
2354 !_print_ascii_file("/etc/redhat-release", st) && | |
2355 !_print_ascii_file("/etc/SuSE-release", st) && | |
2356 !_print_ascii_file("/etc/turbobsd-release", st) && | |
2357 !_print_ascii_file("/etc/gentoo-release", st) && | |
2358 !_print_ascii_file("/etc/debian_version", st) && | |
2359 !_print_ascii_file("/etc/ltib-release", st) && | |
2360 !_print_ascii_file("/etc/angstrom-version", st)) { | |
2361 st->print("Bsd"); | |
2362 } | |
2363 st->cr(); | |
2364 | |
2365 // kernel | |
2366 st->print("uname:"); | |
2367 struct utsname name; | |
2368 uname(&name); | |
2369 st->print(name.sysname); st->print(" "); | |
2370 st->print(name.release); st->print(" "); | |
2371 st->print(name.version); st->print(" "); | |
2372 st->print(name.machine); | |
2373 st->cr(); | |
2374 | |
2375 #ifndef _ALLBSD_SOURCE | |
2376 // Print warning if unsafe chroot environment detected | |
2377 if (unsafe_chroot_detected) { | |
2378 st->print("WARNING!! "); | |
2379 st->print_cr(unstable_chroot_error); | |
2380 } | |
2381 | |
2382 // libc, pthread | |
2383 st->print("libc:"); | |
2384 st->print(os::Bsd::glibc_version()); st->print(" "); | |
2385 st->print(os::Bsd::libpthread_version()); st->print(" "); | |
2386 if (os::Bsd::is_BsdThreads()) { | |
2387 st->print("(%s stack)", os::Bsd::is_floating_stack() ? "floating" : "fixed"); | |
2388 } | |
2389 st->cr(); | |
2390 #endif | |
2391 | |
2392 // rlimit | |
2393 st->print("rlimit:"); | |
2394 struct rlimit rlim; | |
2395 | |
2396 st->print(" STACK "); | |
2397 getrlimit(RLIMIT_STACK, &rlim); | |
2398 if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity"); | |
2399 else st->print("%uk", rlim.rlim_cur >> 10); | |
2400 | |
2401 st->print(", CORE "); | |
2402 getrlimit(RLIMIT_CORE, &rlim); | |
2403 if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity"); | |
2404 else st->print("%uk", rlim.rlim_cur >> 10); | |
2405 | |
2406 st->print(", NPROC "); | |
2407 getrlimit(RLIMIT_NPROC, &rlim); | |
2408 if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity"); | |
2409 else st->print("%d", rlim.rlim_cur); | |
2410 | |
2411 st->print(", NOFILE "); | |
2412 getrlimit(RLIMIT_NOFILE, &rlim); | |
2413 if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity"); | |
2414 else st->print("%d", rlim.rlim_cur); | |
2415 | |
2416 #ifndef _ALLBSD_SOURCE | |
2417 st->print(", AS "); | |
2418 getrlimit(RLIMIT_AS, &rlim); | |
2419 if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity"); | |
2420 else st->print("%uk", rlim.rlim_cur >> 10); | |
2421 st->cr(); | |
2422 | |
2423 // load average | |
2424 st->print("load average:"); | |
2425 double loadavg[3]; | |
2426 os::loadavg(loadavg, 3); | |
2427 st->print("%0.02f %0.02f %0.02f", loadavg[0], loadavg[1], loadavg[2]); | |
2428 st->cr(); | |
2429 #endif | |
2430 } | 2358 } |
2431 | 2359 |
2432 void os::pd_print_cpu_info(outputStream* st) { | 2360 void os::pd_print_cpu_info(outputStream* st) { |
2433 // Nothing to do for now. | 2361 // Nothing to do for now. |
2434 } | 2362 } |