From d034a2a16e8eb8db88f0c8637bceee2533fe58c4 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Tue, 22 Jun 2004 06:14:12 +0000 Subject: [PATCH] add getProcModules --- bindings/java/src/net/hyperic/sigar/Sigar.java | 17 +++++++++++++++++ .../java/src/net/hyperic/sigar/SigarProxy.java | 5 +++++ .../net/hyperic/sigar/SynchronizedSigar.java | 13 +++++++++++++ 3 files changed, 35 insertions(+) diff --git a/bindings/java/src/net/hyperic/sigar/Sigar.java b/bindings/java/src/net/hyperic/sigar/Sigar.java index 9c301afe..a1b9fbfe 100644 --- a/bindings/java/src/net/hyperic/sigar/Sigar.java +++ b/bindings/java/src/net/hyperic/sigar/Sigar.java @@ -4,6 +4,7 @@ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; +import java.util.List; import java.util.Map; import net.hyperic.jni.ArchLoaderException; @@ -382,6 +383,22 @@ public class Sigar implements SigarProxy { return getProcEnv(convertPid(pid), key); } + /** + * Get process loaded modules. + * @param pid The process id. + * @return List of loaded modules. + * @exception SigarException on failure. + */ + private native List getProcModulesNative(long pid) throws SigarException; + + public List getProcModules(long pid) throws SigarException { + return getProcModulesNative(pid); + } + + public List getProcModules(String pid) throws SigarException { + return getProcModules(convertPid(pid)); + } + public native long getProcPort(long port) throws SigarException; public long getProcPort(String port) throws SigarException { diff --git a/bindings/java/src/net/hyperic/sigar/SigarProxy.java b/bindings/java/src/net/hyperic/sigar/SigarProxy.java index c9a614c7..7f5e3bb4 100644 --- a/bindings/java/src/net/hyperic/sigar/SigarProxy.java +++ b/bindings/java/src/net/hyperic/sigar/SigarProxy.java @@ -1,5 +1,6 @@ package net.hyperic.sigar; +import java.util.List; import java.util.Map; /** @@ -72,6 +73,10 @@ public interface SigarProxy { public String getProcEnv(String pid, String key) throws SigarException; + public List getProcModules(long pid) throws SigarException; + + public List getProcModules(String pid) throws SigarException; + public long getProcPort(long port) throws SigarException; public long getProcPort(String port) throws SigarException; diff --git a/bindings/java/src/net/hyperic/sigar/SynchronizedSigar.java b/bindings/java/src/net/hyperic/sigar/SynchronizedSigar.java index 11e7c9cc..a9845228 100644 --- a/bindings/java/src/net/hyperic/sigar/SynchronizedSigar.java +++ b/bindings/java/src/net/hyperic/sigar/SynchronizedSigar.java @@ -1,5 +1,6 @@ package net.hyperic.sigar; +import java.util.List; import java.util.Map; /** @@ -202,6 +203,18 @@ public class SynchronizedSigar implements SigarProxy { return this.sigar.getProcEnv(pid, key); } + public synchronized List getProcModules(long pid) + throws SigarException + { + return this.sigar.getProcModules(pid); + } + + public synchronized List getProcModules(String pid) + throws SigarException + { + return this.sigar.getProcModules(pid); + } + public synchronized long getProcPort(long port) throws SigarException {