sync code with last improvements from OpenBSD

This commit is contained in:
purplerain 2023-09-16 17:29:51 +00:00
parent 2990d002be
commit f0c5a45f3a
Signed by: purplerain
GPG Key ID: F42C07F07E2E35B7
27 changed files with 84 additions and 66 deletions

View File

@ -1,4 +1,4 @@
.\" $OpenBSD: bsd.port.mk.5,v 1.628 2023/09/14 14:06:13 sthen Exp $
.\" $OpenBSD: bsd.port.mk.5,v 1.630 2023/09/16 08:01:31 op Exp $
.\"
.\" Copyright (c) 2000-2008 Marc Espie
.\"
@ -24,7 +24,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: September 14 2023 $
.Dd $Mdocdate: September 16 2023 $
.Dt BSD.PORT.MK 5
.Os
.Sh NAME
@ -1343,6 +1343,9 @@ as this can be a big performance hit, and also because
.Ev lib-depends-check
doesn't know about library subdirectories or dynamic loading through
.Xr dlopen 3 .
.It Ev CHECK_LIB_DEPENDS_ARGS
List of extra arguments for
.Xr check-lib-depends 1 .
.It Ev CHECKSUMFILES
List of all files that need to be retrieved by
.Cm fetch ,
@ -2771,7 +2774,6 @@ for most shell invocations.
Default will trip ports that try to write into $HOME while building:
non-existent
.Pa /${PKGPATH}_writes_to_HOME/ .
.It Ev PORTPATH
Path used by most shell invocations.
Don't override unless really needed.

View File

@ -1,4 +1,4 @@
.\" $OpenBSD: counters_alloc.9,v 1.12 2022/02/20 23:11:01 dlg Exp $
.\" $OpenBSD: counters_alloc.9,v 1.13 2023/09/16 09:33:28 mpi Exp $
.\"
.\" Copyright (c) 2016 David Gwynne <dlg@openbsd.org>
.\"
@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: February 20 2022 $
.Dd $Mdocdate: September 16 2023 $
.Dt COUNTERS_ALLOC 9
.Os
.Sh NAME
@ -64,6 +64,7 @@
.Fa "struct cpumem *cm"
.Fa "uint64_t *counters"
.Fa "unsigned int ncounters"
.Fa "uint64_t *scratch"
.Fc
.Ft void
.Fn counters_zero "struct cpumem *cm" "unsigned int ncounters"
@ -191,6 +192,12 @@ The sum of the counters is written to the
array.
The number of counters is specified with
.Fa ncounters .
.Fa scratch
may point to a buffer used to temporarily hold
.Fa counters .
If
.Dv NULL ,
one will be dynamically allocated and freed.
.Pp
.Fn counters_zero
iterates over each CPU's set of counters referenced by

View File

