History log of /netbsd-current/usr.bin/sockstat/sockstat.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.25 28-Oct-2022 ozaki-r

Adjust userland commands for struct inpcb integration

Only kvm users are affected.


# 1.24 27-Aug-2021 rillig

sockstat: fix undefined behavior when calling ctype functions

lint says: warning: argument to 'function from <ctype.h>' must be cast
to 'unsigned char', not to 'unsigned int' [342]


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 1.23 26-Aug-2020 christos

undo previous, now sockstat works without privs


# 1.22 25-Aug-2020 christos

RR/54971: scole_mail: sockstat command output incorrect for normal
user As the PR hints, it is not enough to have kern.expose_address=1
to see kernel addresses, we also need to have the PK_KMEM bit set
which we achieve by installing sockstat setgid kmem and opening
and closing /dev/mem. (/usr/src/sys/kern/kern_proc.c:311). It is
unfortunate that we need to give the program more privilege, to
prove to the kernel that we have the privilege to see the data.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 phil-wifi-20191119
# 1.21 18-Aug-2019 kamil

sockstat: Add indirection of symbols to remove clash with sanitizers

Add indirection and symbol renaming under MKSANITIZER for the linked in
version of sysctlgetmibinfo and sysctlnametomib.


Revision tags: netbsd-9-base phil-wifi-20190609
# 1.20 03-Feb-2019 mrg

branches: 1.20.2;
- add or adjust /* FALLTHROUGH */ where appropriate
- add __unreachable() after functions that can return but won't in
this case, and thus can't be marked __dead easily


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base
# 1.19 14-Jan-2017 christos

branches: 1.19.14;
don't do _KERNEL; hides bswap stuff.


# 1.18 12-Jan-2017 christos

fix compilation


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 pgoyette-localcount-20170107 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base
# 1.17 29-May-2011 manu

branches: 1.17.26;
Display SOCK_SEQPACKET local sockets in sockstat and netstat


Revision tags: bouyer-quota2-nbase bouyer-quota2-base
# 1.16 28-Jan-2011 pooka

support rump.sockstat


Revision tags: matt-mips64-premerge-20101231 matt-premerge-20091211 jym-xensuspend-nbase jym-xensuspend-base
# 1.15 13-Apr-2009 lukem

branches: 1.15.2;
Fix WARNS=4 issues (-Wshadow -Wsign-compare)


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 wrstuden-revivesa-base
# 1.14 29-Apr-2008 martin

branches: 1.14.8;
Convert to new 2 clause license


Revision tags: yamt-pf42-baseX yamt-pf42-base keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.13 01-Mar-2008 he

branches: 1.13.2;
It's wrong for user-land programs to define _KERNEL before including
<sys/types.h>. The reason is that this will break the build for about
half of our ports, because the wrong variant of e.g. bswap16() is being
defined and referenced (either __bswap16() or bswap16()). Removing
the _KERNEL define restores buildability for this program.


# 1.12 27-Feb-2008 ad

+#define _KERNEL
+#include <sys/types.h>
+#undef _KERNEL


Revision tags: matt-armv6-base hpcarm-cleanup-base
# 1.11 26-Dec-2007 ad

branches: 1.11.2;
Merge more changes from vmlocking2, mainly:

- Locking improvements.
- Use pool_cache for more items.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase matt-armv6-prevmlocking wrstuden-fixsa-base-1 netbsd-4-0-RELEASE cube-autoconf-base netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-mips64-base wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base chap-midi-nbase chap-midi-base
# 1.10 24-Aug-2005 rpaulo

branches: 1.10.12;
If the specificed MIB doesn't exist, then it's probably a kernel without
that socket type (AF_INET, AF_INET6, etc.). That's a normal condition, so
don't bail out.

Reviewed by Andrew Brown.


# 1.9 10-Aug-2005 rpaulo

Query the v6 sockets only if USE_INET6 != "no". Patch provided by Jukka Salmi
on PR#30963.

ok atatat@


# 1.8 10-Aug-2005 rpaulo

Fix a typo in the islistening() routine. Patch provided by Jukka Salmi
on PR#30963.


