Bug 1416

Summary: Request .getName() to Host/Proc/Task
Product: frysk Reporter: Phil Muldoon <pmuldoon>
Component: generalAssignee: Phil Muldoon <pmuldoon>
Status: RESOLVED FIXED    
Severity: normal CC: pmuldoon
Priority: P1    
Version: unspecified   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:
Bug Depends on:    
Bug Blocks: 1593    

Description Phil Muldoon 2005-10-04 19:42:58 UTC
Request a .getName() function to return a descriptive name to each of the
classes shown below:

Host.getName() would return the Host name associated with that Host
Proc.getName() would return the Proc name associated with that Proc
Task.getName() would return the Task name associated with that thread of execution
Comment 1 Andrew Cagney 2005-10-04 20:35:34 UTC
	pmuldoon	cagney, something like: java.net.InetAddress.getLocalHost().getHostName()
Comment 2 Andrew Cagney 2005-10-04 20:36:36 UTC
cagney	pmuldoon, ok, I wonder how I test this
	pmuldoon	cagney, you could spawn a process that runs: uname -n and capture the
output and compare the two? They should be the same
Comment 3 Phil Muldoon 2005-10-31 20:11:38 UTC
2005-10-31  Phil Muldoon  <pmuldoon@redhat.com>

	* Host.java (getName): Added getName function.
	
	* Task.java (getName): Added getName function.


Added some simple functions that return "Task "+getTid() in the Task's case, and
java.net.InetAddress.getLocalHost().getHostName() in the Hosts case.
Comment 4 Phil Muldoon 2006-02-21 20:34:53 UTC
Added the Task and the Host some time back and forgot to close. Proc has a
.getCommand() already implemented. 

Task:

    /**
     * Return the task's (derived) name
     */
    public final String getName ()
    {
        return "Task " + getTid();
    }

Proc:
    /**
     * Return the basename of the program that this process is
     * running.
     */
    public String getCommand ()
    {
        command = sendrecCommand ();
        return command;
    }

Host: 

   /**
     * * Returns the name of the host
     */
    public String getName()
    {
                 try {
                         return java.net.InetAddress.getLocalHost().getHostName();
                 } catch (UnknownHostException e) {
                         return "Unknown Host";
                 }
    }
Comment 5 Phil Muldoon 2006-02-21 20:35:30 UTC
Closing