[SCM] master: Keep syscall's business private.

cagney@sourceware.org cagney@sourceware.org
Fri Dec 21 21:02:00 GMT 2007


The branch, master has been updated
       via  c9165e0207a8809cc0490a85236425c58717db07 (commit)
       via  c6e25ac436b2551c0ceed6ac8613ff9ba5198aec (commit)
      from  59d1aa4c32e5bd3d9275db8cae8c57eac6f28127 (commit)

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

- Log -----------------------------------------------------------------
commit c9165e0207a8809cc0490a85236425c58717db07
Author: Andrew Cagney <cagney@toil.yyz.redhat.com>
Date:   Fri Dec 21 15:58:13 2007 -0500

    Keep syscall's business private.
    
    frysk-core/frysk/ftrace/ChangeLog
    2007-12-21  Andrew Cagney  <cagney@redhat.com>
    
    	* Ftrace.java: Use Syscall.isNoReturn().
    
    frysk-core/frysk/proc/ChangeLog
    2007-12-21  Andrew Cagney  <cagney@redhat.com>
    
    	* Syscall.java (number, name, numArgs, argList, noreturn): Make
    	private.
    	(isNoReturn()): New.

commit c6e25ac436b2551c0ceed6ac8613ff9ba5198aec
Author: Andrew Cagney <cagney@toil.yyz.redhat.com>
Date:   Fri Dec 21 15:38:53 2007 -0500

    Re-indent Syscall.java.
    
    frysk-core/frysk/proc/ChangeLog
    2007-12-21  Andrew Cagney  <cagney@redhat.com>
    
    	* Syscall.java: Re-indent.

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

Summary of changes:
 frysk-core/frysk/ftrace/ChangeLog   |    4 +
 frysk-core/frysk/ftrace/Ftrace.java |    2 +-
 frysk-core/frysk/proc/ChangeLog     |    6 +
 frysk-core/frysk/proc/Syscall.java  |  263 ++++++++++++++++-------------------
 4 files changed, 129 insertions(+), 146 deletions(-)

First 500 lines of diff:
diff --git a/frysk-core/frysk/ftrace/ChangeLog b/frysk-core/frysk/ftrace/ChangeLog
index c28dc52..c39f510 100644
--- a/frysk-core/frysk/ftrace/ChangeLog
+++ b/frysk-core/frysk/ftrace/ChangeLog
@@ -1,3 +1,7 @@
+2007-12-21  Andrew Cagney  <cagney@redhat.com>
+
+	* Ftrace.java: Use Syscall.isNoReturn().
+
 2007-12-21  Petr Machata  <pmachata@redhat.com>
 
 	* TestLtrace.java (testRecursive): New test.
diff --git a/frysk-core/frysk/ftrace/Ftrace.java b/frysk-core/frysk/ftrace/Ftrace.java
index 5a5d7c5..fee19da 100644
--- a/frysk-core/frysk/ftrace/Ftrace.java
+++ b/frysk-core/frysk/ftrace/Ftrace.java
@@ -436,7 +436,7 @@ public class Ftrace
 	    frysk.proc.Syscall syscall
 		= task.getSyscallEventInfo().getSyscall(task);
 	    String name = syscall.getName();
-	    if (syscall.noreturn)
+	    if (syscall.isNoReturn())
 		reporter.eventSingle(task, "syscall " + name,
 				     syscall.extractCallArguments(task));
 	    else
diff --git a/frysk-core/frysk/proc/ChangeLog b/frysk-core/frysk/proc/ChangeLog
index ab0e3cf..d23f180 100644
--- a/frysk-core/frysk/proc/ChangeLog
+++ b/frysk-core/frysk/proc/ChangeLog
@@ -1,5 +1,11 @@
 2007-12-21  Andrew Cagney  <cagney@redhat.com>
 
+	* Syscall.java (number, name, numArgs, argList, noreturn): Make
+	private.
+	(isNoReturn()): New.
+	
+	* Syscall.java: Re-indent.
+
 	* LinuxPPC32On64.java: Delete.
 	* LinuxIa32On64.java: Delete.
 	* IsaFactory.java (IsaFactory()): Simplify.
diff --git a/frysk-core/frysk/proc/Syscall.java b/frysk-core/frysk/proc/Syscall.java
index 9253b8f..f7f9f71 100644
--- a/frysk-core/frysk/proc/Syscall.java
+++ b/frysk-core/frysk/proc/Syscall.java
@@ -1,6 +1,6 @@
 // This file is part of the program FRYSK.
 //
-// Copyright 2005, Red Hat Inc.
+// Copyright 2005, 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
@@ -36,10 +36,10 @@
 // modification, you must delete this exception statement from your
 // version and license this file solely under the GPL without
 // exception.
+
 package frysk.proc;
 
 import inua.util.PrintWriter;
-
 import java.util.HashMap;
 
 /**
@@ -47,72 +47,64 @@ import java.util.HashMap;
  * used in combination with {@link SyscallEventInfo} and the
  * task to get information about a particular system call event.
  */