# 1.7 02-Jun-2005 lukem

appease gcc -Wuninitialized


# 1.6 09-Apr-2005 atatat

Don't allow the command length to mess up the formatting


# 1.5 22-Mar-2005 peter

Fix a typo.


Revision tags: netbsd-3-base
# 1.4 10-Mar-2005 atatat

branches: 1.4.2;
Fix printing of AF_LOCAL names.


# 1.3 09-Mar-2005 kleink

Field width and precision specifier arguments to printf must be ints.


# 1.2 09-Mar-2005 atatat

almost forgot about this.

Optimize getting process information by not getting it again if you're
looking for the same pid.


# 1.1 09-Mar-2005 atatat

Add a sockstat(1) command that can list open sockets and the processes
that own them. The implementation concept and man page came largely
from FreeBSD, but the program is fresh.


# 1.24 27-Aug-2021 rillig

sockstat: fix undefined behavior when calling ctype functions

lint says: warning: argument to 'function from <ctype.h>' must be cast
to 'unsigned char', not to 'unsigned int' [342]


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 1.23 26-Aug-2020 christos

undo previous, now sockstat works without privs


# 1.22 25-Aug-2020 christos

RR/54971: scole_mail: sockstat command output incorrect for normal
user As the PR hints, it is not enough to have kern.expose_address=1
to see kernel addresses, we also need to have the PK_KMEM bit set
which we achieve by installing sockstat setgid kmem and opening
and closing /dev/mem. (/usr/src/sys/kern/kern_proc.c:311). It is
unfortunate that we need to give the program more privilege, to
prove to the kernel that we have the privilege to see the data.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 phil-wifi-20191119
# 1.21 18-Aug-2019 kamil

sockstat: Add indirection of symbols to remove clash with sanitizers

Add indirection and symbol renaming under MKSANITIZER for the linked in
version of sysctlgetmibinfo and sysctlnametomib.


Revision tags: netbsd-9-base phil-wifi-20190609
# 1.20 03-Feb-2019 mrg

branches: 1.20.2;
- add or adjust /* FALLTHROUGH */ where appropriate
- add __unreachable() after functions that can return but won't in
this case, and thus can't be marked __dead easily


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base
# 1.19 14-Jan-2017 christos

branches: 1.19.14;
don't do _KERNEL; hides bswap stuff.


# 1.18 12-Jan-2017 christos

fix compilation


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 pgoyette-localcount-20170107 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base
# 1.17 29-May-2011 manu

branches: 1.17.26;
Display SOCK_SEQPACKET local sockets in sockstat and netstat


Revision tags: bouyer-quota2-nbase bouyer-quota2-base
# 1.16 28-Jan-2011 pooka

support rump.sockstat


Revision tags: matt-mips64-premerge-20101231 matt-premerge-20091211 jym-xensuspend-nbase jym-xensuspend-base
# 1.15 13-Apr-2009 lukem

branches: 1.15.2;
Fix WARNS=4 issues (-Wshadow -Wsign-compare)


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 wrstuden-revivesa-base
# 1.14 29-Apr-2008 martin

branches: 1.14.8;
Convert to new 2 clause license


Revision tags: yamt-pf42-baseX yamt-pf42-base keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.13 01-Mar-2008 he

branches: 1.13.2;
It's wrong for user-land programs to define _KERNEL before including
<sys/types.h>. The reason is that this will break the build for about
half of our ports, because the wrong variant of e.g. bswap16() is being
defined and referenced (either __bswap16() or bswap16()). Removing
the _KERNEL define restores buildability for this program.


# 1.12 27-Feb-2008 ad

+#define _KERNEL
+#include <sys/types.h>
+#undef _KERNEL


Revision tags: matt-armv6-base hpcarm-cleanup-base
# 1.11 26-Dec-2007 ad

branches: 1.11.2;
Merge more changes from vmlocking2, mainly:

- Locking improvements.
- Use pool_cache for more items.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase matt-armv6-prevmlocking wrstuden-fixsa-base-1 netbsd-4-0-RELEASE cube-autoconf-base netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-mips64-base wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base chap-midi-nbase chap-midi-base
# 1.10 24-Aug-2005 rpaulo

