sync code with last improvements from OpenBSD

This commit is contained in:
purplerain 2023-08-21 03:05:03 +00:00
parent cb9f36df51
commit 6b5b190599
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
48 changed files with 1492 additions and 422 deletions

View file

@ -1,10 +1,10 @@
/* $OpenBSD: init_sysent.c,v 1.267 2023/07/24 19:33:29 miod Exp $ */
/* $OpenBSD: init_sysent.c,v 1.268 2023/08/20 15:14:20 visa Exp $ */
/*
* System call switch table.
*
* DO NOT EDIT-- this file is automatically generated.
* created from; OpenBSD: syscalls.master,v 1.249 2023/07/24 19:32:23 miod Exp
* created from; OpenBSD: syscalls.master,v 1.250 2023/08/20 15:13:43 visa Exp
*/
#include <sys/param.h>
@ -604,8 +604,8 @@ const struct sysent sysent[] = {
sys_nosys }, /* 268 = obsolete pad_pwritev */
{ 0, 0, SY_NOLOCK | 0,
sys_kqueue }, /* 269 = kqueue */
{ 0, 0, 0,
sys_nosys }, /* 270 = obsolete t32_kevent */
{ 1, s(struct sys_kqueue1_args), SY_NOLOCK | 0,
sys_kqueue1 }, /* 270 = kqueue1 */
{ 1, s(struct sys_mlockall_args), 0,
sys_mlockall }, /* 271 = mlockall */
{ 0, 0, 0,

View file

@ -1,4 +1,4 @@
/* $OpenBSD: kern_event.c,v 1.197 2023/08/13 08:29:28 visa Exp $ */
/* $OpenBSD: kern_event.c,v 1.198 2023/08/20 15:13:43 visa Exp $ */
/*-
* Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org>
@ -60,6 +60,7 @@
#define KLIST_ASSERT_LOCKED(kl) ((void)(kl))
#endif
int dokqueue(struct proc *, int, register_t *);
struct kqueue *kqueue_alloc(struct filedesc *);
void kqueue_terminate(struct proc *p, struct kqueue *);
void KQREF(struct kqueue *);
@ -912,12 +913,14 @@ kqueue_alloc(struct filedesc *fdp)
}
int
sys_kqueue(struct proc *p, void *v, register_t *retval)
dokqueue(struct proc *p, int flags, register_t *retval)
{
struct filedesc *fdp = p->p_fd;
struct kqueue *kq;
struct file *fp;
int fd, error;
int cloexec, error, fd;
cloexec = (flags & O_CLOEXEC) ? UF_EXCLOSE : 0;
kq = kqueue_alloc(fdp);
@ -925,14 +928,14 @@ sys_kqueue(struct proc *p, void *v, register_t *retval)
error = falloc(p, &fp, &fd);
if (error)
goto out;
fp->f_flag = FREAD | FWRITE;
fp->f_flag = FREAD | FWRITE | (flags & FNONBLOCK);
fp->f_type = DTYPE_KQUEUE;
fp->f_ops = &kqueueops;
fp->f_data = kq;
*retval = fd;
LIST_INSERT_HEAD(&fdp->fd_kqlist, kq, kq_next);
kq = NULL;
fdinsert(fdp, fd, 0, fp);
fdinsert(fdp, fd, cloexec, fp);
FRELE(fp, p);
out:
fdpunlock(fdp);
@ -941,6 +944,24 @@ out:
return (error);
}
int
sys_kqueue(struct proc *p, void *v, register_t *retval)
{
return (dokqueue(p, 0, retval));
}
int
sys_kqueue1(struct proc *p, void *v, register_t *retval)
{
struct sys_kqueue1_args /* {
syscallarg(int) flags;
} */ *uap = v;
if (SCARG(uap, flags) & ~(O_CLOEXEC | FNONBLOCK))
return (EINVAL);
return (dokqueue(p, SCARG(uap, flags), retval));
}
int
sys_kevent(struct proc *p, void *v, register_t *retval)
{

View file

@ -1,4 +1,4 @@
/* $OpenBSD: kern_pledge.c,v 1.306 2023/06/02 17:44:29 cheloha Exp $ */
/* $OpenBSD: kern_pledge.c,v 1.307 2023/08/20 15:13:43 visa Exp $ */
/*
* Copyright (c) 2015 Nicholas Marriott <nicm@openbsd.org>
@ -209,6 +209,7 @@ const uint64_t pledge_syscalls[SYS_MAXSYSCALL] = {
[SYS_ppoll] = PLEDGE_STDIO,
[SYS_kevent] = PLEDGE_STDIO,
[SYS_kqueue] = PLEDGE_STDIO,
[SYS_kqueue1] = PLEDGE_STDIO,
[SYS_select] = PLEDGE_STDIO,
[SYS_pselect] = PLEDGE_STDIO,

View file

@ -1,10 +1,10 @@
/* $OpenBSD: syscalls.c,v 1.265 2023/07/24 19:33:29 miod Exp $ */
/* $OpenBSD: syscalls.c,v 1.266 2023/08/20 15:14:20 visa Exp $ */
/*
* System call names.
*
* DO NOT EDIT-- this file is automatically generated.
* created from; OpenBSD: syscalls.master,v 1.249 2023/07/24 19:32:23 miod Exp
* created from; OpenBSD: syscalls.master,v 1.250 2023/08/20 15:13:43 visa Exp
*/
const char *const syscallnames[] = {
@ -312,7 +312,7 @@ const char *const syscallnames[] = {
"#267 (obsolete pad_preadv)", /* 267 = obsolete pad_preadv */
"#268 (obsolete pad_pwritev)", /* 268 = obsolete pad_pwritev */
"kqueue", /* 269 = kqueue */
"#270 (obsolete t32_kevent)", /* 270 = obsolete t32_kevent */
"kqueue1", /* 270 = kqueue1 */
"mlockall", /* 271 = mlockall */
"munlockall", /* 272 = munlockall */
"#273 (unimplemented sys_getpeereid)", /* 273 = unimplemented sys_getpeereid */

View file

@ -1,4 +1,4 @@
; $OpenBSD: syscalls.master,v 1.249 2023/07/24 19:32:23 miod Exp $
; $OpenBSD: syscalls.master,v 1.250 2023/08/20 15:13:43 visa Exp $
; $NetBSD: syscalls.master,v 1.32 1996/04/23 10:24:21 mycroft Exp $
; @(#)syscalls.master 8.2 (Berkeley) 1/13/94
@ -462,7 +462,7 @@
267 OBSOL pad_preadv
268 OBSOL pad_pwritev
269 STD NOLOCK { int sys_kqueue(void); }
270 OBSOL t32_kevent
270 STD NOLOCK { int sys_kqueue1(int flags); }
271 STD { int sys_mlockall(int flags); }
272 STD { int sys_munlockall(void); }
273 UNIMPL sys_getpeereid

View file

@ -1,5 +1,5 @@
/* deflate.c -- compress data using the deflation algorithm
* Copyright (C) 1995-2022 Jean-loup Gailly and Mark Adler
* Copyright (C) 1995-2023 Jean-loup Gailly and Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/

View file

@ -1,5 +1,5 @@
/* inftrees.c -- generate Huffman trees for efficient decoding
* Copyright (C) 1995-2022 Mark Adler
* Copyright (C) 1995-2023 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@ -55,7 +55,7 @@ int ZLIB_INTERNAL inflate_table(codetype type, unsigned short FAR *lens,
35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
static const unsigned short lext[31] = { /* Length codes 257..285 extra */
16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 77, 76};
19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 198, 203};
static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,

View file

@ -1,7 +1,7 @@
/* zlib.h -- interface of the 'zlib' general purpose compression library
version 1.2.13.1, October xxth, 2022
version 1.3, August 18th, 2023
Copyright (C) 1995-2022 Jean-loup Gailly and Mark Adler
Copyright (C) 1995-2023 Jean-loup Gailly and Mark Adler
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@ -37,12 +37,12 @@
extern "C" {
#endif
#define ZLIB_VERSION "1.2.13.1-motley"
#define ZLIB_VERNUM 0x12d1
#define ZLIB_VERSION "1.3"
#define ZLIB_VERNUM 0x1300
#define ZLIB_VER_MAJOR 1
#define ZLIB_VER_MINOR 2
#define ZLIB_VER_REVISION 13
#define ZLIB_VER_SUBREVISION 1
#define ZLIB_VER_MINOR 3
#define ZLIB_VER_REVISION 0
#define ZLIB_VER_SUBREVISION 0
/*
The 'zlib' compression library provides in-memory compression and

View file

@ -1,4 +1,4 @@
/* $OpenBSD: event.h,v 1.70 2023/08/13 08:29:28 visa Exp $ */
/* $OpenBSD: event.h,v 1.71 2023/08/20 15:13:43 visa Exp $ */
/*-
* Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org>
@ -369,6 +369,7 @@ struct timespec;
__BEGIN_DECLS
int kqueue(void);
int kqueue1(int flags);
int kevent(int kq, const struct kevent *changelist, int nchanges,
struct kevent *eventlist, int nevents,
const struct timespec *timeout);

View file

@ -1,10 +1,10 @@
/* $OpenBSD: syscall.h,v 1.264 2023/07/24 19:33:29 miod Exp $ */
/* $OpenBSD: syscall.h,v 1.265 2023/08/20 15:14:20 visa Exp $ */
/*
* System call numbers.
*
* DO NOT EDIT-- this file is automatically generated.
* created from; OpenBSD: syscalls.master,v 1.249 2023/07/24 19:32:23 miod Exp
* created from; OpenBSD: syscalls.master,v 1.250 2023/08/20 15:13:43 visa Exp
*/
/* syscall: "syscall" ret: "int" args: "int" "..." */
@ -599,7 +599,9 @@
/* syscall: "kqueue" ret: "int" args: */
#define SYS_kqueue 269
/* 270 is obsolete t32_kevent */
/* syscall: "kqueue1" ret: "int" args: "int" */
#define SYS_kqueue1 270
/* syscall: "mlockall" ret: "int" args: "int" */
#define SYS_mlockall 271

View file

@ -1,10 +1,10 @@
/* $OpenBSD: syscallargs.h,v 1.267 2023/07/24 19:33:29 miod Exp $ */
/* $OpenBSD: syscallargs.h,v 1.268 2023/08/20 15:14:20 visa Exp $ */
/*
* System call argument lists.
*
* DO NOT EDIT-- this file is automatically generated.
* created from; OpenBSD: syscalls.master,v 1.249 2023/07/24 19:32:23 miod Exp
* created from; OpenBSD: syscalls.master,v 1.250 2023/08/20 15:13:43 visa Exp
*/
#ifdef syscallarg
@ -960,6 +960,10 @@ struct sys_fhopen_args {
syscallarg(int) flags;
};
struct sys_kqueue1_args {
syscallarg(int) flags;
};
struct sys_mlockall_args {
syscallarg(int) flags;
};
@ -1355,6 +1359,7 @@ int sys_msync(struct proc *, void *, register_t *);
int sys_pipe(struct proc *, void *, register_t *);
int sys_fhopen(struct proc *, void *, register_t *);
int sys_kqueue(struct proc *, void *, register_t *);
int sys_kqueue1(struct proc *, void *, register_t *);
int sys_mlockall(struct proc *, void *, register_t *);
int sys_munlockall(struct proc *, void *, register_t *);
int sys_getresuid(struct proc *, void *, register_t *);