public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
* [SCM] master: Have ProcBuilder.build pass a ProcessIdentifier.
@ 2008-02-08 20:08 cagney
0 siblings, 0 replies; only message in thread
From: cagney @ 2008-02-08 20:08 UTC (permalink / raw)
To: frysk-cvs
The branch, master has been updated
via d38d5031293d95fdc2cff53b8c6dd1beccd63819 (commit)
via 36c630fe54695b5fae501c428c68f49d2d1d24d9 (commit)
from e0ae82571361afe851d6434433320bd49c0e6715 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email.
- Log -----------------------------------------------------------------
commit d38d5031293d95fdc2cff53b8c6dd1beccd63819
Author: Andrew Cagney <cagney@redhat.com>
Date: Fri Feb 8 15:07:00 2008 -0500
Have ProcBuilder.build pass a ProcessIdentifier.
frysk-core/frysk/proc/live/ChangeLog
2008-02-08 Andrew Cagney <cagney@redhat.com>
* LinuxPtraceHost.java: Update to match
ProcBuilder.build(ProcessIdentifier).
* LinuxPtraceProc.java: Ditto.
frysk-sys/frysk/sys/proc/ChangeLog
2008-02-08 Andrew Cagney <cagney@redhat.com>
* ProcBuilder.java (build(ProcessIdentifier)): Replace
buildId(int).
* cni/ProcBuilder.cxx: Update.
frysk-sys/frysk/testbed/ChangeLog
2008-02-08 Andrew Cagney <cagney@redhat.com>
* TearDownProcess.java: Update to match
ProcBuilder.build(ProcessIdentifier).
commit 36c630fe54695b5fae501c428c68f49d2d1d24d9
Author: Andrew Cagney <cagney@redhat.com>
Date: Fri Feb 8 14:38:10 2008 -0500
frysk-core/frysk/isa/corefiles/ChangeLog
2008-02-08 Andrew Cagney <cagney@redhat.com>
* IA32LinuxElfCorefile.java: Update to match Stat.ppid.`
* PPC64LinuxElfCorefile.java: Ditto.
* X8664LinuxElfCorefile.java: Ditto.
* PPC32LinuxElfCorefile.java: Ditto.
frysk-core/frysk/proc/live/ChangeLog
2008-02-08 Andrew Cagney <cagney@redhat.com>
* LinuxPtraceTask.java: Use ProcssIdentifierFactory.create.
* LinuxPtraceHost.java: Update to match Stat.ppid.
frysk-core/frysk/testbed/ChangeLog
2008-02-08 Andrew Cagney <cagney@redhat.com>
* OffspringType.java: Use ProcessIdentifierFactory.create(int).
* TestLib.java: Update to match Stat.ppid.
frysk-sys/frysk/sys/ChangeLog
2008-02-08 Andrew Cagney <cagney@redhat.com>
* ProcessIdentifierFactory.java (create(int)): Make public.
(createFIXME(int)): Delete.
frysk-sys/frysk/sys/proc/ChangeLog
2008-02-08 Andrew Cagney <cagney@redhat.com>
* Stat.java (scan(ProcessIdentifier)): New.
(scan(ProcessIdentifier,ProcessIdentifier)): New.
(tid, ppid): Change type to ProcessIdentifier.
frysk-sys/frysk/testbed/ChangeLog
2008-02-08 Andrew Cagney <cagney@redhat.com>
* TearDownProcess.java: Use ProcessIdentifierFactory.create(int).
-----------------------------------------------------------------------
Summary of changes:
frysk-core/frysk/isa/corefiles/ChangeLog | 7 ++++
.../frysk/isa/corefiles/IA32LinuxElfCorefile.java | 4 +-
.../frysk/isa/corefiles/PPC32LinuxElfCorefile.java | 4 +-
.../frysk/isa/corefiles/PPC64LinuxElfCorefile.java | 4 +-
.../frysk/isa/corefiles/X8664LinuxElfCorefile.java | 4 +-
frysk-core/frysk/proc/live/ChangeLog | 9 +++++
frysk-core/frysk/proc/live/LinuxPtraceHost.java | 20 ++++++------
frysk-core/frysk/proc/live/LinuxPtraceProc.java | 11 ++----
frysk-core/frysk/proc/live/LinuxPtraceTask.java | 4 +-
frysk-core/frysk/testbed/ChangeLog | 5 +++
frysk-core/frysk/testbed/OffspringType.java | 2 +-
frysk-core/frysk/testbed/TestLib.java | 4 +-
frysk-sys/frysk/sys/ChangeLog | 5 +++
frysk-sys/frysk/sys/ProcessIdentifierFactory.java | 9 +-----
frysk-sys/frysk/sys/proc/ChangeLog | 10 ++++++
frysk-sys/frysk/sys/proc/ProcBuilder.java | 28 +++++++----------
frysk-sys/frysk/sys/proc/Stat.java | 32 ++++++++++++++-----
frysk-sys/frysk/sys/proc/cni/ProcBuilder.cxx | 6 ++-
frysk-sys/frysk/sys/proc/cni/Stat.cxx | 12 ++++---
frysk-sys/frysk/testbed/ChangeLog | 7 ++++
frysk-sys/frysk/testbed/TearDownProcess.java | 10 ++----
21 files changed, 121 insertions(+), 76 deletions(-)
First 500 lines of diff:
diff --git a/frysk-core/frysk/isa/corefiles/ChangeLog b/frysk-core/frysk/isa/corefiles/ChangeLog
index 69231ce..c3dffd7 100644
--- a/frysk-core/frysk/isa/corefiles/ChangeLog
+++ b/frysk-core/frysk/isa/corefiles/ChangeLog
@@ -1,3 +1,10 @@
+2008-02-08 Andrew Cagney <cagney@redhat.com>
+
+ * IA32LinuxElfCorefile.java: Update to match Stat.ppid.`
+ * PPC64LinuxElfCorefile.java: Ditto.
+ * X8664LinuxElfCorefile.java: Ditto.
+ * PPC32LinuxElfCorefile.java: Ditto.
+
2008-02-05 Andrew Cagney <cagney@redhat.com>
* X8664LinuxElfCorefile.java: Move from frysk.utils.
diff --git a/frysk-core/frysk/isa/corefiles/IA32LinuxElfCorefile.java b/frysk-core/frysk/isa/corefiles/IA32LinuxElfCorefile.java
index 8062558..adfabf5 100644
--- a/frysk-core/frysk/isa/corefiles/IA32LinuxElfCorefile.java
+++ b/frysk-core/frysk/isa/corefiles/IA32LinuxElfCorefile.java
@@ -127,7 +127,7 @@ public class IA32LinuxElfCorefile extends LinuxElfCorefile {
prpsInfo.setPrGid(Status.getGID(pid));
prpsInfo.setPrPid(pid);
- prpsInfo.setPrPpid(processStat.ppid);
+ prpsInfo.setPrPpid(processStat.ppid.intValue());
prpsInfo.setPrPgrp(processStat.pgrp);
prpsInfo.setPrSid(processStat.session);
@@ -174,7 +174,7 @@ public class IA32LinuxElfCorefile extends LinuxElfCorefile {
// Set initial prstatus data
prStatus.setPrPid(task.getTid());
- prStatus.setPrPpid(processStat.ppid);
+ prStatus.setPrPpid(processStat.ppid.intValue());
prStatus.setPrPgrp(processStat.pgrp);
prStatus.setPrSid(processStat.session);
prStatus.setPrSigPending(processStat.signal);
diff --git a/frysk-core/frysk/isa/corefiles/PPC32LinuxElfCorefile.java b/frysk-core/frysk/isa/corefiles/PPC32LinuxElfCorefile.java
index 1581bbc..b74f848 100644
--- a/frysk-core/frysk/isa/corefiles/PPC32LinuxElfCorefile.java
+++ b/frysk-core/frysk/isa/corefiles/PPC32LinuxElfCorefile.java
@@ -130,7 +130,7 @@ public class PPC32LinuxElfCorefile extends LinuxElfCorefile {
prpsInfo.setPrGid(Status.getGID(pid));
prpsInfo.setPrPid(pid);
- prpsInfo.setPrPpid(processStat.ppid);
+ prpsInfo.setPrPpid(processStat.ppid.intValue());
prpsInfo.setPrPgrp(processStat.pgrp);
prpsInfo.setPrSid(processStat.session);
@@ -177,7 +177,7 @@ public class PPC32LinuxElfCorefile extends LinuxElfCorefile {
// Set initial prstatus data
prStatus.setPrPid(task.getTid());
- prStatus.setPrPpid(processStat.ppid);
+ prStatus.setPrPpid(processStat.ppid.intValue());
prStatus.setPrPgrp(processStat.pgrp);
prStatus.setPrSid(processStat.session);
prStatus.setPrSigPending(processStat.signal);
diff --git a/frysk-core/frysk/isa/corefiles/PPC64LinuxElfCorefile.java b/frysk-core/frysk/isa/corefiles/PPC64LinuxElfCorefile.java
index f2467e1..b3c43ba 100644
--- a/frysk-core/frysk/isa/corefiles/PPC64LinuxElfCorefile.java
+++ b/frysk-core/frysk/isa/corefiles/PPC64LinuxElfCorefile.java
@@ -130,7 +130,7 @@ public class PPC64LinuxElfCorefile extends LinuxElfCorefile {
prpsInfo.setPrGid(Status.getGID(pid));
prpsInfo.setPrPid(pid);
- prpsInfo.setPrPpid(processStat.ppid);
+ prpsInfo.setPrPpid(processStat.ppid.intValue());
prpsInfo.setPrPgrp(processStat.pgrp);
prpsInfo.setPrSid(processStat.session);
@@ -177,7 +177,7 @@ public class PPC64LinuxElfCorefile extends LinuxElfCorefile {
// Set initial prstatus data
prStatus.setPrPid(task.getTid());
- prStatus.setPrPpid(processStat.ppid);
+ prStatus.setPrPpid(processStat.ppid.intValue());
prStatus.setPrPgrp(processStat.pgrp);
prStatus.setPrSid(processStat.session);
prStatus.setPrSigPending(processStat.signal);
diff --git a/frysk-core/frysk/isa/corefiles/X8664LinuxElfCorefile.java b/frysk-core/frysk/isa/corefiles/X8664LinuxElfCorefile.java
index 0cdd89d..94b8cce 100644
--- a/frysk-core/frysk/isa/corefiles/X8664LinuxElfCorefile.java
+++ b/frysk-core/frysk/isa/corefiles/X8664LinuxElfCorefile.java
@@ -126,7 +126,7 @@ public class X8664LinuxElfCorefile extends LinuxElfCorefile {
prpsInfo.setPrGid(Status.getGID(pid));
prpsInfo.setPrPid(pid);
- prpsInfo.setPrPpid(processStat.ppid);
+ prpsInfo.setPrPpid(processStat.ppid.intValue());
prpsInfo.setPrPgrp(processStat.pgrp);
prpsInfo.setPrSid(processStat.session);
@@ -173,7 +173,7 @@ public class X8664LinuxElfCorefile extends LinuxElfCorefile {
// Set initial prstatus data
prStatus.setPrPid(task.getTid());
- prStatus.setPrPpid(processStat.ppid);
+ prStatus.setPrPpid(processStat.ppid.intValue());
prStatus.setPrPgrp(processStat.pgrp);
prStatus.setPrSid(processStat.session);
prStatus.setPrSigPending(processStat.signal);
diff --git a/frysk-core/frysk/proc/live/ChangeLog b/frysk-core/frysk/proc/live/ChangeLog
index 86391b7..f2f0210 100644
--- a/frysk-core/frysk/proc/live/ChangeLog
+++ b/frysk-core/frysk/proc/live/ChangeLog
@@ -1,3 +1,12 @@
+2008-02-08 Andrew Cagney <cagney@redhat.com>
+
+ * LinuxPtraceHost.java: Update to match
+ ProcBuilder.build(ProcessIdentifier).
+ * LinuxPtraceProc.java: Ditto.
+
+ * LinuxPtraceTask.java: Use ProcssIdentifierFactory.create.
+ * LinuxPtraceHost.java: Update to match Stat.ppid.
+
2008-02-07 Andrew Cagney <cagney@redhat.com>
* LinuxPtraceHost.java (getTask(ProcessIdentifier)): New.
diff --git a/frysk-core/frysk/proc/live/LinuxPtraceHost.java b/frysk-core/frysk/proc/live/LinuxPtraceHost.java
index 5e89a41..09fe0a7 100644
--- a/frysk-core/frysk/proc/live/LinuxPtraceHost.java
+++ b/frysk-core/frysk/proc/live/LinuxPtraceHost.java
@@ -53,6 +53,7 @@ import frysk.proc.TaskId;
import frysk.proc.Task;
import frysk.proc.TaskObserver.Attached;
import frysk.sys.ProcessIdentifier;
+import frysk.sys.ProcessIdentifierFactory;
import frysk.proc.Manager;
import java.util.logging.Level;
import frysk.sys.Fork;
@@ -111,9 +112,8 @@ public class LinuxPtraceHost extends LiveHost {
/**
* Update PROCID, either adding it
*/
- Proc update (int pid)
- {
- ProcId procId = new ProcId(pid);
+ Proc update(ProcessIdentifier pid) {
+ ProcId procId = new ProcId(pid.intValue());
Proc proc = (Proc) procPool.get(procId);
if (proc == null) {
// New, unknown process. Try to find both the process
@@ -134,7 +134,7 @@ public class LinuxPtraceHost extends LiveHost {
return null;
// Find the parent, every process, except process
// 1, has a parent.
- if (pid <= 1)
+ if (pid.intValue() <= 1)
break;
parent = update(stat.ppid);
if (parent != null)
@@ -146,16 +146,16 @@ public class LinuxPtraceHost extends LiveHost {
}
else if (removed.get(procId) != null) {
// Process 1 never gets a [new] parent.
- if (pid > 1) {
+ if (pid.intValue() > 1) {
Stat stat = ((LinuxPtraceProc) proc).getStat();
// An existing process that hasn't yet been
// updated. Still need check that its parent
// didn't change (assuming there is one).
- if (! stat.refresh(pid))
+ if (stat.scan(pid) == null)
// Oops, just disappeared.
return null;
Proc oldParent = proc.getParent();
- if (oldParent.getPid() != stat.ppid) {
+ if (oldParent.getPid() != stat.ppid.intValue()) {
// Transfer ownership
Proc newParent = update(stat.ppid);
oldParent.remove(proc);
@@ -174,7 +174,7 @@ public class LinuxPtraceHost extends LiveHost {
// procChanges where it can update the /proc tree.
final ProcChanges procChanges = new ProcChanges();
ProcBuilder pidBuilder = new ProcBuilder() {
- public void buildId (int pid) {
+ public void build(ProcessIdentifier pid) {
procChanges.update(pid);
}
};
@@ -222,7 +222,7 @@ public class LinuxPtraceHost extends LiveHost {
// the given procId.
final ProcChanges procChanges = new ProcChanges();
ProcBuilder pidBuilder = new ProcBuilder() {
- public void buildId (int pid) {
+ public void build(ProcessIdentifier pid) {
procChanges.update(pid);
}
};
@@ -269,7 +269,7 @@ public class LinuxPtraceHost extends LiveHost {
public Proc getSelf() {
if (self == null) {
ProcChanges procChanges = new ProcChanges();
- self = procChanges.update(Pid.get());
+ self = procChanges.update(ProcessIdentifierFactory.create(Pid.get()));
}
return self;
}
diff --git a/frysk-core/frysk/proc/live/LinuxPtraceProc.java b/frysk-core/frysk/proc/live/LinuxPtraceProc.java
index 3807703..b805fba 100644
--- a/frysk-core/frysk/proc/live/LinuxPtraceProc.java
+++ b/frysk-core/frysk/proc/live/LinuxPtraceProc.java
@@ -237,22 +237,19 @@ public class LinuxPtraceProc extends LiveProc {
// starting with all known tasks has any existing tasks
// removed, so that by the end it contains a set of removed
// tasks.
- class TidBuilder
- extends ProcBuilder
- {
+ class TidBuilder extends ProcBuilder {
Map added = new HashMap ();
HashMap removed = (HashMap) ((HashMap)taskPool).clone ();
TaskId searchId = new TaskId ();
- public void buildId (int tid)
- {
- searchId.id = tid;
+ public void build(ProcessIdentifier tid) {
+ searchId.id = tid.intValue();
if (removed.containsKey (searchId)) {
removed.remove (searchId);
}
else {
// Add the process (it currently isn't attached).
Task newTask = new LinuxPtraceTask(LinuxPtraceProc.this,
- new TaskId (tid));
+ new TaskId (tid.intValue()));
added.put (newTask.getTaskId(), newTask);
}
}
diff --git a/frysk-core/frysk/proc/live/LinuxPtraceTask.java b/frysk-core/frysk/proc/live/LinuxPtraceTask.java
index 51f2ca6..780e8ee 100644
--- a/frysk-core/frysk/proc/live/LinuxPtraceTask.java
+++ b/frysk-core/frysk/proc/live/LinuxPtraceTask.java
@@ -82,7 +82,7 @@ public class LinuxPtraceTask extends LiveTask {
*/
public LinuxPtraceTask(Proc proc, TaskId id) {
super(proc, id);
- tid = ProcessIdentifierFactory.createFIXME(id.hashCode());
+ tid = ProcessIdentifierFactory.create(id.hashCode());
((LinuxPtraceHost)proc.getHost()).putTask(tid, this);
newState = LinuxPtraceTaskState.detachedState();
}
@@ -102,7 +102,7 @@ public class LinuxPtraceTask extends LiveTask {
public LinuxPtraceTask(LinuxPtraceProc proc,
TaskObserver.Attached attached) {
super(proc, attached);
- tid = ProcessIdentifierFactory.createFIXME(proc.getPid());
+ tid = ProcessIdentifierFactory.create(proc.getPid());
((LinuxPtraceHost)proc.getHost()).putTask(tid, this);
newState = LinuxPtraceTaskState.mainState();
if (attached != null) {
diff --git a/frysk-core/frysk/testbed/ChangeLog b/frysk-core/frysk/testbed/ChangeLog
index 19c5d23..4390b5c 100644
--- a/frysk-core/frysk/testbed/ChangeLog
+++ b/frysk-core/frysk/testbed/ChangeLog
@@ -1,3 +1,8 @@
+2008-02-08 Andrew Cagney <cagney@redhat.com>
+
+ * OffspringType.java: Use ProcessIdentifierFactory.create(int).
+ * TestLib.java: Update to match Stat.ppid.
+
2008-02-07 Andrew Cagney <cagney@redhat.com>
* Offspring.java: Update to match Host.requestProc(int,FindProc).
diff --git a/frysk-core/frysk/testbed/OffspringType.java b/frysk-core/frysk/testbed/OffspringType.java
index f86e20e..6cbf17e 100644
--- a/frysk-core/frysk/testbed/OffspringType.java
+++ b/frysk-core/frysk/testbed/OffspringType.java
@@ -103,7 +103,7 @@ public abstract class OffspringType {
tidObserver);
TestLib.assertRunUntilStop("starting attached child");
// Return that captured TID.
- return ProcessIdentifierFactory.createFIXME(tidObserver.tid);
+ return ProcessIdentifierFactory.create(tidObserver.tid);
}
};
}
diff --git a/frysk-core/frysk/testbed/TestLib.java b/frysk-core/frysk/testbed/TestLib.java
index 4d2b437..bb45590 100644
--- a/frysk-core/frysk/testbed/TestLib.java
+++ b/frysk-core/frysk/testbed/TestLib.java
@@ -132,13 +132,13 @@ public class TestLib
Stat stat = new Stat();
stat.refresh(proc.getPid());
- if (stat.ppid == pid) {
+ if (stat.ppid.intValue() == pid) {
logger.log(Level.FINE, "isChildOf proc is child\n");
return true;
}
logger.log(Level.FINE,
"isChildOf proc not child pid: {0} ppid: {1} parent: {2} proc: {3}\n",
- new Object[] { new Integer(pid), new Integer(stat.ppid),
+ new Object[] { new Integer(pid), stat.ppid,
proc.getParent(), proc });
return false;
}
diff --git a/frysk-sys/frysk/sys/ChangeLog b/frysk-sys/frysk/sys/ChangeLog
index 5248ce2..7c8ea16 100644
--- a/frysk-sys/frysk/sys/ChangeLog
+++ b/frysk-sys/frysk/sys/ChangeLog
@@ -1,3 +1,8 @@
+2008-02-08 Andrew Cagney <cagney@redhat.com>
+
+ * ProcessIdentifierFactory.java (create(int)): Make public.
+ (createFIXME(int)): Delete.
+
2008-02-07 Andrew Cagney <cagney@redhat.com>
* DaemonFactory.java: Replace Daemon.java.
diff --git a/frysk-sys/frysk/sys/ProcessIdentifierFactory.java b/frysk-sys/frysk/sys/ProcessIdentifierFactory.java
index b5227fa..dccb2d4 100644
--- a/frysk-sys/frysk/sys/ProcessIdentifierFactory.java
+++ b/frysk-sys/frysk/sys/ProcessIdentifierFactory.java
@@ -74,7 +74,7 @@ public class ProcessIdentifierFactory {
private static final Map processTable = new WeakHashMap();
private static final ProcessIdentifierKey key = new ProcessIdentifierKey();
- static ProcessIdentifier create(int pid) {
+ public static ProcessIdentifier create(int pid) {
synchronized (processTable) {
key.pid = pid;
ProcessIdentifier processIdentifier
@@ -86,11 +86,4 @@ public class ProcessIdentifierFactory {
return processIdentifier;
}
}
-
- /**
- * Is going away.
- */
- public static ProcessIdentifier createFIXME(int pid) {
- return create(pid);
- }
}
diff --git a/frysk-sys/frysk/sys/proc/ChangeLog b/frysk-sys/frysk/sys/proc/ChangeLog
index 94415be..f5770b0 100644
--- a/frysk-sys/frysk/sys/proc/ChangeLog
+++ b/frysk-sys/frysk/sys/proc/ChangeLog
@@ -1,3 +1,13 @@
+2008-02-08 Andrew Cagney <cagney@redhat.com>
+
+ * ProcBuilder.java (build(ProcessIdentifier)): Replace
+ buildId(int).
+ * cni/ProcBuilder.cxx: Update.
+
+ * Stat.java (scan(ProcessIdentifier)): New.
+ (scan(ProcessIdentifier,ProcessIdentifier)): New.
+ (tid, ppid): Change type to ProcessIdentifier.
+
2008-01-18 Andrew Cagney <cagney@redhat.com>
* Status.java (isStopped(int)): New.
diff --git a/frysk-sys/frysk/sys/proc/ProcBuilder.java b/frysk-sys/frysk/sys/proc/ProcBuilder.java
index 9ab5dcb..472da76 100644
--- a/frysk-sys/frysk/sys/proc/ProcBuilder.java
+++ b/frysk-sys/frysk/sys/proc/ProcBuilder.java
@@ -1,6 +1,6 @@
// This file is part of the program FRYSK.
//
-// Copyright 2005, 2006, 2007, Red Hat Inc.
+// Copyright 2005, 2006, 2007, 2008, Red Hat Inc.
//
// FRYSK is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
@@ -47,16 +47,14 @@ import frysk.sys.ProcessIdentifier;
* directory for process/task IDs building each ID as it is
* encountered.
*/
-public abstract class ProcBuilder
-{
+public abstract class ProcBuilder {
/**
* Iterate over the <tt>/proc</tt>pid<tt>/task</tt> directory
* notifying ProcBuilder of each "interesting" entry. Use
* "finally" to ensure that the directory is always closed.
*/
- public final boolean construct (int pid)
- {
- RawData dir = open (pid);
+ public final boolean construct(int pid) {
+ RawData dir = open(pid);
if (dir == null)
return false;
try {
@@ -67,28 +65,26 @@ public abstract class ProcBuilder
}
return true;
}
- public final boolean construct (ProcessIdentifier pid)
- {
- return construct (pid.hashCode ());
+ public final boolean construct(ProcessIdentifier pid) {
+ return construct(pid.hashCode ());
}
/**
* Iterate over the <tt>/proc</tt> directory notifying TaskBuilder
* of each "interesting" entry.
*/
- public final boolean construct ()
- {
- return construct (0);
+ public final boolean construct() {
+ return construct(0);
}
/**
* Called for each process or task ID in the <tt>/proc</tt>, or
* <tt>/proc/PID/task</tt> directory.
*/
- abstract public void buildId (int id);
+ abstract public void build(ProcessIdentifier pid);
/**
* Private native methods for manipulating the <tt>/proc</tt>
* directory. Move to frysk.sys.Dir?
*/
- native RawData open (int pid);
- native void scan (RawData dir);
- native void close (RawData dir);
+ native RawData open(int pid);
+ native void scan(RawData dir);
+ native void close(RawData dir);
}
diff --git a/frysk-sys/frysk/sys/proc/Stat.java b/frysk-sys/frysk/sys/proc/Stat.java
index 3baa944..3614b3a 100644
--- a/frysk-sys/frysk/sys/proc/Stat.java
+++ b/frysk-sys/frysk/sys/proc/Stat.java
@@ -1,6 +1,6 @@
// This file is part of the program FRYSK.
//
-// Copyright 2005, 2007, Red Hat Inc.
+// Copyright 2005, 2007, 2008, Red Hat Inc.
//
// FRYSK is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
@@ -39,6 +39,9 @@
package frysk.sys.proc;
+import frysk.sys.ProcessIdentifier;
+import frysk.sys.ProcessIdentifierFactory;
+
/**
* The contents of <tt>/proc/PID/stat</tt> file.
*/
@@ -47,13 +50,13 @@ public class Stat {
* Create an unbounded Stat object.
*/
public Stat() {
- this.tid = -1;
+ this.tid = null;
}
/**
* Create a Stat object for TID.
*/
public Stat(int tid) {
- this.tid = tid;
+ this.tid = ProcessIdentifierFactory.create(tid);
}
/**
@@ -62,7 +65,13 @@ public class Stat {
* exist, or can't be read. Throws an error if there is some sort
* of scan problem.
*/
- public native boolean refresh (int pid);
+ public Stat scan(ProcessIdentifier pid) {
+ if (refresh(pid.intValue()))
+ return this;
+ else
+ return null;
+ }
+ public native boolean refresh(int pid);
/**
* Refresh Stat from <tt>/proc/PID/task/TID/stat</tt>, return true if the
@@ -70,24 +79,29 @@ public class Stat {
* exist, or can't be read. Throws an error if there is some sort
* of scan problem.
*/
+ public Stat scan(ProcessIdentifier pid, ProcessIdentifier tid) {
+ if (refreshThread(pid.intValue(), tid.intValue()))
+ return this;
+ else
+ return null;
+ }
public native boolean refreshThread (int pid, int tid);
/**
* Refresh stat from <tt>/proc/</tt>{@link #pid}<tt>/stat</tt>.
*/
- public final boolean refresh ()
- {
- return refresh (tid);
+ public final boolean refresh() {
+ return scan(tid) != null;
}
/** The thread id (== pid in main thread) */
hooks/post-receive
--
frysk system monitor/debugger
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-02-08 20:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-08 20:08 [SCM] master: Have ProcBuilder.build pass a ProcessIdentifier cagney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).