branches: 1.10.12;
If the specificed MIB doesn't exist, then it's probably a kernel without
that socket type (AF_INET, AF_INET6, etc.). That's a normal condition, so
don't bail out.

Reviewed by Andrew Brown.


# 1.9 10-Aug-2005 rpaulo

Query the v6 sockets only if USE_INET6 != "no". Patch provided by Jukka Salmi
on PR#30963.

ok atatat@


# 1.8 10-Aug-2005 rpaulo

Fix a typo in the islistening() routine. Patch provided by Jukka Salmi
on PR#30963.


# 1.7 02-Jun-2005 lukem

appease gcc -Wuninitialized


# 1.6 09-Apr-2005 atatat

Don't allow the command length to mess up the formatting


# 1.5 22-Mar-2005 peter

Fix a typo.


Revision tags: netbsd-3-base
# 1.4 10-Mar-2005 atatat

branches: 1.4.2;
Fix printing of AF_LOCAL names.


# 1.3 09-Mar-2005 kleink

Field width and precision specifier arguments to printf must be ints.


# 1.2 09-Mar-2005 atatat

almost forgot about this.

Optimize getting process information by not getting it again if you're
looking for the same pid.


# 1.1 09-Mar-2005 atatat

Add a sockstat(1) command that can list open sockets and the processes
that own them. The implementation concept and man page came largely
from FreeBSD, but the program is fresh.


# 1.23 26-Aug-2020 christos

undo previous, now sockstat works without privs


# 1.22 25-Aug-2020 christos

RR/54971: scole_mail: sockstat command output incorrect for normal
user As the PR hints, it is not enough to have kern.expose_address=1
to see kernel addresses, we also need to have the PK_KMEM bit set
which we achieve by installing sockstat setgid kmem and opening
and closing /dev/mem. (/usr/src/sys/kern/kern_proc.c:311). It is
unfortunate that we need to give the program more privilege, to
prove to the kernel that we have the privilege to see the data.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 phil-wifi-20191119
# 1.21 18-Aug-2019 kamil

sockstat: Add indirection of symbols to remove clash with sanitizers

Add indirection and symbol renaming under MKSANITIZER for the linked in
version of sysctlgetmibinfo and sysctlnametomib.


Revision tags: netbsd-9-base phil-wifi-20190609
# 1.20 03-Feb-2019 mrg

branches: 1.20.2;
- add or adjust /* FALLTHROUGH */ where appropriate
- add __unreachable() after functions that can return but won't in
this case, and thus can't be marked __dead easily


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base
# 1.19 14-Jan-2017 christos

branches: 1.19.14;
don't do _KERNEL; hides bswap stuff.


# 1.18 12-Jan-2017 christos

fix compilation


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 pgoyette-localcount-20170107 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base
# 1.17 29-May-2011 manu

branches: 1.17.26;
Display SOCK_SEQPACKET local sockets in sockstat and netstat


Revision tags: bouyer-quota2-nbase bouyer-quota2-base
# 1.16 28-Jan-2011 pooka

support rump.sockstat


Revision tags: matt-mips64-premerge-20101231 matt-premerge-20091211 jym-xensuspend-nbase jym-xensuspend-base
# 1.15 13-Apr-2009 lukem

branches: 1.15.2;
Fix WARNS=4 issues (-Wshadow -Wsign-compare)


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 wrstuden-revivesa-base
# 1.14 29-Apr-2008 martin

branches: 1.14.8;
Convert to new 2 clause license


Revision tags: yamt-pf42-baseX yamt-pf42-base keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.13 01-Mar-2008 he

branches: 1.13.2;
It's wrong for user-land programs to define _KERNEL before including
<sys/types.h>. The reason is that this will break the build for about
half of our ports, because the wrong variant of e.g. bswap16() is being
defined and referenced (either __bswap16() or bswap16()). Removing
the _KERNEL define restores buildability for this program.


# 1.12 27-Feb-2008 ad

+#define _KERNEL
+#include <sys/types.h>
+#undef _KERNEL


