From 933120b0b14cf755e3ea8e1695fc4726b57ba70d Mon Sep 17 00:00:00 2001 From: Thomas Veerman Date: Mon, 2 Apr 2012 15:25:37 +0000 Subject: [PATCH] VFS: add getting active threads control msg --- servers/vfs/misc.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/servers/vfs/misc.c b/servers/vfs/misc.c index c394c893e..3617ee042 100644 --- a/servers/vfs/misc.c +++ b/servers/vfs/misc.c @@ -594,7 +594,7 @@ int ruid; *===========================================================================*/ int do_svrctl() { - int svrctl; + unsigned int svrctl; vir_bytes ptr; svrctl = job_m_in.svrctl_req; @@ -651,13 +651,19 @@ int do_svrctl() r = ESRCH; } } else { /* VFSGETPARAM */ + char small_buf[60]; + + r = ESRCH; if (!strcmp(search_key, "print_traces")) { mthread_stacktraces(); sysgetenv.val = 0; sysgetenv.vallen = 0; r = OK; - } else { - r = ESRCH; + } else if (!strcmp(search_key, "active_threads")) { + int active = NR_WTHREADS - worker_available(); + sprintf(small_buf, "%d", active); + sysgetenv.vallen = strlen(small_buf); + r = OK; } if (r == OK) { @@ -665,6 +671,13 @@ int do_svrctl() (vir_bytes) &sysgetenv, who_e, ptr, sizeof(sysgetenv))) != OK) return(s); + if (sysgetenv.val != 0) { + if ((s = sys_datacopy(SELF, + (vir_bytes) small_buf, who_e, + (vir_bytes) sysgetenv.val, + sysgetenv.vallen)) != OK) + return(s); + } } } -- 2.44.0