-public abstract class Syscall
-{
-    int number;
-    public final int numArgs;
-    String name;
-    public final String argList;
-    public final boolean noreturn;
+
+public abstract class Syscall {
+    private final int number;
+    private final int numArgs;
+    private final String name;
+    private final String argList;
+    private final boolean noReturn;
 
     Syscall (String name, int number, int numArgs,
-	     String argList, boolean noreturn)
-    {
+	     String argList, boolean noReturn) {
 	this.name = name;
 	this.number = number;
 	this.numArgs = numArgs;
 	this.argList = argList;
-	this.noreturn = noreturn;
+	this.noReturn = noReturn;
     }
 
-    Syscall (String name, int number, int numArgs, String argList)
-    {
-	this.name = name;
-	this.number = number;
-	this.numArgs = numArgs;
-	this.argList = argList;
-	this.noreturn = false;
+    Syscall (String name, int number, int numArgs, String argList) {
+	this(name, number, numArgs, argList, false);
     }
 
-    Syscall (String name, int number, int numArgs)
-    {
-	this (name, number, numArgs, "i:iiiiiiii");
+    Syscall (String name, int number, int numArgs) {
+	this(name, number, numArgs, "i:iiiiiiii");
     }
 
-    Syscall (String name, int number)
-    {
-	this (name, number, 0, "i:");
+    Syscall (String name, int number) {
+	this(name, number, 0, "i:");
     }
 
-    Syscall (int number)
-    {
-	this ("<" + number + ">", number, 0, "i:");
+    Syscall (int number) {
+	this("<" + number + ">", number, 0, "i:");
     }
 
     /** Return the name of the system call.  */
-    public String getName()
-    {
+    public String getName() {
         return name;
     }
 
     /** Return the system call's number.  */
-    public int getNumber()
-    {
+    public int getNumber() {
         return number;
     }
+    /** Does the system call return a result?  */
+    public boolean isNoReturn() {
+	return noReturn;
+    }
+
     /** Return true if this object equals the argument.  */
-    public boolean equals(Object other)
-    {
-      // Syscall objects are unique.
-      return this == other;
+    public boolean equals(Object other) {
+	// Syscall objects are unique.
+	return this == other;
     }
 
-  abstract public long getArguments (Task task, int n);
-  abstract public long getReturnCode (Task task);
+    abstract public long getArguments (Task task, int n);
+    abstract public long getReturnCode (Task task);
 
     private String extractStringArg (frysk.proc.Task task,
-				     long addr)
-    {
+				     long addr) {
 	if (addr == 0)
 	    return "0x0";
 	else {
@@ -131,8 +123,7 @@ public abstract class Syscall
      * @param task the task which supplies information about the
      * arguments
      */
-    public String[] extractCallArguments (frysk.proc.Task task)
-    {
+    public String[] extractCallArguments (frysk.proc.Task task) {
 	String[] ret = new String[numArgs];
 
 	for (int i = 0; i < numArgs; ++i) {
@@ -172,8 +163,7 @@ public abstract class Syscall
      * @return writer
      */
     public PrintWriter printCall (PrintWriter writer,
-				  frysk.proc.Task task)
-    {
+				  frysk.proc.Task task) {
 	String[] args = extractCallArguments(task);
 	writer.print ("<SYSCALL> " + name + " (");
 	for (int i = 0; i < args.length; ++i) {
@@ -181,26 +171,24 @@ public abstract class Syscall
 	    if (i < numArgs)
 		writer.print (",");
 	}
-	if (noreturn)
+	if (noReturn)
 	    writer.println (")");
 	else
 	    writer.print (")");
 	return writer;
     }
 
-  public String toString()
-  {
-    return (this.getClass()
-	    +"[name=" + getName()
-	    + ",number=" + getNumber() + "]");
-  }
+    public String toString() {
+	return (this.getClass()
+		+"[name=" + getName()
+		+ ",number=" + getNumber() + "]");
+    }
 
     /**
      * Extract system call return value.  Currently returns formatted
      * string.
      */
-    public String extractReturnValue(frysk.proc.Task task)
-    {
+    public String extractReturnValue(frysk.proc.Task task) {
 	long retVal = getReturnCode(task);
 
 	switch (argList.charAt (0)) {
@@ -235,104 +223,89 @@ public abstract class Syscall
      * @return writer
      */
     public PrintWriter printReturn (PrintWriter writer,
-				    frysk.proc.Task task)
-    {
+				    frysk.proc.Task task) {
 	writer.print (" = " + extractReturnValue(task));
 	return writer;
     }
 
-   /**
-   * Given a system call's name, this will return the corresponding
-   * Syscall object.  If no predefined system call with that name
-   * is available, this will return null.
-   * @param name the name of the system call
-   * @param syscallList system calls list
-   * @return the Syscall object, or null
-   */
-  static Syscall iterateSyscallByName (String name, Syscall[] syscallList)
-  {
-    for (int i = 0; i < syscallList.length; ++i)
-      if (name.equals(syscallList[i].name))
-	return syscallList[i];
-    return null;
-  }
-
-  /**
-   * Given a system call's number, this will return the corresponding
-   * Syscall object.  Note that system call numbers are platform
-   * dependent.  This will return a Syscall object in all cases; if
-   * there is no predefined system call with the given number, a unique
-   * "unknown" system call with the indicated number will be created.
-   *
-   * @param num the number of the system call
-   * @param task the current task
-   * @return the Syscall object
-   */
-  public static Syscall syscallByNum (int num, Task task)
-  {
-    Syscall[] syscallList;
-    HashMap unknownSyscalls;
-
-    syscallList = task.getIsa().getSyscallList ();
-    unknownSyscalls = task.getIsa().getUnknownSyscalls ();
-
-    if (num < 0)
-      {
-	throw new RuntimeException ("Negative syscall number: " + num);
-      }
-    else if (num >= syscallList.length)
-      {
-	synchronized (unknownSyscalls)
-	  {
-	    Integer key = new Integer(num);
-	    if (unknownSyscalls.containsKey(key))
-	      return (Syscall) unknownSyscalls.get(key);
+    /**
+     * Given a system call's name, this will return the corresponding
+     * Syscall object.  If no predefined system call with that name
+     * is available, this will return null.
+     * @param name the name of the system call
+     * @param syscallList system calls list
+     * @return the Syscall object, or null
+     */
+    static Syscall iterateSyscallByName (String name, Syscall[] syscallList) {
+	for (int i = 0; i < syscallList.length; ++i)
+	    if (name.equals(syscallList[i].name))
+		return syscallList[i];
+	return null;
+    }
+
+    /**
+     * Given a system call's number, this will return the corresponding
+     * Syscall object.  Note that system call numbers are platform
+     * dependent.  This will return a Syscall object in all cases; if
+     * there is no predefined system call with the given number, a unique
+     * "unknown" system call with the indicated number will be created.
+     *
+     * @param num the number of the system call
+     * @param task the current task
+     * @return the Syscall object
+     */
+    public static Syscall syscallByNum (int num, Task task) {
+	Syscall[] syscallList;
+	HashMap unknownSyscalls;
+
+	syscallList = task.getIsa().getSyscallList ();
+	unknownSyscalls = task.getIsa().getUnknownSyscalls ();
+
+	if (num < 0) {
+	    throw new RuntimeException ("Negative syscall number: " + num);
+	} else if (num >= syscallList.length) {
+	    synchronized (unknownSyscalls) {
+		Integer key = new Integer(num);
+		if (unknownSyscalls.containsKey(key))
+		    return (Syscall) unknownSyscalls.get(key);
 	    
-	    class UnknownSyscall
-	      extends Syscall
-	    {
-	      UnknownSyscall (String name, int number)
-	      {
-		super (name, number);
-	      }
+		class UnknownSyscall extends Syscall {
+		    UnknownSyscall (String name, int number) {
+			super (name, number);
+		    }
 	      
-	      public long getArguments (Task task, int n)
-	      {
-		return 0;
-	      }
-	      public long getReturnCode (Task task)
-	      {
-		return 0;
-	      }
+		    public long getArguments (Task task, int n) {
+			return 0;
+		    }
+		    public long getReturnCode (Task task) {
+			return 0;
+		    }
+		}
+		Syscall result = new UnknownSyscall("UNKNOWN SYSCALL " + num, num);
+
+		unknownSyscalls.put(key, result);
+	    
+		return result;
 	    }
-	    Syscall result = new UnknownSyscall("UNKNOWN SYSCALL " + num, num);
+	} else {
+	    return syscallList[num];
+	}
+    }
 
-	    unknownSyscalls.put(key, result);
-	    
-	    return result;
-	  }
-      }
-    else
-      {
-	return syscallList[num];
-      }
-  }
-
-  /**
-   * Given a system call's name, this will return the corresponding
-   * Syscall object.  If no predefined system call with that name
-   * is available, this will return null.
-   * @param name the name of the system call
-   * @param task the cuurent task
-   * @return the Syscall object, or null
-   * @throws NullPointerException if name is null
-   */
-  public static Syscall syscallByName (String name, Task task)
-  {
-    Syscall syscall;
-
-    syscall = task.getIsa().syscallByName(name);
-
-    return syscall;
-  }
+    /**
+     * Given a system call's name, this will return the corresponding
+     * Syscall object.  If no predefined system call with that name
+     * is available, this will return null.
+     * @param name the name of the system call
+     * @param task the cuurent task
+     * @return the Syscall object, or null
+     * @throws NullPointerException if name is null
+     */
+    public static Syscall syscallByName (String name, Task task) {
+	Syscall syscall;
+
+	syscall = task.getIsa().syscallByName(name);
+
+	return syscall;
+    }
 }


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



More information about the Frysk-cvs mailing list