Revision tags: matt-armv6-base hpcarm-cleanup-base
# 1.11 26-Dec-2007 ad

branches: 1.11.2;
Merge more changes from vmlocking2, mainly:

- Locking improvements.
- Use pool_cache for more items.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase matt-armv6-prevmlocking wrstuden-fixsa-base-1 netbsd-4-0-RELEASE cube-autoconf-base netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-mips64-base wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base chap-midi-nbase chap-midi-base
# 1.10 24-Aug-2005 rpaulo

branches: 1.10.12;
If the specificed MIB doesn't exist, then it's probably a kernel without
that socket type (AF_INET, AF_INET6, etc.). That's a normal condition, so
don't bail out.

Reviewed by Andrew Brown.


# 1.9 10-Aug-2005 rpaulo

Query the v6 sockets only if USE_INET6 != "no". Patch provided by Jukka Salmi
on PR#30963.

ok atatat@


# 1.8 10-Aug-2005 rpaulo

Fix a typo in the islistening() routine. Patch provided by Jukka Salmi
on PR#30963.


# 1.7 02-Jun-2005 lukem

appease gcc -Wuninitialized


# 1.6 09-Apr-2005 atatat

Don't allow the command length to mess up the formatting


# 1.5 22-Mar-2005 peter

Fix a typo.


Revision tags: netbsd-3-base
# 1.4 10-Mar-2005 atatat

branches: 1.4.2;
Fix printing of AF_LOCAL names.


# 1.3 09-Mar-2005 kleink

Field width and precision specifier arguments to printf must be ints.


# 1.2 09-Mar-2005 atatat

almost forgot about this.

Optimize getting process information by not getting it again if you're
looking for the same pid.


# 1.1 09-Mar-2005 atatat

Add a sockstat(1) command that can list open sockets and the processes
that own them. The implementation concept and man page came largely
from FreeBSD, but the program is fresh.


# 1.22 25-Aug-2020 christos

RR/54971: scole_mail: sockstat command output incorrect for normal
user As the PR hints, it is not enough to have kern.expose_address=1
to see kernel addresses, we also need to have the PK_KMEM bit set
which we achieve by installing sockstat setgid kmem and opening
and closing /dev/mem. (/usr/src/sys/kern/kern_proc.c:311). It is
unfortunate that we need to give the program more privilege, to
prove to the kernel that we have the privilege to see the data.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 phil-wifi-20191119
# 1.21 18-Aug-2019 kamil

sockstat: Add indirection of symbols to remove clash with sanitizers

Add indirection and symbol renaming under MKSANITIZER for the linked in
version of sysctlgetmibinfo and sysctlnametomib.


Revision tags: netbsd-9-base phil-wifi-20190609
# 1.20 03-Feb-2019 mrg

branches: 1.20.2;
- add or adjust /* FALLTHROUGH */ where appropriate
- add __unreachable() after functions that can return but won't in
this case, and thus can't be marked __dead easily


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base
# 1.19 14-Jan-2017 christos

branches: 1.19.14;
don't do _KERNEL; hides bswap stuff.


# 1.18 12-Jan-2017 christos

fix compilation


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 pgoyette-localcount-20170107 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base
# 1.17 29-May-2011 manu

branches: 1.17.26;
Display SOCK_SEQPACKET local sockets in sockstat and netstat


Revision tags: bouyer-quota2-nbase bouyer-quota2-base
# 1.16 28-Jan-2011 pooka

support rump.sockstat


Revision tags: matt-mips64-premerge-20101231 matt-premerge-20091211 jym-xensuspend-nbase jym-xensuspend-base
# 1.15 13-Apr-2009 lukem

branches: 1.15.2;
Fix WARNS=4 issues (-Wshadow -Wsign-compare)


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 wrstuden-revivesa-base
# 1.14 29-Apr-2008 martin

branches: 1.14.8;
Convert to new 2 clause license


Revision tags: yamt-pf42-baseX yamt-pf42-base keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.13 01-Mar-2008 he

