diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2023-09-16 09:33:29 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2023-09-16 09:33:29 +0000 |
commit | fff317a1d2654248f137b1b92993cc737921b110 (patch) | |
tree | 4d1cb84a19d51934c530fd92b6321ff3519eb995 /sys/netinet/ipsec_input.c | |
parent | 817d1e1b3d749f30a8a76eba5823137fb9695bde (diff) |
Allow counters_read(9) to take an optional scratch buffer.
Using a scratch buffer makes it possible to take a consistent snapshot of
per-CPU counters without having to allocate memory.
Makes ddb(4) show uvmexp command work in OOM situations.
ok kn@, mvs@, cheloha@
Diffstat (limited to 'sys/netinet/ipsec_input.c')
-rw-r--r-- | sys/netinet/ipsec_input.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/netinet/ipsec_input.c b/sys/netinet/ipsec_input.c index 9e3f4dee18f..07de8e38eff 100644 --- a/sys/netinet/ipsec_input.c +++ b/sys/netinet/ipsec_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipsec_input.c,v 1.205 2023/08/07 03:43:57 dlg Exp $ */ +/* $OpenBSD: ipsec_input.c,v 1.206 2023/09/16 09:33:27 mpi Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr) and @@ -664,7 +664,7 @@ esp_sysctl_espstat(void *oldp, size_t *oldlenp, void *newp) CTASSERT(sizeof(espstat) == (esps_ncounters * sizeof(uint64_t))); memset(&espstat, 0, sizeof espstat); - counters_read(espcounters, (uint64_t *)&espstat, esps_ncounters); + counters_read(espcounters, (uint64_t *)&espstat, esps_ncounters, NULL); return (sysctl_rdstruct(oldp, oldlenp, newp, &espstat, sizeof(espstat))); } @@ -698,7 +698,7 @@ ah_sysctl_ahstat(void *oldp, size_t *oldlenp, void *newp) CTASSERT(sizeof(ahstat) == (ahs_ncounters * sizeof(uint64_t))); memset(&ahstat, 0, sizeof ahstat); - counters_read(ahcounters, (uint64_t *)&ahstat, ahs_ncounters); + counters_read(ahcounters, (uint64_t *)&ahstat, ahs_ncounters, NULL); return (sysctl_rdstruct(oldp, oldlenp, newp, &ahstat, sizeof(ahstat))); } @@ -733,7 +733,7 @@ ipcomp_sysctl_ipcompstat(void *oldp, size_t *oldlenp, void *newp) CTASSERT(sizeof(ipcompstat) == (ipcomps_ncounters * sizeof(uint64_t))); memset(&ipcompstat, 0, sizeof ipcompstat); counters_read(ipcompcounters, (uint64_t *)&ipcompstat, - ipcomps_ncounters); + ipcomps_ncounters, NULL); return (sysctl_rdstruct(oldp, oldlenp, newp, &ipcompstat, sizeof(ipcompstat))); } @@ -745,7 +745,8 @@ ipsec_sysctl_ipsecstat(void *oldp, size_t *oldlenp, void *newp) CTASSERT(sizeof(ipsecstat) == (ipsec_ncounters * sizeof(uint64_t))); memset(&ipsecstat, 0, sizeof ipsecstat); - counters_read(ipseccounters, (uint64_t *)&ipsecstat, ipsec_ncounters); + counters_read(ipseccounters, (uint64_t *)&ipsecstat, ipsec_ncounters, + NULL); return (sysctl_rdstruct(oldp, oldlenp, newp, &ipsecstat, sizeof(ipsecstat))); } |