Mercurial > hg > truffle
comparison src/os/linux/vm/os_linux.cpp @ 12212:4472884d8b37
6986195: correctly identify Ubuntu as the operating system in crash report instead of "Debian"
Summary: Cleanup and document how various Linux release info files are used by print_distro_info().
Reviewed-by: dcubed, dsamersoff, coleenp, iklam, omajid
Contributed-by: gerald.thornbrugh@oracle.com
author | dcubed |
---|---|
date | Mon, 16 Sep 2013 12:43:34 -0700 |
parents | 2e6938dd68f2 |
children | 06ae47d9d088 |
comparison
equal
deleted
inserted
replaced
12211:2e6938dd68f2 | 12212:4472884d8b37 |
---|---|
2167 | 2167 |
2168 os::Linux::print_full_memory_info(st); | 2168 os::Linux::print_full_memory_info(st); |
2169 } | 2169 } |
2170 | 2170 |
2171 // Try to identify popular distros. | 2171 // Try to identify popular distros. |
2172 // Most Linux distributions have /etc/XXX-release file, which contains | 2172 // Most Linux distributions have a /etc/XXX-release file, which contains |
2173 // the OS version string. Some have more than one /etc/XXX-release file | 2173 // the OS version string. Newer Linux distributions have a /etc/lsb-release |
2174 // (e.g. Mandrake has both /etc/mandrake-release and /etc/redhat-release.), | 2174 // file that also contains the OS version string. Some have more than one |
2175 // so the order is important. | 2175 // /etc/XXX-release file (e.g. Mandrake has both /etc/mandrake-release and |
2176 // /etc/redhat-release.), so the order is important. | |
2177 // Any Linux that is based on Redhat (i.e. Oracle, Mandrake, Sun JDS...) have | |
2178 // their own specific XXX-release file as well as a redhat-release file. | |
2179 // Because of this the XXX-release file needs to be searched for before the | |
2180 // redhat-release file. | |
2181 // Since Red Hat has a lsb-release file that is not very descriptive the | |
2182 // search for redhat-release needs to be before lsb-release. | |
2183 // Since the lsb-release file is the new standard it needs to be searched | |
2184 // before the older style release files. | |
2185 // Searching system-release (Red Hat) and os-release (other Linuxes) are a | |
2186 // next to last resort. The os-release file is a new standard that contains | |
2187 // distribution information and the system-release file seems to be an old | |
2188 // standard that has been replaced by the lsb-release and os-release files. | |
2189 // Searching for the debian_version file is the last resort. It contains | |
2190 // an informative string like "6.0.6" or "wheezy/sid". Because of this | |
2191 // "Debian " is printed before the contents of the debian_version file. | |
2176 void os::Linux::print_distro_info(outputStream* st) { | 2192 void os::Linux::print_distro_info(outputStream* st) { |
2177 if (!_print_ascii_file("/etc/mandrake-release", st) && | 2193 if (!_print_ascii_file("/etc/oracle-release", st) && |
2178 !_print_ascii_file("/etc/sun-release", st) && | 2194 !_print_ascii_file("/etc/mandriva-release", st) && |
2179 !_print_ascii_file("/etc/redhat-release", st) && | 2195 !_print_ascii_file("/etc/mandrake-release", st) && |
2180 !_print_ascii_file("/etc/SuSE-release", st) && | 2196 !_print_ascii_file("/etc/sun-release", st) && |
2181 !_print_ascii_file("/etc/turbolinux-release", st) && | 2197 !_print_ascii_file("/etc/redhat-release", st) && |
2182 !_print_ascii_file("/etc/gentoo-release", st) && | 2198 !_print_ascii_file("/etc/lsb-release", st) && |
2183 !_print_ascii_file("/etc/debian_version", st) && | 2199 !_print_ascii_file("/etc/SuSE-release", st) && |
2184 !_print_ascii_file("/etc/ltib-release", st) && | 2200 !_print_ascii_file("/etc/turbolinux-release", st) && |
2185 !_print_ascii_file("/etc/angstrom-version", st)) { | 2201 !_print_ascii_file("/etc/gentoo-release", st) && |
2186 st->print("Linux"); | 2202 !_print_ascii_file("/etc/ltib-release", st) && |
2187 } | 2203 !_print_ascii_file("/etc/angstrom-version", st) && |
2188 st->cr(); | 2204 !_print_ascii_file("/etc/system-release", st) && |
2205 !_print_ascii_file("/etc/os-release", st)) { | |
2206 | |
2207 if (file_exists("/etc/debian_version")) { | |
2208 st->print("Debian "); | |
2209 _print_ascii_file("/etc/debian_version", st); | |
2210 } else { | |
2211 st->print("Linux"); | |
2212 } | |
2213 } | |
2214 st->cr(); | |
2189 } | 2215 } |
2190 | 2216 |
2191 void os::Linux::print_libversion_info(outputStream* st) { | 2217 void os::Linux::print_libversion_info(outputStream* st) { |
2192 // libc, pthread | 2218 // libc, pthread |
2193 st->print("libc:"); | 2219 st->print("libc:"); |