branches: 1.13.2;
It's wrong for user-land programs to define _KERNEL before including
<sys/types.h>. The reason is that this will break the build for about
half of our ports, because the wrong variant of e.g. bswap16() is being
defined and referenced (either __bswap16() or bswap16()). Removing
the _KERNEL define restores buildability for this program.


# 1.12 27-Feb-2008 ad

+#define _KERNEL
+#include <sys/types.h>
+#undef _KERNEL


Revision tags: matt-armv6-base hpcarm-cleanup-base
# 1.11 26-Dec-2007 ad

branches: 1.11.2;
Merge more changes from vmlocking2, mainly:

- Locking improvements.
- Use pool_cache for more items.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase matt-armv6-prevmlocking wrstuden-fixsa-base-1 netbsd-4-0-RELEASE cube-autoconf-base netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-mips64-base wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base chap-midi-nbase chap-midi-base
# 1.10 24-Aug-2005 rpaulo

branches: 1.10.12;
If the specificed MIB doesn't exist, then it's probably a kernel without
that socket type (AF_INET, AF_INET6, etc.). That's a normal condition, so
don't bail out.

Reviewed by Andrew Brown.


# 1.9 10-Aug-2005 rpaulo

Query the v6 sockets only if USE_INET6 != "no". Patch provided by Jukka Salmi
on PR#30963.

ok atatat@


# 1.8 10-Aug-2005 rpaulo

Fix a typo in the islistening() routine. Patch provided by Jukka Salmi
on PR#30963.


# 1.7 02-Jun-2005 lukem

appease gcc -Wuninitialized


# 1.6 09-Apr-2005 atatat

Don't allow the command length to mess up the formatting


# 1.5 22-Mar-2005 peter

Fix a typo.


Revision tags: netbsd-3-base
# 1.4 10-Mar-2005 atatat

branches: 1.4.2;
Fix printing of AF_LOCAL names.


# 1.3 09-Mar-2005 kleink

Field width and precision specifier arguments to printf must be ints.


# 1.2 09-Mar-2005 atatat

almost forgot about this.

Optimize getting process information by not getting it again if you're
looking for the same pid.


# 1.1 09-Mar-2005 atatat

Add a sockstat(1) command that can list open sockets and the processes
that own them. The implementation concept and man page came largely
from FreeBSD, but the program is fresh.


# 1.21 18-Aug-2019 kamil

sockstat: Add indirection of symbols to remove clash with sanitizers

Add indirection and symbol renaming under MKSANITIZER for the linked in
version of sysctlgetmibinfo and sysctlnametomib.


Revision tags: netbsd-9-base phil-wifi-20190609
# 1.20 03-Feb-2019 mrg

- add or adjust /* FALLTHROUGH */ where appropriate
- add __unreachable() after functions that can return but won't in
this case, and thus can't be marked __dead easily


Revision tags: netbsd-8-1-RELEASE netbsd-8-1-RC1 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base
# 1.19 14-Jan-2017 christos

branches: 1.19.14;
don't do _KERNEL; hides bswap stuff.


# 1.18 12-Jan-2017 christos

fix compilation


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 pgoyette-localcount-20170107 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base
# 1.17 29-May-2011 manu

branches: 1.17.26;
Display SOCK_SEQPACKET local sockets in sockstat and netstat


Revision tags: bouyer-quota2-nbase bouyer-quota2-base
# 1.16 28-Jan-2011 pooka

support rump.sockstat


Revision tags: matt-mips64-premerge-20101231 matt-premerge-20091211 jym-xensuspend-nbase jym-xensuspend-base
# 1.15 13-Apr-2009 lukem

branches: 1.15.2;
Fix WARNS=4 issues (-Wshadow -Wsign-compare)


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 wrstuden-revivesa-base
# 1.14 29-Apr-2008 martin

branches: 1.14.8;
Convert to new 2 clause license


Revision tags: yamt-pf42-baseX yamt-pf42-base keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.13 01-Mar-2008 he

branches: 1.13.2;
It's wrong for user-land programs to define _KERNEL before including
<sys/types.h>. The reason is that this will break the build for about
half of our ports, because the wrong variant of e.g. bswap16() is being
defined and referenced (either __bswap16() or bswap16()). Removing
the _KERNEL define restores buildability for this program.


