diff options
author | louiz’ <louiz@louiz.org> | 2017-02-27 18:01:20 +0100 |
---|---|---|
committer | louiz’ <louiz@louiz.org> | 2017-02-27 18:01:20 +0100 |
commit | d81cbc4a33ee2c28628ccb632af9ae1b27e84d03 (patch) | |
tree | e301669f22080be2241e082af34c6d8c8979f5ec /louloulibs/utils/system.cpp | |
parent | 9f978cda943619c95a41e5da9047c3cc0dd31555 (diff) | |
download | biboumi-d81cbc4a33ee2c28628ccb632af9ae1b27e84d03.tar.gz biboumi-d81cbc4a33ee2c28628ccb632af9ae1b27e84d03.tar.bz2 biboumi-d81cbc4a33ee2c28628ccb632af9ae1b27e84d03.tar.xz biboumi-d81cbc4a33ee2c28628ccb632af9ae1b27e84d03.zip |
Use uname() instead of CMAKE_SYSTEM
fix #3235
Diffstat (limited to 'louloulibs/utils/system.cpp')
-rw-r--r-- | louloulibs/utils/system.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/louloulibs/utils/system.cpp b/louloulibs/utils/system.cpp new file mode 100644 index 0000000..c0bee11 --- /dev/null +++ b/louloulibs/utils/system.cpp @@ -0,0 +1,21 @@ +#include <logger/logger.hpp> +#include <utils/system.hpp> +#include <sys/utsname.h> +#include <cstring> + +using namespace std::string_literals; + +namespace utils +{ +std::string get_system_name() +{ + struct utsname uts; + const int res = ::uname(&uts); + if (res == -1) + { + log_error("uname failed: ", std::strerror(errno)); + return "Unknown"; + } + return uts.sysname + " "s + uts.release; +} +}
\ No newline at end of file |