Browse Source

core: more version related rpcs

core.flags - prints the compile flags.

core.info - verbose version info, including the version, git hash,
            compiler, compile date and compile flags.
Andrei Pelinescu-Onciul 15 years ago
parent
commit
20fd4b8b75
3 changed files with 46 additions and 1 deletions
  1. 38 1
      core_cmd.c
  2. 4 0
      ver.c
  3. 4 0
      ver.h

+ 38 - 1
core_cmd.c

@@ -339,6 +339,38 @@ static void core_version(rpc_t* rpc, void* c)
 
 
 
+static const char* core_flags_doc[] = {
+	"Returns the compile flags.", /* Documentation string */
+	0                             /* Method signature(s) */
+};
+
+static void core_flags(rpc_t* rpc, void* c)
+{
+	rpc->add(c, "s", ver_flags);
+}
+
+
+
+static const char* core_info_doc[] = {
+	"Verbose info, including version number, compile flags, compiler,"
+	"repository hash a.s.o.",     /* Documentation string */
+	0                             /* Method signature(s) */
+};
+
+static void core_info(rpc_t* rpc, void* c)
+{
+	void* s;
+	
+	if (rpc->add(c, "{", &s) < 0) return;
+	rpc->struct_printf(s, "version", "%s %s", ver_name, ver_version);
+	rpc->struct_add(s, "s", "id", ver_id);
+	rpc->struct_add(s, "s", "compiler", ver_compiler);
+	rpc->struct_add(s, "s", "compiled", ver_compiled_time);
+	rpc->struct_add(s, "s", "flags", ver_flags);
+}
+
+
+
 static const char* core_uptime_doc[] = {
 	"Returns uptime of SER server.",  /* Documentation string */
 	0                                 /* Method signature(s) */
@@ -824,7 +856,12 @@ static rpc_export_t core_rpc_methods[] = {
 	RET_ARRAY},
 	{"core.echo",              core_echo,              core_echo_doc,
 	RET_ARRAY},
-	{"core.version",           core_version,           core_version_doc,           0        },
+	{"core.version",           core_version,           core_version_doc,
+		0        },
+	{"core.flags",             core_flags,             core_flags_doc,
+		0        },
+	{"core.info",              core_info,              core_info_doc,
+		0        },
 	{"core.uptime",            core_uptime,            core_uptime_doc,            0        },
 	{"core.ps",                core_ps,                core_ps_doc,                RET_ARRAY},
 	{"core.pwd",               core_pwd,               core_pwd_doc,               RET_ARRAY},

+ 4 - 0
ver.c

@@ -30,6 +30,10 @@
 
 
 const char full_version[] = SER_FULL_VERSION " " REPO_VER;
+const char ver_name[] = NAME;
+const char ver_version[] = VERSION;
+const char ver_arch[] = ARCH;
+const char ver_os[] = OS_QUOTED;
 const char ver_id[] = REPO_HASH " " REPO_STATE;
 const char ver_compiled_time[] =  __TIME__ " " __DATE__ ;
 const char ver_compiler[] = COMPILER;

+ 4 - 0
ver.h

@@ -29,6 +29,10 @@
 #define __ver_h
 
 extern const char full_version[];
+extern const char ver_name[];
+extern const char ver_version[];
+extern const char ver_arch[];
+extern const char ver_os[];
 extern const char ver_id[];
 extern const char ver_compiled_time[];
 extern const char ver_compiler[];