0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-25 16:22:35 +01:00

ircd::info: Improve various version information gathering.

This commit is contained in:
Jason Volk 2018-11-01 20:14:00 -07:00
parent c0e92eb2a1
commit 3385d25c97
6 changed files with 65 additions and 35 deletions

View file

@ -85,7 +85,8 @@ enum class ircd::db::pos
//
namespace ircd::db
{
extern const char *const version;
extern const uint version[3];
extern const string_view version_str;
// Utils for "name:checkpoint" string amalgam
std::string namepoint(const string_view &name, const uint64_t &checkpoint);

View file

@ -49,14 +49,12 @@ namespace ircd::info
extern const size_t rlimit_rss;
extern const size_t rlimit_nofile;
extern const int glibc[3];
extern const int glibc_version[3];
extern const string_view glibc_version_str;
#ifdef HAVE_SYS_UTSNAME_H
extern const ::utsname utsname;
#endif
// Third party information
extern const uint boost_version[3];
// Extended information
extern const std::vector<info::line> myinfo;
extern const std::vector<string_view> credits;

View file

@ -24,6 +24,9 @@ namespace boost::asio
namespace ircd
{
namespace asio = boost::asio; ///< Alias so that asio:: can be used.
extern const uint boost_version[3];
extern const string_view boost_version_str;
}
namespace ircd::ios

View file

@ -130,22 +130,27 @@ namespace ircd::db
static void init_test_direct_io();
static void init_compressions();
static void init_directory();
static void init_version();
}
static char ircd_db_version[64];
const char *const ircd::db::version(ircd_db_version);
// Renders a version string from the defines included here.
__attribute__((constructor))
void
ircd::db::init_version()
decltype(ircd::db::version)
ircd::db::version
{
::snprintf(ircd_db_version, sizeof(ircd_db_version), "%d.%d.%d",
ROCKSDB_MAJOR,
ROCKSDB_MINOR,
ROCKSDB_PATCH);
}
ROCKSDB_MAJOR,
ROCKSDB_MINOR,
ROCKSDB_PATCH
};
char ircd_db_version_str_buf[64];
decltype(ircd::db::version_str)
ircd::db::version_str
(
ircd_db_version_str_buf,
::snprintf(ircd_db_version_str_buf, sizeof(ircd_db_version_str_buf),
"%u.%u.%u",
version[0],
version[1],
version[2])
);
//
// init::init

View file

@ -10,7 +10,6 @@
#include <RB_INC_SYS_RESOURCE_H
#include <RB_INC_UNISTD_H
#include <boost/version.hpp>
void
ircd::info::init()
@ -38,12 +37,11 @@ ircd::info::dump()
// assumed for this execution.
log::info
{
"%s. boost %u.%u.%u. RocksDB %s. SpiderMonkey %s. sodium %s. %s. libmagic %d.",
"%s. glibc %s. boost %s. RocksDB %s. SpiderMonkey %s. sodium %s. %s. libmagic %d.",
PACKAGE_STRING,
boost_version[0],
boost_version[1],
boost_version[2],
db::version,
glibc_version_str,
boost_version_str,
db::version_str,
js::version(js::ver::IMPLEMENTATION),
nacl::version(),
openssl::version(),
@ -179,14 +177,26 @@ ircd::info::startup
// System / platform information
//
const int
glibc[3]
decltype(ircd::info::glibc_version)
ircd::info::glibc_version
{
__GNU_LIBRARY__,
__GLIBC__,
__GLIBC_MINOR__,
};
char ircd_info_glibc_version_str_buf[32];
decltype(ircd::info::glibc_version_str)
ircd::info::glibc_version_str
(
ircd_info_glibc_version_str_buf,
::snprintf(ircd_info_glibc_version_str_buf, sizeof(ircd_info_glibc_version_str_buf),
"%d.%d.%d",
glibc_version[0],
glibc_version[1],
glibc_version[2])
);
#ifdef HAVE_SYS_UTSNAME_H
decltype(ircd::info::utsname)
ircd::info::utsname{[]
@ -279,15 +289,6 @@ ircd::info::constructive_interference
// Third party dependency information
//
/// Boost version indicator for compiled header files.
decltype(ircd::info::boost_version)
ircd::info::boost_version
{
BOOST_VERSION / 100000,
BOOST_VERSION / 100 % 1000,
BOOST_VERSION % 100,
};
/// Provides tcmalloc version information if tcmalloc is linked in to IRCd.
struct ircd::info::tc_version
{

View file

@ -8,8 +8,30 @@
// copyright notice and this permission notice is present in all copies. The
// full license for this software is available in the LICENSE file.
#include <boost/version.hpp>
#include <ircd/asio.h>
/// Boost version indicator for compiled header files.
decltype(ircd::boost_version)
ircd::boost_version
{
BOOST_VERSION / 100000,
BOOST_VERSION / 100 % 1000,
BOOST_VERSION % 100,
};
char ircd_boost_version_str_buf[32];
decltype(ircd::boost_version_str)
ircd::boost_version_str
(
ircd_boost_version_str_buf,
::snprintf(ircd_boost_version_str_buf, sizeof(ircd_boost_version_str_buf),
"%u.%u.%u",
boost_version[0],
boost_version[1],
boost_version[2])
);
/// Record of the ID of the thread static initialization took place on.
decltype(ircd::ios::static_thread_id)
ircd::ios::static_thread_id