SCE输出版本号
This commit is contained in:
@@ -35,12 +35,12 @@ endif()
|
||||
|
||||
set(DESCRIBE "${VCS_SHORT_HASH}")
|
||||
set(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
|
||||
set(GIT_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}-${DESCRIBE}")
|
||||
set(SCE_GIT_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}-${DESCRIBE}")
|
||||
|
||||
# Replace .- with _
|
||||
string(REGEX REPLACE "[\\.\\-]" "_" VAR_VERSION "${GIT_VERSION}")
|
||||
string(REGEX REPLACE "[\\.\\-]" "_" VAR_VERSION "${SCE_GIT_VERSION}")
|
||||
|
||||
# Print information
|
||||
message(STATUS "Welcome to Traffic Steering Service, Version: ${GIT_VERSION}")
|
||||
add_definitions(-DGIT_VERSION=\"${GIT_VERSION}\")
|
||||
message(STATUS "Welcome to TSG Service Chaining Engine, Version: ${SCE_GIT_VERSION}")
|
||||
add_definitions(-DSCE_GIT_VERSION=\"${SCE_GIT_VERSION}\")
|
||||
add_definitions(-DVAR_VERSION=${VAR_VERSION})
|
||||
@@ -11,6 +11,20 @@
|
||||
#include "health_check.h"
|
||||
#include "global_metrics.h"
|
||||
|
||||
#ifdef SCE_GIT_VERSION
|
||||
static __attribute__((__used__)) const char *__sce_version = SCE_GIT_VERSION;
|
||||
#else
|
||||
static __attribute__((__used__)) const char *__sce_version = "Unknown";
|
||||
#endif
|
||||
|
||||
static void usage(char *cmd)
|
||||
{
|
||||
fprintf(stderr, "USAGE: %s [OPTIONS]\n", cmd);
|
||||
fprintf(stderr, " -v -- show version\n");
|
||||
fprintf(stderr, " -h -- show help info\n\n");
|
||||
fprintf(stderr, "kill -s SIGHUP $PID -- reload zlog configure\n");
|
||||
}
|
||||
|
||||
static void sig_handler(int signo)
|
||||
{
|
||||
if (signo == SIGHUP)
|
||||
@@ -90,6 +104,22 @@ int main(int argc, char **argv)
|
||||
{
|
||||
const char *profile = "./conf/sce.conf";
|
||||
|
||||
int opt = 0;
|
||||
while ((opt = getopt(argc, argv, "vh")) != -1)
|
||||
{
|
||||
switch (opt)
|
||||
{
|
||||
case 'v':
|
||||
fprintf(stderr, "TSG Service Chaining Engine, Version: %s\n", __sce_version);
|
||||
return 0;
|
||||
case 'h': /* fall through */
|
||||
default:
|
||||
usage(argv[0]);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
fprintf(stderr, "TSG Service Chaining Engine, Version: %s\n", __sce_version);
|
||||
|
||||
if (LOG_INIT("./conf/zlog.conf") == -1)
|
||||
{
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user