Browse code

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 authored on 13/07/2010 18:38:08
Showing 3 changed files
... ...
@@ -339,6 +339,38 @@ static void core_version(rpc_t* rpc, void* c)
339 339
 
340 340
 
341 341
 
342
+static const char* core_flags_doc[] = {
343
+	"Returns the compile flags.", /* Documentation string */
344
+	0                             /* Method signature(s) */
345
+};
346
+
347
+static void core_flags(rpc_t* rpc, void* c)
348
+{
349
+	rpc->add(c, "s", ver_flags);
350
+}
351
+
352
+
353
+
354
+static const char* core_info_doc[] = {
355
+	"Verbose info, including version number, compile flags, compiler,"
356
+	"repository hash a.s.o.",     /* Documentation string */
357
+	0                             /* Method signature(s) */
358
+};
359
+
360
+static void core_info(rpc_t* rpc, void* c)
361
+{
362
+	void* s;
363
+	
364
+	if (rpc->add(c, "{", &s) < 0) return;
365
+	rpc->struct_printf(s, "version", "%s %s", ver_name, ver_version);
366
+	rpc->struct_add(s, "s", "id", ver_id);
367
+	rpc->struct_add(s, "s", "compiler", ver_compiler);
368
+	rpc->struct_add(s, "s", "compiled", ver_compiled_time);
369
+	rpc->struct_add(s, "s", "flags", ver_flags);
370
+}
371
+
372
+
373
+
342 374
 static const char* core_uptime_doc[] = {
343 375
 	"Returns uptime of SER server.",  /* Documentation string */
344 376
 	0                                 /* Method signature(s) */
... ...
@@ -824,7 +856,12 @@ static rpc_export_t core_rpc_methods[] = {
824 824
 	RET_ARRAY},
825 825
 	{"core.echo",              core_echo,              core_echo_doc,
826 826
 	RET_ARRAY},
827
-	{"core.version",           core_version,           core_version_doc,           0        },
827
+	{"core.version",           core_version,           core_version_doc,
828
+		0        },
829
+	{"core.flags",             core_flags,             core_flags_doc,
830
+		0        },
831
+	{"core.info",              core_info,              core_info_doc,
832
+		0        },
828 833
 	{"core.uptime",            core_uptime,            core_uptime_doc,            0        },
829 834
 	{"core.ps",                core_ps,                core_ps_doc,                RET_ARRAY},
830 835
 	{"core.pwd",               core_pwd,               core_pwd_doc,               RET_ARRAY},
... ...
@@ -30,6 +30,10 @@
30 30
 
31 31
 
32 32
 const char full_version[] = SER_FULL_VERSION " " REPO_VER;
33
+const char ver_name[] = NAME;
34
+const char ver_version[] = VERSION;
35
+const char ver_arch[] = ARCH;
36
+const char ver_os[] = OS_QUOTED;
33 37
 const char ver_id[] = REPO_HASH " " REPO_STATE;
34 38
 const char ver_compiled_time[] =  __TIME__ " " __DATE__ ;
35 39
 const char ver_compiler[] = COMPILER;
... ...
@@ -29,6 +29,10 @@
29 29
 #define __ver_h
30 30
 
31 31
 extern const char full_version[];
32
+extern const char ver_name[];
33
+extern const char ver_version[];
34
+extern const char ver_arch[];
35
+extern const char ver_os[];
32 36
 extern const char ver_id[];
33 37
 extern const char ver_compiled_time[];
34 38
 extern const char ver_compiler[];