diff options
author | rbuj <[email protected]> | 2019-03-18 17:14:06 +0100 |
---|---|---|
committer | raveit65 <[email protected]> | 2019-04-12 17:43:29 +0200 |
commit | 8e92f12169578e6f6be1bbf8348bba457dda127f (patch) | |
tree | ddc2c1cfe58f5de9646ba4e9e9b6b4722fbec336 /src | |
parent | fbdd007ab4e35deb4c8a89d3400f4db652196542 (diff) | |
download | mate-system-monitor-8e92f12169578e6f6be1bbf8348bba457dda127f.tar.bz2 mate-system-monitor-8e92f12169578e6f6be1bbf8348bba457dda127f.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"; + } } }; |