diff --git a/CMakeLists.txt b/CMakeLists.txt index a5ba6ee6..d55c8607 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,7 +16,7 @@ endif() # Project configuration # -project(uvw VERSION 1.12.0) +project(uvw VERSION 1.13.0) if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Debug) @@ -144,6 +144,7 @@ install( add_custom_target( uvw_aob SOURCES + cmake/in/deps.in appveyor.yml AUTHORS LICENSE diff --git a/cmake/in/deps.in b/cmake/in/deps.in index 9351c339..709869f1 100644 --- a/cmake/in/deps.in +++ b/cmake/in/deps.in @@ -17,7 +17,7 @@ ExternalProject_Add( ExternalProject_Add( libuv GIT_REPOSITORY https://github.com/libuv/libuv.git - GIT_TAG v1.24.0 + GIT_TAG v1.25.0 SOURCE_DIR @LIBUV_DEPS_DIR@ CONFIGURE_COMMAND "" BUILD_COMMAND "" diff --git a/src/uvw/util.hpp b/src/uvw/util.hpp index 40cc556f..7c23dd86 100644 --- a/src/uvw/util.hpp +++ b/src/uvw/util.hpp @@ -278,6 +278,55 @@ private: }; +/** + * @brief Utility class. + * + * This class can be used to get name and information about the current kernel. + * The populated data includes the operating system name, release, version, and + * machine. + * + * \sa Utilities::uname + */ +struct UName { + UName(std::shared_ptr utsname): utsname{utsname} {} + + /** + * @brief Gets the operating system name (like "Linux"). + * @return The operating system name. + */ + std::string sysname() const noexcept { + return utsname ? utsname->sysname : ""; + } + + /** + * @brief Gets the operating system release (like "2.6.28"). + * @return The operating system release. + */ + std::string release() const noexcept { + return utsname ? utsname->release : ""; + } + + /** + * @brief Gets the operating system version. + * @return The operating system version + */ + std::string version() const noexcept { + return utsname ? utsname->version : ""; + } + + /** + * @brief Gets the hardware identifier. + * @return The hardware identifier. + */ + std::string machine() const noexcept { + return utsname ? utsname->machine : ""; + } + +private: + std::shared_ptr utsname; +}; + + /** * @brief The IPv4 tag. * @@ -521,6 +570,21 @@ struct Utilities { return details::tryRead(&uv_os_gethostname); } + /** + * @brief Gets name and information about the current kernel. + * + * This function can be used to get name and information about the + * current kernel. The populated data includes the operating system + * name, release, version, and machine. + * + * @return Name and information about the current kernel. + */ + static UName uname() noexcept { + auto ptr = std::make_shared(); + uv_os_uname(ptr.get()); + return ptr; + } + /** * @brief Gets a subset of the password file entry. *