sync with OpenBSD -current

This commit is contained in:
purplerain 2024-08-06 04:33:39 +00:00
parent 04f8de21b3
commit 174ac28011
Signed by: purplerain
GPG Key ID: F42C07F07E2E35B7
16 changed files with 313 additions and 118 deletions

View File

@ -798,8 +798,8 @@ static void reportGNUWarning(Symbol &sym, InputSectionBase &sec,
// report first occurance only
sym.gwarn = false;
if (!gnuWarning.empty())
message(sec.getSrcMsg(sym, offset) + "(" + sec.getObjMsg(offset) +
"): warning: " + gnuWarning);
warn(sec.getSrcMsg(sym, offset) + "(" + sec.getObjMsg(offset) +
"): warning: " + gnuWarning);
}
}

View File

@ -50,6 +50,8 @@ typedef unsigned long ulg;
# define Z_U8 unsigned long
# elif (ULLONG_MAX == 0xffffffffffffffff)
# define Z_U8 unsigned long long
# elif (ULONG_LONG_MAX == 0xffffffffffffffff)
# define Z_U8 unsigned long long
# elif (UINT_MAX == 0xffffffffffffffff)
# define Z_U8 unsigned
# endif

View File

@ -1,4 +1,4 @@
.\" $OpenBSD: bpf.4,v 1.45 2023/03/09 06:01:40 dlg Exp $
.\" $OpenBSD: bpf.4,v 1.46 2024/08/05 23:56:10 dlg Exp $
.\" $NetBSD: bpf.4,v 1.7 1995/09/27 18:31:50 thorpej Exp $
.\"
.\" Copyright (c) 1990 The Regents of the University of California.
@ -23,7 +23,7 @@
.\" This document is derived in part from the enet man page (enet.4)
.\" distributed with 4.3BSD Unix.
.\"
.Dd $Mdocdate: March 9 2023 $
.Dd $Mdocdate: August 5 2024 $
.Dt BPF 4
.Os
.Sh NAME
@ -315,6 +315,7 @@ the kernel buffer becoming readable.
By default, or when reset, the wait timeout is infinite, meaning
the age of packets in the kernel buffer does not make the buffer
readable.
The maximum wait time that can be set is 5 minutes (300 seconds).
.Pp
.It Dv BIOCSETF Fa "struct bpf_program *"
Sets the filter program used by the kernel to discard uninteresting packets.

View File

@ -1,4 +1,4 @@
.\" $OpenBSD: timeout.9,v 1.57 2023/10/12 15:32:38 cheloha Exp $
.\" $OpenBSD: timeout.9,v 1.58 2024/08/05 23:52:03 dlg Exp $
.\"
.\" Copyright (c) 2000 Artur Grabowski <art@openbsd.org>
.\" Copyright (c) 2021, 2022 Scott Cheloha <cheloha@openbsd.org>
@ -24,7 +24,7 @@
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: October 12 2023 $
.Dd $Mdocdate: August 5 2024 $
.Dt TIMEOUT_SET 9
.Os
.Sh NAME
@ -93,7 +93,7 @@
.Ft int
.Fo timeout_add_nsec
.Fa "struct timeout *to"
.Fa "int nsecs"
.Fa "uint64_t nsecs"
.Fc
.Ft int
.Fo timeout_add_tv

View File

