]> Zhao Yanbai Git Server - minix.git/commitdiff
VFS: add getting active threads control msg
authorThomas Veerman <thomas@minix3.org>
Mon, 2 Apr 2012 15:25:37 +0000 (15:25 +0000)
committerThomas Veerman <thomas@minix3.org>
Fri, 13 Apr 2012 13:21:01 +0000 (13:21 +0000)
servers/vfs/misc.c

index c394c893e1ddc39f35f85cc7be8407d6932ff86d..3617ee04235ce0d8e488af0e7fa5b59de80049aa 100644 (file)
@@ -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);
+                               }
                        }
                }