This is the mail archive of the frysk-cvs@sources.redhat.com mailing list for the frysk project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[SCM] master: Simplify DummyTask.


The branch, master has been updated
       via  669debac6ae033d83a046cfdc8f93876b24da1cf (commit)
       via  6d3b1cdba3b1cc32b881ecab44689578321430fb (commit)
      from  a24692e579989250c60a2cbef2a32bd55b5790ca (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit 669debac6ae033d83a046cfdc8f93876b24da1cf
Author: Andrew Cagney <cagney@redhat.com>
Date:   Wed Jan 2 19:30:44 2008 -0500

    Simplify DummyTask.
    
    frysk-core/frysk/proc/dummy/ChangeLog
    2008-01-02  Andrew Cagney  <cagney@redhat.com>
    
    	* DummyTask.java (oldState, newState): Delete; remove references.
    	(getState(), oldState()): Delete; remove references.
    	(getStateFIXME()): Simplify.

commit 6d3b1cdba3b1cc32b881ecab44689578321430fb
Author: Andrew Cagney <cagney@redhat.com>
Date:   Wed Jan 2 19:12:27 2008 -0500

    Delete frysk.proc.dead.LinuxProcState.
    
    frysk-core/frysk/proc/ChangeLog
    2008-01-02  Andrew Cagney  <cagney@redhat.com>
    
    	* Proc.java (getInitialState(boolean)): Delete.
    	(setStateFIXME(TaskState)): Delete.
    
    frysk-core/frysk/proc/dead/ChangeLog
    2008-01-02  Andrew Cagney  <cagney@redhat.com>
    
    	* DeadProc.java (setStateFIXME(ProcState)): Delete.
    	* LinuxProc.java (getInitialState(boolean)): Delete.
    	* LinuxExeProc.java (getInitialState(boolean)): Delete.
    	* LinuxProcState.java: Delete.
    
    frysk-core/frysk/proc/dummy/ChangeLog
    2008-01-02  Andrew Cagney  <cagney@redhat.com>
    
    	* DummyProc.java (getInitialState(boolean)): Delete.
    	(setStateFIXME(TaskState)): Delete.
    
    frysk-core/frysk/proc/live/ChangeLog
    2008-01-02  Andrew Cagney  <cagney@redhat.com>
    
    	* LinuxProcState.java (initial(boolean)): Replace
    	initial(Proc,boolean).
    	(Detaching()): New constructor.
    	* LiveProc.java (setStateFIXME(ProcState)): Delete.
    	(LiveProc(Host,Proc,ProcId,ProcState)): Replace
    	LiveProc(Host,Proc.ProcId).
    	(LiveProc(Task,ProcId,ProcState)): Replace LiveProc(Task,ProcId).
    	* LinuxProc.java (getInitialState(boolean)): Delete.

-----------------------------------------------------------------------

Summary of changes:
 frysk-core/frysk/proc/ChangeLog                |    3 +
 frysk-core/frysk/proc/Proc.java                |    5 --
 frysk-core/frysk/proc/dead/ChangeLog           |    5 ++
 frysk-core/frysk/proc/dead/DeadProc.java       |    4 -
 frysk-core/frysk/proc/dead/LinuxExeProc.java   |    7 +--
 frysk-core/frysk/proc/dead/LinuxProc.java      |    9 +--
 frysk-core/frysk/proc/dead/LinuxProcState.java |   75 --------------------
 frysk-core/frysk/proc/dummy/ChangeLog          |    7 ++
 frysk-core/frysk/proc/dummy/DummyProc.java     |    7 --
 frysk-core/frysk/proc/dummy/DummyTask.java     |   88 +++---------------------
 frysk-core/frysk/proc/live/ChangeLog           |    9 +++
 frysk-core/frysk/proc/live/LinuxProc.java      |   23 ++-----
 frysk-core/frysk/proc/live/LinuxProcState.java |   21 ++++--
 frysk-core/frysk/proc/live/LiveProc.java       |    9 +--
 14 files changed, 59 insertions(+), 213 deletions(-)
 delete mode 100644 frysk-core/frysk/proc/dead/LinuxProcState.java

First 500 lines of diff:
diff --git a/frysk-core/frysk/proc/ChangeLog b/frysk-core/frysk/proc/ChangeLog
index ae939b5..f227862 100644
--- a/frysk-core/frysk/proc/ChangeLog
+++ b/frysk-core/frysk/proc/ChangeLog
@@ -1,5 +1,8 @@
 2008-01-02  Andrew Cagney  <cagney@redhat.com>
 
+	* Proc.java (getInitialState(boolean)): Delete.
+	(setStateFIXME(TaskState)): Delete.
+
 	* ProcEvent.java (ProcEvent(Proc)): Make public.
 
 	* Proc.java (handleAddObservation(TaskObservation observation)): Delete.
diff --git a/frysk-core/frysk/proc/Proc.java b/frysk-core/frysk/proc/Proc.java
index 49bb795..ddc5cf0 100644
--- a/frysk-core/frysk/proc/Proc.java
+++ b/frysk-core/frysk/proc/Proc.java
@@ -236,8 +236,6 @@ public abstract class Proc {
 	}
     }
 