@ -1,4 +1,4 @@
/* $OpenBSD: intr.c,v 1.22 2024/06/26 01:40:49 jsg Exp $ */
/* $OpenBSD: intr.c,v 1.23 2024/08/05 13:55:34 kettenis Exp $ */
/*
* Copyright (c) 2011 Dale Rahn <drahn@openbsd.org>
*
@ -25,7 +25,7 @@
#include <dev/ofw/openfirm.h>
uint32_t arm_intr_get_parent(int);
int arm_intr_get_parent(int);
uint32_t arm_intr_map_msi(int, uint64_t *);
void *arm_intr_prereg_establish_fdt(void *, int *, int, struct cpu_info *,
@ -94,17 +94,21 @@ arm_intr_string(void *cookie)
/*
* Find the interrupt parent by walking up the tree.
*/
uint32_t
int
arm_intr_get_parent(int node)
{
uint32_t phandle = 0;
uint32_t phandle;
while (node && !phandle) {
while (node) {
phandle = OF_getpropint(node, "interrupt-parent", 0);
if (phandle)
return OF_getnodebyphandle(phandle);
node = OF_parent(node);
if (OF_getpropbool(node, "interrupt-controller"))
return node;
}
return phandle;
return 0;
}
uint32_t
@ -280,8 +284,6 @@ arm_intr_register_fdt(struct interrupt_controller *ic)
ic->ic_cells = OF_getpropint(ic->ic_node, "#interrupt-cells", 0);
ic->ic_phandle = OF_getpropint(ic->ic_node, "phandle", 0);
if (ic->ic_phandle == 0)
return;
KASSERT(ic->ic_cells <= MAX_INTERRUPT_CELLS);
LIST_INSERT_HEAD(&interrupt_controllers, ic, ic_list);
@ -335,7 +337,8 @@ arm_intr_establish_fdt_idx_cpu(int node, int idx, int level, struct cpu_info *ci
int (*func)(void *), void *cookie, char *name)
{
struct interrupt_controller *ic;
int i, len, ncells, extended = 1;
int i, len, ncells, parent;
int extended = 1;
uint32_t *cell, *cells, phandle;
struct arm_intr_handle *ih;
void *val = NULL;
@ -350,9 +353,9 @@ arm_intr_establish_fdt_idx_cpu(int node, int idx, int level, struct cpu_info *ci
/* Old style. */
if (!extended) {
phandle = arm_intr_get_parent(node);
parent = arm_intr_get_parent(node);
LIST_FOREACH(ic, &interrupt_controllers, ic_list) {
if (ic->ic_phandle == phandle)
if (ic->ic_node == parent)
break;
}
@ -563,12 +566,12 @@ arm_intr_parent_establish_fdt(void *cookie, int *cell, int level,
{
struct interrupt_controller *ic = cookie;
struct arm_intr_handle *ih;
uint32_t phandle;
int parent;
void *val;
phandle = arm_intr_get_parent(ic->ic_node);
parent = arm_intr_get_parent(ic->ic_node);
LIST_FOREACH(ic, &interrupt_controllers, ic_list) {
if (ic->ic_phandle == phandle)
if (ic->ic_node == parent)
break;
}
if (ic == NULL)

View File

@ -1,4 +1,4 @@
/* $OpenBSD: acpibat.c,v 1.71 2024/06/24 15:56:07 mglocker Exp $ */
/* $OpenBSD: acpibat.c,v 1.72 2024/08/05 18:37:29 kettenis Exp $ */
/*
* Copyright (c) 2005 Marco Peereboom <marco@openbsd.org>
*
@ -279,13 +279,11 @@ acpibat_refresh(void *arg)
else if (sc->sc_bst.bst_state & BST_CHARGE)
strlcpy(sc->sc_sens[4].desc, "battery charging",
sizeof(sc->sc_sens[4].desc));
else if (sc->sc_bst.bst_state & BST_CRITICAL) {
strlcpy(sc->sc_sens[4].desc, "battery critical",
sizeof(sc->sc_sens[4].desc));
sc->sc_sens[4].status = SENSOR_S_CRIT;
} else
else
strlcpy(sc->sc_sens[4].desc, "battery idle",
sizeof(sc->sc_sens[4].desc));
if (sc->sc_bst.bst_state & BST_CRITICAL)
sc->sc_sens[4].status = SENSOR_S_CRIT;
sc->sc_sens[4].value = sc->sc_bst.bst_state;
if (sc->sc_bst.bst_rate == BST_UNKNOWN) {

View File

@ -1,4 +1,4 @@
/* $OpenBSD: mvgicp.c,v 1.5 2021/10/24 17:52:26 mpi Exp $ */
/* $OpenBSD: mvgicp.c,v 1.6 2024/08/05 18:39:34 kettenis Exp $ */
/*
* Copyright (c) 2019 Patrick Wildt <patrick@blueri.se>
*
@ -74,7 +74,7 @@ mvgicp_attach(struct device *parent, struct device *self, void *aux)
struct mvgicp_softc *sc = (struct mvgicp_softc *)self;
struct fdt_attach_args *faa = aux;
struct interrupt_controller *ic;
uint32_t phandle;
int node;
if (faa->fa_nreg < 1) {
printf(": no registers\n");
@ -100,11 +100,11 @@ mvgicp_attach(struct device *parent, struct device *self, void *aux)
return;
}
extern uint32_t fdt_intr_get_parent(int);
phandle = fdt_intr_get_parent(faa->fa_node);
extern int fdt_intr_get_parent(int);
node = fdt_intr_get_parent(faa->fa_node);
extern LIST_HEAD(, interrupt_controller) interrupt_controllers;
LIST_FOREACH(ic, &interrupt_controllers, ic_list) {
if (ic->ic_phandle == phandle)
if (ic->ic_node == node)
break;
}
sc->sc_parent_ic = ic;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: qcpas.c,v 1.5 2024/08/04 20:10:38 mglocker Exp $ */
/* $OpenBSD: qcpas.c,v 1.6 2024/08/05 18:36:28 kettenis Exp $ */
/*
* Copyright (c) 2023 Patrick Wildt <patrick@blueri.se>
*
@ -21,6 +21,7 @@
#include <sys/malloc.h>
#include <sys/atomic.h>
#include <sys/exec_elf.h>
#include <sys/sensors.h>
#include <sys/task.h>
#include <machine/apmvar.h>
@ -102,6 +103,14 @@ struct qcpas_softc {
struct task sc_glink_rx;
uint32_t sc_glink_max_channel;
TAILQ_HEAD(,qcpas_glink_channel) sc_glink_channels;
#ifndef SMALL_KERNEL
uint32_t sc_last_full_capacity;
uint32_t sc_warning_capacity;
uint32_t sc_low_capacity;
struct ksensor sc_sens[11];
struct ksensordev sc_sensdev;
#endif
};
int qcpas_match(struct device *, void *, void *);
@ -271,6 +280,77 @@ qcpas_mountroot(struct device *self)
node = OF_getnodebyname(sc->sc_node, "glink-edge");
if (node)
qcpas_glink_attach(sc, node);
#ifndef SMALL_KERNEL
strlcpy(sc->sc_sensdev.xname, sc->sc_dev.dv_xname,
sizeof(sc->sc_sensdev.xname));
strlcpy(sc->sc_sens[0].desc, "last full capacity",
sizeof(sc->sc_sens[0].desc));
sc->sc_sens[0].type = SENSOR_WATTHOUR;
sc->sc_sens[0].flags = SENSOR_FUNKNOWN;
sensor_attach(&sc->sc_sensdev, &sc->sc_sens[0]);
strlcpy(sc->sc_sens[1].desc, "warning capacity",
sizeof(sc->sc_sens[1].desc));
sc->sc_sens[1].type = SENSOR_WATTHOUR;
sc->sc_sens[1].flags = SENSOR_FUNKNOWN;
sensor_attach(&sc->sc_sensdev, &sc->sc_sens[1]);
strlcpy(sc->sc_sens[2].desc, "low capacity",
sizeof(sc->sc_sens[2].desc));
sc->sc_sens[2].type = SENSOR_WATTHOUR;
sc->sc_sens[2].flags = SENSOR_FUNKNOWN;
sensor_attach(&sc->sc_sensdev, &sc->sc_sens[2]);
strlcpy(sc->sc_sens[3].desc, "voltage", sizeof(sc->sc_sens[3].desc));
sc->sc_sens[3].type = SENSOR_VOLTS_DC;
sc->sc_sens[3].flags = SENSOR_FUNKNOWN;
sensor_attach(&sc->sc_sensdev, &sc->sc_sens[3]);
strlcpy(sc->sc_sens[4].desc, "battery unknown",
sizeof(sc->sc_sens[4].desc));
sc->sc_sens[4].type = SENSOR_INTEGER;
sc->sc_sens[4].flags = SENSOR_FUNKNOWN;
sensor_attach(&sc->sc_sensdev, &sc->sc_sens[4]);
strlcpy(sc->sc_sens[5].desc, "rate", sizeof(sc->sc_sens[5].desc));
sc->sc_sens[5].type =SENSOR_WATTS;
sc->sc_sens[5].flags = SENSOR_FUNKNOWN;
sensor_attach(&sc->sc_sensdev, &sc->sc_sens[5]);
strlcpy(sc->sc_sens[6].desc, "remaining capacity",
sizeof(sc->sc_sens[6].desc));
sc->sc_sens[6].type = SENSOR_WATTHOUR;
sc->sc_sens[6].flags = SENSOR_FUNKNOWN;
sensor_attach(&sc->sc_sensdev, &sc->sc_sens[6]);
strlcpy(sc->sc_sens[7].desc, "current voltage",
sizeof(sc->sc_sens[7].desc));
sc->sc_sens[7].type = SENSOR_VOLTS_DC;
sc->sc_sens[7].flags = SENSOR_FUNKNOWN;
sensor_attach(&sc->sc_sensdev, &sc->sc_sens[7]);
strlcpy(sc->sc_sens[8].desc, "design capacity",
sizeof(sc->sc_sens[8].desc));
sc->sc_sens[8].type = SENSOR_WATTHOUR;
sc->sc_sens[8].flags = SENSOR_FUNKNOWN;
sensor_attach(&sc->sc_sensdev, &sc->sc_sens[8]);
strlcpy(sc->sc_sens[9].desc, "discharge cycles",
sizeof(sc->sc_sens[9].desc));
sc->sc_sens[9].type = SENSOR_INTEGER;
sc->sc_sens[9].flags = SENSOR_FUNKNOWN;
sensor_attach(&sc->sc_sensdev, &sc->sc_sens[9]);
strlcpy(sc->sc_sens[10].desc, "temperature",
sizeof(sc->sc_sens[10].desc));
sc->sc_sens[10].type = SENSOR_TEMP;
sc->sc_sens[10].flags = SENSOR_FUNKNOWN;
sensor_attach(&sc->sc_sensdev, &sc->sc_sens[10]);
sensordev_install(&sc->sc_sensdev);
#endif
}
int
@ -1178,6 +1258,12 @@ struct battmgr_bat_status {
uint32_t temperature;
};
void qcpas_pmic_rtr_refresh(void *);
void qcpas_pmic_rtr_bat_info(struct qcpas_softc *,
struct battmgr_bat_info *);
void qcpas_pmic_rtr_bat_status(struct qcpas_softc *,
struct battmgr_bat_status *);
void
qcpas_pmic_rtr_battmgr_req_info(void *cookie)
{
@ -1227,6 +1313,9 @@ qcpas_pmic_rtr_init(void *cookie)
qcpas_pmic_rtr_apm_cookie = cookie;
apm_setinfohook(qcpas_pmic_rtr_apminfo);
#endif
#ifndef SMALL_KERNEL
sensor_task_register(cookie, qcpas_pmic_rtr_refresh, 5);
#endif
return 0;
}
@ -1234,12 +1323,10 @@ qcpas_pmic_rtr_init(void *cookie)
int
qcpas_pmic_rtr_recv(void *cookie, uint8_t *buf, int len)
{
#if NAPM > 0
static uint32_t last_full_capacity;
#endif
struct qcpas_glink_channel *ch = cookie;
struct qcpas_softc *sc = ch->ch_sc;
struct pmic_glink_hdr hdr;
uint32_t notification;
extern int hw_power;
if (len < sizeof(hdr)) {
printf("%s: pmic glink message too small\n",
@ -1282,67 +1369,21 @@ qcpas_pmic_rtr_recv(void *cookie, uint8_t *buf, int len)
return 0;
}
bat = malloc(sizeof(*bat), M_TEMP, M_WAITOK);
memcpy((void *)bat, buf + sizeof(hdr), sizeof(*bat));
#if NAPM > 0
last_full_capacity = bat->last_full_capacity;
#endif
memcpy(bat, buf + sizeof(hdr), sizeof(*bat));
qcpas_pmic_rtr_bat_info(sc, bat);
free(bat, M_TEMP, sizeof(*bat));
break;
}
case BATTMGR_OPCODE_BAT_STATUS: {
struct battmgr_bat_status *bat;
#if NAPM > 0
struct apm_power_info *info;
uint32_t delta;
#endif
if (len - sizeof(hdr) != sizeof(*bat)) {
printf("%s: invalid battgmr bat status\n",
__func__);
return 0;
}
#if NAPM > 0
/* Needs BAT_INFO fist */
if (last_full_capacity == 0) {
wakeup(&qcpas_pmic_rtr_apm_power_info);
return 0;
}
#endif
bat = malloc(sizeof(*bat), M_TEMP, M_WAITOK);
memcpy((void *)bat, buf + sizeof(hdr), sizeof(*bat));
#if NAPM > 0
info = &qcpas_pmic_rtr_apm_power_info;
info->battery_life = ((bat->capacity * 100) /
last_full_capacity);
if (info->battery_life > 50)
info->battery_state = APM_BATT_HIGH;
else if (info->battery_life > 25)
info->battery_state = APM_BATT_LOW;
else
info->battery_state = APM_BATT_CRITICAL;
if (bat->battery_state & BATTMGR_BAT_STATE_CHARGING)
info->battery_state = APM_BATT_CHARGING;
else if (bat->battery_state & BATTMGR_BAT_STATE_CRITICAL_LOW)
info->battery_state = APM_BATT_CRITICAL;
if (bat->rate < 0)
delta = bat->capacity;
else
delta = last_full_capacity - bat->capacity;
if (bat->rate == 0)
info->minutes_left = -1;
else
info->minutes_left =
(60 * delta) / abs(bat->rate);
if (bat->power_state & BATTMGR_PWR_STATE_AC_ON) {
info->ac_state = APM_AC_ON;
hw_power = 1;
} else {
info->ac_state = APM_AC_OFF;
hw_power = 0;
}
wakeup(&qcpas_pmic_rtr_apm_power_info);
#endif
memcpy(bat, buf + sizeof(hdr), sizeof(*bat));
qcpas_pmic_rtr_bat_status(sc, bat);
free(bat, M_TEMP, sizeof(*bat));
break;
}
@ -1377,3 +1418,127 @@ qcpas_pmic_rtr_apminfo(struct apm_power_info *info)
return 0;
}
#endif
void
qcpas_pmic_rtr_refresh(void *arg)
{
qcpas_pmic_rtr_battmgr_req_status(arg);
}
void
qcpas_pmic_rtr_bat_info(struct qcpas_softc *sc, struct battmgr_bat_info *bat)
{
#ifndef SMALL_KERNEL
sc->sc_last_full_capacity = bat->last_full_capacity;
sc->sc_warning_capacity = bat->capacity_warning;
sc->sc_low_capacity = bat->capacity_low;
sc->sc_sens[0].value = bat->last_full_capacity * 1000;
sc->sc_sens[0].flags &= ~SENSOR_FUNKNOWN;
sc->sc_sens[1].value = bat->capacity_warning * 1000;
sc->sc_sens[1].flags &= ~SENSOR_FUNKNOWN;
sc->sc_sens[2].value = bat->capacity_low * 1000;
sc->sc_sens[2].flags &= ~SENSOR_FUNKNOWN;
sc->sc_sens[3].value = bat->design_voltage * 1000;
sc->sc_sens[3].flags &= ~SENSOR_FUNKNOWN;
sc->sc_sens[8].value = bat->design_capacity * 1000;
sc->sc_sens[8].flags &= ~SENSOR_FUNKNOWN;
sc->sc_sens[9].value = bat->cycle_count;
sc->sc_sens[9].flags &= ~SENSOR_FUNKNOWN;
#endif
}
void
qcpas_pmic_rtr_bat_status(struct qcpas_softc *sc,
struct battmgr_bat_status *bat)
{
#if NAPM > 0
extern int hw_power;
struct apm_power_info *info = &qcpas_pmic_rtr_apm_power_info;
uint32_t delta;
#endif
#ifndef SMALL_KERNEL
if (bat->capacity >= sc->sc_last_full_capacity)
strlcpy(sc->sc_sens[4].desc, "battery full",
sizeof(sc->sc_sens[4].desc));
else if (bat->battery_state & BATTMGR_BAT_STATE_DISCHARGE)
strlcpy(sc->sc_sens[4].desc, "battery discharging",
sizeof(sc->sc_sens[4].desc));
else if (bat->battery_state & BATTMGR_BAT_STATE_CHARGING)
strlcpy(sc->sc_sens[4].desc, "battery charging",
sizeof(sc->sc_sens[4].desc));
else
strlcpy(sc->sc_sens[4].desc, "battery idle",
sizeof(sc->sc_sens[4].desc));
if (bat->battery_state & BATTMGR_BAT_STATE_CRITICAL_LOW)
sc->sc_sens[4].status = SENSOR_S_CRIT;
else
sc->sc_sens[4].status = SENSOR_S_OK;
sc->sc_sens[4].value = bat->battery_state;
sc->sc_sens[4].flags &= ~SENSOR_FUNKNOWN;
sc->sc_sens[5].value = abs(bat->rate) * 1000;
sc->sc_sens[5].flags &= ~SENSOR_FUNKNOWN;
sc->sc_sens[6].value = bat->capacity * 1000;
if (bat->capacity < sc->sc_low_capacity)
sc->sc_sens[6].status = SENSOR_S_CRIT;
else if (bat->capacity < sc->sc_warning_capacity)
sc->sc_sens[6].status = SENSOR_S_WARN;
else
sc->sc_sens[6].status = SENSOR_S_OK;
sc->sc_sens[6].flags &= ~SENSOR_FUNKNOWN;
sc->sc_sens[7].value = bat->battery_voltage * 1000;
sc->sc_sens[7].flags &= ~SENSOR_FUNKNOWN;
sc->sc_sens[10].value = (bat->temperature * 10000) + 273150000;
sc->sc_sens[10].flags &= ~SENSOR_FUNKNOWN;
#endif
#if NAPM > 0
/* Needs BAT_INFO fist */
if (sc->sc_last_full_capacity == 0) {
wakeup(&qcpas_pmic_rtr_apm_power_info);
return;
}
info->battery_life =
((bat->capacity * 100) / sc->sc_last_full_capacity);
if (info->battery_life > 50)
info->battery_state = APM_BATT_HIGH;
else if (info->battery_life > 25)
info->battery_state = APM_BATT_LOW;
else
info->battery_state = APM_BATT_CRITICAL;
if (bat->battery_state & BATTMGR_BAT_STATE_CHARGING)
info->battery_state = APM_BATT_CHARGING;
else if (bat->battery_state & BATTMGR_BAT_STATE_CRITICAL_LOW)
info->battery_state = APM_BATT_CRITICAL;
if (bat->rate < 0)
delta = bat->capacity;
else
delta = sc->sc_last_full_capacity - bat->capacity;
if (bat->rate == 0)
info->minutes_left = -1;
else
info->minutes_left = (60 * delta) / abs(bat->rate);
if (bat->power_state & BATTMGR_PWR_STATE_AC_ON) {
info->ac_state = APM_AC_ON;
hw_power = 1;
} else {
info->ac_state = APM_AC_OFF;
hw_power = 0;
}
wakeup(&qcpas_pmic_rtr_apm_power_info);
#endif
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: kern_sysctl.c,v 1.430 2024/08/02 14:34:45 mvs Exp $ */
/* $OpenBSD: kern_sysctl.c,v 1.433 2024/08/05 18:47:29 mvs Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
@ -172,26 +172,25 @@ sysctl_vslock(void *addr, size_t len)
{
int error;
KERNEL_LOCK();
error = rw_enter(&sysctl_lock, RW_WRITE|RW_INTR);
if (error)
goto out;
return (error);
KERNEL_LOCK();
if (addr) {
if (atop(len) > uvmexp.wiredmax - uvmexp.wired) {
error = ENOMEM;
goto out2;
goto out;
}
error = uvm_vslock(curproc, addr, len, PROT_READ | PROT_WRITE);
if (error)
goto out2;
goto out;
}
return (0);
out2:
rw_exit_write(&sysctl_lock);
out:
KERNEL_UNLOCK();
rw_exit_write(&sysctl_lock);
return (error);
}
@ -202,8 +201,8 @@ sysctl_vsunlock(void *addr, size_t len)
if (addr)
uvm_vsunlock(curproc, addr, len);
rw_exit_write(&sysctl_lock);
KERNEL_UNLOCK();
rw_exit_write(&sysctl_lock);
}
int
@ -508,6 +507,12 @@ kern_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
return (sysctl_rdstring(oldp, oldlenp, newp, version));
case KERN_NUMVNODES: /* XXX numvnodes is a long */
return (sysctl_rdint(oldp, oldlenp, newp, numvnodes));
case KERN_BOOTTIME: {
struct timeval bt;
memset(&bt, 0, sizeof bt);
microboottime(&bt);
return (sysctl_rdstruct(oldp, oldlenp, newp, &bt, sizeof bt));
}
case KERN_MBSTAT: {
extern struct cpumem *mbstat;
uint64_t counters[MBSTAT_COUNT];
@ -526,6 +531,30 @@ kern_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
return (sysctl_rdstruct(oldp, oldlenp, newp,
&mbs, sizeof(mbs)));
}
case KERN_OSREV:
case KERN_NFILES:
case KERN_TTYCOUNT:
case KERN_ARGMAX:
case KERN_POSIX1:
case KERN_NGROUPS:
case KERN_JOB_CONTROL:
case KERN_SAVED_IDS:
case KERN_MAXPARTITIONS:
case KERN_RAWPARTITION:
case KERN_NTHREADS:
case KERN_SOMAXCONN:
case KERN_SOMINCONN:
case KERN_FSYNC:
case KERN_SYSVMSG:
case KERN_SYSVSEM:
case KERN_SYSVSHM:
case KERN_FSCALE:
case KERN_CCPU:
case KERN_NPROCS:
case KERN_NETLIVELOCKS:
case KERN_AUTOCONF_SERIAL:
return (sysctl_bounded_arr(kern_vars, nitems(kern_vars), name,
namelen, oldp, oldlenp, newp, newlen));
}
savelen = *oldlenp;
@ -587,12 +616,6 @@ kern_sysctl_locked(int *name, u_int namelen, void *oldp, size_t *oldlenp,
return (error);
case KERN_CLOCKRATE:
return (sysctl_clockrate(oldp, oldlenp, newp));
case KERN_BOOTTIME: {
struct timeval bt;
memset(&bt, 0, sizeof bt);
microboottime(&bt);
return (sysctl_rdstruct(oldp, oldlenp, newp, &bt, sizeof bt));
}
case KERN_MSGBUFSIZE:
case KERN_CONSBUFSIZE: {
struct msgbuf *mp;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: kern_timeout.c,v 1.97 2024/02/23 16:51:39 cheloha Exp $ */
/* $OpenBSD: kern_timeout.c,v 1.98 2024/08/05 23:51:11 dlg Exp $ */
/*
* Copyright (c) 2001 Thomas Nordin <nordin@openbsd.org>
* Copyright (c) 2000-2001 Artur Grabowski <art@openbsd.org>
@ -386,14 +386,17 @@ timeout_add_usec(struct timeout *to, int usecs)
}
int
timeout_add_nsec(struct timeout *to, int nsecs)
timeout_add_nsec(struct timeout *to, uint64_t nsecs)
{
int to_ticks = nsecs / (tick * 1000);
uint64_t to_ticks;
to_ticks = nsecs / (tick * 1000);
if (to_ticks > INT_MAX)
to_ticks = INT_MAX;
if (to_ticks == 0 && nsecs > 0)
to_ticks = 1;
return timeout_add(to, to_ticks);
return timeout_add(to, (int)to_ticks);
}
int

View File

@ -63,6 +63,8 @@ typedef unsigned long ulg;
# define Z_U8 unsigned long
# elif (ULLONG_MAX == 0xffffffffffffffff)
# define Z_U8 unsigned long long
# elif (ULONG_LONG_MAX == 0xffffffffffffffff)
# define Z_U8 unsigned long long
# elif (UINT_MAX == 0xffffffffffffffff)
# define Z_U8 unsigned
# endif

View File

@ -1,4 +1,4 @@
/* $OpenBSD: bpf.c,v 1.222 2024/01/26 21:14:08 jan Exp $ */
/* $OpenBSD: bpf.c,v 1.223 2024/08/05 23:56:10 dlg Exp $ */
/* $NetBSD: bpf.c,v 1.33 1997/02/21 23:59:35 thorpej Exp $ */
/*
@ -731,6 +731,8 @@ bpf_set_wtimeout(struct bpf_d *d, const struct timeval *tv)
return (EINVAL);
nsec = TIMEVAL_TO_NSEC(tv);
if (nsec > SEC_TO_NSEC(300))
return (EINVAL);
if (nsec > MAXTSLP)
return (EOVERFLOW);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: if_bridge.c,v 1.370 2024/04/14 20:46:27 bluhm Exp $ */
/* $OpenBSD: if_bridge.c,v 1.371 2024/08/05 17:47:29 bluhm Exp $ */
/*
* Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net)
@ -70,7 +70,7 @@
#if NPF > 0
#include <net/pfvar.h>
#define BRIDGE_IN PF_IN
#define BRIDGE_OUT PF_OUT
#define BRIDGE_OUT PF_FWD
#else
#define BRIDGE_IN 0
#define BRIDGE_OUT 1

View File

@ -1,4 +1,4 @@
/* $OpenBSD: if_veb.c,v 1.35 2024/02/13 12:22:09 bluhm Exp $ */
/* $OpenBSD: if_veb.c,v 1.36 2024/08/05 17:47:29 bluhm Exp $ */
/*
* Copyright (c) 2021 David Gwynne <dlg@openbsd.org>
@ -944,7 +944,7 @@ veb_broadcast(struct veb_softc *sc, struct veb_port *rp, struct mbuf *m0,
* let pf look at it, but use the veb interface as a proxy.
*/
if (ISSET(ifp->if_flags, IFF_LINK1) &&
(m0 = veb_pf(ifp, PF_OUT, m0)) == NULL)
(m0 = veb_pf(ifp, PF_FWD, m0)) == NULL)
return;
#endif
@ -1039,7 +1039,7 @@ veb_transmit(struct veb_softc *sc, struct veb_port *rp, struct veb_port *tp,
#if NPF > 0
if (ISSET(ifp->if_flags, IFF_LINK1) &&
(m = veb_pf(ifp0, PF_OUT, m)) == NULL)
(m = veb_pf(ifp0, PF_FWD, m)) == NULL)
return (NULL);
#endif

View File

@ -1,4 +1,4 @@
/* $OpenBSD: timeout.h,v 1.48 2023/10/12 15:32:38 cheloha Exp $ */
/* $OpenBSD: timeout.h,v 1.49 2024/08/05 23:51:11 dlg Exp $ */
/*
* Copyright (c) 2000-2001 Artur Grabowski <art@openbsd.org>
* All rights reserved.
@ -110,7 +110,7 @@ int timeout_add_tv(struct timeout *, const struct timeval *);
int timeout_add_sec(struct timeout *, int);
int timeout_add_msec(struct timeout *, int);
int timeout_add_usec(struct timeout *, int);
int timeout_add_nsec(struct timeout *, int);
int timeout_add_nsec(struct timeout *, uint64_t);
int timeout_abs_ts(struct timeout *, const struct timespec *);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: netcat.c,v 1.227 2024/08/02 21:08:47 jan Exp $ */
/* $OpenBSD: netcat.c,v 1.228 2024/08/05 07:16:30 tb Exp $ */
/*
* Copyright (c) 2001 Eric Jackson <ericj@monkey.org>
* Copyright (c) 2015 Bob Beck. All rights reserved.
@ -644,10 +644,6 @@ main(int argc, char *argv[])
close(connfd);
tls_free(tls_cctx);
}
if (family == AF_UNIX && uflag) {
if (connect(s, NULL, 0) == -1)
err(1, "connect");
}
if (!kflag)
break;