Bug 1416 - Request .getName() to Host/Proc/Task
Summary: Request .getName() to Host/Proc/Task
Status: RESOLVED FIXED
Alias: None
Product: frysk
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
: P1 normal
Target Milestone: ---
Assignee: Phil Muldoon
URL:
Keywords:
Depends on:
Blocks: 1593
  Show dependency treegraph
 
Reported: 2005-10-04 19:42 IST by Phil Muldoon
Modified: 2006-02-21 20:35 IST (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Phil Muldoon 2005-10-04 19:42:58 IST
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 IST
	pmuldoon	cagney, something like: java.net.InetAddress.getLocalHost().getHostName()
Comment 2 Andrew Cagney 2005-10-04 20:36:36 IST
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 IST
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 IST
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 IST
Closing