Show additional version information
This commit is contained in:
@@ -382,6 +382,12 @@ if (HAVE_PTHREAD_SETNAME_NP)
|
||||
add_definitions(-DHAVE_PTHREAD_SETNAME_NP)
|
||||
endif()
|
||||
|
||||
check_c_source_compiles("#include <gnu/libc-version.h>\nint main() { return (gnu_get_libc_version() && gnu_get_libc_release()) ? 0 : 1; }" HAVE_GLIBC)
|
||||
|
||||
if (HAVE_GLIBC)
|
||||
add_definitions(-DHAVE_GLIBC)
|
||||
endif()
|
||||
|
||||
add_definitions("-DRAPIDJSON_PARSE_DEFAULT_FLAGS=kParseTrailingCommasFlag")
|
||||
|
||||
if (WIN32 AND (CMAKE_BUILD_TYPE STREQUAL "Release"))
|
||||
|
||||
@@ -330,7 +330,7 @@ static void do_exit(p2pool *m_pool, const char * /* args */)
|
||||
// cppcheck-suppress constParameterCallback
|
||||
static void do_version(p2pool* m_pool, const char* /* args */)
|
||||
{
|
||||
LOGINFO(0, log::LightCyan() << VERSION);
|
||||
LOGINFO(0, log::LightCyan() << p2pool_version());
|
||||
|
||||
const P2PServer* p2p = m_pool->p2p_server();
|
||||
if (p2p) {
|
||||
|
||||
@@ -119,11 +119,6 @@ void p2pool_usage()
|
||||
);
|
||||
}
|
||||
|
||||
void p2pool_version()
|
||||
{
|
||||
printf("P2Pool %s\n", p2pool::VERSION);
|
||||
}
|
||||
|
||||
int p2pool_test()
|
||||
{
|
||||
printf("Self-test started\n");
|
||||
@@ -232,7 +227,7 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
|
||||
if (!strcmp(argv[i], "--version") || !strcmp(argv[i], "/version") || !strcmp(argv[i], "-v") || !strcmp(argv[i], "/v")) {
|
||||
p2pool_version();
|
||||
puts(p2pool::p2pool_version().c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
43
src/util.cpp
43
src/util.cpp
@@ -40,6 +40,19 @@
|
||||
#include <resolv.h>
|
||||
#endif
|
||||
|
||||
#include <curl/curl.h>
|
||||
#include <zmq.h>
|
||||
|
||||
#ifdef HAVE_GLIBC
|
||||
#include <gnu/libc-version.h>
|
||||
#endif
|
||||
|
||||
#ifdef WITH_GRPC
|
||||
#include <grpc/include/grpcpp/version_info.h>
|
||||
#endif
|
||||
|
||||
#include <rapidjson/rapidjson.h>
|
||||
|
||||
LOG_CATEGORY(Util)
|
||||
|
||||
namespace p2pool {
|
||||
@@ -60,6 +73,36 @@ const char* VERSION = "v" STR2(P2POOL_VERSION_MAJOR) "." STR2(P2POOL_VERSION_MIN
|
||||
#endif
|
||||
" on " __DATE__ ")";
|
||||
|
||||
std::string p2pool_version()
|
||||
{
|
||||
const curl_version_info_data* curl_version = curl_version_info(CURLVERSION_NOW);
|
||||
|
||||
int zmq_major, zmq_minor, zmq_patch;
|
||||
zmq_version(&zmq_major, &zmq_minor, &zmq_patch);
|
||||
|
||||
char buf[384] = {};
|
||||
log::Stream s(buf);
|
||||
|
||||
s << "P2Pool " << VERSION << '\n'
|
||||
<< "\nDependencies:\n"
|
||||
#ifdef HAVE_GLIBC
|
||||
<< " - glibc " << gnu_get_libc_version() << '-' << gnu_get_libc_release() << '\n'
|
||||
#endif
|
||||
#ifdef WITH_GRPC
|
||||
<< " - grpc " << GRPC_CPP_VERSION_STRING << '\n'
|
||||
#endif
|
||||
<< " - libcurl " << (curl_version ? curl_version->version : "unknown") << '\n'
|
||||
<< " - libuv " << uv_version_string() << '\n'
|
||||
<< " - libzmq " << zmq_major << '.' << zmq_minor << '.' << zmq_patch << '\n'
|
||||
#ifdef WITH_UPNP
|
||||
<< " - miniupnpc " << MINIUPNPC_VERSION << '\n'
|
||||
#endif
|
||||
<< " - rapidjson " << RAPIDJSON_VERSION_STRING << '\n'
|
||||
;
|
||||
|
||||
return std::string(buf, s.m_pos);
|
||||
}
|
||||
|
||||
const uint8_t ED25519_MASTER_PUBLIC_KEY[32] = {51,175,37,73,203,241,188,115,195,255,123,53,218,120,90,74,186,240,82,178,67,139,124,91,180,106,188,181,187,51,236,10};
|
||||
|
||||
std::string DATA_DIR;
|
||||
|
||||
@@ -381,12 +381,13 @@ void show_top_10_allocations();
|
||||
void minidump_and_crash(size_t delay);
|
||||
#endif
|
||||
|
||||
std::string p2pool_version();
|
||||
|
||||
} // namespace p2pool
|
||||
|
||||
void memory_tracking_start();
|
||||
bool memory_tracking_stop();
|
||||
void p2pool_usage();
|
||||
void p2pool_version();
|
||||
int p2pool_test();
|
||||
|
||||
namespace robin_hood {
|
||||
|
||||
Reference in New Issue
Block a user