Port queries only support 'eq'

This commit is contained in:
Doug MacEachern 2007-06-02 17:46:51 +00:00
parent 17cfaa494a
commit 508c39b2aa
2 changed files with 6 additions and 0 deletions

View File

@ -100,6 +100,7 @@ public class TestPTQL extends SigarTestCase {
"Pid.Pid.eq=foo",
"Cpu.Percent.ge=x",
"Port.foo.eq=8080",
"Port.tcp.gt=8080",
"",
null,
//disabled for testing w/ -Dsigar.ptql.native=true

View File

@ -856,6 +856,11 @@ static int ptql_env_match(sigar_t *sigar,
static int ptql_branch_init_port(ptql_parse_branch_t *parsed,
ptql_branch_t *branch)
{
/* only 'eq' is supported here */
if (branch->op_name != PTQL_OP_EQ) {
return SIGAR_PTQL_MALFORMED_QUERY;
}
if (strEQ(parsed->attr, "tcp")) {
branch->flags = SIGAR_NETCONN_TCP;
}