[jbossnative-commits] JBoss Native SVN: r1016 - in trunk/sight: java/org/jboss/sight and 1 other directories.

jbossnative-commits at lists.jboss.org jbossnative-commits at lists.jboss.org
Mon Sep 10 12:37:51 EDT 2007


Author: mladen.turk at jboss.com
Date: 2007-09-10 12:37:51 -0400 (Mon, 10 Sep 2007)
New Revision: 1016

Modified:
   trunk/sight/examples/org/jboss/sight/ListProcesses.java
   trunk/sight/java/org/jboss/sight/Process.java
   trunk/sight/native/os/windows/process.c
Log:
Fix Process.refresh

Modified: trunk/sight/examples/org/jboss/sight/ListProcesses.java
===================================================================
--- trunk/sight/examples/org/jboss/sight/ListProcesses.java	2007-09-10 12:49:34 UTC (rev 1015)
+++ trunk/sight/examples/org/jboss/sight/ListProcesses.java	2007-09-10 16:37:51 UTC (rev 1016)
@@ -38,6 +38,7 @@
 
     public ListProcesses()
     {
+        Process x = null;
         try {
             for (Process p : Process.getProcesses()) {
                 User u  = new User(p.UserId);
@@ -47,7 +48,17 @@
                                    " User(" + u.Name + ") Group(" +
                                    g.Name +")" + "\t " +
                                    p.CurrentWorkingDirectory);
+                if (p.Id == 380)
+                   x = p;
             }
+            Thread.sleep(10000);
+            if (x != null) {
+                int i = x.refresh();
+                System.out.println("Process\t[" + x.Id + "] \t" +
+                                   x.State + " : " + " " + i + " " + x.BaseName +
+                                   "\t " +
+                                   x.CurrentWorkingDirectory);
+            }
 
         } catch (Exception e) {
             e.printStackTrace();

Modified: trunk/sight/java/org/jboss/sight/Process.java
===================================================================
--- trunk/sight/java/org/jboss/sight/Process.java	2007-09-10 12:49:34 UTC (rev 1015)
+++ trunk/sight/java/org/jboss/sight/Process.java	2007-09-10 16:37:51 UTC (rev 1016)
@@ -159,6 +159,7 @@
         if (allocated) {
             // Only allocated processes can be refreshed.
             clear();
+            State = ProcessState.DEAD;
             return alloc0(this, INSTANCE, Id);
         }
         else

Modified: trunk/sight/native/os/windows/process.c
===================================================================
--- trunk/sight/native/os/windows/process.c	2007-09-10 12:49:34 UTC (rev 1015)
+++ trunk/sight/native/os/windows/process.c	2007-09-10 16:37:51 UTC (rev 1016)
@@ -387,6 +387,10 @@
     no->clean = proc_cleanup;
 #endif
     if (!find_pe32(pid, &pe32)) {
+        /* System pids have low values */
+        if (pid > 10)
+            return APR_ENOENT;
+        // Check if this is needed at all.
         lstrcpyW(pe32.szExeFile, L"Unknown");
     }
     else {




More information about the jbossnative-commits mailing list