Browse code

core: added rpc command core.psx

- similar to core.ps but prints the details in RPC structure along with
process index, like:

sercmd> core.psx
{
IDX: 0
PID: 73408
DSC: attendant
}
{
IDX: 1
PID: 73409
DSC: udp receiver child=0 sock=127.0.0.1:5060
}

Daniel-Constantin Mierla authored on 16/05/2011 15:27:07
Showing 1 changed files
... ...
@@ -412,6 +412,27 @@ static void core_ps(rpc_t* rpc, void* c)
412 412
 	}
413 413
 }
414 414
 
415
+static const char* core_psx_doc[] = {
416
+	"Returns the detailed description of running SER processes.",
417
+		/* Documentation string */
418
+	0	/* Method signature(s) */
419
+};
420
+
421
+
422
+static void core_psx(rpc_t* rpc, void* c)
423
+{
424
+	int p;
425
+	void *handle;
426
+
427
+	for (p=0; p<*process_count;p++) {
428
+		rpc->add(c, "{", &handle);
429
+		rpc->struct_add(handle, "dds",
430
+				"IDX", p,
431
+				"PID", pt[p].pid,
432
+				"DSC", pt[p].desc);
433
+	}
434
+}
435
+
415 436
 
416 437
 static const char* core_pwd_doc[] = {
417 438
 	"Returns the working directory of SER server.",    /* Documentation string */
... ...
@@ -889,6 +910,7 @@ static rpc_export_t core_rpc_methods[] = {
889 889
 		0        },
890 890
 	{"core.uptime",            core_uptime,            core_uptime_doc,            0        },
891 891
 	{"core.ps",                core_ps,                core_ps_doc,                RET_ARRAY},
892
+	{"core.psx",               core_psx,               core_psx_doc,                0},
892 893
 	{"core.pwd",               core_pwd,               core_pwd_doc,               RET_ARRAY},
893 894
 	{"core.arg",               core_arg,               core_arg_doc,               RET_ARRAY},
894 895
 	{"core.kill",              core_kill,              core_kill_doc,              0        },