sync with OpenBSD -current

This commit is contained in:
purplerain 2024-07-11 15:49:23 +00:00
parent a8049e67d3
commit ae019f102d
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
77 changed files with 4413 additions and 6362 deletions

View file

@ -1,4 +1,4 @@
/* $OpenBSD: kern_sig.c,v 1.331 2024/07/09 09:22:50 claudio Exp $ */
/* $OpenBSD: kern_sig.c,v 1.332 2024/07/10 12:28:46 claudio Exp $ */
/* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */
/*
@ -1078,7 +1078,12 @@ ptsignal(struct proc *p, int signum, enum signal_type type)
*/
if (signum == SIGKILL) {
atomic_clearbits_int(&p->p_flag, P_SUSPSIG);
goto runfast;
/* Raise priority to at least PUSER. */
if (p->p_usrpri > PUSER)
p->p_usrpri = PUSER;
unsleep(p);
setrunnable(p);
goto out;
}
if (prop & SA_CONT) {
@ -1097,10 +1102,19 @@ ptsignal(struct proc *p, int signum, enum signal_type type)
wakeparent = 1;
if (action == SIG_DFL)
mask = 0;
if (action == SIG_CATCH)
goto runfast;
if (p->p_wchan == NULL)
goto run;
if (action == SIG_CATCH) {
/* Raise priority to at least PUSER. */
if (p->p_usrpri > PUSER)
p->p_usrpri = PUSER;
unsleep(p);
setrunnable(p);
goto out;
}
if (p->p_wchan == NULL) {
unsleep(p);
setrunnable(p);
goto out;
}
atomic_clearbits_int(&p->p_flag, P_WSLEEP);
p->p_stat = SSLEEP;
goto out;
@ -1146,8 +1160,11 @@ ptsignal(struct proc *p, int signum, enum signal_type type)
* so it can discover the signal in cursig() and stop
* for the parent.
*/
if (pr->ps_flags & PS_TRACED)
goto run;
if (pr->ps_flags & PS_TRACED) {
unsleep(p);
setrunnable(p);
goto out;
}
/*
* Recheck sigmask before waking up the process,
@ -1206,8 +1223,13 @@ ptsignal(struct proc *p, int signum, enum signal_type type)
/*
* All other (caught or default) signals
* cause the process to run.
* Raise priority to at least PUSER.
*/
goto runfast;
if (p->p_usrpri > PUSER)
p->p_usrpri = PUSER;
unsleep(p);
setrunnable(p);
goto out;
/* NOTREACHED */
case SONPROC:
@ -1229,15 +1251,6 @@ ptsignal(struct proc *p, int signum, enum signal_type type)
}
/* NOTREACHED */
runfast:
/*
* Raise priority to at least PUSER.
*/
if (p->p_usrpri > PUSER)
p->p_usrpri = PUSER;
run:
unsleep(p);
setrunnable(p);
out:
/* finally adjust siglist */
if (mask)

View file

@ -1,4 +1,4 @@
/* $OpenBSD: kern_sysctl.c,v 1.428 2024/07/08 13:17:12 claudio Exp $ */
/* $OpenBSD: kern_sysctl.c,v 1.429 2024/07/11 14:11:55 bluhm Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
@ -41,6 +41,7 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/atomic.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/pool.h>
@ -1005,19 +1006,39 @@ int
sysctl_int_bounded(void *oldp, size_t *oldlenp, void *newp, size_t newlen,
int *valp, int minimum, int maximum)
{
int val = *valp;
int oldval, newval;
int error;
/* read only */
if (newp == NULL || minimum > maximum)
return (sysctl_rdint(oldp, oldlenp, newp, val));
if (newp != NULL && minimum > maximum)
return (EPERM);
if ((error = sysctl_int(oldp, oldlenp, newp, newlen, &val)))
return (error);
/* outside limits */
if (val < minimum || maximum < val)
if (oldp != NULL && *oldlenp < sizeof(int))
return (ENOMEM);
if (newp != NULL && newlen != sizeof(int))
return (EINVAL);
*valp = val;
*oldlenp = sizeof(int);
/* copyin() may sleep, call it first */
if (newp != NULL) {
if ((error = copyin(newp, &newval, sizeof(int))))
return (error);
/* outside limits */
if (newval < minimum || maximum < newval)
return (EINVAL);
}
if (oldp != NULL) {
if (newp != NULL)
oldval = atomic_swap_uint(valp, newval);
else
oldval = atomic_load_int(valp);
if ((error = copyout(&oldval, oldp, sizeof(int)))) {
/* new value has been set although user gets error */
return (error);
}
} else if (newp != NULL)
atomic_store_int(valp, newval);
return (0);
}

View file

@ -1,4 +1,4 @@
/* $OpenBSD: vfs_syscalls.c,v 1.365 2024/05/18 05:20:22 guenther Exp $ */
/* $OpenBSD: vfs_syscalls.c,v 1.366 2024/07/10 09:12:11 krw Exp $ */
/* $NetBSD: vfs_syscalls.c,v 1.71 1996/04/23 10:29:02 mycroft Exp $ */
/*
@ -697,10 +697,6 @@ sys_getfsstat(struct proc *p, void *v, register_t *retval)
}
sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK;
#if notyet
if (mp->mnt_flag & MNT_SOFTDEP)
sp->f_eflags = STATFS_SOFTUPD;
#endif
error = (copyout_statfs(sp, sfsp, p));
if (error) {
vfs_unbusy(mp);