@ -1,4 +1,4 @@
/* $OpenBSD: kern_sysctl.c,v 1.418 2023/07/16 03:01:31 yasuoka Exp $ */
/* $OpenBSD: kern_sysctl.c,v 1.419 2023/09/16 09:33:27 mpi Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
@ -519,7 +519,7 @@ kern_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
unsigned int i;
memset(&mbs, 0, sizeof(mbs));
counters_read(mbstat, counters, MBSTAT_COUNT);
counters_read(mbstat, counters, MBSTAT_COUNT, NULL);
for (i = 0; i < MBSTAT_TYPES; i++)
mbs.m_mtypes[i] = counters[i];

View File

@ -1,4 +1,4 @@
/* $OpenBSD: subr_evcount.c,v 1.15 2022/12/05 08:58:49 visa Exp $ */
/* $OpenBSD: subr_evcount.c,v 1.16 2023/09/16 09:33:27 mpi Exp $ */
/*
* Copyright (c) 2004 Artur Grabowski <art@openbsd.org>
* Copyright (c) 2004 Aaron Campbell <aaron@openbsd.org>
@ -101,7 +101,7 @@ evcount_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp,
{
int error = 0, s, nintr, i;
struct evcount *ec;
u_int64_t count;
uint64_t count, scratch;
if (newp != NULL)
return (EPERM);
@ -129,7 +129,7 @@ evcount_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp,
if (ec == NULL)
return (ENOENT);
if (ec->ec_percpu != NULL) {
counters_read(ec->ec_percpu, &count, 1);
counters_read(ec->ec_percpu, &count, 1, &scratch);
} else {
s = splhigh();
count = ec->ec_count;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: subr_percpu.c,v 1.10 2022/10/03 14:10:53 bluhm Exp $ */
/* $OpenBSD: subr_percpu.c,v 1.11 2023/09/16 09:33:27 mpi Exp $ */
/*
* Copyright (c) 2016 David Gwynne <dlg@openbsd.org>
@ -159,17 +159,19 @@ counters_free(struct cpumem *cm, unsigned int n)
}
void
counters_read(struct cpumem *cm, uint64_t *output, unsigned int n)
counters_read(struct cpumem *cm, uint64_t *output, unsigned int n,
uint64_t *scratch)
{
struct cpumem_iter cmi;
uint64_t *gen, *counters, *temp;
uint64_t *gen, *counters, *temp = scratch;
uint64_t enter, leave;
unsigned int i;
for (i = 0; i < n; i++)
output[i] = 0;
temp = mallocarray(n, sizeof(uint64_t), M_TEMP, M_WAITOK);
if (scratch == NULL)
temp = mallocarray(n, sizeof(uint64_t), M_TEMP, M_WAITOK);
gen = cpumem_first(&cmi, cm);
do {
@ -202,7 +204,8 @@ counters_read(struct cpumem *cm, uint64_t *output, unsigned int n)
gen = cpumem_next(&cmi, cm);
} while (gen != NULL);
free(temp, M_TEMP, n * sizeof(uint64_t));
if (scratch == NULL)
free(temp, M_TEMP, n * sizeof(uint64_t));
}
void
@ -305,7 +308,8 @@ counters_free(struct cpumem *cm, unsigned int n)
}
void
counters_read(struct cpumem *cm, uint64_t *output, unsigned int n)
counters_read(struct cpumem *cm, uint64_t *output, unsigned int n,
uint64_t *scratch)
{
uint64_t *counters;
unsigned int i;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: if.c,v 1.707 2023/08/18 08:10:16 jsg Exp $ */
/* $OpenBSD: if.c,v 1.708 2023/09/16 09:33:27 mpi Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@ -2797,7 +2797,8 @@ if_getdata(struct ifnet *ifp, struct if_data *data)
if (ifp->if_counters != NULL) {
uint64_t counters[ifc_ncounters];
counters_read(ifp->if_counters, counters, nitems(counters));
counters_read(ifp->if_counters, counters, nitems(counters),
NULL);
data->ifi_ipackets += counters[ifc_ipackets];
data->ifi_ierrors += counters[ifc_ierrors];

View File

@ -1,4 +1,4 @@
/* $OpenBSD: if_etherip.c,v 1.50 2022/02/28 00:12:11 dlg Exp $ */
/* $OpenBSD: if_etherip.c,v 1.51 2023/09/16 09:33:27 mpi Exp $ */
/*
* Copyright (c) 2015 Kazuya GODA <goda@openbsd.org>
*
@ -789,7 +789,7 @@ etherip_sysctl_etheripstat(void *oldp, size_t *oldlenp, void *newp)
sizeof(uint64_t)));
memset(&etheripstat, 0, sizeof etheripstat);
counters_read(etheripcounters, (uint64_t *)&etheripstat,
etherips_ncounters);
etherips_ncounters, NULL);
return (sysctl_rdstruct(oldp, oldlenp, newp, &etheripstat,
sizeof(etheripstat)));
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: if_pfsync.c,v 1.320 2023/08/18 08:03:57 jsg Exp $ */
/* $OpenBSD: if_pfsync.c,v 1.321 2023/09/16 09:33:27 mpi Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff
@ -3339,7 +3339,7 @@ pfsync_sysctl_pfsyncstat(void *oldp, size_t *oldlenp, void *newp)
CTASSERT(sizeof(pfsyncstat) == (pfsyncs_ncounters * sizeof(uint64_t)));
memset(&pfsyncstat, 0, sizeof pfsyncstat);
counters_read(pfsynccounters, (uint64_t *)&pfsyncstat,
pfsyncs_ncounters);
pfsyncs_ncounters, NULL);
return (sysctl_rdstruct(oldp, oldlenp, newp,
&pfsyncstat, sizeof(pfsyncstat)));
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: pfkeyv2_convert.c,v 1.80 2023/08/07 03:35:06 dlg Exp $ */
/* $OpenBSD: pfkeyv2_convert.c,v 1.81 2023/09/16 09:33:27 mpi Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@keromytis.org)
*
@ -992,7 +992,7 @@ export_counter(void **p, struct tdb *tdb)
uint64_t counters[tdb_ncounters];
struct sadb_x_counter *scnt = (struct sadb_x_counter *)*p;
counters_read(tdb->tdb_counters, counters, tdb_ncounters);
counters_read(tdb->tdb_counters, counters, tdb_ncounters, NULL);
scnt->sadb_x_counter_len = sizeof(struct sadb_x_counter) /
sizeof(uint64_t);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: pipex.c,v 1.148 2022/08/30 19:42:29 bluhm Exp $ */
/* $OpenBSD: pipex.c,v 1.149 2023/09/16 09:33:27 mpi Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@ -558,7 +558,7 @@ pipex_export_session_stats(struct pipex_session *session,
memset(stats, 0, sizeof(*stats));
counters_read(session->stat_counters, counters, pxc_ncounters);
counters_read(session->stat_counters, counters, pxc_ncounters, NULL);
stats->ipackets = counters[pxc_ipackets];
stats->ierrors = counters[pxc_ierrors];
stats->ibytes = counters[pxc_ibytes];

View File

@ -1,4 +1,4 @@
/* $OpenBSD: rtsock.c,v 1.369 2023/07/28 09:33:16 mvs Exp $ */
/* $OpenBSD: rtsock.c,v 1.370 2023/09/16 09:33:27 mpi Exp $ */
/* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */
/*
@ -2245,7 +2245,7 @@ sysctl_rtable_rtstat(void *oldp, size_t *oldlenp, void *newp)
CTASSERT(sizeof(rtstat) == (nitems(counters) * sizeof(uint32_t)));
memset(&rtstat, 0, sizeof rtstat);
counters_read(rtcounters, counters, nitems(counters));
counters_read(rtcounters, counters, nitems(counters), NULL);
for (i = 0; i < nitems(counters); i++)
words[i] = (uint32_t)counters[i];

View File

@ -1,4 +1,4 @@
/* $OpenBSD: igmp.c,v 1.82 2022/09/08 10:22:06 kn Exp $ */
/* $OpenBSD: igmp.c,v 1.83 2023/09/16 09:33:27 mpi Exp $ */
/* $NetBSD: igmp.c,v 1.15 1996/02/13 23:41:25 christos Exp $ */
/*
@ -687,7 +687,7 @@ igmp_sysctl_igmpstat(void *oldp, size_t *oldlenp, void *newp)
CTASSERT(sizeof(igmpstat) == (nitems(counters) * sizeof(u_long)));
memset(&igmpstat, 0, sizeof igmpstat);
counters_read(igmpcounters, counters, nitems(counters));
counters_read(igmpcounters, counters, nitems(counters), NULL);
for (i = 0; i < nitems(counters); i++)
words[i] = (u_long)counters[i];

View File

@ -1,4 +1,4 @@
/* $OpenBSD: ip_carp.c,v 1.357 2023/05/16 14:32:54 jan Exp $ */
/* $OpenBSD: ip_carp.c,v 1.358 2023/09/16 09:33:27 mpi Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff. All rights reserved.
@ -749,7 +749,8 @@ carp_sysctl_carpstat(void *oldp, size_t *oldlenp, void *newp)
CTASSERT(sizeof(carpstat) == (carps_ncounters * sizeof(uint64_t)));
memset(&carpstat, 0, sizeof carpstat);
counters_read(carpcounters, (uint64_t *)&carpstat, carps_ncounters);
counters_read(carpcounters, (uint64_t *)&carpstat, carps_ncounters,
NULL);
return (sysctl_rdstruct(oldp, oldlenp, newp,
&carpstat, sizeof(carpstat)));
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: ip_divert.c,v 1.91 2023/05/13 13:35:17 bluhm Exp $ */
/* $OpenBSD: ip_divert.c,v 1.92 2023/09/16 09:33:27 mpi Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@ -350,7 +350,7 @@ divert_sysctl_divstat(void *oldp, size_t *oldlenp, void *newp)
CTASSERT(sizeof(divstat) == (nitems(counters) * sizeof(u_long)));
memset(&divstat, 0, sizeof divstat);
counters_read(divcounters, counters, nitems(counters));
counters_read(divcounters, counters, nitems(counters), NULL);
for (i = 0; i < nitems(counters); i++)
words[i] = (u_long)counters[i];

View File

@ -1,4 +1,4 @@
/* $OpenBSD: ip_icmp.c,v 1.191 2022/05/05 13:57:40 claudio Exp $ */
/* $OpenBSD: ip_icmp.c,v 1.192 2023/09/16 09:33:27 mpi Exp $ */
/* $NetBSD: ip_icmp.c,v 1.19 1996/02/13 23:42:22 christos Exp $ */
/*
@ -917,7 +917,7 @@ icmp_sysctl_icmpstat(void *oldp, size_t *oldlenp, void *newp)
CTASSERT(sizeof(icmpstat) == (nitems(counters) * sizeof(u_long)));
memset(&icmpstat, 0, sizeof icmpstat);
counters_read(icmpcounters, counters, nitems(counters));
counters_read(icmpcounters, counters, nitems(counters), NULL);
for (i = 0; i < nitems(counters); i++)
words[i] = (u_long)counters[i];

View File

@ -1,4 +1,4 @@
/* $OpenBSD: ip_input.c,v 1.386 2023/09/06 11:09:43 bluhm Exp $ */
/* $OpenBSD: ip_input.c,v 1.387 2023/09/16 09:33:27 mpi Exp $ */
/* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */
/*
@ -1747,7 +1747,7 @@ ip_sysctl_ipstat(void *oldp, size_t *oldlenp, void *newp)
CTASSERT(sizeof(ipstat) == (nitems(counters) * sizeof(u_long)));
memset(&ipstat, 0, sizeof ipstat);
counters_read(ipcounters, counters, nitems(counters));
counters_read(ipcounters, counters, nitems(counters), NULL);
for (i = 0; i < nitems(counters); i++)
words[i] = (u_long)counters[i];

View File

@ -1,4 +1,4 @@
/* $OpenBSD: ip_ipip.c,v 1.98 2022/01/02 22:36:04 jsg Exp $ */
/* $OpenBSD: ip_ipip.c,v 1.99 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
@ -573,7 +573,8 @@ ipip_sysctl_ipipstat(void *oldp, size_t *oldlenp, void *newp)
CTASSERT(sizeof(ipipstat) == (ipips_ncounters * sizeof(uint64_t)));
memset(&ipipstat, 0, sizeof ipipstat);
counters_read(ipipcounters, (uint64_t *)&ipipstat, ipips_ncounters);
counters_read(ipipcounters, (uint64_t *)&ipipstat, ipips_ncounters,
NULL);
return (sysctl_rdstruct(oldp, oldlenp, newp,
&ipipstat, sizeof(ipipstat)));
}

View File

@ -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)));
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: tcp_usrreq.c,v 1.221 2023/07/06 09:15:24 bluhm Exp $ */
/* $OpenBSD: tcp_usrreq.c,v 1.222 2023/09/16 09:33:27 mpi Exp $ */
/* $NetBSD: tcp_usrreq.c,v 1.20 1996/02/13 23:44:16 christos Exp $ */
/*
@ -1237,7 +1237,7 @@ tcp_sysctl_tcpstat(void *oldp, size_t *oldlenp, void *newp)
#define ASSIGN(field) do { tcpstat.field = counters[i++]; } while (0)
memset(&tcpstat, 0, sizeof tcpstat);
counters_read(tcpcounters, counters, nitems(counters));
counters_read(tcpcounters, counters, nitems(counters), NULL);
ASSIGN(tcps_connattempt);
ASSIGN(tcps_accepts);
ASSIGN(tcps_connects);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: udp_usrreq.c,v 1.305 2023/01/22 12:05:44 mvs Exp $ */
/* $OpenBSD: udp_usrreq.c,v 1.306 2023/09/16 09:33:27 mpi Exp $ */
/* $NetBSD: udp_usrreq.c,v 1.28 1996/03/16 23:54:03 christos Exp $ */
/*
@ -1314,7 +1314,7 @@ udp_sysctl_udpstat(void *oldp, size_t *oldlenp, void *newp)
CTASSERT(sizeof(udpstat) == (nitems(counters) * sizeof(u_long)));
memset(&udpstat, 0, sizeof udpstat);
counters_read(udpcounters, counters, nitems(counters));
counters_read(udpcounters, counters, nitems(counters), NULL);
for (i = 0; i < nitems(counters); i++)
words[i] = (u_long)counters[i];

View File

@ -1,4 +1,4 @@
/* $OpenBSD: icmp6.c,v 1.248 2023/04/05 21:51:47 bluhm Exp $ */
/* $OpenBSD: icmp6.c,v 1.249 2023/09/16 09:33:27 mpi Exp $ */
/* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */
/*
@ -1870,7 +1870,8 @@ icmp6_sysctl_icmp6stat(void *oldp, size_t *oldlenp, void *newp)
CTASSERT(sizeof(*icmp6stat) == icp6s_ncounters * sizeof(uint64_t));
icmp6stat = malloc(sizeof(*icmp6stat), M_TEMP, M_WAITOK|M_ZERO);
counters_read(icmp6counters, (uint64_t *)icmp6stat, icp6s_ncounters);
counters_read(icmp6counters, (uint64_t *)icmp6stat, icp6s_ncounters,
NULL);
ret = sysctl_rdstruct(oldp, oldlenp, newp,
icmp6stat, sizeof(*icmp6stat));
free(icmp6stat, M_TEMP, sizeof(*icmp6stat));

View File

@ -1,4 +1,4 @@
/* $OpenBSD: ip6_divert.c,v 1.89 2023/04/04 10:12:03 bluhm Exp $ */
/* $OpenBSD: ip6_divert.c,v 1.90 2023/09/16 09:33:27 mpi Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@ -358,7 +358,7 @@ divert6_sysctl_div6stat(void *oldp, size_t *oldlenp, void *newp)
CTASSERT(sizeof(div6stat) == (nitems(counters) * sizeof(u_long)));
counters_read(div6counters, counters, nitems(counters));
counters_read(div6counters, counters, nitems(counters), NULL);
for (i = 0; i < nitems(counters); i++)
words[i] = (u_long)counters[i];

View File

@ -1,4 +1,4 @@
/* $OpenBSD: ip6_input.c,v 1.255 2023/09/06 11:09:43 bluhm Exp $ */
/* $OpenBSD: ip6_input.c,v 1.256 2023/09/16 09:33:27 mpi Exp $ */
/* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */
/*
@ -1466,7 +1466,7 @@ ip6_sysctl_ip6stat(void *oldp, size_t *oldlenp, void *newp)
CTASSERT(sizeof(*ip6stat) == (ip6s_ncounters * sizeof(uint64_t)));
ip6stat = malloc(sizeof(*ip6stat), M_TEMP, M_WAITOK);
counters_read(ip6counters, (uint64_t *)ip6stat, ip6s_ncounters);
counters_read(ip6counters, (uint64_t *)ip6stat, ip6s_ncounters, NULL);
ret = sysctl_rdstruct(oldp, oldlenp, newp,
ip6stat, sizeof(*ip6stat));
free(ip6stat, M_TEMP, sizeof(*ip6stat));

View File

@ -1,4 +1,4 @@
/* $OpenBSD: raw_ip6.c,v 1.172 2023/01/22 12:05:44 mvs Exp $ */
/* $OpenBSD: raw_ip6.c,v 1.173 2023/09/16 09:33:27 mpi Exp $ */
/* $KAME: raw_ip6.c,v 1.69 2001/03/04 15:55:44 itojun Exp $ */
/*
@ -784,7 +784,8 @@ rip6_sysctl_rip6stat(void *oldp, size_t *oldplen, void *newp)
struct rip6stat rip6stat;
CTASSERT(sizeof(rip6stat) == rip6s_ncounters * sizeof(uint64_t));
counters_read(rip6counters, (uint64_t *)&rip6stat, rip6s_ncounters);
counters_read(rip6counters, (uint64_t *)&rip6stat, rip6s_ncounters,
NULL);
return (sysctl_rdstruct(oldp, oldplen, newp,
&rip6stat, sizeof(rip6stat)));

View File

@ -1,4 +1,4 @@
/* $OpenBSD: percpu.h,v 1.8 2018/08/28 15:15:02 mpi Exp $ */
/* $OpenBSD: percpu.h,v 1.9 2023/09/16 09:33:27 mpi Exp $ */
/*
* Copyright (c) 2016 David Gwynne <dlg@openbsd.org>
@ -113,7 +113,8 @@ static struct { \
struct cpumem *counters_alloc(unsigned int);
struct cpumem *counters_alloc_ncpus(struct cpumem *, unsigned int);
void counters_free(struct cpumem *, unsigned int);
void counters_read(struct cpumem *, uint64_t *, unsigned int);
void counters_read(struct cpumem *, uint64_t *, unsigned int,
uint64_t *);
void counters_zero(struct cpumem *, unsigned int);
static inline uint64_t *

View File

@ -1,4 +1,4 @@
/* $OpenBSD: uvm_meter.c,v 1.49 2023/08/18 09:18:52 claudio Exp $ */
/* $OpenBSD: uvm_meter.c,v 1.50 2023/09/16 09:33:27 mpi Exp $ */
/* $NetBSD: uvm_meter.c,v 1.21 2001/07/14 06:36:03 matt Exp $ */
/*
@ -249,11 +249,12 @@ uvm_total(struct vmtotal *totalp)
void
uvmexp_read(struct uvmexp *uexp)
{
uint64_t counters[exp_ncounters];
uint64_t counters[exp_ncounters], scratch[exp_ncounters];
memcpy(uexp, &uvmexp, sizeof(*uexp));
counters_read(uvmexp_counters, counters, exp_ncounters);
counters_read(uvmexp_counters, counters, exp_ncounters,
scratch);
/* stat counters */
uexp->faults = (int)counters[faults];

View File

@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
# $OpenBSD: Cache.pm,v 1.12 2023/06/13 09:07:18 espie Exp $
# $OpenBSD: Cache.pm,v 1.13 2023/09/16 09:33:13 espie Exp $
#
# Copyright (c) 2022 Marc Espie <espie@openbsd.org>
#
@ -137,9 +137,6 @@ sub get_cached_info($self, $name)
$content = '';
open my $fh, "-|", $self->pipe_locate($name.":*") or die $!;
while (<$fh>) {
if (m/\@option\s+always-update/) {
return undef;
}
if (m/^.*?\:(.*)/) {
$content .= $1."\n";
} else {