-    protected abstract ProcState getInitialState(boolean procStarting);
-
     /**
      * Create a new Proc skeleton. Since PARENT could be NULL,
      * explicitly specify the HOST.
@@ -261,7 +259,6 @@ public abstract class Proc {
      */
     protected Proc(Host host, Proc parent, ProcId id) {
 	this(id, parent, host, null);
-	setStateFIXME(getInitialState(false));
 	logger.log(Level.FINEST, "{0} new - create unattached running proc\n", this);
     }
 
@@ -277,7 +274,6 @@ public abstract class Proc {
      */
     protected Proc(Task task, ProcId forkId) {
 	this(forkId, task.getProc(), task.getProc().getHost(), task);
-	setStateFIXME(getInitialState(true));
 	logger.log(Level.FINE, "{0} new - create attached running proc\n", this);
     }
 
@@ -288,7 +284,6 @@ public abstract class Proc {
      * Return the current state as a string.
      */
     protected abstract String getStateFIXME();
-    protected abstract void setStateFIXME(ProcState state);
 
     /**
      * killRequest handles killing off processes that either the
diff --git a/frysk-core/frysk/proc/dead/ChangeLog b/frysk-core/frysk/proc/dead/ChangeLog
index f285d46..71907c3 100644
--- a/frysk-core/frysk/proc/dead/ChangeLog
+++ b/frysk-core/frysk/proc/dead/ChangeLog
@@ -1,5 +1,10 @@
 2008-01-02  Andrew Cagney  <cagney@redhat.com>
 
+	* DeadProc.java (setStateFIXME(ProcState)): Delete.
+	* LinuxProc.java (getInitialState(boolean)): Delete.
+	* LinuxExeProc.java (getInitialState(boolean)): Delete.
+	* LinuxProcState.java: Delete.
+
 	* DeadProc.java (oldState, newState): Delete.
 	(getStateFIXME()): Simplify.
 	(oldState()): Delete.
diff --git a/frysk-core/frysk/proc/dead/DeadProc.java b/frysk-core/frysk/proc/dead/DeadProc.java
index 2ec4a04..206e4f1 100644
--- a/frysk-core/frysk/proc/dead/DeadProc.java
+++ b/frysk-core/frysk/proc/dead/DeadProc.java
@@ -49,7 +49,6 @@ import frysk.proc.TaskObservable;
 import frysk.proc.Manager;
 import frysk.proc.TaskObservation;
 import frysk.proc.ProcEvent;
-import frysk.proc.ProcState;
 
 /**
  * A dead Host/Proc/Task is characterised by its lack of state, and an
@@ -68,9 +67,6 @@ abstract class DeadProc extends Proc {
     protected String getStateFIXME() {
 	return "dead";
     }
-    protected void setStateFIXME(ProcState state) {
-	// ignore
-    }
   
     /**
      * Request that the Proc's task list be refreshed using system
diff --git a/frysk-core/frysk/proc/dead/LinuxExeProc.java b/frysk-core/frysk/proc/dead/LinuxExeProc.java
index 40a22db..11ea9fa 100644
--- a/frysk-core/frysk/proc/dead/LinuxExeProc.java
+++ b/frysk-core/frysk/proc/dead/LinuxExeProc.java
@@ -1,6 +1,6 @@
 // This file is part of the program FRYSK.
 //
-// Copyright 2007 Red Hat Inc.
+// Copyright 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
@@ -54,7 +54,6 @@ import frysk.proc.Auxv;
 import frysk.proc.Isa;
 import frysk.proc.MemoryMap;
 import frysk.proc.ProcId;
-import frysk.proc.ProcState;
 import frysk.proc.TaskId;
 
 public class LinuxExeProc extends DeadProc {
@@ -72,10 +71,6 @@ public class LinuxExeProc extends DeadProc {
 	buildMetaData();
     }
 
-    protected ProcState getInitialState(boolean procStarting) {
-	return LinuxProcState.initial(this);
-    }
-
     public void sendRefresh() {
 	 LinuxExeTask newTask = new LinuxExeTask(this, new TaskId(0),
 		 LinuxExeTaskState.initial());
diff --git a/frysk-core/frysk/proc/dead/LinuxProc.java b/frysk-core/frysk/proc/dead/LinuxProc.java
index 69f0d84..81758ac 100644
--- a/frysk-core/frysk/proc/dead/LinuxProc.java
+++ b/frysk-core/frysk/proc/dead/LinuxProc.java
@@ -1,6 +1,6 @@
 // This file is part of the program FRYSK.
 //
-// Copyright 2007 Red Hat Inc.
+// Copyright 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
@@ -56,7 +56,6 @@ import java.util.logging.Level;
 import java.util.Iterator;
 import java.io.File;
 import java.util.ArrayList;
-import frysk.proc.ProcState;
 import frysk.proc.ProcId;
 import frysk.proc.Task;
 import frysk.proc.Auxv;
@@ -303,12 +302,6 @@ public class LinuxProc extends DeadProc {
     return factory.getIsaForCoreFile(header.machine);
   }
 
-  protected ProcState getInitialState (boolean procStarting) 
-  {
-    return LinuxProcState.initial(this);
-  }
-
-
   /**
    * XXX: Meta Data construction functions.
    * Not really part of the implementation of proc, but has a very
diff --git a/frysk-core/frysk/proc/dead/LinuxProcState.java b/frysk-core/frysk/proc/dead/LinuxProcState.java
deleted file mode 100644
index 2718e86..0000000
--- a/frysk-core/frysk/proc/dead/LinuxProcState.java
+++ /dev/null
@@ -1,75 +0,0 @@
-// This file is part of the program FRYSK.
-//
-// Copyright 2007 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
-// the Free Software Foundation; version 2 of the License.
-//
-// FRYSK is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with FRYSK; if not, write to the Free Software Foundation,
-// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-// 
-// In addition, as a special exception, Red Hat, Inc. gives You the
-// additional right to link the code of FRYSK with code not covered
-// under the GNU General Public License ("Non-GPL Code") and to
-// distribute linked combinations including the two, subject to the
-// limitations in this paragraph. Non-GPL Code permitted under this
-// exception must only link to the code of FRYSK through those well
-// defined interfaces identified in the file named EXCEPTION found in
-// the source code files (the "Approved Interfaces"). The files of
-// Non-GPL Code may instantiate templates or use macros or inline
-// functions from the Approved Interfaces without causing the
-// resulting work to be covered by the GNU General Public
-// License. Only Red Hat, Inc. may make changes or additions to the
-// list of Approved Interfaces. You must obey the GNU General Public
-// License in all respects for all of the FRYSK code and other code
-// used in conjunction with FRYSK except the Non-GPL Code covered by
-// this exception. If you modify this file, you may extend this
-// exception to your version of the file, but you are not obligated to
-// do so. If you do not wish to provide this exception without
-// modification, you must delete this exception statement from your
-// version and license this file solely under the GPL without
-// exception.
-
-package frysk.proc.dead;
-
-import java.util.logging.Level;
-import frysk.proc.ProcState;
-import frysk.proc.Proc;
-
-/**
- * A CoreFile Process State
- */
-
-class LinuxProcState
-  extends ProcState
-{
-
-  protected LinuxProcState (String state)
-  {
-    super (state);
-  }
-  
-  /**
-   * Return the Proc's initial state.
-   *
-   */
-  static ProcState initial (Proc proc)    
-  {
-    logger.log (Level.FINEST, "{0} initial\n", proc); 
-    return detached;
-  }
-  
-    /**
-     * The process is running free (or at least was the last time its
-     * status was checked).
-     */
-    private static final ProcState detached = new ProcState ("detached") {
-	};
-}
diff --git a/frysk-core/frysk/proc/dummy/ChangeLog b/frysk-core/frysk/proc/dummy/ChangeLog
index 1d4cf8c..0cbdd84 100644
--- a/frysk-core/frysk/proc/dummy/ChangeLog
+++ b/frysk-core/frysk/proc/dummy/ChangeLog
@@ -1,5 +1,12 @@
 2008-01-02  Andrew Cagney  <cagney@redhat.com>
 
+	* DummyTask.java (oldState, newState): Delete; remove references.
+	(getState(), oldState()): Delete; remove references.
+	(getStateFIXME()): Simplify.
+
+	* DummyProc.java (getInitialState(boolean)): Delete.
+	(setStateFIXME(TaskState)): Delete.
+
 	* DummyProc.java (getStateFIXME()): New.
 	(handleAddObservation(TaskObservation)): New.
 	(performDetach()): New.
diff --git a/frysk-core/frysk/proc/dummy/DummyProc.java b/frysk-core/frysk/proc/dummy/DummyProc.java
index 28e80d7..f01ced3 100644
--- a/frysk-core/frysk/proc/dummy/DummyProc.java
+++ b/frysk-core/frysk/proc/dummy/DummyProc.java
@@ -40,7 +40,6 @@
 package frysk.proc.dummy;
 
 import frysk.proc.Auxv;
-import frysk.proc.ProcState;
 import frysk.proc.ProcId;
 import frysk.proc.Isa;
 import frysk.proc.MemoryMap;
@@ -75,9 +74,6 @@ public class DummyProc extends Proc {
     }
     public void sendRefresh() {
     }
-    protected ProcState getInitialState (boolean procStarting) {
-	return null;
-    }
     public MemoryMap[] sendrecMaps () {
         return null;
     }
@@ -90,9 +86,6 @@ public class DummyProc extends Proc {
     protected String getStateFIXME() {
 	return "<dummy>";
     }
-    protected void setStateFIXME(ProcState state) {
-	// ignore
-    }
     public void requestRefresh() {
 	throw new RuntimeException("oops!");
     }
diff --git a/frysk-core/frysk/proc/dummy/DummyTask.java b/frysk-core/frysk/proc/dummy/DummyTask.java
index eb55b5a..d8df7dc 100644
--- a/frysk-core/frysk/proc/dummy/DummyTask.java
+++ b/frysk-core/frysk/proc/dummy/DummyTask.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
@@ -50,6 +50,7 @@ import frysk.proc.Task;
 import frysk.proc.Proc;
 
 public class DummyTask extends Task {
+
     public DummyTask (Proc parent) {
 	super (parent, (TaskObserver.Attached) null, null);
     }
@@ -69,105 +70,38 @@ public class DummyTask extends Task {
 	return null;
     }
 
-    /**
-     * The state of this task. During a state transition newState is
-     * NULL.
-     */
-    private TaskState oldState;
-    private TaskState newState;
-
-    /**
-     * Return the current state.
-     */
-    protected final TaskState getState() {
-	if (newState != null)
-	    return newState;
-	else
-	    return oldState;
-    }
     protected String getStateFIXME() {
-	return getState().toString();
+	return "dummy";
     }
 
     /**
      * Set the new state.
      */
     protected final void set(TaskState newState) {
-	this.newState = newState;
+	// ignore
     }
 
-    /**
-     * Return the current state while at the same time marking that
-     * the state is in flux. If a second attempt to change state
-     * occurs before the current state transition has completed,
-     * barf. XXX: Bit of a hack, but at least this prevents state
-     * transition code attempting a second recursive state transition.
-     */
-    protected TaskState oldState() {
-	if (newState == null)
-	    throw new RuntimeException(this + " double state transition");
-	oldState = newState;
-	newState = null;
-	return oldState;
-    }
-
-    /**
-     * (Internal) Add the specified observer to the observable.
-     */
     protected void handleAddObservation(TaskObservation observation) {
-	newState = oldState().handleAddObservation(this, observation);
+	throw new RuntimeException("oops!");
     }
-
-    /**
-     * (Internal) Delete the specified observer from the observable.
-     */
     protected void handleDeleteObservation(TaskObservation observation) {
-	newState = oldState().handleDeleteObservation(this, observation);
+	throw new RuntimeException("oops!");
     }
-
     public void handleUnblock(TaskObserver observer) {
-	newState = oldState().handleUnblock(this, observer);
+	throw new RuntimeException("oops!");
     }
-
-    /**
-     * (Internal) Requesting that the task go (or resume execution).
-     */
     public void performContinue() {
-	newState = oldState().handleContinue(this);
+	throw new RuntimeException("oops!");
     }
-
-    /**
-     * (Internal) Tell the task to remove itself (it is no longer
-     * listed in the system process table and, presumably, has
-     * exited).
-     *
-     * XXX: Should not be public.
-     */
     public void performRemoval() {
-	newState = oldState().handleRemoval(this);
+	throw new RuntimeException("oops!");
     }
-
-    /**
-     * (Internal) Tell the task to attach itself (if it isn't
-     * already). Notify the containing process once the operation has
-     * been completed. The task is left in the stopped state.
-     *
-     * XXX: Should not be public.
-     */
     public void performAttach() {
-	newState = oldState().handleAttach(this);
+	throw new RuntimeException("oops!");
     }
-
-    /**
-     * (Internal) Tell the task to detach itself (if it isn't
-     * already). Notify the containing process once the operation has
-     * been processed; the task is allowed to run free.
-     * @param shouldRemoveObservers whether to remove the observers as well.
-     */
     public void performDetach(boolean shouldRemoveObservers) {
-	newState = oldState().handleDetach(this, shouldRemoveObservers);
+	throw new RuntimeException("oops!");
     }
-
     public void requestUnblock(final TaskObserver observerArg) {
 	throw new RuntimeException("oops!");
     }
diff --git a/frysk-core/frysk/proc/live/ChangeLog b/frysk-core/frysk/proc/live/ChangeLog
index 3a67aa5..3e3b566 100644
--- a/frysk-core/frysk/proc/live/ChangeLog
+++ b/frysk-core/frysk/proc/live/ChangeLog
@@ -1,5 +1,14 @@
 2008-01-02  Andrew Cagney  <cagney@redhat.com>
 
+	* LinuxProcState.java (initial(boolean)): Replace
+	initial(Proc,boolean).
+	(Detaching()): New constructor.
+	* LiveProc.java (setStateFIXME(ProcState)): Delete.
+	(LiveProc(Host,Proc,ProcId,ProcState)): Replace
+	LiveProc(Host,Proc.ProcId).
+	(LiveProc(Task,ProcId,ProcState)): Replace LiveProc(Task,ProcId).
+	* LinuxProc.java (getInitialState(boolean)): Delete.
+
 	* LinuxTask.java (LinuxTask(LiveProc,Attached)): Rename
 	LinuxTask(Proc,TaskObserver.Attached).
 	* LiveProc.java (handleAddObservation(TaskObservation)): Make
diff --git a/frysk-core/frysk/proc/live/LinuxProc.java b/frysk-core/frysk/proc/live/LinuxProc.java
index 8102bdb..d5568a5 100644
--- a/frysk-core/frysk/proc/live/LinuxProc.java
+++ b/frysk-core/frysk/proc/live/LinuxProc.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
@@ -55,7 +55,6 @@ import frysk.sys.proc.MapsBuilder;
 import frysk.sys.proc.Status;
 import frysk.proc.IsaFactory;
 import java.util.logging.Level;
-import frysk.proc.ProcState;
 import frysk.sys.proc.ProcBuilder;
 import java.util.Map;
 import java.util.HashMap;
@@ -72,18 +71,16 @@ public class LinuxProc extends LiveProc {
      * Create a new detached process.  RUNNING makes no sense here.
      * Since PARENT could be NULL, also explicitly pass in the host.
      */
-    public LinuxProc (Host host, Proc parent, ProcId pid, Stat stat)
-    {
-	super (host, parent, pid);
+    public LinuxProc(Host host, Proc parent, ProcId pid, Stat stat) {
+	super(host, parent, pid, LinuxProcState.initial(false));
 	this.stat = stat;
     }
     /**
      * Create a new, definitely attached, definitely running fork of
      * Task.
      */
-    public LinuxProc (Task task, ProcId forkId)
-    {
-	super (task, forkId);
+    public LinuxProc(Task task, ProcId forkId) {
+	super(task, forkId, LinuxProcState.initial(true));
     }
 
     /**
@@ -257,16 +254,6 @@ public class LinuxProc extends LiveProc {
     }
 
     /**
-     * Some constructors in Proc.java need a starting state.  As Proc
-     * is abstract and cannot return a state specific to its subclass,
-     * return here in the subclass
-     */
-    protected ProcState getInitialState (boolean procStarting)
-    {
-	return LinuxProcState.initial(this, procStarting);
-    }
-
-    /**
      * Refresh the Proc.
      */
     public void sendRefresh ()
diff --git a/frysk-core/frysk/proc/live/LinuxProcState.java b/frysk-core/frysk/proc/live/LinuxProcState.java
index d54a96e..3673a7a 100644
--- a/frysk-core/frysk/proc/live/LinuxProcState.java
+++ b/frysk-core/frysk/proc/live/LinuxProcState.java
@@ -1,6 +1,6 @@


hooks/post-receive
--
frysk system monitor/debugger


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]