sync with OpenBSD -current

This commit is contained in:
purplerain 2025-01-14 01:44:52 +00:00
parent 62ccfe7163
commit 39858ff105
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
5 changed files with 73 additions and 109 deletions

View file

@ -1,4 +1,4 @@
.\" $OpenBSD: cargo-module.5,v 1.9 2024/01/06 08:03:31 semarie Exp $ .\" $OpenBSD: cargo-module.5,v 1.10 2025/01/13 18:20:47 kirill Exp $
.\" .\"
.\" Copyright (c) 2008 Marc Espie .\" Copyright (c) 2008 Marc Espie
.\" Copyright (c) 2017 Daniel Jakots .\" Copyright (c) 2017 Daniel Jakots
@ -25,7 +25,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\" .\"
.Dd $Mdocdate: January 6 2024 $ .Dd $Mdocdate: January 13 2025 $
.Dt CARGO-MODULE 5 .Dt CARGO-MODULE 5
.Os .Os
.Sh NAME .Sh NAME
@ -93,6 +93,14 @@ This module defines:
Path to cargo manifest. Path to cargo manifest.
Defaults to Defaults to
.Pa ${WRKSRC}/Cargo.toml . .Pa ${WRKSRC}/Cargo.toml .
.It Ev MODCARGO_CARGOLOCK
Path to
.Pa Cargo.lock ,
which is used only by the
.Cm modcargo-gen-crates
target.
Defaults to
.Pa ${MODCARGO_CARGOTOML:toml=lock} .
.It Ev MODCARGO_CRATES .It Ev MODCARGO_CRATES
Crates that will be downloaded by the module. Crates that will be downloaded by the module.
.It Ev MODCARGO_CRATES_UPDATE .It Ev MODCARGO_CRATES_UPDATE

View file

