diff options
author | rbuj <[email protected]> | 2019-03-18 17:14:06 +0100 |
---|---|---|
committer | raveit65 <[email protected]> | 2019-04-15 18:18:29 +0200 |
commit | 08645403f57a44a270df6b737f9b5d82059848f3 (patch) | |
tree | ff1f4263b4a85a886b6dd97c280f404e0b93074d /src | |
parent | e86eb044ee248349dd6a77738a09daddc023c962 (diff) | |
download | mate-system-monitor-08645403f57a44a270df6b737f9b5d82059848f3.tar.bz2 mate-system-monitor-08645403f57a44a270df6b737f9b5d82059848f3.tar.xz |
Show OpenIndiana release and kernel info in System tab
Diffstat (limited to 'src')
-rw-r--r-- | src/sysinfo.cpp | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/sysinfo.cpp b/src/sysinfo.cpp index 27b00b0..91cfee8 100644 --- a/src/sysinfo.cpp +++ b/src/sysinfo.cpp @@ -298,8 +298,10 @@ namespace { void load_uname_info() { this->hostname = uname().nodename; -#ifdef __linux__ +#if defined(__linux__) this->kernel = string(uname().sysname) + ' ' + uname().release + ' ' + uname().machine; +#elif defined(__sun) && defined(__SVR4) + this->kernel = string(uname().sysname) + ' ' + uname().release + ' ' + uname().version + ' ' + uname().machine; #else this->kernel = string(uname().version) + ' ' + uname().machine; #endif @@ -369,12 +371,23 @@ namespace { private: void load_solaris_info() { - this->distro_name = "Solaris"; - std::ifstream input("/etc/release"); - if (input) - std::getline(input, this->distro_release); + if (input) { + std::string s; + std::getline(input, s); + std::size_t found = s.find("OpenIndiana "); + if (found!=std::string::npos) { + this->distro_name = "OpenIndiana"; + this->distro_release = s.substr(found + strlen("OpenIndiana ")); + } else if (!s.empty()) { + this->distro_release = s; + } + } + + if (this->distro_release.empty()) { + this->distro_name = "Solaris"; + } } }; |