# 1.12 27-Feb-2008 ad

+#define _KERNEL
+#include <sys/types.h>
+#undef _KERNEL


Revision tags: matt-armv6-base hpcarm-cleanup-base
# 1.11 26-Dec-2007 ad

branches: 1.11.2;
Merge more changes from vmlocking2, mainly:

- Locking improvements.
- Use pool_cache for more items.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase matt-armv6-prevmlocking wrstuden-fixsa-base-1 netbsd-4-0-RELEASE cube-autoconf-base netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-mips64-base wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base chap-midi-nbase chap-midi-base
# 1.10 24-Aug-2005 rpaulo

branches: 1.10.12;
If the specificed MIB doesn't exist, then it's probably a kernel without
that socket type (AF_INET, AF_INET6, etc.). That's a normal condition, so
don't bail out.

Reviewed by Andrew Brown.


# 1.9 10-Aug-2005 rpaulo

Query the v6 sockets only if USE_INET6 != "no". Patch provided by Jukka Salmi
on PR#30963.

ok atatat@


# 1.8 10-Aug-2005 rpaulo

Fix a typo in the islistening() routine. Patch provided by Jukka Salmi
on PR#30963.


# 1.7 02-Jun-2005 lukem

appease gcc -Wuninitialized


# 1.6 09-Apr-2005 atatat

Don't allow the command length to mess up the formatting


# 1.5 22-Mar-2005 peter

Fix a typo.


Revision tags: netbsd-3-base
# 1.4 10-Mar-2005 atatat

branches: 1.4.2;
Fix printing of AF_LOCAL names.


# 1.3 09-Mar-2005 kleink

Field width and precision specifier arguments to printf must be ints.


# 1.2 09-Mar-2005 atatat

almost forgot about this.

Optimize getting process information by not getting it again if you're
looking for the same pid.


# 1.1 09-Mar-2005 atatat

Add a sockstat(1) command that can list open sockets and the processes
that own them. The implementation concept and man page came largely
from FreeBSD, but the program is fresh.


# 1.20 03-Feb-2019 mrg

- add or adjust /* FALLTHROUGH */ where appropriate
- add __unreachable() after functions that can return but won't in
this case, and thus can't be marked __dead easily


Revision tags: pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base
# 1.19 14-Jan-2017 christos

don't do _KERNEL; hides bswap stuff.


# 1.18 12-Jan-2017 christos

fix compilation


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 pgoyette-localcount-20170107 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base
# 1.17 29-May-2011 manu

branches: 1.17.26;
Display SOCK_SEQPACKET local sockets in sockstat and netstat


Revision tags: bouyer-quota2-nbase bouyer-quota2-base
# 1.16 28-Jan-2011 pooka

support rump.sockstat


Revision tags: matt-mips64-premerge-20101231 matt-premerge-20091211 jym-xensuspend-nbase jym-xensuspend-base
# 1.15 13-Apr-2009 lukem

branches: 1.15.2;
Fix WARNS=4 issues (-Wshadow -Wsign-compare)


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 wrstuden-revivesa-base
# 1.14 29-Apr-2008 martin

branches: 1.14.8;
Convert to new 2 clause license


Revision tags: yamt-pf42-baseX yamt-pf42-base keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.13 01-Mar-2008 he

branches: 1.13.2;
It's wrong for user-land programs to define _KERNEL before including
<sys/types.h>. The reason is that this will break the build for about
half of our ports, because the wrong variant of e.g. bswap16() is being
defined and referenced (either __bswap16() or bswap16()). Removing
the _KERNEL define restores buildability for this program.


# 1.12 27-Feb-2008 ad

+#define _KERNEL
+#include <sys/types.h>
+#undef _KERNEL


Revision tags: matt-armv6-base hpcarm-cleanup-base
# 1.11 26-Dec-2007 ad

branches: 1.11.2;
Merge more changes from vmlocking2, mainly:

