diff --git a/bindings/java/src/org/hyperic/sigar/test/TestPTQL.java b/bindings/java/src/org/hyperic/sigar/test/TestPTQL.java index 1fd4ee57..41150fc7 100644 --- a/bindings/java/src/org/hyperic/sigar/test/TestPTQL.java +++ b/bindings/java/src/org/hyperic/sigar/test/TestPTQL.java @@ -72,6 +72,7 @@ public class TestPTQL extends SigarTestCase { "Service.Name.ct=Oracle", "Service.DisplayName.re=DHCP|DNS", "Service.Path.ct=svchost", + "Service.Exe.Ieq=inetinfo.exe", OTHER_JAVA_PROCESS, //all java procs cept this one "Cpu.Percent.ge=0.2", "State.Name.sw=java,Args.*.eq=org.jboss.Main", //jboss diff --git a/src/sigar_ptql.c b/src/sigar_ptql.c index cfe0c1ac..eeeefd5b 100644 --- a/src/sigar_ptql.c +++ b/src/sigar_ptql.c @@ -666,7 +666,8 @@ enum { PTQL_PID_FILE, PTQL_PID_SERVICE_NAME, PTQL_PID_SERVICE_DISPLAY, - PTQL_PID_SERVICE_PATH + PTQL_PID_SERVICE_PATH, + PTQL_PID_SERVICE_EXE }; #ifdef SIGAR_64BIT @@ -700,6 +701,10 @@ static int ptql_branch_init_service(ptql_parse_branch_t *parsed, else if (strEQ(parsed->attr, "Path")) { branch->flags = PTQL_PID_SERVICE_PATH; } + else if (strEQ(parsed->attr, "Exe")) { + /* basename of Path */ + branch->flags = PTQL_PID_SERVICE_EXE; + } else { return ptql_error(error, "Unsupported %s attribute: %s", parsed->name, parsed->attr); @@ -785,7 +790,7 @@ static int sigar_services_walk(sigar_services_walker_t *walker, } for (i=0; ilpBinaryPathName; + if (branch->flags == PTQL_PID_SERVICE_EXE) { + value = strrchr(config->lpBinaryPathName, '\\'); + if (value) ++value; + } + if (value == NULL) { + value = config->lpBinaryPathName; + } } else { continue;