use protocol arg in proc_port

This commit is contained in:
Doug MacEachern 2005-03-16 04:03:16 +00:00
parent cd6df9317e
commit c3a432ac60
1 changed files with 14 additions and 2 deletions

View File

@ -2034,6 +2034,18 @@ int sigar_proc_port_get(sigar_t *sigar, int protocol,
struct procsinfo pinfo; struct procsinfo pinfo;
struct fdsinfo finfo; struct fdsinfo finfo;
pid_t pid = 0; pid_t pid = 0;
int type;
switch (protocol) {
case SIGAR_NETCONN_TCP:
type = IPPROTO_TCP;
break;
case SIGAR_NETCONN_UDP:
type = IPPROTO_UDP;
break;
default:
return SIGAR_ENOTIMPL;
}
for (;;) { for (;;) {
int fd, status; int fd, status;
@ -2088,7 +2100,7 @@ int sigar_proc_port_get(sigar_t *sigar, int protocol,
continue; continue;
} }
if (protosw.pr_protocol != IPPROTO_TCP) { if (protosw.pr_protocol != type) {
continue; continue;
} }