summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authortuexen <tuexen@FreeBSD.org>2015-06-13 20:01:54 +0000
committertuexen <tuexen@FreeBSD.org>2015-06-13 20:01:54 +0000
commit300f572dc3341b1c535f7c5f3b29b361b81f3fd0 (patch)
tree81233b749f20a10a3d173c38355fb47fdedaaa2b /usr.bin
parent199422d7cbcc67075bb11efbfd39d572162dfe76 (diff)
downloadFreeBSD-src-300f572dc3341b1c535f7c5f3b29b361b81f3fd0.zip
FreeBSD-src-300f572dc3341b1c535f7c5f3b29b361b81f3fd0.tar.gz
Allow more than one socket entry for a file descriptor. This is needed
for supporting 1-to-many style SCTP sockets. For other sochets, there is no functional change. MFC after: 3 days
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/sockstat/sockstat.c45
1 files changed, 22 insertions, 23 deletions
diff --git a/usr.bin/sockstat/sockstat.c b/usr.bin/sockstat/sockstat.c
index 5ee157b..2e45ae6 100644
--- a/usr.bin/sockstat/sockstat.c
+++ b/usr.bin/sockstat/sockstat.c
@@ -669,29 +669,28 @@ display(void)
if (opt_j >= 0 && opt_j != getprocjid(xf->xf_pid))
continue;
hash = (int)((uintptr_t)xf->xf_data % HASHSIZE);
- for (s = sockhash[hash]; s != NULL; s = s->next)
- if ((void *)s->socket == xf->xf_data)
- break;
- if (s == NULL)
- continue;
- if (!check_ports(s))
- continue;
- s->shown = 1;
- pos = 0;
- if ((pwd = getpwuid(xf->xf_uid)) == NULL)
- pos += xprintf("%lu ", (u_long)xf->xf_uid);
- else
- pos += xprintf("%s ", pwd->pw_name);
- while (pos < 9)
- pos += xprintf(" ");
- pos += xprintf("%.10s", getprocname(xf->xf_pid));
- while (pos < 20)
- pos += xprintf(" ");
- pos += xprintf("%lu ", (u_long)xf->xf_pid);
- while (pos < 26)
- pos += xprintf(" ");
- pos += xprintf("%d ", xf->xf_fd);
- displaysock(s, pos);
+ for (s = sockhash[hash]; s != NULL; s = s->next) {
+ if ((void *)s->socket != xf->xf_data)
+ continue;
+ if (!check_ports(s))
+ continue;
+ s->shown = 1;
+ pos = 0;
+ if ((pwd = getpwuid(xf->xf_uid)) == NULL)
+ pos += xprintf("%lu ", (u_long)xf->xf_uid);
+ else
+ pos += xprintf("%s ", pwd->pw_name);
+ while (pos < 9)
+ pos += xprintf(" ");
+ pos += xprintf("%.10s", getprocname(xf->xf_pid));
+ while (pos < 20)
+ pos += xprintf(" ");
+ pos += xprintf("%lu ", (u_long)xf->xf_pid);
+ while (pos < 26)
+ pos += xprintf(" ");
+ pos += xprintf("%d ", xf->xf_fd);
+ displaysock(s, pos);
+ }
}
if (opt_j >= 0)
return;
OpenPOWER on IntegriCloud