- Locking improvements.
- Use pool_cache for more items.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase matt-armv6-prevmlocking wrstuden-fixsa-base-1 netbsd-4-0-RELEASE cube-autoconf-base netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-mips64-base wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base chap-midi-nbase chap-midi-base
# 1.10 24-Aug-2005 rpaulo

branches: 1.10.12;
If the specificed MIB doesn't exist, then it's probably a kernel without
that socket type (AF_INET, AF_INET6, etc.). That's a normal condition, so
don't bail out.

Reviewed by Andrew Brown.


# 1.9 10-Aug-2005 rpaulo

Query the v6 sockets only if USE_INET6 != "no". Patch provided by Jukka Salmi
on PR#30963.

ok atatat@


# 1.8 10-Aug-2005 rpaulo

Fix a typo in the islistening() routine. Patch provided by Jukka Salmi
on PR#30963.


# 1.7 02-Jun-2005 lukem

appease gcc -Wuninitialized


# 1.6 09-Apr-2005 atatat

Don't allow the command length to mess up the formatting


# 1.5 22-Mar-2005 peter

Fix a typo.


Revision tags: netbsd-3-base
# 1.4 10-Mar-2005 atatat

branches: 1.4.2;
Fix printing of AF_LOCAL names.


# 1.3 09-Mar-2005 kleink

Field width and precision specifier arguments to printf must be ints.


# 1.2 09-Mar-2005 atatat

almost forgot about this.

Optimize getting process information by not getting it again if you're
looking for the same pid.


# 1.1 09-Mar-2005 atatat

Add a sockstat(1) command that can list open sockets and the processes
that own them. The implementation concept and man page came largely
from FreeBSD, but the program is fresh.


# 1.19 14-Jan-2017 christos

don't do _KERNEL; hides bswap stuff.


# 1.18 12-Jan-2017 christos

fix compilation


Revision tags: pgoyette-localcount-20170107 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base
# 1.17 29-May-2011 manu

Display SOCK_SEQPACKET local sockets in sockstat and netstat


Revision tags: bouyer-quota2-nbase bouyer-quota2-base
# 1.16 28-Jan-2011 pooka

support rump.sockstat


Revision tags: matt-mips64-premerge-20101231 matt-premerge-20091211 jym-xensuspend-nbase jym-xensuspend-base
# 1.15 13-Apr-2009 lukem

branches: 1.15.2;
Fix WARNS=4 issues (-Wshadow -Wsign-compare)


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 wrstuden-revivesa-base
# 1.14 29-Apr-2008 martin

branches: 1.14.8;
Convert to new 2 clause license


Revision tags: yamt-pf42-baseX yamt-pf42-base keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.13 01-Mar-2008 he

branches: 1.13.2;
It's wrong for user-land programs to define _KERNEL before including
<sys/types.h>. The reason is that this will break the build for about
half of our ports, because the wrong variant of e.g. bswap16() is being
defined and referenced (either __bswap16() or bswap16()). Removing
the _KERNEL define restores buildability for this program.


# 1.12 27-Feb-2008 ad

+#define _KERNEL
+#include <sys/types.h>
+#undef _KERNEL


Revision tags: matt-armv6-base hpcarm-cleanup-base
# 1.11 26-Dec-2007 ad

branches: 1.11.2;
Merge more changes from vmlocking2, mainly:

- Locking improvements.
- Use pool_cache for more items.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase matt-armv6-prevmlocking wrstuden-fixsa-base-1 netbsd-4-0-RELEASE cube-autoconf-base netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-mips64-base wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base chap-midi-nbase chap-midi-base
# 1.10 24-Aug-2005 rpaulo

branches: 1.10.12;
If the specificed MIB doesn't exist, then it's probably a kernel without
that socket type (AF_INET, AF_INET6, etc.). That's a normal condition, so
don't bail out.

Reviewed by Andrew Brown.


# 1.9 10-Aug-2005 rpaulo

Query the v6 sockets only if USE_INET6 != "no". Patch provided by Jukka Salmi
on PR#30963.

ok atatat@


# 1.8 10-Aug-2005 rpaulo

Fix a typo in the islistening() routine. Patch provided by Jukka Salmi
on PR#30963.


