Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 140035 Details for
Bug 175293
[dstore] Processes do not work on Dstore-UNIX connection to Solaris
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
patch to support solaris ps commands
patch.txt (text/plain), 8.29 KB, created by
David McKnight
on 2009-06-24 18:06:40 EDT
(
hide
)
Description:
patch to support solaris ps commands
Filename:
MIME Type:
Creator:
David McKnight
Created:
2009-06-24 18:06:40 EDT
Size:
8.29 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.rse.services >Index: clientserver/org/eclipse/rse/services/clientserver/processes/handlers/ProcessHandlerManager.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/processes/handlers/ProcessHandlerManager.java,v >retrieving revision 1.4 >diff -u -r1.4 ProcessHandlerManager.java >--- clientserver/org/eclipse/rse/services/clientserver/processes/handlers/ProcessHandlerManager.java 5 Jun 2007 10:37:07 -0000 1.4 >+++ clientserver/org/eclipse/rse/services/clientserver/processes/handlers/ProcessHandlerManager.java 24 Jun 2009 22:08:16 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2006, 2007 IBM Corporation and others. >+ * Copyright (c) 2006, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -12,7 +12,7 @@ > * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. > * > * Contributors: >- * {Name} (company) - description of contribution. >+ * David McKnight (IBM) - [175293] [dstore] Processes do not work on Dstore-UNIX connection to Solaris > *******************************************************************************/ > > package org.eclipse.rse.services.clientserver.processes.handlers; >@@ -40,10 +40,13 @@ > public ProcessHandler getNewProcessHandler() > { > String osName = System.getProperty("os.name").toLowerCase(); //$NON-NLS-1$ >+ > if (osName.startsWith("linux")) return new UniversalLinuxProcessHandler(); //$NON-NLS-1$ > else if (osName.startsWith("aix")) return new UniversalAIXProcessHandler(); //$NON-NLS-1$ > else if (osName.startsWith("z/os")) return new UniversalZOSProcessHandler(); //$NON-NLS-1$ > else if (osName.startsWith("mac os x")) return new UniversalMacOSXProcessHandler(); //$NON-NLS-1$ >- else return null; >+ else if (osName.startsWith("sun")) return new UniversalSolarisProcessHandler(); //$NON-NLS-1$ >+ return null; >+ > } > } >Index: clientserver/org/eclipse/rse/services/clientserver/processes/handlers/UniversalSolarisProcessHandler.java >=================================================================== >RCS file: clientserver/org/eclipse/rse/services/clientserver/processes/handlers/UniversalSolarisProcessHandler.java >diff -N clientserver/org/eclipse/rse/services/clientserver/processes/handlers/UniversalSolarisProcessHandler.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ clientserver/org/eclipse/rse/services/clientserver/processes/handlers/UniversalSolarisProcessHandler.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,138 @@ >+/******************************************************************************** >+ * Copyright (c) 2009 IBM Corporation. All rights reserved. >+ * This program and the accompanying materials are made available under the terms >+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is >+ * available at http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Initial Contributors: >+ * The following IBM employees contributed to the Remote System Explorer >+ * component that contains this file: David McKnight. >+ * >+ * Contributors: >+ * David McKnight (IBM) - [175293] [dstore] Processes do not work on Dstore-UNIX connection to Solaris >+ ********************************************************************************/ >+package org.eclipse.rse.services.clientserver.processes.handlers; >+ >+import java.io.BufferedReader; >+import java.io.InputStreamReader; >+import java.util.HashMap; >+import java.util.SortedSet; >+import java.util.TreeSet; >+ >+import org.eclipse.rse.services.clientserver.processes.IHostProcess; >+import org.eclipse.rse.services.clientserver.processes.IHostProcessFilter; >+ >+/** >+ * @since 3.1 >+ */ >+public class UniversalSolarisProcessHandler extends UniversalAIXProcessHandler { >+ >+ private static final String[] processAttributes = {"pid","ppid","comm","uid","user","gid","vsz","s"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ >+ private static final String firstColumnHeader = "PID"; //$NON-NLS-1$ >+ >+ >+ public IHostProcess kill(IHostProcess process, String type) >+ throws Exception { >+ return super.kill(process, type); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.rse.services.clientserver.processes.handlers.ProcessHandler#lookupProcesses >+ */ >+ public SortedSet lookupProcesses(IHostProcessFilter rpfs) >+ throws Exception >+ { >+ SortedSet results = new TreeSet(new ProcessComparator()); >+ >+ // create the remote command with the UNIX specific attributes >+ String cmdLine = "/usr/bin/ps -A -o "; //$NON-NLS-1$ >+ for (int i = 0; i < processAttributes.length; i++) >+ { >+ cmdLine = cmdLine + processAttributes[i]; >+ if ((processAttributes.length - i > 1)) cmdLine = cmdLine + ","; //$NON-NLS-1$ >+ } >+ // run the command and get output >+ Process ps = Runtime.getRuntime().exec(cmdLine); >+ InputStreamReader isr = new InputStreamReader(ps.getInputStream()); >+ >+ BufferedReader reader = new BufferedReader(isr); >+ >+ String nextLine = reader.readLine(); >+ if (nextLine != null && nextLine.trim().startsWith(firstColumnHeader)) nextLine = reader.readLine(); >+ while (nextLine != null) >+ { >+ String statusLine = ""; //$NON-NLS-1$ >+ // put the details of each process into a hashmap >+ HashMap psLineContents = getPSOutput(nextLine); >+ if (psLineContents == null) >+ { >+ nextLine = reader.readLine(); >+ continue; >+ } >+ >+ String pid = (String) psLineContents.get("pid"); //$NON-NLS-1$ >+ statusLine = pid + "|"; //$NON-NLS-1$ >+ >+ // add the name to the status string >+ String name = (String) psLineContents.get("comm"); //$NON-NLS-1$ >+ if (name == null) name = " "; //$NON-NLS-1$ >+ statusLine = statusLine + name + "|"; //$NON-NLS-1$ >+ >+ // add the status letter to the status string >+ String state = (String) psLineContents.get("s"); //$NON-NLS-1$ >+ if (state == null) state = " "; //$NON-NLS-1$ >+ String stateCode = convertToStateCode(state); >+ statusLine = statusLine + stateCode + "|"; //$NON-NLS-1$ >+ >+ // add the Tgid >+ String tgid = (String) psLineContents.get("tgid"); //$NON-NLS-1$ >+ if (tgid == null) tgid = " "; //$NON-NLS-1$ >+ statusLine = statusLine + tgid + "|"; //$NON-NLS-1$ >+ >+ // add the Ppid >+ String pPid = (String) psLineContents.get("ppid"); //$NON-NLS-1$ >+ if (pPid == null) pPid = " "; //$NON-NLS-1$ >+ statusLine = statusLine + pPid + "|"; //$NON-NLS-1$ >+ >+ // add the TracerPid >+ String tracerpid = (String) psLineContents.get("tracerpid"); //$NON-NLS-1$ >+ if (tracerpid == null) tracerpid = " "; //$NON-NLS-1$ >+ statusLine = statusLine + tracerpid + "|"; //$NON-NLS-1$ >+ >+ String uid = (String) psLineContents.get("uid"); //$NON-NLS-1$ >+ if (uid == null) uid = " "; //$NON-NLS-1$ >+ statusLine = statusLine + uid + "|"; // add the uid to the status string //$NON-NLS-1$ >+ >+ String username = (String) psLineContents.get("user"); //$NON-NLS-1$ >+ if (username == null) username = " "; //$NON-NLS-1$ >+ statusLine = statusLine + username + "|"; // add the username to the status string //$NON-NLS-1$ >+ >+ // add the gid to the status string >+ String gid = (String) psLineContents.get("gid"); //$NON-NLS-1$ >+ if (gid == null) gid = " "; //$NON-NLS-1$ >+ statusLine = statusLine + gid + "|"; //$NON-NLS-1$ >+ >+ // add the VmSize to the status string >+ String vmsize = (String) psLineContents.get("vsz"); //$NON-NLS-1$ >+ if (vmsize == null) vmsize = " "; //$NON-NLS-1$ >+ statusLine = statusLine + vmsize +"|"; //$NON-NLS-1$ >+ >+ // add a dummy vmrss to the status string >+ // vmRss is not available on ZOS >+ String vmrss = " "; //$NON-NLS-1$ >+ statusLine = statusLine + vmrss; >+ >+ if (rpfs.allows(statusLine)) >+ { >+ UniversalServerProcessImpl usp = new UniversalServerProcessImpl(statusLine); >+ results.add(usp); >+ } >+ nextLine = reader.readLine(); >+ } >+ reader.close(); >+ isr.close(); >+ if (results.size() == 0) return null; >+ return results; >+ } >+ >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 175293
:
139901
| 140035