aboutsummaryrefslogtreecommitdiff
path: root/sys/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys/sys')
-rw-r--r--sys/sys/asan.h3
-rw-r--r--sys/sys/atomic_common.h99
-rw-r--r--sys/sys/cdefs.h14
-rw-r--r--sys/sys/cnv.h1
-rw-r--r--sys/sys/dnv.h1
-rw-r--r--sys/sys/elf_common.h1
-rw-r--r--sys/sys/epoch.h1
-rw-r--r--sys/sys/exec.h10
-rw-r--r--sys/sys/filedesc.h3
-rw-r--r--sys/sys/imgact.h2
-rw-r--r--sys/sys/interrupt.h4
-rw-r--r--sys/sys/ipmi.h4
-rw-r--r--sys/sys/kassert.h16
-rw-r--r--sys/sys/kthread.h2
-rw-r--r--sys/sys/ktls.h15
-rw-r--r--sys/sys/ktrace.h24
-rw-r--r--sys/sys/mbuf.h34
-rw-r--r--sys/sys/mman.h3
-rw-r--r--sys/sys/mount.h4
-rw-r--r--sys/sys/nv.h1
-rw-r--r--sys/sys/nv_namespace.h282
-rw-r--r--sys/sys/param.h2
-rw-r--r--sys/sys/pmc.h20
-rw-r--r--sys/sys/priority.h37
-rw-r--r--sys/sys/priv.h1
-rw-r--r--sys/sys/proc.h81
-rw-r--r--sys/sys/protosw.h3
-rw-r--r--sys/sys/racct.h1
-rw-r--r--sys/sys/sched.h1
-rw-r--r--sys/sys/signalvar.h2
-rw-r--r--sys/sys/sockbuf.h122
-rw-r--r--sys/sys/socketvar.h20
-rw-r--r--sys/sys/sockio.h3
-rw-r--r--sys/sys/syscallsubr.h4
-rw-r--r--sys/sys/sysent.h8
-rw-r--r--sys/sys/syslog.h1
-rw-r--r--sys/sys/systm.h5
-rw-r--r--sys/sys/tree.h214
-rw-r--r--sys/sys/user.h19
39 files changed, 843 insertions, 225 deletions
diff --git a/sys/sys/asan.h b/sys/sys/asan.h
index caa6643bda68..0a9d94007bec 100644
--- a/sys/sys/asan.h
+++ b/sys/sys/asan.h
@@ -56,11 +56,10 @@
#define KASAN_EXEC_ARGS_FREED 0xFF
void kasan_init(void);
+void kasan_init_early(vm_offset_t, size_t);
void kasan_shadow_map(vm_offset_t, size_t);
-
void kasan_mark(const void *, size_t, size_t, uint8_t);
#else /* KASAN */
-#define kasan_early_init(u)
#define kasan_init()
#define kasan_shadow_map(a, s)
#define kasan_mark(p, s, l, c)
diff --git a/sys/sys/atomic_common.h b/sys/sys/atomic_common.h
index e3969b241a8c..04281ae8f2ed 100644
--- a/sys/sys/atomic_common.h
+++ b/sys/sys/atomic_common.h
@@ -36,38 +36,93 @@
#error do not include this header, use machine/atomic.h
#endif
-#define atomic_load_char(p) (*(volatile u_char *)(p))
-#define atomic_load_short(p) (*(volatile u_short *)(p))
-#define atomic_load_int(p) (*(volatile u_int *)(p))
-#define atomic_load_long(p) (*(volatile u_long *)(p))
-#define atomic_load_ptr(p) (*(volatile __typeof(*p) *)(p))
-#define atomic_load_8(p) (*(volatile uint8_t *)(p))
-#define atomic_load_16(p) (*(volatile uint16_t *)(p))
-#define atomic_load_32(p) (*(volatile uint32_t *)(p))
-#ifdef _LP64
-#define atomic_load_64(p) (*(volatile uint64_t *)(p))
-#endif
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+#define __atomic_load_bool_relaxed(p) (*(volatile _Bool *)(p))
+#define __atomic_store_bool_relaxed(p, v) \
+ (*(volatile _Bool *)(p) = (_Bool)(v))
+
+#define __atomic_load_char_relaxed(p) (*(volatile u_char *)(p))
+#define __atomic_load_short_relaxed(p) (*(volatile u_short *)(p))
+#define __atomic_load_int_relaxed(p) (*(volatile u_int *)(p))
+#define __atomic_load_long_relaxed(p) (*(volatile u_long *)(p))
+#define __atomic_load_8_relaxed(p) (*(volatile uint8_t *)(p))
+#define __atomic_load_16_relaxed(p) (*(volatile uint16_t *)(p))
+#define __atomic_load_32_relaxed(p) (*(volatile uint32_t *)(p))
+#define __atomic_load_64_relaxed(p) (*(volatile uint64_t *)(p))
-#define atomic_store_char(p, v) \
+#define __atomic_store_char_relaxed(p, v) \
(*(volatile u_char *)(p) = (u_char)(v))
-#define atomic_store_short(p, v) \
+#define __atomic_store_short_relaxed(p, v) \
(*(volatile u_short *)(p) = (u_short)(v))
-#define atomic_store_int(p, v) \
+#define __atomic_store_int_relaxed(p, v) \
(*(volatile u_int *)(p) = (u_int)(v))
-#define atomic_store_long(p, v) \
+#define __atomic_store_long_relaxed(p, v) \
(*(volatile u_long *)(p) = (u_long)(v))
-#define atomic_store_ptr(p, v) \
- (*(volatile __typeof(*p) *)(p) = (v))
-#define atomic_store_8(p, v) \
+#define __atomic_store_8_relaxed(p, v) \
(*(volatile uint8_t *)(p) = (uint8_t)(v))
-#define atomic_store_16(p, v) \
+#define __atomic_store_16_relaxed(p, v) \
(*(volatile uint16_t *)(p) = (uint16_t)(v))
-#define atomic_store_32(p, v) \
+#define __atomic_store_32_relaxed(p, v) \
(*(volatile uint32_t *)(p) = (uint32_t)(v))
-#ifdef _LP64
-#define atomic_store_64(p, v) \
+#define __atomic_store_64_relaxed(p, v) \
(*(volatile uint64_t *)(p) = (uint64_t)(v))
+
+/*
+ * When _Generic is available, try to provide some type checking.
+ */
+#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \
+ __has_extension(c_generic_selections)
+#define atomic_load_bool(p) \
+ _Generic(*(p), _Bool: __atomic_load_bool_relaxed(p))
+#define atomic_store_bool(p, v) \
+ _Generic(*(p), _Bool: __atomic_store_bool_relaxed(p, v))
+
+#define __atomic_load_generic(p, t, ut, n) \
+ _Generic(*(p), \
+ t: __atomic_load_ ## n ## _relaxed(p), ut: __atomic_load_ ## n ## _relaxed(p))
+#define __atomic_store_generic(p, v, t, ut, n) \
+ _Generic(*(p), \
+ t: __atomic_store_ ## n ## _relaxed(p, v), ut: __atomic_store_ ## n ## _relaxed(p, v))
+#else
+#define atomic_load_bool(p) __atomic_load_bool_relaxed(p)
+#define atomic_store_bool(p, v) __atomic_store_bool_relaxed(p, v)
+#define __atomic_load_generic(p, t, ut, n) __atomic_load_ ## n ## _relaxed(p)
+#define __atomic_store_generic(p, v, t, ut, n) __atomic_store_ ## n ## _relaxed(p, v)
+#endif
+
+#define atomic_load_char(p) __atomic_load_generic(p, char, u_char, char)
+#define atomic_load_short(p) __atomic_load_generic(p, short, u_short, short)
+#define atomic_load_int(p) __atomic_load_generic(p, int, u_int, int)
+#define atomic_load_long(p) __atomic_load_generic(p, long, u_long, long)
+#define atomic_load_8(p) __atomic_load_generic(p, int8_t, uint8_t, 8)
+#define atomic_load_16(p) __atomic_load_generic(p, int16_t, uint16_t, 16)
+#define atomic_load_32(p) __atomic_load_generic(p, int32_t, uint32_t, 32)
+#ifdef __LP64__
+#define atomic_load_64(p) __atomic_load_generic(p, int64_t, uint64_t, 64)
#endif
+#define atomic_store_char(p, v) \
+ __atomic_store_generic(p, v, char, u_char, char)
+#define atomic_store_short(p, v) \
+ __atomic_store_generic(p, v, short, u_short, short)
+#define atomic_store_int(p, v) \
+ __atomic_store_generic(p, v, int, u_int, int)
+#define atomic_store_long(p, v) \
+ __atomic_store_generic(p, v, long, u_long, long)
+#define atomic_store_8(p, v) \
+ __atomic_store_generic(p, v, int8_t, uint8_t, 8)
+#define atomic_store_16(p, v) \
+ __atomic_store_generic(p, v, int16_t, uint16_t, 16)
+#define atomic_store_32(p, v) \
+ __atomic_store_generic(p, v, int32_t, uint32_t, 32)
+#ifdef __LP64__
+#define atomic_store_64(p, v) \
+ __atomic_store_generic(p, v, int64_t, uint64_t, 64)
+#endif
+
+#define atomic_load_ptr(p) (*(volatile __typeof(*p) *)(p))
+#define atomic_store_ptr(p, v) (*(volatile __typeof(*p) *)(p) = (v))
/*
* Currently all architectures provide acquire and release fences on their own,
diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h
index 2295dd39f5ad..1ace5fbee787 100644
--- a/sys/sys/cdefs.h
+++ b/sys/sys/cdefs.h
@@ -637,15 +637,23 @@
* POSIX.1 requires that the macros we test be defined before any standard
* header file is included.
*
- * Here's a quick run-down of the versions:
+ * Here's a quick run-down of the versions (and some informal names)
* defined(_POSIX_SOURCE) 1003.1-1988
+ * encoded as 198808 below
* _POSIX_C_SOURCE == 1 1003.1-1990
+ * encoded as 199009 below
* _POSIX_C_SOURCE == 2 1003.2-1992 C Language Binding Option
+ * encoded as 199209 below
* _POSIX_C_SOURCE == 199309 1003.1b-1993
+ * (1003.1 Issue 4, Single Unix Spec v1, Unix 93)
* _POSIX_C_SOURCE == 199506 1003.1c-1995, 1003.1i-1995,
* and the omnibus ISO/IEC 9945-1: 1996
- * _POSIX_C_SOURCE == 200112 1003.1-2001
- * _POSIX_C_SOURCE == 200809 1003.1-2008
+ * (1003.1 Issue 5, Single Unix Spec v2, Unix 95)
+ * _POSIX_C_SOURCE == 200112 1003.1-2001 (1003.1 Issue 6, Unix 03)
+ * _POSIX_C_SOURCE == 200809 1003.1-2008 (1003.1 Issue 7)
+ * IEEE Std 1003.1-2017 (Rev of 1003.1-2008) is
+ * 1003.1-2008 with two TCs applied with
+ * _POSIX_C_SOURCE=200809 and _XOPEN_SOURCE=700
*
* In addition, the X/Open Portability Guide, which is now the Single UNIX
* Specification, defines a feature-test macro which indicates the version of
diff --git a/sys/sys/cnv.h b/sys/sys/cnv.h
index babc913c5637..17e6184f87d2 100644
--- a/sys/sys/cnv.h
+++ b/sys/sys/cnv.h
@@ -38,6 +38,7 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
+#include <sys/nv_namespace.h>
#endif
#ifndef _NVLIST_T_DECLARED
diff --git a/sys/sys/dnv.h b/sys/sys/dnv.h
index 9ddd8720c923..96c9b75843f1 100644
--- a/sys/sys/dnv.h
+++ b/sys/sys/dnv.h
@@ -40,6 +40,7 @@
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
+#include <sys/nv_namespace.h>
#endif
#ifndef _NVLIST_T_DECLARED
diff --git a/sys/sys/elf_common.h b/sys/sys/elf_common.h
index 4eae060895ab..23440f535887 100644
--- a/sys/sys/elf_common.h
+++ b/sys/sys/elf_common.h
@@ -944,6 +944,7 @@ typedef struct {
/* Values for ch_type (compressed section headers). */
#define ELFCOMPRESS_ZLIB 1 /* ZLIB/DEFLATE */
+#define ELFCOMPRESS_ZSTD 2 /* Zstandard */
#define ELFCOMPRESS_LOOS 0x60000000 /* OS-specific */
#define ELFCOMPRESS_HIOS 0x6fffffff
#define ELFCOMPRESS_LOPROC 0x70000000 /* Processor-specific */
diff --git a/sys/sys/epoch.h b/sys/sys/epoch.h
index 7b06ee19c2f3..10ca9a6e5c7d 100644
--- a/sys/sys/epoch.h
+++ b/sys/sys/epoch.h
@@ -109,6 +109,7 @@ extern epoch_t net_epoch_preempt;
#define NET_EPOCH_EXIT(et) epoch_exit_preempt(net_epoch_preempt, &(et))
#define NET_EPOCH_WAIT() epoch_wait_preempt(net_epoch_preempt)
#define NET_EPOCH_CALL(f, c) epoch_call(net_epoch_preempt, (f), (c))
+#define NET_EPOCH_DRAIN_CALLBACKS() epoch_drain_callbacks(net_epoch_preempt)
#define NET_EPOCH_ASSERT() MPASS(in_epoch(net_epoch_preempt))
#define NET_TASK_INIT(t, p, f, c) TASK_INIT_FLAGS(t, p, f, c, TASK_NETWORK)
#define NET_GROUPTASK_INIT(gtask, prio, func, ctx) \
diff --git a/sys/sys/exec.h b/sys/sys/exec.h
index 82ee16befe28..dd7a99475cbd 100644
--- a/sys/sys/exec.h
+++ b/sys/sys/exec.h
@@ -90,6 +90,16 @@ struct execsw {
#define PROC_PS_STRINGS(p) \
((p)->p_vmspace->vm_stacktop - (p)->p_sysent->sv_psstringssz)
+/*
+ * Address of signal trampoline (in user space).
+ * This assumes that the sigcode resides in the shared page.
+ */
+#define PROC_SIGCODE(p) \
+ ((p)->p_vmspace->vm_shp_base + (p)->p_sysent->sv_sigcode_offset)
+
+#define PROC_HAS_SHP(p) \
+ ((p)->p_sysent->sv_shared_page_obj != NULL)
+
int exec_map_first_page(struct image_params *);
void exec_unmap_first_page(struct image_params *);
diff --git a/sys/sys/filedesc.h b/sys/sys/filedesc.h
index 8ecf7d8cb45e..52bd3c97a9ac 100644
--- a/sys/sys/filedesc.h
+++ b/sys/sys/filedesc.h
@@ -270,6 +270,9 @@ struct filedesc *fdshare(struct filedesc *fdp);
struct filedesc_to_leader *
filedesc_to_leader_alloc(struct filedesc_to_leader *old,
struct filedesc *fdp, struct proc *leader);
+struct filedesc_to_leader *
+ filedesc_to_leader_share(struct filedesc_to_leader *fdtol,
+ struct filedesc *fdp);
int getvnode(struct thread *td, int fd, cap_rights_t *rightsp,
struct file **fpp);
int getvnode_path(struct thread *td, int fd, cap_rights_t *rightsp,
diff --git a/sys/sys/imgact.h b/sys/sys/imgact.h
index bc1ab77a491e..0be3e71604bf 100644
--- a/sys/sys/imgact.h
+++ b/sys/sys/imgact.h
@@ -92,6 +92,8 @@ struct image_params {
bool opened; /* we have opened executable vnode */
bool textset;
u_int map_flags;
+#define IMGP_ASLR_SHARED_PAGE 0x1
+ uint32_t imgp_flags;
};
#ifdef _KERNEL
diff --git a/sys/sys/interrupt.h b/sys/sys/interrupt.h
index 09162469daed..ee4f07da1611 100644
--- a/sys/sys/interrupt.h
+++ b/sys/sys/interrupt.h
@@ -138,8 +138,8 @@ struct intr_event {
#define SWI_DELAY 0x2
/*
- * Software interrupt numbers in priority order. The priority determines
- * the priority of the corresponding interrupt thread.
+ * Software interrupt numbers. Historically this was used to determine
+ * the relative priority of SWI ithreads.
*/
#define SWI_TTY 0
#define SWI_NET 1
diff --git a/sys/sys/ipmi.h b/sys/sys/ipmi.h
index 3c805bac099d..9b46d1869101 100644
--- a/sys/sys/ipmi.h
+++ b/sys/sys/ipmi.h
@@ -33,9 +33,11 @@
#define IPMI_MAX_ADDR_SIZE 0x20
#define IPMI_MAX_RX 1024
-#define IPMI_BMC_SLAVE_ADDR 0x20 /* Linux Default slave address */
+
#define IPMI_BMC_CHANNEL 0x0f /* Linux BMC channel */
+#define IPMI_IPMB_CHANNEL 0x00
+#define IPMI_BMC_SLAVE_ADDR 0x20 /* Linux Default slave address */
#define IPMI_BMC_SMS_LUN 0x02
#define IPMI_SYSTEM_INTERFACE_ADDR_TYPE 0x0c
diff --git a/sys/sys/kassert.h b/sys/sys/kassert.h
index bb6847dc404f..d7c1a21385f9 100644
--- a/sys/sys/kassert.h
+++ b/sys/sys/kassert.h
@@ -46,19 +46,35 @@ extern bool panicked;
kassert_panic msg; \
} \
} while (0)
+#define MPASSERT(exp, mp, msg) do { \
+ if (__predict_false(!(exp))) { \
+ printf("MPASSERT mp %p failed: %s not true at %s:%d (%s)\n",\
+ (mp), #exp, __FILE__, __LINE__, __func__); \
+ kassert_panic msg; \
+ } \
+} while (0)
#define VNPASS(exp, vp) do { \
const char *_exp = #exp; \
VNASSERT(exp, vp, ("condition %s not met at %s:%d (%s)", \
_exp, __FILE__, __LINE__, __func__)); \
} while (0)
+#define MPPASS(exp, mp) do { \
+ const char *_exp = #exp; \
+ MPASSERT(exp, mp, ("condition %s not met at %s:%d (%s)", \
+ _exp, __FILE__, __LINE__, __func__)); \
+} while (0)
#define __assert_unreachable() \
panic("executing segment marked as unreachable at %s:%d (%s)\n", \
__FILE__, __LINE__, __func__)
#else /* INVARIANTS */
#define VNASSERT(exp, vp, msg) do { \
} while (0)
+#define MPASSERT(exp, mp, msg) do { \
+} while (0)
#define VNPASS(exp, vp) do { \
} while (0)
+#define MPPASS(exp, mp) do { \
+} while (0)
#define __assert_unreachable() __unreachable()
#endif /* INVARIANTS */
diff --git a/sys/sys/kthread.h b/sys/sys/kthread.h
index 826472f4bb38..e16fe3e1b446 100644
--- a/sys/sys/kthread.h
+++ b/sys/sys/kthread.h
@@ -60,7 +60,7 @@ void kproc_start(const void *);
int kproc_suspend(struct proc *, int);
void kproc_suspend_check(struct proc *);
-/* create a thread inthe given process. create the process if needed */
+/* create a thread in the given process. create the process if needed */
int kproc_kthread_add(void (*)(void *), void *,
struct proc **,
struct thread **,
diff --git a/sys/sys/ktls.h b/sys/sys/ktls.h
index 885e4dc38ef9..66b510ddfe40 100644
--- a/sys/sys/ktls.h
+++ b/sys/sys/ktls.h
@@ -187,7 +187,12 @@ struct ktls_session {
struct task reset_tag_task;
struct task disable_ifnet_task;
- struct inpcb *inp;
+ union {
+ struct inpcb *inp; /* Used by transmit tasks. */
+ struct socket *so; /* Used by receive task. */
+ };
+ struct ifnet *rx_ifp;
+ u_short rx_vlan_id;
bool reset_pending;
bool disable_ifnet_pending;
bool sync_dispatch;
@@ -200,7 +205,14 @@ struct ktls_session {
extern unsigned int ktls_ifnet_max_rexmit_pct;
+typedef enum {
+ KTLS_MBUF_CRYPTO_ST_MIXED = 0,
+ KTLS_MBUF_CRYPTO_ST_ENCRYPTED = 1,
+ KTLS_MBUF_CRYPTO_ST_DECRYPTED = -1,
+} ktls_mbuf_crypto_st_t;
+
void ktls_check_rx(struct sockbuf *sb);
+ktls_mbuf_crypto_st_t ktls_mbuf_crypto_state(struct mbuf *mb, int offset, int len);
void ktls_disable_ifnet(void *arg);
int ktls_enable_rx(struct socket *so, struct tls_enable *en);
int ktls_enable_tx(struct socket *so, struct tls_enable *en);
@@ -215,6 +227,7 @@ int ktls_get_rx_mode(struct socket *so, int *modep);
int ktls_set_tx_mode(struct socket *so, int mode);
int ktls_get_tx_mode(struct socket *so, int *modep);
int ktls_get_rx_sequence(struct inpcb *inp, uint32_t *tcpseq, uint64_t *tlsseq);
+void ktls_input_ifp_mismatch(struct sockbuf *sb, struct ifnet *ifp);
int ktls_output_eagain(struct inpcb *inp, struct ktls_session *tls);
#ifdef RATELIMIT
int ktls_modify_txrtlmt(struct ktls_session *tls, uint64_t max_pacing_rate);
diff --git a/sys/sys/ktrace.h b/sys/sys/ktrace.h
index f417fdf8a22a..ed5c6c11eaf2 100644
--- a/sys/sys/ktrace.h
+++ b/sys/sys/ktrace.h
@@ -52,7 +52,7 @@
/*
* ktrace record header
*/
-struct ktr_header {
+struct ktr_header_v0 {
int ktr_len; /* length of buf */
short ktr_type; /* trace record type */
pid_t ktr_pid; /* process id */
@@ -61,6 +61,21 @@ struct ktr_header {
intptr_t ktr_tid; /* was ktr_buffer */
};
+struct ktr_header {
+ int ktr_len; /* length of buf */
+ short ktr_type; /* trace record type */
+ short ktr_version; /* ktr_header version */
+ pid_t ktr_pid; /* process id */
+ char ktr_comm[MAXCOMLEN + 1];/* command name */
+ struct timespec ktr_time; /* timestamp */
+ intptr_t ktr_tid; /* thread id */
+ int ktr_cpu; /* cpu id */
+};
+
+#define KTR_VERSION0 0
+#define KTR_VERSION1 1
+#define KTR_OFFSET_V0 sizeof(struct ktr_header_v0) - \
+ sizeof(struct ktr_header)
/*
* Test for kernel trace point (MP SAFE).
*
@@ -236,6 +251,13 @@ struct ktr_struct_array {
* between the previous record and this record was dropped.
*/
#define KTR_DROP 0x8000
+/*
+ * KTR_VERSIONED - If this bit is set in ktr_type, then the kernel
+ * exposes the new struct ktr_header (versioned), otherwise the old
+ * struct ktr_header_v0 is exposed.
+ */
+#define KTR_VERSIONED 0x4000
+#define KTR_TYPE (KTR_DROP | KTR_VERSIONED)
/*
* kernel trace points (in p_traceflag)
diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h
index 61da52c6e67c..48ed63ef67b8 100644
--- a/sys/sys/mbuf.h
+++ b/sys/sys/mbuf.h
@@ -150,8 +150,8 @@ struct m_snd_tag {
/*
* Record/packet header in first mbuf of chain; valid only if M_PKTHDR is set.
- * Size ILP32: 48
- * LP64: 56
+ * Size ILP32: 56
+ * LP64: 64
* Compile-time assertions in uipc_mbuf.c test these values to ensure that
* they are correct.
*/
@@ -164,6 +164,13 @@ struct pkthdr {
uint16_t rcvgen; /* ... and generation count */
};
};
+ union {
+ struct ifnet *leaf_rcvif; /* leaf rcv interface */
+ struct {
+ uint16_t leaf_rcvidx; /* leaf rcv interface index ... */
+ uint16_t leaf_rcvgen; /* ... and generation count */
+ };
+ };
SLIST_HEAD(packet_tags, m_tag) tags; /* list of packet tags */
int32_t len; /* total packet length */
@@ -173,6 +180,9 @@ struct pkthdr {
uint16_t fibnum; /* this packet should use this fib */
uint8_t numa_domain; /* NUMA domain of recvd pkt */
uint8_t rsstype; /* hash type */
+#if !defined(__LP64__)
+ uint32_t pad; /* pad for 64bit alignment */
+#endif
union {
uint64_t rcv_tstmp; /* timestamp in ns */
struct {
@@ -197,13 +207,17 @@ struct pkthdr {
/* Layer specific non-persistent local storage for reassembly, etc. */
union {
- uint8_t eight[8];
- uint16_t sixteen[4];
- uint32_t thirtytwo[2];
- uint64_t sixtyfour[1];
- uintptr_t unintptr[1];
- void *ptr;
- } PH_loc;
+ union {
+ uint8_t eight[8];
+ uint16_t sixteen[4];
+ uint32_t thirtytwo[2];
+ uint64_t sixtyfour[1];
+ uintptr_t unintptr[1];
+ void *ptr;
+ } PH_loc;
+ /* Upon allocation: total packet memory consumption. */
+ u_int memlen;
+ };
};
#define ether_vtag PH_per.sixteen[0]
#define tcp_tun_port PH_per.sixteen[0] /* outbound */
@@ -238,7 +252,7 @@ struct pkthdr {
#if defined(__LP64__)
#define MBUF_PEXT_MAX_PGS (40 / sizeof(vm_paddr_t))
#else
-#define MBUF_PEXT_MAX_PGS (72 / sizeof(vm_paddr_t))
+#define MBUF_PEXT_MAX_PGS (64 / sizeof(vm_paddr_t))
#endif
#define MBUF_PEXT_MAX_BYTES \
diff --git a/sys/sys/mman.h b/sys/sys/mman.h
index a07b3550d51a..71172bfd49a3 100644
--- a/sys/sys/mman.h
+++ b/sys/sys/mman.h
@@ -300,6 +300,8 @@ struct shmfd {
#endif
#ifdef _KERNEL
+struct prison;
+
int shm_map(struct file *fp, size_t size, off_t offset, void **memp);
int shm_unmap(struct file *fp, void *mem, size_t size);
@@ -309,6 +311,7 @@ struct shmfd *shm_hold(struct shmfd *shmfd);
void shm_drop(struct shmfd *shmfd);
int shm_dotruncate(struct shmfd *shmfd, off_t length);
bool shm_largepage(struct shmfd *shmfd);
+void shm_remove_prison(struct prison *pr);
extern struct fileops shm_ops;
diff --git a/sys/sys/mount.h b/sys/sys/mount.h
index 3383bfe8f431..ffb2676258f3 100644
--- a/sys/sys/mount.h
+++ b/sys/sys/mount.h
@@ -91,7 +91,9 @@ struct statfs {
uint64_t f_asyncwrites; /* count of async writes since mount */
uint64_t f_syncreads; /* count of sync reads since mount */
uint64_t f_asyncreads; /* count of async reads since mount */
- uint64_t f_spare[10]; /* unused spare */
+ uint32_t f_nvnodelistsize; /* # of vnodes */
+ uint32_t f_spare0; /* unused spare */
+ uint64_t f_spare[9]; /* unused spare */
uint32_t f_namemax; /* maximum filename length */
uid_t f_owner; /* user that mounted the filesystem */
fsid_t f_fsid; /* filesystem id */
diff --git a/sys/sys/nv.h b/sys/sys/nv.h
index 80fb877721f0..0c382002b77b 100644
--- a/sys/sys/nv.h
+++ b/sys/sys/nv.h
@@ -42,6 +42,7 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
+#include <sys/nv_namespace.h>
#endif
#ifndef _NVLIST_T_DECLARED
diff --git a/sys/sys/nv_namespace.h b/sys/sys/nv_namespace.h
new file mode 100644
index 000000000000..ab88db8e8a7a
--- /dev/null
+++ b/sys/sys/nv_namespace.h
@@ -0,0 +1,282 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2022 Rubicon Communications, LLC (Netgate)
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _NV_NAMESPACE_H_
+#define _NV_NAMESPACE_H_
+
+#define cnvlist_free_binary FreeBSD_cnvlist_free_binary
+#define cnvlist_free_bool FreeBSD_cnvlist_free_bool
+#define cnvlist_free_bool_array FreeBSD_cnvlist_free_bool_array
+#define cnvlist_free_descriptor FreeBSD_cnvlist_free_descriptor
+#define cnvlist_free_descriptor_array FreeBSD_cnvlist_free_descriptor_array
+#define cnvlist_free_number FreeBSD_cnvlist_free_number
+#define cnvlist_free_number_array FreeBSD_cnvlist_free_number_array
+#define cnvlist_free_nvlist FreeBSD_cnvlist_free_nvlist
+#define cnvlist_free_nvlist_array FreeBSD_cnvlist_free_nvlist_array
+#define cnvlist_free_string FreeBSD_cnvlist_free_string
+#define cnvlist_free_string_array FreeBSD_cnvlist_free_string_array
+#define cnvlist_get_binary FreeBSD_cnvlist_get_binary
+#define cnvlist_get_bool FreeBSD_cnvlist_get_bool
+#define cnvlist_get_bool_array FreeBSD_cnvlist_get_bool_array
+#define cnvlist_get_descriptor FreeBSD_cnvlist_get_descriptor
+#define cnvlist_get_descriptor_array FreeBSD_cnvlist_get_descriptor_array
+#define cnvlist_get_number FreeBSD_cnvlist_get_number
+#define cnvlist_get_number_array FreeBSD_cnvlist_get_number_array
+#define cnvlist_get_nvlist FreeBSD_cnvlist_get_nvlist
+#define cnvlist_get_nvlist_array FreeBSD_cnvlist_get_nvlist_array
+#define cnvlist_get_string FreeBSD_cnvlist_get_string
+#define cnvlist_get_string_array FreeBSD_cnvlist_get_string_array
+#define cnvlist_name FreeBSD_cnvlist_name
+#define cnvlist_take_binary FreeBSD_cnvlist_take_binary
+#define cnvlist_take_bool FreeBSD_cnvlist_take_bool
+#define cnvlist_take_bool_array FreeBSD_cnvlist_take_bool_array
+#define cnvlist_take_descriptor FreeBSD_cnvlist_take_descriptor
+#define cnvlist_take_descriptor_array FreeBSD_cnvlist_take_descriptor_array
+#define cnvlist_take_number FreeBSD_cnvlist_take_number
+#define cnvlist_take_number_array FreeBSD_cnvlist_take_number_array
+#define cnvlist_take_nvlist FreeBSD_cnvlist_take_nvlist
+#define cnvlist_take_nvlist_array FreeBSD_cnvlist_take_nvlist_array
+#define cnvlist_take_string FreeBSD_cnvlist_take_string
+#define cnvlist_take_string_array FreeBSD_cnvlist_take_string_array
+#define cnvlist_type FreeBSD_cnvlist_type
+#define dnvlist_get_binary FreeBSD_dnvlist_get_binary
+#define dnvlist_get_bool FreeBSD_dnvlist_get_bool
+#define dnvlist_get_descriptor FreeBSD_dnvlist_get_descriptor
+#define dnvlist_get_number FreeBSD_dnvlist_get_number
+#define dnvlist_get_nvlist FreeBSD_dnvlist_get_nvlist
+#define dnvlist_get_string FreeBSD_dnvlist_get_string
+#define dnvlist_take_binary FreeBSD_dnvlist_take_binary
+#define dnvlist_take_bool FreeBSD_dnvlist_take_bool
+#define dnvlist_take_descriptor FreeBSD_dnvlist_take_descriptor
+#define dnvlist_take_number FreeBSD_dnvlist_take_number
+#define dnvlist_take_nvlist FreeBSD_dnvlist_take_nvlist
+#define dnvlist_take_string FreeBSD_dnvlist_take_string
+#define nvlist FreeBSD_nvlist
+#define nvlist_add_binary FreeBSD_nvlist_add_binary
+#define nvlist_add_bool FreeBSD_nvlist_add_bool
+#define nvlist_add_bool_array FreeBSD_nvlist_add_bool_array
+#define nvlist_add_descriptor FreeBSD_nvlist_add_descriptor
+#define nvlist_add_descriptor_array FreeBSD_nvlist_add_descriptor_array
+#define nvlist_add_null FreeBSD_nvlist_add_null
+#define nvlist_add_number FreeBSD_nvlist_add_number
+#define nvlist_add_number_array FreeBSD_nvlist_add_number_array
+#define nvlist_add_nvlist FreeBSD_nvlist_add_nvlist
+#define nvlist_add_nvlist_array FreeBSD_nvlist_add_nvlist_array
+#define nvlist_add_nvpair FreeBSD_nvlist_add_nvpair
+#define nvlist_add_string FreeBSD_nvlist_add_string
+#define nvlist_add_string_array FreeBSD_nvlist_add_string_array
+#define nvlist_add_stringf FreeBSD_nvlist_add_stringf
+#define nvlist_add_stringv FreeBSD_nvlist_add_stringv
+#define nvlist_append_bool_array FreeBSD_nvlist_append_bool_array
+#define nvlist_append_descriptor_array FreeBSD_nvlist_append_descriptor_array
+#define nvlist_append_number_array FreeBSD_nvlist_append_number_array
+#define nvlist_append_nvlist_array FreeBSD_nvlist_append_nvlist_array
+#define nvlist_append_string_array FreeBSD_nvlist_append_string_array
+#define nvlist_clone FreeBSD_nvlist_clone
+#define nvlist_create FreeBSD_nvlist_create
+#define nvlist_descriptors FreeBSD_nvlist_descriptors
+#define nvlist_destroy FreeBSD_nvlist_destroy
+#define nvlist_dump FreeBSD_nvlist_dump
+#define nvlist_empty FreeBSD_nvlist_empty
+#define nvlist_error FreeBSD_nvlist_error
+#define nvlist_exists FreeBSD_nvlist_exists
+#define nvlist_exists_binary FreeBSD_nvlist_exists_binary
+#define nvlist_exists_bool FreeBSD_nvlist_exists_bool
+#define nvlist_exists_bool_array FreeBSD_nvlist_exists_bool_array
+#define nvlist_exists_descriptor FreeBSD_nvlist_exists_descriptor
+#define nvlist_exists_descriptor_array FreeBSD_nvlist_exists_descriptor_array
+#define nvlist_exists_null FreeBSD_nvlist_exists_null
+#define nvlist_exists_number FreeBSD_nvlist_exists_number
+#define nvlist_exists_number_array FreeBSD_nvlist_exists_number_array
+#define nvlist_exists_nvlist FreeBSD_nvlist_exists_nvlist
+#define nvlist_exists_nvlist_array FreeBSD_nvlist_exists_nvlist_array
+#define nvlist_exists_string FreeBSD_nvlist_exists_string
+#define nvlist_exists_string_array FreeBSD_nvlist_exists_string_array
+#define nvlist_exists_type FreeBSD_nvlist_exists_type
+#define nvlist_fdump FreeBSD_nvlist_fdump
+#define nvlist_first_nvpair FreeBSD_nvlist_first_nvpair
+#define nvlist_flags FreeBSD_nvlist_flags
+#define nvlist_free FreeBSD_nvlist_free
+#define nvlist_free_binary FreeBSD_nvlist_free_binary
+#define nvlist_free_binary_array FreeBSD_nvlist_free_binary_array
+#define nvlist_free_bool FreeBSD_nvlist_free_bool
+#define nvlist_free_bool_array FreeBSD_nvlist_free_bool_array
+#define nvlist_free_descriptor FreeBSD_nvlist_free_descriptor
+#define nvlist_free_descriptor_array FreeBSD_nvlist_free_descriptor_array
+#define nvlist_free_null FreeBSD_nvlist_free_null
+#define nvlist_free_number FreeBSD_nvlist_free_number
+#define nvlist_free_number_array FreeBSD_nvlist_free_number_array
+#define nvlist_free_nvlist FreeBSD_nvlist_free_nvlist
+#define nvlist_free_nvlist_array FreeBSD_nvlist_free_nvlist_array
+#define nvlist_free_nvpair FreeBSD_nvlist_free_nvpair
+#define nvlist_free_string FreeBSD_nvlist_free_string
+#define nvlist_free_string_array FreeBSD_nvlist_free_string_array
+#define nvlist_free_type FreeBSD_nvlist_free_type
+#define nvlist_get_array_next FreeBSD_nvlist_get_array_next
+#define nvlist_get_array_next_nvpair FreeBSD_nvlist_get_array_next_nvpair
+#define nvlist_get_binary FreeBSD_nvlist_get_binary
+#define nvlist_get_bool FreeBSD_nvlist_get_bool
+#define nvlist_get_bool_array FreeBSD_nvlist_get_bool_array
+#define nvlist_get_descriptor FreeBSD_nvlist_get_descriptor
+#define nvlist_get_descriptor_array FreeBSD_nvlist_get_descriptor_array
+#define nvlist_get_number FreeBSD_nvlist_get_number
+#define nvlist_get_number_array FreeBSD_nvlist_get_number_array
+#define nvlist_get_nvlist FreeBSD_nvlist_get_nvlist
+#define nvlist_get_nvlist_array FreeBSD_nvlist_get_nvlist_array
+#define nvlist_get_nvpair FreeBSD_nvlist_get_nvpair
+#define nvlist_get_nvpair_parent FreeBSD_nvlist_get_nvpair_parent
+#define nvlist_get_pararr FreeBSD_nvlist_get_pararr
+#define nvlist_get_parent FreeBSD_nvlist_get_parent
+#define nvlist_get_string FreeBSD_nvlist_get_string
+#define nvlist_get_string_array FreeBSD_nvlist_get_string_array
+#define nvlist_in_array FreeBSD_nvlist_in_array
+#define nvlist_move_binary FreeBSD_nvlist_move_binary
+#define nvlist_move_bool_array FreeBSD_nvlist_move_bool_array
+#define nvlist_move_descriptor FreeBSD_nvlist_move_descriptor
+#define nvlist_move_descriptor_array FreeBSD_nvlist_move_descriptor_array
+#define nvlist_move_number_array FreeBSD_nvlist_move_number_array
+#define nvlist_move_nvlist FreeBSD_nvlist_move_nvlist
+#define nvlist_move_nvlist_array FreeBSD_nvlist_move_nvlist_array
+#define nvlist_move_nvpair FreeBSD_nvlist_move_nvpair
+#define nvlist_move_string FreeBSD_nvlist_move_string
+#define nvlist_move_string_array FreeBSD_nvlist_move_string_array
+#define nvlist_ndescriptors FreeBSD_nvlist_ndescriptors
+#define nvlist_next FreeBSD_nvlist_next
+#define nvlist_next_nvpair FreeBSD_nvlist_next_nvpair
+#define nvlist_pack FreeBSD_nvlist_pack
+#define nvlist_prev_nvpair FreeBSD_nvlist_prev_nvpair
+#define nvlist_recv FreeBSD_nvlist_recv
+#define nvlist_remove_nvpair FreeBSD_nvlist_remove_nvpair
+#define nvlist_report_missing FreeBSD_nvlist_report_missing
+#define nvlist_send FreeBSD_nvlist_send
+#define nvlist_set_array_next FreeBSD_nvlist_set_array_next
+#define nvlist_set_error FreeBSD_nvlist_set_error
+#define nvlist_set_flags FreeBSD_nvlist_set_flags
+#define nvlist_set_parent FreeBSD_nvlist_set_parent
+#define nvlist_size FreeBSD_nvlist_size
+#define nvlist_t FreeBSD_nvlist_t
+#define nvlist_take_binary FreeBSD_nvlist_take_binary
+#define nvlist_take_bool FreeBSD_nvlist_take_bool
+#define nvlist_take_bool_array FreeBSD_nvlist_take_bool_array
+#define nvlist_take_descriptor FreeBSD_nvlist_take_descriptor
+#define nvlist_take_descriptor_array FreeBSD_nvlist_take_descriptor_array
+#define nvlist_take_number FreeBSD_nvlist_take_number
+#define nvlist_take_number_array FreeBSD_nvlist_take_number_array
+#define nvlist_take_nvlist FreeBSD_nvlist_take_nvlist
+#define nvlist_take_nvlist_array FreeBSD_nvlist_take_nvlist_array
+#define nvlist_take_nvpair FreeBSD_nvlist_take_nvpair
+#define nvlist_take_string FreeBSD_nvlist_take_string
+#define nvlist_take_string_array FreeBSD_nvlist_take_string_array
+#define nvlist_unpack FreeBSD_nvlist_unpack
+#define nvlist_unpack_header FreeBSD_nvlist_unpack_header
+#define nvlist_xfer FreeBSD_nvlist_xfer
+#define nvpair_append_bool_array FreeBSD_nvpair_append_bool_array
+#define nvpair_append_descriptor_array FreeBSD_nvpair_append_descriptor_array
+#define nvpair_append_number_array FreeBSD_nvpair_append_number_array
+#define nvpair_append_nvlist_array FreeBSD_nvpair_append_nvlist_array
+#define nvpair_append_string_array FreeBSD_nvpair_append_string_array
+#define nvpair_assert FreeBSD_nvpair_assert
+#define nvpair_clone FreeBSD_nvpair_clone
+#define nvpair_create_binary FreeBSD_nvpair_create_binary
+#define nvpair_create_bool FreeBSD_nvpair_create_bool
+#define nvpair_create_bool_array FreeBSD_nvpair_create_bool_array
+#define nvpair_create_descriptor FreeBSD_nvpair_create_descriptor
+#define nvpair_create_descriptor_array FreeBSD_nvpair_create_descriptor_array
+#define nvpair_create_null FreeBSD_nvpair_create_null
+#define nvpair_create_number FreeBSD_nvpair_create_number
+#define nvpair_create_number_array FreeBSD_nvpair_create_number_array
+#define nvpair_create_nvlist FreeBSD_nvpair_create_nvlist
+#define nvpair_create_nvlist_array FreeBSD_nvpair_create_nvlist_array
+#define nvpair_create_string FreeBSD_nvpair_create_string
+#define nvpair_create_string_array FreeBSD_nvpair_create_string_array
+#define nvpair_create_stringf FreeBSD_nvpair_create_stringf
+#define nvpair_create_stringv FreeBSD_nvpair_create_stringv
+#define nvpair_free FreeBSD_nvpair_free
+#define nvpair_free_structure FreeBSD_nvpair_free_structure
+#define nvpair_get_binary FreeBSD_nvpair_get_binary
+#define nvpair_get_bool FreeBSD_nvpair_get_bool
+#define nvpair_get_bool_array FreeBSD_nvpair_get_bool_array
+#define nvpair_get_descriptor FreeBSD_nvpair_get_descriptor
+#define nvpair_get_descriptor_array FreeBSD_nvpair_get_descriptor_array
+#define nvpair_get_number FreeBSD_nvpair_get_number
+#define nvpair_get_number_array FreeBSD_nvpair_get_number_array
+#define nvpair_get_nvlist FreeBSD_nvpair_get_nvlist
+#define nvpair_get_nvlist_array FreeBSD_nvpair_get_nvlist_array
+#define nvpair_get_string FreeBSD_nvpair_get_string
+#define nvpair_get_string_array FreeBSD_nvpair_get_string_array
+#define nvpair_header_size FreeBSD_nvpair_header_size
+#define nvpair_init_datasize FreeBSD_nvpair_init_datasize
+#define nvpair_insert FreeBSD_nvpair_insert
+#define nvpair_move_binary FreeBSD_nvpair_move_binary
+#define nvpair_move_bool_array FreeBSD_nvpair_move_bool_array
+#define nvpair_move_descriptor FreeBSD_nvpair_move_descriptor
+#define nvpair_move_descriptor_array FreeBSD_nvpair_move_descriptor_array
+#define nvpair_move_number_array FreeBSD_nvpair_move_number_array
+#define nvpair_move_nvlist FreeBSD_nvpair_move_nvlist
+#define nvpair_move_nvlist_array FreeBSD_nvpair_move_nvlist_array
+#define nvpair_move_string FreeBSD_nvpair_move_string
+#define nvpair_move_string_array FreeBSD_nvpair_move_string_array
+#define nvpair_name FreeBSD_nvpair_name
+#define nvpair_next FreeBSD_nvpair_next
+#define nvpair_nvlist FreeBSD_nvpair_nvlist
+#define nvpair_pack_binary FreeBSD_nvpair_pack_binary
+#define nvpair_pack_bool FreeBSD_nvpair_pack_bool
+#define nvpair_pack_bool_array FreeBSD_nvpair_pack_bool_array
+#define nvpair_pack_descriptor FreeBSD_nvpair_pack_descriptor
+#define nvpair_pack_descriptor_array FreeBSD_nvpair_pack_descriptor_array
+#define nvpair_pack_header FreeBSD_nvpair_pack_header
+#define nvpair_pack_null FreeBSD_nvpair_pack_null
+#define nvpair_pack_number FreeBSD_nvpair_pack_number
+#define nvpair_pack_number_array FreeBSD_nvpair_pack_number_array
+#define nvpair_pack_nvlist_array_next FreeBSD_nvpair_pack_nvlist_array_next
+#define nvpair_pack_nvlist_up FreeBSD_nvpair_pack_nvlist_up
+#define nvpair_pack_string FreeBSD_nvpair_pack_string
+#define nvpair_pack_string_array FreeBSD_nvpair_pack_string_array
+#define nvpair_prev FreeBSD_nvpair_prev
+#define nvpair_remove FreeBSD_nvpair_remove
+#define nvpair_size FreeBSD_nvpair_size
+#define nvpair_type FreeBSD_nvpair_type
+#define nvpair_type_string FreeBSD_nvpair_type_string
+#define nvpair_unpack FreeBSD_nvpair_unpack
+#define nvpair_unpack_binary FreeBSD_nvpair_unpack_binary
+#define nvpair_unpack_bool FreeBSD_nvpair_unpack_bool
+#define nvpair_unpack_bool_array FreeBSD_nvpair_unpack_bool_array
+#define nvpair_unpack_descriptor FreeBSD_nvpair_unpack_descriptor
+#define nvpair_unpack_descriptor_array FreeBSD_nvpair_unpack_descriptor_array
+#define nvpair_unpack_header FreeBSD_nvpair_unpack_header
+#define nvpair_unpack_null FreeBSD_nvpair_unpack_null
+#define nvpair_unpack_number FreeBSD_nvpair_unpack_number
+#define nvpair_unpack_number_array FreeBSD_nvpair_unpack_number_array
+#define nvpair_unpack_nvlist FreeBSD_nvpair_unpack_nvlist
+#define nvpair_unpack_nvlist_array FreeBSD_nvpair_unpack_nvlist_array
+#define nvpair_unpack_string FreeBSD_nvpair_unpack_string
+#define nvpair_unpack_string_array FreeBSD_nvpair_unpack_string_array
+
+#endif
diff --git a/sys/sys/param.h b/sys/sys/param.h
index 1f720ed31142..5925b85911f6 100644
--- a/sys/sys/param.h
+++ b/sys/sys/param.h
@@ -76,7 +76,7 @@
* cannot include sys/param.h and should only be updated here.
*/
#undef __FreeBSD_version
-#define __FreeBSD_version 1400059
+#define __FreeBSD_version 1400065
/*
* __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
diff --git a/sys/sys/pmc.h b/sys/sys/pmc.h
index b54bc8d8e9f0..5465d0532a2a 100644
--- a/sys/sys/pmc.h
+++ b/sys/sys/pmc.h
@@ -113,6 +113,9 @@ extern char pmc_cpuid[PMC_CPUID_LEN];
__PMC_CPU(INTEL_ATOM_GOLDMONT, 0x9A, "Intel Atom Goldmont") \
__PMC_CPU(INTEL_ICELAKE, 0x9B, "Intel Icelake") \
__PMC_CPU(INTEL_ICELAKE_XEON, 0x9C, "Intel Icelake Xeon") \
+ __PMC_CPU(INTEL_ALDERLAKE, 0x9D, "Intel Alderlake") \
+ __PMC_CPU(INTEL_ATOM_GOLDMONT_P, 0x9E, "Intel Atom Goldmont Plus") \
+ __PMC_CPU(INTEL_ATOM_TREMONT, 0x9F, "Intel Atom Tremont") \
__PMC_CPU(INTEL_XSCALE, 0x100, "Intel XScale") \
__PMC_CPU(MIPS_24K, 0x200, "MIPS 24K") \
__PMC_CPU(MIPS_OCTEON, 0x201, "Cavium Octeon") \
@@ -168,7 +171,10 @@ enum pmc_cputype {
__PMC_CLASS(MIPS74K, 0x12, "MIPS 74K") \
__PMC_CLASS(E500, 0x13, "Freescale e500 class") \
__PMC_CLASS(BERI, 0x14, "MIPS BERI") \
- __PMC_CLASS(POWER8, 0x15, "IBM POWER8 class")
+ __PMC_CLASS(POWER8, 0x15, "IBM POWER8 class") \
+ __PMC_CLASS(DMC620_PMU_CD2, 0x16, "ARM DMC620 Memory Controller PMU CLKDIV2") \
+ __PMC_CLASS(DMC620_PMU_C, 0x17, "ARM DMC620 Memory Controller PMU CLK") \
+ __PMC_CLASS(CMN600_PMU, 0x18, "Arm CoreLink CMN600 Coherent Mesh Network PMU")
enum pmc_class {
#undef __PMC_CLASS
@@ -177,7 +183,7 @@ enum pmc_class {
};
#define PMC_CLASS_FIRST PMC_CLASS_TSC
-#define PMC_CLASS_LAST PMC_CLASS_POWER8
+#define PMC_CLASS_LAST PMC_CLASS_CMN600_PMU
/*
* A PMC can be in the following states:
@@ -305,7 +311,9 @@ enum pmc_disp {
__PMC_CAP(QUALIFIER, 8, "further qualify monitored events") \
__PMC_CAP(PRECISE, 9, "perform precise sampling") \
__PMC_CAP(TAGGING, 10, "tag upstream events") \
- __PMC_CAP(CASCADE, 11, "cascade counters")
+ __PMC_CAP(CASCADE, 11, "cascade counters") \
+ __PMC_CAP(SYSWIDE, 12, "system wide counter") \
+ __PMC_CAP(DOMWIDE, 13, "NUMA domain wide counter")
enum pmc_caps
{
@@ -315,7 +323,7 @@ enum pmc_caps
};
#define PMC_CAP_FIRST PMC_CAP_INTERRUPT
-#define PMC_CAP_LAST PMC_CAP_CASCADE
+#define PMC_CAP_LAST PMC_CAP_DOMWIDE
/*
* PMC Event Numbers
@@ -994,6 +1002,7 @@ struct pmc_cpu {
struct pmc_binding {
int pb_bound; /* is bound? */
int pb_cpu; /* if so, to which CPU */
+ u_char pb_priority; /* Thread active priority. */
};
struct pmc_mdep;
@@ -1222,6 +1231,9 @@ int pmc_save_kernel_callchain(uintptr_t *_cc, int _maxsamples,
struct trapframe *_tf);
int pmc_save_user_callchain(uintptr_t *_cc, int _maxsamples,
struct trapframe *_tf);
+void pmc_restore_cpu_binding(struct pmc_binding *pb);
+void pmc_save_cpu_binding(struct pmc_binding *pb);
+void pmc_select_cpu(int cpu);
struct pmc_mdep *pmc_mdep_alloc(int nclasses);
void pmc_mdep_free(struct pmc_mdep *md);
uint64_t pmc_rdtsc(void);
diff --git a/sys/sys/priority.h b/sys/sys/priority.h
index 428be2d02c68..ab97baeeb822 100644
--- a/sys/sys/priority.h
+++ b/sys/sys/priority.h
@@ -69,10 +69,10 @@
* Priorities range from 0 to 255, but differences of less then 4 (RQ_PPQ)
* are insignificant. Ranges are as follows:
*
- * Interrupt threads: 0 - 47
- * Realtime user threads: 48 - 79
- * Top half kernel threads: 80 - 119
- * Time sharing user threads: 120 - 223
+ * Interrupt threads: 0 - 15
+ * Realtime user threads: 16 - 47
+ * Top half kernel threads: 48 - 87
+ * Time sharing user threads: 88 - 223
* Idle user threads: 224 - 255
*
* XXX If/When the specific interrupt thread and top half thread ranges
@@ -85,20 +85,25 @@
#define PRI_MIN_ITHD (PRI_MIN)
#define PRI_MAX_ITHD (PRI_MIN_REALTIME - 1)
+/*
+ * Most hardware interrupt threads run at the same priority, but can
+ * decay to lower priorities if they run for full time slices.
+ */
#define PI_REALTIME (PRI_MIN_ITHD + 0)
-#define PI_AV (PRI_MIN_ITHD + 4)
-#define PI_SOFTCLOCK PI_AV
-#define PI_NET (PRI_MIN_ITHD + 8)
-#define PI_DISK (PRI_MIN_ITHD + 12)
-#define PI_TTY (PRI_MIN_ITHD + 16)
-#define PI_DULL (PRI_MIN_ITHD + 20)
-#define PI_SOFT (PRI_MIN_ITHD + 24)
-#define PI_SWI(x) (PI_SOFT + (x) * RQ_PPQ)
-
-#define PRI_MIN_REALTIME (48)
+#define PI_INTR (PRI_MIN_ITHD + 4)
+#define PI_AV PI_INTR
+#define PI_NET PI_INTR
+#define PI_DISK PI_INTR
+#define PI_TTY PI_INTR
+#define PI_DULL PI_INTR
+#define PI_SOFT (PRI_MIN_ITHD + 8)
+#define PI_SOFTCLOCK PI_SOFT
+#define PI_SWI(x) PI_SOFT
+
+#define PRI_MIN_REALTIME (16)
#define PRI_MAX_REALTIME (PRI_MIN_KERN - 1)
-#define PRI_MIN_KERN (80)
+#define PRI_MIN_KERN (48)
#define PRI_MAX_KERN (PRI_MIN_TIMESHARE - 1)
#define PSWP (PRI_MIN_KERN + 0)
@@ -112,7 +117,7 @@
#define PLOCK (PRI_MIN_KERN + 32)
#define PPAUSE (PRI_MIN_KERN + 36)
-#define PRI_MIN_TIMESHARE (120)
+#define PRI_MIN_TIMESHARE (88)
#define PRI_MAX_TIMESHARE (PRI_MIN_IDLE - 1)
#define PUSER (PRI_MIN_TIMESHARE)
diff --git a/sys/sys/priv.h b/sys/sys/priv.h
index 8757db879a5c..8f7a2496064a 100644
--- a/sys/sys/priv.h
+++ b/sys/sys/priv.h
@@ -348,6 +348,7 @@
#define PRIV_NET_VXLAN 420 /* Administer vxlan. */
#define PRIV_NET_SETLANPCP 421 /* Set LAN priority. */
#define PRIV_NET_SETVLANPCP PRIV_NET_SETLANPCP /* Alias Set VLAN priority */
+#define PRIV_NET_OVPN 422 /* Administer OpenVPN DCO. */
/*
* 802.11-related privileges.
diff --git a/sys/sys/proc.h b/sys/sys/proc.h
index 223714724aca..9d55f0b71e4f 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -257,11 +257,13 @@ struct thread {
#define td_siglist td_sigqueue.sq_signals
u_char td_lend_user_pri; /* (t) Lend user pri. */
u_char td_allocdomain; /* (b) NUMA domain backing this struct thread. */
+ u_char td_base_ithread_pri; /* (t) Base ithread pri */
struct kmsan_td *td_kmsan; /* (k) KMSAN state */
/* Cleared during fork1() */
#define td_startzero td_flags
int td_flags; /* (t) TDF_* flags. */
+ int td_ast; /* (t) TDA_* indicators */
int td_inhibitors; /* (t) Why can not run. */
int td_pflags; /* (k) Private thread (TDP_*) flags. */
int td_pflags2; /* (k) Private thread (TDP2_*) flags. */
@@ -456,26 +458,53 @@ do { \
#define TDF_KTH_SUSP 0x00000100 /* kthread is suspended */
#define TDF_ALLPROCSUSP 0x00000200 /* suspended by SINGLE_ALLPROC */
#define TDF_BOUNDARY 0x00000400 /* Thread suspended at user boundary */
-#define TDF_ASTPENDING 0x00000800 /* Thread has some asynchronous events. */
-#define TDF_KQTICKLED 0x00001000 /* AST drain kqueue taskqueue */
+#define TDF_UNUSED1 0x00000800 /* Available */
+#define TDF_UNUSED2 0x00001000 /* Available */
#define TDF_SBDRY 0x00002000 /* Stop only on usermode boundary. */
#define TDF_UPIBLOCKED 0x00004000 /* Thread blocked on user PI mutex. */
-#define TDF_NEEDSUSPCHK 0x00008000 /* Thread may need to suspend. */
-#define TDF_NEEDRESCHED 0x00010000 /* Thread needs to yield. */
-#define TDF_NEEDSIGCHK 0x00020000 /* Thread may need signal delivery. */
+#define TDF_UNUSED3 0x00008000 /* Available */
+#define TDF_UNUSED4 0x00010000 /* Available */
+#define TDF_UNUSED5 0x00020000 /* Available */
#define TDF_NOLOAD 0x00040000 /* Ignore during load avg calculations. */
#define TDF_SERESTART 0x00080000 /* ERESTART on stop attempts. */
#define TDF_THRWAKEUP 0x00100000 /* Libthr thread must not suspend itself. */
#define TDF_SEINTR 0x00200000 /* EINTR on stop attempts. */
#define TDF_SWAPINREQ 0x00400000 /* Swapin request due to wakeup. */
-#define TDF_UNUSED23 0x00800000 /* --available-- */
+#define TDF_DOING_SA 0x00800000 /* Doing SINGLE_ALLPROC, do not unsuspend me */
#define TDF_SCHED0 0x01000000 /* Reserved for scheduler private use */
#define TDF_SCHED1 0x02000000 /* Reserved for scheduler private use */
#define TDF_SCHED2 0x04000000 /* Reserved for scheduler private use */
#define TDF_SCHED3 0x08000000 /* Reserved for scheduler private use */
-#define TDF_ALRMPEND 0x10000000 /* Pending SIGVTALRM needs to be posted. */
-#define TDF_PROFPEND 0x20000000 /* Pending SIGPROF needs to be posted. */
-#define TDF_MACPEND 0x40000000 /* AST-based MAC event pending. */
+#define TDF_UNUSED6 0x10000000 /* Available */
+#define TDF_UNUSED7 0x20000000 /* Available */
+#define TDF_UNUSED8 0x40000000 /* Available */
+#define TDF_UNUSED9 0x80000000 /* Available */
+
+enum {
+ TDA_AST = 0, /* Special: call all non-flagged AST handlers */
+ TDA_OWEUPC,
+ TDA_HWPMC,
+ TDA_VFORK,
+ TDA_ALRM,
+ TDA_PROF,
+ TDA_MAC,
+ TDA_SCHED,
+ TDA_UFS,
+ TDA_GEOM,
+ TDA_KQUEUE,
+ TDA_RACCT,
+ TDA_MOD1, /* For third party use, before signals are */
+ TAD_MOD2, /* processed .. */
+ TDA_SIG,
+ TDA_KTRACE,
+ TDA_SUSPEND,
+ TDA_SIGSUSPEND,
+ TDA_MOD3, /* .. and after */
+ TAD_MOD4,
+ TDA_MAX,
+};
+#define TDAI(tda) (1U << (tda))
+#define td_ast_pending(td, tda) ((td->td_ast & TDAI(tda)) != 0)
/* Userland debug flags */
#define TDB_SUSPEND 0x00000001 /* Thread is suspended by debugger */
@@ -691,6 +720,8 @@ struct proc {
int p_pendingexits; /* (c) Count of pending thread exits. */
struct filemon *p_filemon; /* (c) filemon-specific data. */
int p_pdeathsig; /* (c) Signal from parent on exit. */
+ int p_singlethr; /* (c) Count of threads doing
+ external thread_single() */
/* End area that is zeroed on creation. */
#define p_endzero p_magic
@@ -847,6 +878,9 @@ struct proc {
#define P2_NO_NEW_PRIVS 0x00008000 /* Ignore setuid */
#define P2_WXORX_DISABLE 0x00010000 /* WX mappings enabled */
#define P2_WXORX_ENABLE_EXEC 0x00020000 /* WXORX enabled after exec */
+#define P2_WEXIT 0x00040000 /* exit just started, no
+ external thread_single() is
+ permitted */
/* Flags protected by proctree_lock, kept in p_treeflags. */
#define P_TREE_ORPHANED 0x00000001 /* Reparented, on orphan list */
@@ -1105,7 +1139,23 @@ struct fork_req {
int pget(pid_t pid, int flags, struct proc **pp);
+/* ast_register() flags */
+#define ASTR_ASTF_REQUIRED 0x0001 /* td_ast TDAI(TDA_X) flag set is
+ required for call */
+#define ASTR_TDP 0x0002 /* td_pflags flag set is required */
+#define ASTR_KCLEAR 0x0004 /* call me on ast_kclear() */
+#define ASTR_UNCOND 0x0008 /* call me always */
+
void ast(struct trapframe *framep);
+void ast_kclear(struct thread *td);
+void ast_register(int ast, int ast_flags, int tdp,
+ void (*f)(struct thread *td, int asts));
+void ast_deregister(int tda);
+void ast_sched_locked(struct thread *td, int tda);
+void ast_sched_mask(struct thread *td, int ast);
+void ast_sched(struct thread *td, int tda);
+void ast_unsched_locked(struct thread *td, int tda);
+
struct thread *choosethread(void);
int cr_cansee(struct ucred *u1, struct ucred *u2);
int cr_canseesocket(struct ucred *cred, struct socket *so);
@@ -1118,7 +1168,6 @@ int enterpgrp(struct proc *p, pid_t pgid, struct pgrp *pgrp,
int enterthispgrp(struct proc *p, struct pgrp *pgrp);
void faultin(struct proc *p);
int fork1(struct thread *, struct fork_req *);
-void fork_rfppwait(struct thread *);
void fork_exit(void (*)(void *, struct trapframe *), void *,
struct trapframe *);
void fork_return(struct thread *, struct trapframe *);
@@ -1155,6 +1204,7 @@ void proc_linkup(struct proc *p, struct thread *td);
struct proc *proc_realparent(struct proc *child);
void proc_reap(struct thread *td, struct proc *p, int *status, int options);
void proc_reparent(struct proc *child, struct proc *newparent, bool set_oppid);
+void proc_set_p2_wexit(struct proc *p);
void proc_set_traced(struct proc *p, bool stop);
void proc_wkilled(struct proc *p);
struct pstats *pstats_alloc(void);
@@ -1232,7 +1282,7 @@ void thread_unlink(struct thread *td);
void thread_unsuspend(struct proc *p);
void thread_wait(struct proc *p);
-void stop_all_proc_block(void);
+bool stop_all_proc_block(void);
void stop_all_proc_unblock(void);
void stop_all_proc(void);
void resume_all_proc(void);
@@ -1289,15 +1339,6 @@ td_get_sched(struct thread *td)
return ((struct td_sched *)&td[1]);
}
-extern void (*softdep_ast_cleanup)(struct thread *);
-static __inline void
-td_softdep_cleanup(struct thread *td)
-{
-
- if (td->td_su != NULL && softdep_ast_cleanup != NULL)
- softdep_ast_cleanup(td);
-}
-
#define PROC_ID_PID 0
#define PROC_ID_GROUP 1
#define PROC_ID_SESSION 2
diff --git a/sys/sys/protosw.h b/sys/sys/protosw.h
index dc550d42f1fd..26cd1bc3fc16 100644
--- a/sys/sys/protosw.h
+++ b/sys/sys/protosw.h
@@ -114,6 +114,8 @@ struct protosw {
* and the protocol understands the MSG_EOF flag. The first property is
* is only relevant if PR_CONNREQUIRED is set (otherwise sendto is allowed
* anyhow).
+ * PR_SOCKBUF requires protocol to initialize and destroy its socket buffers
+ * in its pr_attach and pr_detach.
*/
#define PR_ATOMIC 0x01 /* exchange atomic messages only */
#define PR_ADDR 0x02 /* addresses given with messages */
@@ -123,6 +125,7 @@ struct protosw {
#define PR_IMPLOPCL 0x20 /* implied open/close */
#define PR_LASTHDR 0x40 /* enforce ipsec policy; last header */
#define PR_CAPATTACH 0x80 /* socket can attach in cap mode */
+#define PR_SOCKBUF 0x100 /* private implementation of buffers */
/*
* In earlier BSD network stacks, a single pr_usrreq() function pointer was
diff --git a/sys/sys/racct.h b/sys/sys/racct.h
index 49e0ce64069e..13a77f68a003 100644
--- a/sys/sys/racct.h
+++ b/sys/sys/racct.h
@@ -196,7 +196,6 @@ void racct_proc_exit(struct proc *p);
void racct_proc_ucred_changed(struct proc *p, struct ucred *oldcred,
struct ucred *newcred);
void racct_move(struct racct *dest, struct racct *src);
-void racct_proc_throttled(struct proc *p);
void racct_proc_throttle(struct proc *p, int timeout);
#else
diff --git a/sys/sys/sched.h b/sys/sys/sched.h
index a9598767e4cb..e0556d29f0db 100644
--- a/sys/sys/sched.h
+++ b/sys/sys/sched.h
@@ -95,6 +95,7 @@ void sched_ap_entry(void);
void sched_exit_thread(struct thread *td, struct thread *child);
u_int sched_estcpu(struct thread *td);
void sched_fork_thread(struct thread *td, struct thread *child);
+void sched_ithread_prio(struct thread *td, u_char prio);
void sched_lend_prio(struct thread *td, u_char prio);
void sched_lend_user_prio(struct thread *td, u_char pri);
void sched_lend_user_prio_cond(struct thread *td, u_char pri);
diff --git a/sys/sys/signalvar.h b/sys/sys/signalvar.h
index 4e86f54856f6..85538abeedf9 100644
--- a/sys/sys/signalvar.h
+++ b/sys/sys/signalvar.h
@@ -272,7 +272,6 @@ int __sys_sigfastblock(int cmd, void *ptr);
#endif
#ifdef _KERNEL
-extern sigset_t fastblock_mask;
extern bool sigfastblock_fetch_always;
/* Return nonzero if process p has an unmasked pending signal. */
@@ -406,7 +405,6 @@ void sigexit(struct thread *td, int sig) __dead2;
int sigev_findtd(struct proc *p, struct sigevent *sigev, struct thread **);
void sigfastblock_clear(struct thread *td);
void sigfastblock_fetch(struct thread *td);
-void sigfastblock_setpend(struct thread *td, bool resched);
int sig_intr(void);
void siginit(struct proc *p);
void signotify(struct thread *td);
diff --git a/sys/sys/sockbuf.h b/sys/sys/sockbuf.h
index 753ebd1fbf35..7075cab650da 100644
--- a/sys/sys/sockbuf.h
+++ b/sys/sys/sockbuf.h
@@ -53,6 +53,7 @@
#define SB_STOP 0x1000 /* backpressure indicator */
#define SB_AIO_RUNNING 0x2000 /* AIO operation running */
#define SB_TLS_IFNET 0x4000 /* has used / is using ifnet KTLS */
+#define SB_TLS_RX_RESYNC 0x8000 /* KTLS RX lost HW sync */
#define SBS_CANTSENDMORE 0x0010 /* can't send more data to peer */
#define SBS_CANTRCVMORE 0x0020 /* can't receive more data from peer */
@@ -74,43 +75,98 @@ struct thread;
struct selinfo;
/*
- * Variables for socket buffering.
+ * Socket buffer
*
- * Locking key to struct sockbuf:
- * (a) locked by SOCKBUF_LOCK().
+ * A buffer starts with the fields that are accessed by I/O multiplexing
+ * APIs like select(2), kevent(2) or AIO and thus are shared between different
+ * buffer implementations. They are protected by the SOCK_RECVBUF_LOCK()
+ * or SOCK_SENDBUF_LOCK() of the owning socket.
+ *
+ * XXX: sb_acc, sb_ccc and sb_mbcnt shall become implementation specific
+ * methods.
+ *
+ * Protocol specific implementations follow in a union.
*/
struct sockbuf {
- struct mtx *sb_mtx; /* sockbuf lock */
struct selinfo *sb_sel; /* process selecting read/write */
- short sb_state; /* (a) socket state on sockbuf */
- short sb_flags; /* (a) flags, see above */
- struct mbuf *sb_mb; /* (a) the mbuf chain */
- struct mbuf *sb_mbtail; /* (a) the last mbuf in the chain */
- struct mbuf *sb_lastrecord; /* (a) first mbuf of last
- * record in socket buffer */
- struct mbuf *sb_sndptr; /* (a) pointer into mbuf chain */
- struct mbuf *sb_fnrdy; /* (a) pointer to first not ready buffer */
- u_int sb_sndptroff; /* (a) byte offset of ptr into chain */
- u_int sb_acc; /* (a) available chars in buffer */
- u_int sb_ccc; /* (a) claimed chars in buffer */
- u_int sb_hiwat; /* (a) max actual char count */
- u_int sb_mbcnt; /* (a) chars of mbufs used */
- u_int sb_mcnt; /* (a) number of mbufs in buffer */
- u_int sb_ccnt; /* (a) number of clusters in buffer */
- u_int sb_mbmax; /* (a) max chars of mbufs to use */
- u_int sb_ctl; /* (a) non-data chars in buffer */
- u_int sb_tlscc; /* (a) TLS chain characters */
- u_int sb_tlsdcc; /* (a) TLS characters being decrypted */
- int sb_lowat; /* (a) low water mark */
- sbintime_t sb_timeo; /* (a) timeout for read/write */
- struct mbuf *sb_mtls; /* (a) TLS mbuf chain */
- struct mbuf *sb_mtlstail; /* (a) last mbuf in TLS chain */
- int (*sb_upcall)(struct socket *, void *, int); /* (a) */
- void *sb_upcallarg; /* (a) */
- uint64_t sb_tls_seqno; /* (a) TLS seqno */
- struct ktls_session *sb_tls_info; /* (a + b) TLS state */
- TAILQ_HEAD(, kaiocb) sb_aiojobq; /* (a) pending AIO ops */
- struct task sb_aiotask; /* AIO task */
+ short sb_state; /* socket state on sockbuf */
+ short sb_flags; /* flags, see above */
+ u_int sb_acc; /* available chars in buffer */
+ u_int sb_ccc; /* claimed chars in buffer */
+ u_int sb_mbcnt; /* chars of mbufs used */
+ u_int sb_ctl; /* non-data chars in buffer */
+ u_int sb_hiwat; /* max actual char count */
+ u_int sb_lowat; /* low water mark */
+ u_int sb_mbmax; /* max chars of mbufs to use */
+ sbintime_t sb_timeo; /* timeout for read/write */
+ int (*sb_upcall)(struct socket *, void *, int);
+ void *sb_upcallarg;
+ TAILQ_HEAD(, kaiocb) sb_aiojobq; /* pending AIO ops */
+ struct task sb_aiotask; /* AIO task */
+ union {
+ /*
+ * Classic BSD one-size-fits-all socket buffer, capable of
+ * doing streams and datagrams. The stream part is able
+ * to perform special features:
+ * - not ready data (sendfile)
+ * - TLS
+ */
+ struct {
+ /* compat: sockbuf lock pointer */
+ struct mtx *sb_mtx;
+ /* first and last mbufs in the chain */
+ struct mbuf *sb_mb;
+ struct mbuf *sb_mbtail;
+ /* first mbuf of last record in socket buffer */
+ struct mbuf *sb_lastrecord;
+ /* pointer to data to send next (TCP */
+ struct mbuf *sb_sndptr;
+ /* pointer to first not ready buffer */
+ struct mbuf *sb_fnrdy;
+ /* byte offset of ptr into chain, used with sb_sndptr */
+ u_int sb_sndptroff;
+ /* TLS */
+ u_int sb_tlscc; /* TLS chain characters */
+ u_int sb_tlsdcc; /* characters being decrypted */
+ struct mbuf *sb_mtls; /* TLS mbuf chain */
+ struct mbuf *sb_mtlstail; /* last mbuf in TLS chain */
+ uint64_t sb_tls_seqno; /* TLS seqno */
+ struct ktls_session *sb_tls_info; /* TLS state */
+ };
+ /*
+ * PF_UNIX/SOCK_DGRAM
+ *
+ * Local protocol, thus we should buffer on the receive side
+ * only. However, in one to many configuration we don't want
+ * a single receive buffer to be shared. So we would link
+ * send buffers onto receive buffer. All the fields are locked
+ * by the receive buffer lock.
+ */
+ struct {
+ /*
+ * For receive buffer: own queue of this buffer for
+ * unconnected sends. For send buffer: queue lended
+ * to the peer receive buffer, to isolate ourselves
+ * from other senders.
+ */
+ STAILQ_HEAD(, mbuf) uxdg_mb;
+ /* For receive buffer: datagram seen via MSG_PEEK. */
+ struct mbuf *uxdg_peeked;
+ /*
+ * For receive buffer: queue of send buffers of
+ * connected peers. For send buffer: linkage on
+ * connected peer receive buffer queue.
+ */
+ union {
+ TAILQ_HEAD(, sockbuf) uxdg_conns;
+ TAILQ_ENTRY(sockbuf) uxdg_clist;
+ };
+ /* Counters for this buffer uxdg_mb chain + peeked. */
+ u_int uxdg_cc;
+ u_int uxdg_ctl;
+ u_int uxdg_mbcnt;
+ };
+ };
};
#endif /* defined(_KERNEL) || defined(_WANT_SOCKET) */
diff --git a/sys/sys/socketvar.h b/sys/sys/socketvar.h
index 05eefd7e4fd4..c496239f92bc 100644
--- a/sys/sys/socketvar.h
+++ b/sys/sys/socketvar.h
@@ -210,7 +210,6 @@ struct socket {
* Many fields will be read without locks to improve performance and avoid
* lock order issues. However, this approach must be used with caution.
*/
-#define SS_NOFDREF 0x0001 /* no file table ref any more */
#define SS_ISCONNECTED 0x0002 /* socket connected to a peer */
#define SS_ISCONNECTING 0x0004 /* in process of connecting to peer */
#define SS_ISDISCONNECTING 0x0008 /* in process of disconnecting */
@@ -219,15 +218,6 @@ struct socket {
#define SS_ISCONFIRMING 0x0400 /* deciding to accept connection req */
#define SS_ISDISCONNECTED 0x2000 /* socket disconnected from peer */
-/*
- * Protocols can mark a socket as SS_PROTOREF to indicate that, following
- * pru_detach, they still want the socket to persist, and will free it
- * themselves when they are done. Protocols should only ever call sofree()
- * following setting this flag in pru_detach(), and never otherwise, as
- * sofree() bypasses socket reference counting.
- */
-#define SS_PROTOREF 0x4000 /* strong protocol reference */
-
#ifdef _KERNEL
#define SOCK_MTX(so) (&(so)->so_lock)
@@ -254,6 +244,11 @@ struct socket {
KASSERT(SOLISTENING(sol), \
("%s: %p not listening", __func__, (sol))); \
} while (0)
+#define SOLISTEN_UNLOCK_ASSERT(sol) do { \
+ mtx_assert(&(sol)->so_lock, MA_NOTOWNED); \
+ KASSERT(SOLISTENING(sol), \
+ ("%s: %p not listening", __func__, (sol))); \
+} while (0)
/*
* Socket buffer locks. These are strongly preferred over SOCKBUF_LOCK(sb)
@@ -474,7 +469,6 @@ int socreate(int dom, struct socket **aso, int type, int proto,
int sodisconnect(struct socket *so);
void sodtor_set(struct socket *, so_dtor_t *);
struct sockaddr *sodupsockaddr(const struct sockaddr *sa, int mflags);
-void sofree(struct socket *so);
void sohasoutofband(struct socket *so);
int solisten(struct socket *so, int backlog, struct thread *td);
void solisten_proto(struct socket *so, int backlog);
@@ -577,8 +571,8 @@ struct xsocket {
uint32_t sb_cc;
uint32_t sb_hiwat;
uint32_t sb_mbcnt;
- uint32_t sb_mcnt;
- uint32_t sb_ccnt;
+ uint32_t sb_spare0; /* was sb_mcnt */
+ uint32_t sb_spare1; /* was sb_ccnt */
uint32_t sb_mbmax;
int32_t sb_lowat;
int32_t sb_timeo;
diff --git a/sys/sys/sockio.h b/sys/sys/sockio.h
index 93b8af28e171..b9ed4a439995 100644
--- a/sys/sys/sockio.h
+++ b/sys/sys/sockio.h
@@ -147,4 +147,7 @@
#define SIOCGIFDOWNREASON _IOWR('i', 154, struct ifdownreason)
+#define SIOCSIFCAPNV _IOW('i', 155, struct ifreq) /* set IF features */
+#define SIOCGIFCAPNV _IOWR('i', 156, struct ifreq) /* get IF features */
+
#endif /* !_SYS_SOCKIO_H_ */
diff --git a/sys/sys/syscallsubr.h b/sys/sys/syscallsubr.h
index 70e33e9244c4..5520d1ea8f89 100644
--- a/sys/sys/syscallsubr.h
+++ b/sys/sys/syscallsubr.h
@@ -119,9 +119,11 @@ int kern_connectat(struct thread *td, int dirfd, int fd,
struct sockaddr *sa);
int kern_copy_file_range(struct thread *td, int infd, off_t *inoffp,
int outfd, off_t *outoffp, size_t len, unsigned int flags);
-int kern_cpuset_getaffinity(struct thread *td, cpulevel_t level,
+int user_cpuset_getaffinity(struct thread *td, cpulevel_t level,
cpuwhich_t which, id_t id, size_t cpusetsize, cpuset_t *maskp,
const struct cpuset_copy_cb *cb);
+int kern_cpuset_getaffinity(struct thread *td, cpulevel_t level,
+ cpuwhich_t which, id_t id, size_t cpusetsize, cpuset_t *mask);
int kern_cpuset_setaffinity(struct thread *td, cpulevel_t level,
cpuwhich_t which, id_t id, cpuset_t *maskp);
int user_cpuset_setaffinity(struct thread *td, cpulevel_t level,
diff --git a/sys/sys/sysent.h b/sys/sys/sysent.h
index f677050db769..a77feb5bcbf7 100644
--- a/sys/sys/sysent.h
+++ b/sys/sys/sysent.h
@@ -137,19 +137,19 @@ struct sysentvec {
void (*sv_set_syscall_retval)(struct thread *, int);
int (*sv_fetch_syscall_args)(struct thread *);
const char **sv_syscallnames;
- vm_offset_t sv_timekeep_base;
+ vm_offset_t sv_timekeep_offset;
vm_offset_t sv_shared_page_base;
vm_offset_t sv_shared_page_len;
- vm_offset_t sv_sigcode_base;
+ vm_offset_t sv_sigcode_offset;
void *sv_shared_page_obj;
- vm_offset_t sv_vdso_base;
+ vm_offset_t sv_vdso_offset;
void (*sv_schedtail)(struct thread *);
void (*sv_thread_detach)(struct thread *);
int (*sv_trap)(struct thread *);
u_long *sv_hwcap; /* Value passed in AT_HWCAP. */
u_long *sv_hwcap2; /* Value passed in AT_HWCAP2. */
const char *(*sv_machine_arch)(struct proc *);
- vm_offset_t sv_fxrng_gen_base;
+ vm_offset_t sv_fxrng_gen_offset;
void (*sv_onexec_old)(struct thread *td);
int (*sv_onexec)(struct proc *, struct image_params *);
void (*sv_onexit)(struct proc *);
diff --git a/sys/sys/syslog.h b/sys/sys/syslog.h
index 071b68427105..ff2bd1450802 100644
--- a/sys/sys/syslog.h
+++ b/sys/sys/syslog.h
@@ -37,7 +37,6 @@
#define _PATH_LOG "/var/run/log"
#define _PATH_LOG_PRIV "/var/run/logpriv"
-#define _PATH_OLDLOG "/dev/log" /* backward compatibility */
/*
* priorities/facilities are encoded into a single 32-bit quantity, where the
diff --git a/sys/sys/systm.h b/sys/sys/systm.h
index 98637c4f4838..52ee592e9e4a 100644
--- a/sys/sys/systm.h
+++ b/sys/sys/systm.h
@@ -150,7 +150,6 @@ void *hashinit_flags(int count, struct malloc_type *type,
void *phashinit(int count, struct malloc_type *type, u_long *nentries);
void *phashinit_flags(int count, struct malloc_type *type, u_long *nentries,
int flags);
-void g_waitidle(void);
void cpu_flush_dcache(void *, size_t);
void cpu_rootconf(void);
@@ -360,8 +359,6 @@ int SAN_INTERCEPTOR(casueword)(volatile u_long *p, u_long oldval,
#endif /* !SAN_RUNTIME */
#endif /* SAN_NEEDS_INTERCEPTORS && !KCSAN */
-void realitexpire(void *);
-
int sysbeep(int hertz, sbintime_t duration);
void hardclock(int cnt, int usermode);
@@ -407,7 +404,7 @@ int getenv_array(const char *name, void *data, int size, int *psize,
#define GETENV_SIGNED true /* negative numbers allowed */
typedef uint64_t (cpu_tick_f)(void);
-void set_cputicker(cpu_tick_f *func, uint64_t freq, unsigned var);
+void set_cputicker(cpu_tick_f *func, uint64_t freq, bool isvariable);
extern cpu_tick_f *cpu_ticks;
uint64_t cpu_tickrate(void);
uint64_t cputick2usec(uint64_t tick);
diff --git a/sys/sys/tree.h b/sys/sys/tree.h
index bc01e4de910a..d82c341049c6 100644
--- a/sys/sys/tree.h
+++ b/sys/sys/tree.h
@@ -176,7 +176,7 @@ name##_SPLAY_INSERT(struct name *head, struct type *elm) \
if (SPLAY_EMPTY(head)) { \
SPLAY_LEFT(elm, field) = SPLAY_RIGHT(elm, field) = NULL; \
} else { \
- int __comp; \
+ __typeof(cmp(NULL, NULL)) __comp; \
name##_SPLAY(head, elm); \
__comp = (cmp)(elm, (head)->sph_root); \
if (__comp < 0) { \
@@ -219,7 +219,7 @@ void \
name##_SPLAY(struct name *head, struct type *elm) \
{ \
struct type __node, *__left, *__right, *__tmp; \
- int __comp; \
+ __typeof(cmp(NULL, NULL)) __comp; \
\
SPLAY_LEFT(&__node, field) = SPLAY_RIGHT(&__node, field) = NULL;\
__left = __right = &__node; \
@@ -340,6 +340,7 @@ struct { \
#define RB_RED_MASK ((__uintptr_t)3)
#define RB_FLIP_LEFT(elm, field) (RB_BITS(elm, field) ^= RB_RED_L)
#define RB_FLIP_RIGHT(elm, field) (RB_BITS(elm, field) ^= RB_RED_R)
+#define RB_FLIP_ALL(elm, field) (RB_BITS(elm, field) ^= RB_RED_MASK)
#define RB_RED_LEFT(elm, field) ((RB_BITS(elm, field) & RB_RED_L) != 0)
#define RB_RED_RIGHT(elm, field) ((RB_BITS(elm, field) & RB_RED_R) != 0)
#define RB_PARENT(elm, field) ((__typeof(RB_UP(elm, field))) \
@@ -348,8 +349,8 @@ struct { \
#define RB_EMPTY(head) (RB_ROOT(head) == NULL)
#define RB_SET_PARENT(dst, src, field) do { \
- RB_BITS(dst, field) &= RB_RED_MASK; \
- RB_BITS(dst, field) |= (__uintptr_t)src; \
+ RB_BITS(dst, field) = (__uintptr_t)src | \
+ (RB_BITS(dst, field) & RB_RED_MASK); \
} while (/*CONSTCOND*/ 0)
#define RB_SET(elm, parent, field) do { \
@@ -370,6 +371,13 @@ struct { \
#define RB_AUGMENT(x) break
#endif
+#define RB_UPDATE_AUGMENT(elm, field) do { \
+ __typeof(elm) rb_update_tmp = (elm); \
+ do { \
+ RB_AUGMENT(rb_update_tmp); \
+ } while ((rb_update_tmp = RB_PARENT(rb_update_tmp, field)) != NULL); \
+} while (0)
+
#define RB_SWAP_CHILD(head, out, in, field) do { \
if (RB_PARENT(out, field) == NULL) \
RB_ROOT(head) = (in); \
@@ -380,7 +388,6 @@ struct { \
} while (/*CONSTCOND*/ 0)
#define RB_ROTATE_LEFT(head, elm, tmp, field) do { \
- (tmp) = RB_RIGHT(elm, field); \
if ((RB_RIGHT(elm, field) = RB_LEFT(tmp, field)) != NULL) { \
RB_SET_PARENT(RB_RIGHT(elm, field), elm, field); \
} \
@@ -388,11 +395,9 @@ struct { \
RB_SWAP_CHILD(head, elm, tmp, field); \
RB_LEFT(tmp, field) = (elm); \
RB_SET_PARENT(elm, tmp, field); \
- RB_AUGMENT(elm); \
} while (/*CONSTCOND*/ 0)
#define RB_ROTATE_RIGHT(head, elm, tmp, field) do { \
- (tmp) = RB_LEFT(elm, field); \
if ((RB_LEFT(elm, field) = RB_RIGHT(tmp, field)) != NULL) { \
RB_SET_PARENT(RB_LEFT(elm, field), elm, field); \
} \
@@ -400,7 +405,6 @@ struct { \
RB_SWAP_CHILD(head, elm, tmp, field); \
RB_RIGHT(tmp, field) = (elm); \
RB_SET_PARENT(elm, tmp, field); \
- RB_AUGMENT(elm); \
} while (/*CONSTCOND*/ 0)
/* Generates prototypes and inline functions */
@@ -464,6 +468,17 @@ struct { \
attr void \
name##_RB_INSERT_COLOR(struct name *head, struct type *elm) \
{ \
+ /* \
+ * Initially, elm is a leaf. Either its parent was previously \
+ * a leaf, with two black null children, or an interior node \
+ * with a black non-null child and a red null child. The \
+ * balance criterion "the rank of any leaf is 1" precludes the \
+ * possibility of two red null children for the initial parent. \
+ * So the first loop iteration cannot lead to accessing an \
+ * uninitialized 'child', and a later iteration can only happen \
+ * when a value has been assigned to 'child' in the previous \
+ * one. \
+ */ \
struct type *child, *parent; \
while ((parent = RB_PARENT(elm, field)) != NULL) { \
if (RB_LEFT(parent, field) == elm) { \
@@ -473,19 +488,26 @@ name##_RB_INSERT_COLOR(struct name *head, struct type *elm) \
} \
RB_FLIP_RIGHT(parent, field); \
if (RB_RED_RIGHT(parent, field)) { \
+ child = elm; \
elm = parent; \
continue; \
} \
- if (!RB_RED_RIGHT(elm, field)) { \
- RB_FLIP_LEFT(elm, field); \
+ if (RB_RED_RIGHT(elm, field)) \
+ child = elm; \
+ else { \
+ /* coverity[uninit_use] */ \
RB_ROTATE_LEFT(head, elm, child, field);\
- if (RB_RED_LEFT(child, field)) \
- RB_FLIP_RIGHT(elm, field); \
- else if (RB_RED_RIGHT(child, field)) \
+ if (RB_RED_RIGHT(child, field)) \
RB_FLIP_LEFT(parent, field); \
- elm = child; \
+ if (RB_RED_LEFT(child, field)) \
+ RB_FLIP_ALL(elm, field); \
+ else \
+ RB_FLIP_LEFT(elm, field); \
+ if ((RB_BITS(child, field) & \
+ RB_RED_MASK) == 0) \
+ elm = child; \
} \
- RB_ROTATE_RIGHT(head, parent, elm, field); \
+ RB_ROTATE_RIGHT(head, parent, child, field); \
} else { \
if (RB_RED_RIGHT(parent, field)) { \
RB_FLIP_RIGHT(parent, field); \
@@ -493,25 +515,46 @@ name##_RB_INSERT_COLOR(struct name *head, struct type *elm) \
} \
RB_FLIP_LEFT(parent, field); \
if (RB_RED_LEFT(parent, field)) { \
+ child = elm; \
elm = parent; \
continue; \
} \
- if (!RB_RED_LEFT(elm, field)) { \
- RB_FLIP_RIGHT(elm, field); \
+ if (RB_RED_LEFT(elm, field)) \
+ child = elm; \
+ else { \
+ /* coverity[uninit_use] */ \
RB_ROTATE_RIGHT(head, elm, child, field);\
- if (RB_RED_RIGHT(child, field)) \
- RB_FLIP_LEFT(elm, field); \
- else if (RB_RED_LEFT(child, field)) \
+ if (RB_RED_LEFT(child, field)) \
RB_FLIP_RIGHT(parent, field); \
- elm = child; \
+ if (RB_RED_RIGHT(child, field)) \
+ RB_FLIP_ALL(elm, field); \
+ else \
+ RB_FLIP_RIGHT(elm, field); \
+ if ((RB_BITS(child, field) & \
+ RB_RED_MASK) == 0) \
+ elm = child; \
} \
- RB_ROTATE_LEFT(head, parent, elm, field); \
+ RB_ROTATE_LEFT(head, parent, child, field); \
} \
- RB_BITS(elm, field) &= ~RB_RED_MASK; \
+ RB_BITS(child, field) &= ~RB_RED_MASK; \
+ if (elm != child) \
+ RB_AUGMENT(elm); \
+ RB_AUGMENT(parent); \
break; \
} \
}
+#ifndef RB_STRICT_HST
+/*
+ * In REMOVE_COLOR, the HST paper, in figure 3, in the single-rotate case, has
+ * 'parent' with one higher rank, and then reduces its rank if 'parent' has
+ * become a leaf. This implementation always has the parent in its new position
+ * with lower rank, to avoid the leaf check. Define RB_STRICT_HST to 1 to get
+ * the behavior that HST describes.
+ */
+#define RB_STRICT_HST 0
+#endif
+
#define RB_GENERATE_REMOVE_COLOR(name, type, field, attr) \
attr void \
name##_RB_REMOVE_COLOR(struct name *head, \
@@ -526,7 +569,7 @@ name##_RB_REMOVE_COLOR(struct name *head, \
if (parent == NULL) \
return; \
} \
- do { \
+ do { \
if (RB_LEFT(parent, field) == elm) { \
if (!RB_RED_LEFT(parent, field)) { \
RB_FLIP_LEFT(parent, field); \
@@ -538,25 +581,39 @@ name##_RB_REMOVE_COLOR(struct name *head, \
continue; \
} \
sib = RB_RIGHT(parent, field); \
- if ((~RB_BITS(sib, field) & RB_RED_MASK) == 0) {\
- RB_BITS(sib, field) &= ~RB_RED_MASK; \
+ switch (RB_BITS(sib, field) & RB_RED_MASK) { \
+ case RB_RED_MASK: \
+ RB_FLIP_ALL(sib, field); \
elm = parent; \
continue; \
- } \
- RB_FLIP_RIGHT(sib, field); \
- if (RB_RED_LEFT(sib, field)) \
- RB_FLIP_LEFT(parent, field); \
- else if (!RB_RED_RIGHT(sib, field)) { \
- RB_FLIP_LEFT(parent, field); \
+ case RB_RED_R: \
+ elm = RB_LEFT(sib, field); \
RB_ROTATE_RIGHT(head, sib, elm, field); \
- if (RB_RED_RIGHT(elm, field)) \
- RB_FLIP_LEFT(sib, field); \
if (RB_RED_LEFT(elm, field)) \
- RB_FLIP_RIGHT(parent, field); \
+ RB_FLIP_ALL(parent, field); \
+ else \
+ RB_FLIP_LEFT(parent, field); \
+ if (RB_RED_RIGHT(elm, field)) \
+ RB_FLIP_ALL(sib, field); \
+ else \
+ RB_FLIP_RIGHT(sib, field); \
RB_BITS(elm, field) |= RB_RED_MASK; \
- sib = elm; \
+ break; \
+ case RB_RED_L: \
+ if (RB_STRICT_HST && elm != NULL) { \
+ RB_FLIP_RIGHT(parent, field); \
+ RB_FLIP_ALL(sib, field); \
+ elm = sib; \
+ break; \
+ } \
+ RB_FLIP_LEFT(parent, field); \
+ /* FALLTHROUGH */ \
+ default: \
+ RB_FLIP_RIGHT(sib, field); \
+ elm = sib; \
+ break; \
} \
- RB_ROTATE_LEFT(head, parent, sib, field); \
+ RB_ROTATE_LEFT(head, parent, elm, field); \
} else { \
if (!RB_RED_RIGHT(parent, field)) { \
RB_FLIP_RIGHT(parent, field); \
@@ -568,26 +625,42 @@ name##_RB_REMOVE_COLOR(struct name *head, \
continue; \
} \
sib = RB_LEFT(parent, field); \
- if ((~RB_BITS(sib, field) & RB_RED_MASK) == 0) {\
- RB_BITS(sib, field) &= ~RB_RED_MASK; \
+ switch (RB_BITS(sib, field) & RB_RED_MASK) { \
+ case RB_RED_MASK: \
+ RB_FLIP_ALL(sib, field); \
elm = parent; \
continue; \
- } \
- RB_FLIP_LEFT(sib, field); \
- if (RB_RED_RIGHT(sib, field)) \
- RB_FLIP_RIGHT(parent, field); \
- else if (!RB_RED_LEFT(sib, field)) { \
- RB_FLIP_RIGHT(parent, field); \
+ case RB_RED_L: \
+ elm = RB_RIGHT(sib, field); \
RB_ROTATE_LEFT(head, sib, elm, field); \
- if (RB_RED_LEFT(elm, field)) \
- RB_FLIP_RIGHT(sib, field); \
if (RB_RED_RIGHT(elm, field)) \
- RB_FLIP_LEFT(parent, field); \
+ RB_FLIP_ALL(parent, field); \
+ else \
+ RB_FLIP_RIGHT(parent, field); \
+ if (RB_RED_LEFT(elm, field)) \
+ RB_FLIP_ALL(sib, field); \
+ else \
+ RB_FLIP_LEFT(sib, field); \
RB_BITS(elm, field) |= RB_RED_MASK; \
- sib = elm; \
+ break; \
+ case RB_RED_R: \
+ if (RB_STRICT_HST && elm != NULL) { \
+ RB_FLIP_LEFT(parent, field); \
+ RB_FLIP_ALL(sib, field); \
+ elm = sib; \
+ break; \
+ } \
+ RB_FLIP_RIGHT(parent, field); \
+ /* FALLTHROUGH */ \
+ default: \
+ RB_FLIP_LEFT(sib, field); \
+ elm = sib; \
+ break; \
} \
- RB_ROTATE_RIGHT(head, parent, sib, field); \
+ RB_ROTATE_RIGHT(head, parent, elm, field); \
} \
+ if (sib != elm) \
+ RB_AUGMENT(sib); \
break; \
} while ((parent = RB_PARENT(elm, field)) != NULL); \
}
@@ -625,11 +698,11 @@ name##_RB_REMOVE(struct name *head, struct type *elm) \
RB_SWAP_CHILD(head, old, elm, field); \
if (child != NULL) \
RB_SET_PARENT(child, parent, field); \
- if (parent != NULL) \
+ if (parent != NULL) { \
name##_RB_REMOVE_COLOR(head, parent, child); \
- while (parent != NULL) { \
- RB_AUGMENT(parent); \
- parent = RB_PARENT(parent, field); \
+ if (parent == elm && RB_LEFT(parent, field) == NULL) \
+ parent = RB_PARENT(parent, field); \
+ RB_UPDATE_AUGMENT(parent, field); \
} \
return (old); \
}
@@ -641,7 +714,7 @@ name##_RB_INSERT(struct name *head, struct type *elm) \
{ \
struct type *tmp; \
struct type *parent = NULL; \
- int comp = 0; \
+ __typeof(cmp(NULL, NULL)) comp = 0; \
tmp = RB_ROOT(head); \
while (tmp) { \
parent = tmp; \
@@ -661,10 +734,7 @@ name##_RB_INSERT(struct name *head, struct type *elm) \
else \
RB_RIGHT(parent, field) = elm; \
name##_RB_INSERT_COLOR(head, elm); \
- while (elm != NULL) { \
- RB_AUGMENT(elm); \
- elm = RB_PARENT(elm, field); \
- } \
+ RB_UPDATE_AUGMENT(elm, field); \
return (NULL); \
}
@@ -674,7 +744,7 @@ attr struct type * \
name##_RB_FIND(struct name *head, struct type *elm) \
{ \
struct type *tmp = RB_ROOT(head); \
- int comp; \
+ __typeof(cmp(NULL, NULL)) comp; \
while (tmp) { \
comp = cmp(elm, tmp); \
if (comp < 0) \
@@ -694,7 +764,7 @@ name##_RB_NFIND(struct name *head, struct type *elm) \
{ \
struct type *tmp = RB_ROOT(head); \
struct type *res = NULL; \
- int comp; \
+ __typeof(cmp(NULL, NULL)) comp; \
while (tmp) { \
comp = cmp(elm, tmp); \
if (comp < 0) { \
@@ -719,15 +789,10 @@ name##_RB_NEXT(struct type *elm) \
while (RB_LEFT(elm, field)) \
elm = RB_LEFT(elm, field); \
} else { \
- if (RB_PARENT(elm, field) && \
- (elm == RB_LEFT(RB_PARENT(elm, field), field))) \
- elm = RB_PARENT(elm, field); \
- else { \
- while (RB_PARENT(elm, field) && \
- (elm == RB_RIGHT(RB_PARENT(elm, field), field)))\
- elm = RB_PARENT(elm, field); \
+ while (RB_PARENT(elm, field) && \
+ (elm == RB_RIGHT(RB_PARENT(elm, field), field))) \
elm = RB_PARENT(elm, field); \
- } \
+ elm = RB_PARENT(elm, field); \
} \
return (elm); \
}
@@ -742,15 +807,10 @@ name##_RB_PREV(struct type *elm) \
while (RB_RIGHT(elm, field)) \
elm = RB_RIGHT(elm, field); \
} else { \
- if (RB_PARENT(elm, field) && \
- (elm == RB_RIGHT(RB_PARENT(elm, field), field))) \
- elm = RB_PARENT(elm, field); \
- else { \
- while (RB_PARENT(elm, field) && \
- (elm == RB_LEFT(RB_PARENT(elm, field), field)))\
- elm = RB_PARENT(elm, field); \
+ while (RB_PARENT(elm, field) && \
+ (elm == RB_LEFT(RB_PARENT(elm, field), field))) \
elm = RB_PARENT(elm, field); \
- } \
+ elm = RB_PARENT(elm, field); \
} \
return (elm); \
}
diff --git a/sys/sys/user.h b/sys/sys/user.h
index cf64f8e8eda4..edbe6a8655ff 100644
--- a/sys/sys/user.h
+++ b/sys/sys/user.h
@@ -420,8 +420,9 @@ struct kinfo_file {
uint64_t kf_pipe_addr;
uint64_t kf_pipe_peer;
uint32_t kf_pipe_buffer_cnt;
- /* Round to 64 bit alignment. */
- uint32_t kf_pipe_pad0[3];
+ uint32_t kf_pipe_buffer_in;
+ uint32_t kf_pipe_buffer_out;
+ uint32_t kf_pipe_buffer_size;
} kf_pipe;
struct {
uint32_t kf_spareint[4];
@@ -440,7 +441,14 @@ struct kinfo_file {
struct {
uint64_t kf_eventfd_value;
uint32_t kf_eventfd_flags;
+ uint32_t kf_eventfd_spareint[3];
+ uint64_t kf_eventfd_addr;
} kf_eventfd;
+ struct {
+ uint64_t kf_kqueue_addr;
+ int32_t kf_kqueue_count;
+ int32_t kf_kqueue_state;
+ } kf_kqueue;
} kf_un;
};
uint16_t kf_status; /* Status flags. */
@@ -479,7 +487,7 @@ struct kinfo_lockf {
* another process as a series of entries.
*/
#define KVME_TYPE_NONE 0
-#define KVME_TYPE_DEFAULT 1
+#define KVME_TYPE_DEFAULT 1 /* no longer returned */
#define KVME_TYPE_VNODE 2
#define KVME_TYPE_SWAP 3
#define KVME_TYPE_DEVICE 4
@@ -625,6 +633,7 @@ struct kinfo_sigtramp {
#define KMAP_FLAG_ASLR_IGNSTART 0x04 /* ASLR may map into sbrk grow region */
#define KMAP_FLAG_WXORX 0x08 /* W^X mapping policy is enforced */
#define KMAP_FLAG_ASLR_STACK 0x10 /* the stack location is randomized */
+#define KMAP_FLAG_ASLR_SHARED_PAGE 0x20 /* the shared page location is randomized */
struct kinfo_vm_layout {
uintptr_t kvm_min_user_addr;
@@ -636,7 +645,9 @@ struct kinfo_vm_layout {
uintptr_t kvm_stack_addr;
size_t kvm_stack_size;
int kvm_map_flags;
- uintptr_t kvm_spare[14];
+ uintptr_t kvm_shp_addr;
+ size_t kvm_shp_size;
+ uintptr_t kvm_spare[12];
};
#ifdef _KERNEL