# 1.7 02-Jun-2005 lukem

appease gcc -Wuninitialized


# 1.6 09-Apr-2005 atatat

Don't allow the command length to mess up the formatting


# 1.5 22-Mar-2005 peter

Fix a typo.


Revision tags: netbsd-3-base
# 1.4 10-Mar-2005 atatat

branches: 1.4.2;
Fix printing of AF_LOCAL names.


# 1.3 09-Mar-2005 kleink

Field width and precision specifier arguments to printf must be ints.


# 1.2 09-Mar-2005 atatat

almost forgot about this.

Optimize getting process information by not getting it again if you're
looking for the same pid.


# 1.1 09-Mar-2005 atatat

Add a sockstat(1) command that can list open sockets and the processes
that own them. The implementation concept and man page came largely
from FreeBSD, but the program is fresh.


# 1.18 12-Jan-2017 christos

fix compilation


Revision tags: pgoyette-localcount-20170107 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base
# 1.17 29-May-2011 manu

Display SOCK_SEQPACKET local sockets in sockstat and netstat


Revision tags: bouyer-quota2-nbase bouyer-quota2-base
# 1.16 28-Jan-2011 pooka

support rump.sockstat


Revision tags: matt-mips64-premerge-20101231 matt-premerge-20091211 jym-xensuspend-nbase jym-xensuspend-base
# 1.15 13-Apr-2009 lukem

branches: 1.15.2;
Fix WARNS=4 issues (-Wshadow -Wsign-compare)


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 wrstuden-revivesa-base
# 1.14 29-Apr-2008 martin

branches: 1.14.8;
Convert to new 2 clause license


Revision tags: yamt-pf42-baseX yamt-pf42-base keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.13 01-Mar-2008 he

branches: 1.13.2;
It's wrong for user-land programs to define _KERNEL before including
<sys/types.h>. The reason is that this will break the build for about
half of our ports, because the wrong variant of e.g. bswap16() is being
defined and referenced (either __bswap16() or bswap16()). Removing
the _KERNEL define restores buildability for this program.


# 1.12 27-Feb-2008 ad

+#define _KERNEL
+#include <sys/types.h>
+#undef _KERNEL


Revision tags: matt-armv6-base hpcarm-cleanup-base
# 1.11 26-Dec-2007 ad

branches: 1.11.2;
Merge more changes from vmlocking2, mainly:

- Locking improvements.
- Use pool_cache for more items.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase matt-armv6-prevmlocking wrstuden-fixsa-base-1 netbsd-4-0-RELEASE cube-autoconf-base netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-mips64-base wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base chap-midi-nbase chap-midi-base
# 1.10 24-Aug-2005 rpaulo

branches: 1.10.12;
If the specificed MIB doesn't exist, then it's probably a kernel without
that socket type (AF_INET, AF_INET6, etc.). That's a normal condition, so
don't bail out.

Reviewed by Andrew Brown.


# 1.9 10-Aug-2005 rpaulo

Query the v6 sockets only if USE_INET6 != "no". Patch provided by Jukka Salmi
on PR#30963.

ok atatat@


# 1.8 10-Aug-2005 rpaulo

Fix a typo in the islistening() routine. Patch provided by Jukka Salmi
on PR#30963.


# 1.7 02-Jun-2005 lukem

appease gcc -Wuninitialized


# 1.6 09-Apr-2005 atatat

Don't allow the command length to mess up the formatting


# 1.5 22-Mar-2005 peter

Fix a typo.


Revision tags: netbsd-3-base
# 1.4 10-Mar-2005 atatat

branches: 1.4.2;
Fix printing of AF_LOCAL names.


# 1.3 09-Mar-2005 kleink

Field width and precision specifier arguments to printf must be ints.


# 1.2 09-Mar-2005 atatat

almost forgot about this.

Optimize getting process information by not getting it again if you're
looking for the same pid.


# 1.1 09-Mar-2005 atatat

Add a sockstat(1) command that can list open sockets and the processes
that own them. The implementation concept and man page came largely
from FreeBSD, but the program is fresh.