@ -1,4 +1,4 @@
/* $OpenBSD: kern_sysctl.c,v 1.460 2025/01/04 09:26:01 mvs Exp $ */ /* $OpenBSD: kern_sysctl.c,v 1.461 2025/01/13 18:09:24 mvs Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */ /* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*- /*-
@ -1672,9 +1672,10 @@ sysctl_file(int *name, u_int namelen, char *where, size_t *sizep,
kf = malloc(sizeof(*kf), M_TEMP, M_WAITOK); kf = malloc(sizeof(*kf), M_TEMP, M_WAITOK);
#define FILLIT2(fp, fdp, i, vp, pr, so) do { \ #define FILLIT(fp, fdp, i, vp, pr) do { \
if (buflen >= elem_size && elem_count > 0) { \ if (buflen >= elem_size && elem_count > 0) { \
fill_file(kf, fp, fdp, i, vp, pr, p, so, show_pointers);\ fill_file(kf, fp, fdp, i, vp, pr, p, NULL, \
show_pointers); \
error = copyout(kf, dp, outsize); \ error = copyout(kf, dp, outsize); \
if (error) \ if (error) \
break; \ break; \
@ -1684,62 +1685,59 @@ sysctl_file(int *name, u_int namelen, char *where, size_t *sizep,
} \ } \
needed += elem_size; \ needed += elem_size; \
} while (0) } while (0)
#define FILLIT(fp, fdp, i, vp, pr) \
FILLIT2(fp, fdp, i, vp, pr, NULL) #define FILLINPTABLE(table) \
#define FILLSO(so) \ do { \
FILLIT2(NULL, NULL, 0, NULL, NULL, so) struct inpcb_iterator iter = { .inp_table = NULL }; \
struct inpcb *inp = NULL; \
struct socket *so; \
\
mtx_enter(&(table)->inpt_mtx); \
while ((inp = in_pcb_iterator(table, inp, &iter)) != NULL) { \
if (buflen >= elem_size && elem_count > 0) { \
mtx_enter(&inp->inp_sofree_mtx); \
so = soref(inp->inp_socket); \
mtx_leave(&inp->inp_sofree_mtx); \
if (so == NULL) \
continue; \
mtx_leave(&(table)->inpt_mtx); \
solock_shared(so); \
fill_file(kf, NULL, NULL, 0, NULL, NULL, p, \
so, show_pointers); \
sounlock_shared(so); \
sorele(so); \
error = copyout(kf, dp, outsize); \
mtx_enter(&(table)->inpt_mtx); \
if (error) { \
in_pcb_iterator_abort((table), inp, \
&iter); \
break; \
} \
dp += elem_size; \
buflen -= elem_size; \
elem_count--; \
} \
needed += elem_size; \
} \
mtx_leave(&(table)->inpt_mtx); \
} while (0)
switch (op) { switch (op) {
case KERN_FILE_BYFILE: case KERN_FILE_BYFILE:
/* use the inp-tables to pick up closed connections, too */ /* use the inp-tables to pick up closed connections, too */
if (arg == DTYPE_SOCKET) { if (arg == DTYPE_SOCKET) {
struct inpcb *inp; FILLINPTABLE(&tcbtable);
NET_LOCK();
mtx_enter(&tcbtable.inpt_mtx);
TAILQ_FOREACH(inp, &tcbtable.inpt_queue, inp_queue)
FILLSO(inp->inp_socket);
mtx_leave(&tcbtable.inpt_mtx);
#ifdef INET6 #ifdef INET6
mtx_enter(&tcb6table.inpt_mtx); FILLINPTABLE(&tcb6table);
TAILQ_FOREACH(inp, &tcb6table.inpt_queue, inp_queue)
FILLSO(inp->inp_socket);
mtx_leave(&tcb6table.inpt_mtx);
#endif #endif
mtx_enter(&udbtable.inpt_mtx); FILLINPTABLE(&udbtable);
TAILQ_FOREACH(inp, &udbtable.inpt_queue, inp_queue) {
if (in_pcb_is_iterator(inp))
continue;
FILLSO(inp->inp_socket);
}
mtx_leave(&udbtable.inpt_mtx);
#ifdef INET6 #ifdef INET6
mtx_enter(&udb6table.inpt_mtx); FILLINPTABLE(&udb6table);
TAILQ_FOREACH(inp, &udb6table.inpt_queue, inp_queue) {
if (in_pcb_is_iterator(inp))
continue;
FILLSO(inp->inp_socket);
}
mtx_leave(&udb6table.inpt_mtx);
#endif #endif
mtx_enter(&rawcbtable.inpt_mtx); FILLINPTABLE(&rawcbtable);
TAILQ_FOREACH(inp, &rawcbtable.inpt_queue, inp_queue) {
if (in_pcb_is_iterator(inp))
continue;
FILLSO(inp->inp_socket);
}
mtx_leave(&rawcbtable.inpt_mtx);
#ifdef INET6 #ifdef INET6
mtx_enter(&rawin6pcbtable.inpt_mtx); FILLINPTABLE(&rawin6pcbtable);
TAILQ_FOREACH(inp, &rawin6pcbtable.inpt_queue,
inp_queue) {
if (in_pcb_is_iterator(inp))
continue;
FILLSO(inp->inp_socket);
}
mtx_leave(&rawin6pcbtable.inpt_mtx);
#endif #endif
NET_UNLOCK();
} }
fp = NULL; fp = NULL;
while ((fp = fd_iterfile(fp, p)) != NULL) { while ((fp = fd_iterfile(fp, p)) != NULL) {

View file

@ -1,4 +1,4 @@
/* $OpenBSD: subr_hibernate.c,v 1.150 2025/01/09 19:22:39 mglocker Exp $ */ /* $OpenBSD: subr_hibernate.c,v 1.151 2025/01/13 17:50:54 krw Exp $ */
/* /*
* Copyright (c) 2011 Ariane van der Steldt <ariane@stack.nl> * Copyright (c) 2011 Ariane van der Steldt <ariane@stack.nl>
@ -405,49 +405,11 @@ hiballoc_init(struct hiballoc_arena *arena, void *p_ptr, size_t p_len)
return 0; return 0;
} }
/*
* Zero all free memory.
*/
void
uvm_pmr_zero_everything(void)
{
struct uvm_pmemrange *pmr;
struct vm_page *pg;
int i;
uvm_lock_fpageq();
TAILQ_FOREACH(pmr, &uvm.pmr_control.use, pmr_use) {
/* Zero single pages. */
while ((pg = TAILQ_FIRST(&pmr->single[UVM_PMR_MEMTYPE_DIRTY]))
!= NULL) {
uvm_pmr_remove(pmr, pg);
uvm_pagezero(pg);
atomic_setbits_int(&pg->pg_flags, PG_ZERO);
uvmexp.zeropages++;
uvm_pmr_insert(pmr, pg, 0);
}
/* Zero multi page ranges. */
while ((pg = RBT_ROOT(uvm_pmr_size,
&pmr->size[UVM_PMR_MEMTYPE_DIRTY])) != NULL) {
pg--; /* Size tree always has second page. */
uvm_pmr_remove(pmr, pg);
for (i = 0; i < pg->fpgsz; i++) {
uvm_pagezero(&pg[i]);
atomic_setbits_int(&pg[i].pg_flags, PG_ZERO);
uvmexp.zeropages++;
}
uvm_pmr_insert(pmr, pg, 0);
}
}
uvm_unlock_fpageq();
}
/* /*
* Mark all memory as dirty. * Mark all memory as dirty.
* *
* Used to inform the system that the clean memory isn't clean for some * Used to inform the system that there are no pre-zero'd (PG_ZERO) free pages
* reason, for example because we just came back from hibernate. * when we came back from hibernate.
*/ */
void void
uvm_pmr_dirty_everything(void) uvm_pmr_dirty_everything(void)
@ -1534,7 +1496,6 @@ hibernate_write_chunks(union hibernate_info *hib)
} }
uvm_pmr_dirty_everything(); uvm_pmr_dirty_everything();
uvm_pmr_zero_everything();
/* Compress and write the chunks in the chunktable */ /* Compress and write the chunks in the chunktable */
for (i = 0; i < hib->chunk_ctr; i++) { for (i = 0; i < hib->chunk_ctr; i++) {

View file

@ -1,4 +1,4 @@
/* $OpenBSD: uipc_socket.c,v 1.359 2025/01/09 17:43:33 mvs Exp $ */ /* $OpenBSD: uipc_socket.c,v 1.360 2025/01/13 18:10:20 mvs Exp $ */
/* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */ /* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */
/* /*
@ -1604,15 +1604,11 @@ somove(struct socket *so, int wait)
long space; long space;
int error = 0, maxreached = 0, unsplice = 0; int error = 0, maxreached = 0, unsplice = 0;
unsigned int rcvstate; unsigned int rcvstate;
int sockdgram = ((so->so_proto->pr_flags &
PR_WANTRCVD) == 0);
sbassertlocked(&so->so_rcv); sbassertlocked(&so->so_rcv);
if (!sockdgram) { if (so->so_proto->pr_flags & PR_WANTRCVD)
sblock(&so->so_snd, SBL_WAIT | SBL_NOINTR); sblock(&so->so_snd, SBL_WAIT | SBL_NOINTR);
solock(so);
}
mtx_enter(&so->so_rcv.sb_mtx); mtx_enter(&so->so_rcv.sb_mtx);
mtx_enter(&sosp->so_snd.sb_mtx); mtx_enter(&sosp->so_snd.sb_mtx);
@ -1682,7 +1678,9 @@ somove(struct socket *so, int wait)
if (so->so_proto->pr_flags & PR_WANTRCVD) { if (so->so_proto->pr_flags & PR_WANTRCVD) {
mtx_leave(&sosp->so_snd.sb_mtx); mtx_leave(&sosp->so_snd.sb_mtx);
mtx_leave(&so->so_rcv.sb_mtx); mtx_leave(&so->so_rcv.sb_mtx);
solock_shared(so);
pru_rcvd(so); pru_rcvd(so);
sounlock_shared(so);
mtx_enter(&so->so_rcv.sb_mtx); mtx_enter(&so->so_rcv.sb_mtx);
mtx_enter(&sosp->so_snd.sb_mtx); mtx_enter(&sosp->so_snd.sb_mtx);
} }
@ -1793,7 +1791,9 @@ somove(struct socket *so, int wait)
if (so->so_proto->pr_flags & PR_WANTRCVD) { if (so->so_proto->pr_flags & PR_WANTRCVD) {
mtx_leave(&sosp->so_snd.sb_mtx); mtx_leave(&sosp->so_snd.sb_mtx);
mtx_leave(&so->so_rcv.sb_mtx); mtx_leave(&so->so_rcv.sb_mtx);
solock_shared(so);
pru_rcvd(so); pru_rcvd(so);
sounlock_shared(so);
mtx_enter(&so->so_rcv.sb_mtx); mtx_enter(&so->so_rcv.sb_mtx);
mtx_enter(&sosp->so_snd.sb_mtx); mtx_enter(&sosp->so_snd.sb_mtx);
} }
@ -1826,7 +1826,9 @@ somove(struct socket *so, int wait)
if (o) { if (o) {
mtx_leave(&sosp->so_snd.sb_mtx); mtx_leave(&sosp->so_snd.sb_mtx);
mtx_leave(&so->so_rcv.sb_mtx); mtx_leave(&so->so_rcv.sb_mtx);
solock_shared(sosp);
error = pru_send(sosp, m, NULL, NULL); error = pru_send(sosp, m, NULL, NULL);
sounlock_shared(sosp);
mtx_enter(&so->so_rcv.sb_mtx); mtx_enter(&so->so_rcv.sb_mtx);
mtx_enter(&sosp->so_snd.sb_mtx); mtx_enter(&sosp->so_snd.sb_mtx);
@ -1850,7 +1852,9 @@ somove(struct socket *so, int wait)
mtx_leave(&sosp->so_snd.sb_mtx); mtx_leave(&sosp->so_snd.sb_mtx);
mtx_leave(&so->so_rcv.sb_mtx); mtx_leave(&so->so_rcv.sb_mtx);
solock_shared(sosp);
error = pru_sendoob(sosp, o, NULL, NULL); error = pru_sendoob(sosp, o, NULL, NULL);
sounlock_shared(sosp);
mtx_enter(&so->so_rcv.sb_mtx); mtx_enter(&so->so_rcv.sb_mtx);
mtx_enter(&sosp->so_snd.sb_mtx); mtx_enter(&sosp->so_snd.sb_mtx);
@ -1877,13 +1881,9 @@ somove(struct socket *so, int wait)
mtx_leave(&sosp->so_snd.sb_mtx); mtx_leave(&sosp->so_snd.sb_mtx);
mtx_leave(&so->so_rcv.sb_mtx); mtx_leave(&so->so_rcv.sb_mtx);
solock_shared(sosp);
if (sockdgram)
solock_shared(sosp);
error = pru_send(sosp, m, NULL, NULL); error = pru_send(sosp, m, NULL, NULL);
if (sockdgram) sounlock_shared(sosp);
sounlock_shared(sosp);
mtx_enter(&so->so_rcv.sb_mtx); mtx_enter(&so->so_rcv.sb_mtx);
mtx_enter(&sosp->so_snd.sb_mtx); mtx_enter(&sosp->so_snd.sb_mtx);
@ -1916,10 +1916,8 @@ somove(struct socket *so, int wait)
mtx_leave(&sosp->so_snd.sb_mtx); mtx_leave(&sosp->so_snd.sb_mtx);
mtx_leave(&so->so_rcv.sb_mtx); mtx_leave(&so->so_rcv.sb_mtx);
if (!sockdgram) { if (so->so_proto->pr_flags & PR_WANTRCVD)
sbunlock(&so->so_snd); sbunlock(&so->so_snd);
sounlock(so);
}
if (unsplice) { if (unsplice) {
soref(sosp); soref(sosp);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: hibernate.h,v 1.48 2024/12/24 14:24:58 krw Exp $ */ /* $OpenBSD: hibernate.h,v 1.49 2025/01/13 17:50:54 krw Exp $ */
/* /*
* Copyright (c) 2011 Ariane van der Steldt <ariane@stack.nl> * Copyright (c) 2011 Ariane van der Steldt <ariane@stack.nl>
@ -115,7 +115,6 @@ union hibernate_info {
void *hib_alloc(struct hiballoc_arena*, size_t); void *hib_alloc(struct hiballoc_arena*, size_t);
void hib_free(struct hiballoc_arena*, void*); void hib_free(struct hiballoc_arena*, void*);
int hiballoc_init(struct hiballoc_arena*, void*, size_t len); int hiballoc_init(struct hiballoc_arena*, void*, size_t len);
void uvm_pmr_zero_everything(void);
void uvm_pmr_dirty_everything(void); void uvm_pmr_dirty_everything(void);
int uvm_pmr_alloc_pig(paddr_t*, psize_t, paddr_t); int uvm_pmr_alloc_pig(paddr_t*, psize_t, paddr_t);
int uvm_pmr_alloc_piglet(vaddr_t*, paddr_t*, vsize_t, paddr_t); int uvm_pmr_alloc_piglet(vaddr_t*, paddr_t*, vsize_t, paddr_t);