summaryrefslogtreecommitdiffstats
path: root/freebsd/sys/sys
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-04-04 09:36:57 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-04-04 14:46:23 +0200
commitde8a76da2f374792594ce03a203b3f30e4889f6f (patch)
tree12b5e1e59358005c3c522955c08aee4795e4829c /freebsd/sys/sys
parentEnable bridging by default (diff)
downloadrtems-libbsd-de8a76da2f374792594ce03a203b3f30e4889f6f.tar.bz2
Update to FreeBSD head 2017-04-04
Git mirror commit 642b174daddbd0efd9bb5f242c43f4ab4db6869f.
Diffstat (limited to 'freebsd/sys/sys')
-rw-r--r--freebsd/sys/sys/_callout.h2
-rw-r--r--freebsd/sys/sys/_sockaddr_storage.h2
-rw-r--r--freebsd/sys/sys/ata.h2
-rw-r--r--freebsd/sys/sys/bitstring.h2
-rw-r--r--freebsd/sys/sys/buf.h2
-rw-r--r--freebsd/sys/sys/buf_ring.h6
-rw-r--r--freebsd/sys/sys/bufobj.h6
-rw-r--r--freebsd/sys/sys/bus.h13
-rw-r--r--freebsd/sys/sys/callout.h2
-rw-r--r--freebsd/sys/sys/capability.h1
-rw-r--r--freebsd/sys/sys/conf.h2
-rw-r--r--freebsd/sys/sys/ctype.h2
-rw-r--r--freebsd/sys/sys/domain.h2
-rw-r--r--freebsd/sys/sys/eventvar.h2
-rw-r--r--freebsd/sys/sys/file.h10
-rw-r--r--freebsd/sys/sys/filedesc.h2
-rw-r--r--freebsd/sys/sys/gtaskqueue.h124
-rw-r--r--freebsd/sys/sys/kernel.h2
-rw-r--r--freebsd/sys/sys/libkern.h40
-rw-r--r--freebsd/sys/sys/limits.h2
-rw-r--r--freebsd/sys/sys/linker.h5
-rw-r--r--freebsd/sys/sys/lockmgr.h4
-rw-r--r--freebsd/sys/sys/lockstat.h15
-rw-r--r--freebsd/sys/sys/malloc.h2
-rw-r--r--freebsd/sys/sys/mbuf.h28
-rw-r--r--freebsd/sys/sys/mount.h2
-rw-r--r--freebsd/sys/sys/mutex.h56
-rw-r--r--freebsd/sys/sys/nlist_aout.h2
-rw-r--r--freebsd/sys/sys/nv.h246
-rw-r--r--freebsd/sys/sys/pcpu.h2
-rwxr-xr-xfreebsd/sys/sys/pipe.h2
-rw-r--r--freebsd/sys/sys/proc.h29
-rw-r--r--freebsd/sys/sys/protosw.h2
-rw-r--r--freebsd/sys/sys/reboot.h2
-rw-r--r--freebsd/sys/sys/resourcevar.h2
-rw-r--r--freebsd/sys/sys/rwlock.h38
-rw-r--r--freebsd/sys/sys/sbuf.h1
-rw-r--r--freebsd/sys/sys/sdt.h4
-rw-r--r--freebsd/sys/sys/selinfo.h2
-rw-r--r--freebsd/sys/sys/sigio.h2
-rw-r--r--freebsd/sys/sys/signalvar.h10
-rw-r--r--freebsd/sys/sys/sleepqueue.h3
-rw-r--r--freebsd/sys/sys/slicer.h24
-rw-r--r--freebsd/sys/sys/sockbuf.h2
-rw-r--r--freebsd/sys/sys/socket.h57
-rw-r--r--freebsd/sys/sys/socketvar.h9
-rw-r--r--freebsd/sys/sys/sockopt.h4
-rw-r--r--freebsd/sys/sys/sockstate.h2
-rw-r--r--freebsd/sys/sys/stdint.h7
-rw-r--r--freebsd/sys/sys/sx.h77
-rw-r--r--freebsd/sys/sys/sysctl.h5
-rw-r--r--freebsd/sys/sys/syslog.h2
-rw-r--r--freebsd/sys/sys/sysproto.h133
-rw-r--r--freebsd/sys/sys/systm.h103
-rw-r--r--freebsd/sys/sys/taskqueue.h3
-rw-r--r--freebsd/sys/sys/tty.h1
-rw-r--r--freebsd/sys/sys/ttyqueue.h4
-rw-r--r--freebsd/sys/sys/ucred.h2
-rw-r--r--freebsd/sys/sys/un.h2
-rw-r--r--freebsd/sys/sys/unpcb.h2
-rw-r--r--freebsd/sys/sys/user.h2
-rw-r--r--freebsd/sys/sys/vmmeter.h2
-rw-r--r--freebsd/sys/sys/vnode.h2
63 files changed, 823 insertions, 307 deletions
diff --git a/freebsd/sys/sys/_callout.h b/freebsd/sys/sys/_callout.h
index a9134c8d..650073d3 100644
--- a/freebsd/sys/sys/_callout.h
+++ b/freebsd/sys/sys/_callout.h
@@ -15,7 +15,7 @@
* 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.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
diff --git a/freebsd/sys/sys/_sockaddr_storage.h b/freebsd/sys/sys/_sockaddr_storage.h
index 5c0048b5..189e16d8 100644
--- a/freebsd/sys/sys/_sockaddr_storage.h
+++ b/freebsd/sys/sys/_sockaddr_storage.h
@@ -10,7 +10,7 @@
* 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.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
diff --git a/freebsd/sys/sys/ata.h b/freebsd/sys/sys/ata.h
index 72104140..9737487d 100644
--- a/freebsd/sys/sys/ata.h
+++ b/freebsd/sys/sys/ata.h
@@ -682,7 +682,7 @@ struct atapi_sense {
#define ATA_IDL_ATA_STRINGS 0x05 /* ATA Strings */
#define ATA_IDL_SECURITY 0x06 /* Security */
#define ATA_IDL_PARALLEL_ATA 0x07 /* Parallel ATA */
-#define ATA_IDL_SERIAL_ATA 0x08 /* Seiral ATA */
+#define ATA_IDL_SERIAL_ATA 0x08 /* Serial ATA */
#define ATA_IDL_ZDI 0x09 /* Zoned Device Information */
struct ata_gp_log_dir {
diff --git a/freebsd/sys/sys/bitstring.h b/freebsd/sys/sys/bitstring.h
index 32465d11..18c91878 100644
--- a/freebsd/sys/sys/bitstring.h
+++ b/freebsd/sys/sys/bitstring.h
@@ -13,7 +13,7 @@
* 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.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
diff --git a/freebsd/sys/sys/buf.h b/freebsd/sys/sys/buf.h
index 8688056f..ea6019c1 100644
--- a/freebsd/sys/sys/buf.h
+++ b/freebsd/sys/sys/buf.h
@@ -15,7 +15,7 @@
* 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.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
diff --git a/freebsd/sys/sys/buf_ring.h b/freebsd/sys/sys/buf_ring.h
index 88c28157..86534564 100644
--- a/freebsd/sys/sys/buf_ring.h
+++ b/freebsd/sys/sys/buf_ring.h
@@ -250,16 +250,16 @@ buf_ring_advance_sc(struct buf_ring *br)
/*
* Used to return a buffer (most likely already there)
- * to the top od the ring. The caller should *not*
+ * to the top of the ring. The caller should *not*
* have used any dequeue to pull it out of the ring
* but instead should have used the peek() function.
* This is normally used where the transmit queue
- * of a driver is full, and an mubf must be returned.
+ * of a driver is full, and an mbuf must be returned.
* Most likely whats in the ring-buffer is what
* is being put back (since it was not removed), but
* sometimes the lower transmit function may have
* done a pullup or other function that will have
- * changed it. As an optimzation we always put it
+ * changed it. As an optimization we always put it
* back (since jhb says the store is probably cheaper),
* if we have to do a multi-queue version we will need
* the compare and an atomic.
diff --git a/freebsd/sys/sys/bufobj.h b/freebsd/sys/sys/bufobj.h
index 657702c1..2dc440a6 100644
--- a/freebsd/sys/sys/bufobj.h
+++ b/freebsd/sys/sys/bufobj.h
@@ -88,6 +88,12 @@ struct buf_ops {
#define BO_WRITE(bo, bp) ((bo)->bo_ops->bop_write((bp)))
#define BO_BDFLUSH(bo, bp) ((bo)->bo_ops->bop_bdflush((bo), (bp)))
+/*
+ * Locking notes:
+ * 'S' is sync_mtx
+ * 'v' is the vnode lock which embeds the bufobj.
+ * '-' Constant and unchanging after initialization.
+ */
struct bufobj {
struct rwlock bo_lock; /* Lock which protects "i" things */
struct buf_ops *bo_ops; /* - Buffer operations */
diff --git a/freebsd/sys/sys/bus.h b/freebsd/sys/sys/bus.h
index e62c9bab..61cb5b9c 100644
--- a/freebsd/sys/sys/bus.h
+++ b/freebsd/sys/sys/bus.h
@@ -265,6 +265,7 @@ enum intr_type {
};
enum intr_trigger {
+ INTR_TRIGGER_INVALID = -1,
INTR_TRIGGER_CONFORM = 0,
INTR_TRIGGER_EDGE = 1,
INTR_TRIGGER_LEVEL = 2
@@ -392,14 +393,14 @@ int resource_list_print_type(struct resource_list *rl,
const char *format);
/*
- * The root bus, to which all top-level busses are attached.
+ * The root bus, to which all top-level buses are attached.
*/
extern device_t root_bus;
extern devclass_t root_devclass;
void root_bus_configure(void);
/*
- * Useful functions for implementing busses.
+ * Useful functions for implementing buses.
*/
int bus_generic_activate_resource(device_t dev, device_t child, int type,
@@ -662,7 +663,7 @@ void bus_data_generation_update(void);
* Some convenience defines for probe routines to return. These are just
* suggested values, and there's nothing magical about them.
* BUS_PROBE_SPECIFIC is for devices that cannot be reprobed, and that no
- * possible other driver may exist (typically legacy drivers who don't fallow
+ * possible other driver may exist (typically legacy drivers who don't follow
* all the rules, or special needs drivers). BUS_PROBE_VENDOR is the
* suggested value that vendor supplied drivers use. This is for source or
* binary drivers that are not yet integrated into the FreeBSD tree. Its use
@@ -675,7 +676,7 @@ void bus_data_generation_update(void);
* supports the newer ones would return BUS_PROBE_DEFAULT. BUS_PROBE_GENERIC
* is for drivers that wish to have a generic form and a specialized form,
* like is done with the pci bus and the acpi pci bus. BUS_PROBE_HOOVER is
- * for those busses that implement a generic device place-holder for devices on
+ * for those buses that implement a generic device placeholder for devices on
* the bus that have no more specific driver for them (aka ugen).
* BUS_PROBE_NOWILDCARD or lower means that the device isn't really bidding
* for a device node, but accepts only devices that its parent has told it
@@ -699,7 +700,7 @@ void bus_data_generation_update(void);
* probed in earlier passes.
*/
#define BUS_PASS_ROOT 0 /* Used to attach root0. */
-#define BUS_PASS_BUS 10 /* Busses and bridges. */
+#define BUS_PASS_BUS 10 /* Buses and bridges. */
#define BUS_PASS_CPU 20 /* CPU devices. */
#define BUS_PASS_RESOURCE 30 /* Resource discovery. */
#define BUS_PASS_INTERRUPT 40 /* Interrupt controllers. */
@@ -734,7 +735,7 @@ struct module;
int driver_module_handler(struct module *, int, void *);
/**
- * Module support for automatically adding drivers to busses.
+ * Module support for automatically adding drivers to buses.
*/
struct driver_module_data {
int (*dmd_chainevh)(struct module *, int, void *);
diff --git a/freebsd/sys/sys/callout.h b/freebsd/sys/sys/callout.h
index f58fa587..b219052f 100644
--- a/freebsd/sys/sys/callout.h
+++ b/freebsd/sys/sys/callout.h
@@ -15,7 +15,7 @@
* 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.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
diff --git a/freebsd/sys/sys/capability.h b/freebsd/sys/sys/capability.h
index 8b1c229f..3bdaf203 100644
--- a/freebsd/sys/sys/capability.h
+++ b/freebsd/sys/sys/capability.h
@@ -38,6 +38,7 @@
#ifndef _SYS_CAPABILITY_H_
#define _SYS_CAPABILITY_H_
+#warning this file includes <sys/capability.h> which is deprecated
#include <sys/capsicum.h>
#endif /* !_SYS_CAPABILITY_H_ */
diff --git a/freebsd/sys/sys/conf.h b/freebsd/sys/sys/conf.h
index 084cab22..8d39c629 100644
--- a/freebsd/sys/sys/conf.h
+++ b/freebsd/sys/sys/conf.h
@@ -17,7 +17,7 @@
* 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.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
diff --git a/freebsd/sys/sys/ctype.h b/freebsd/sys/sys/ctype.h
index 5022d40c..57b848b5 100644
--- a/freebsd/sys/sys/ctype.h
+++ b/freebsd/sys/sys/ctype.h
@@ -15,7 +15,7 @@
* 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.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
diff --git a/freebsd/sys/sys/domain.h b/freebsd/sys/sys/domain.h
index 1817e788..64da7ed7 100644
--- a/freebsd/sys/sys/domain.h
+++ b/freebsd/sys/sys/domain.h
@@ -10,7 +10,7 @@
* 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.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
diff --git a/freebsd/sys/sys/eventvar.h b/freebsd/sys/sys/eventvar.h
index c7e46230..335a6191 100644
--- a/freebsd/sys/sys/eventvar.h
+++ b/freebsd/sys/sys/eventvar.h
@@ -30,7 +30,7 @@
#define _SYS_EVENTVAR_H_
#ifndef _KERNEL
-#error "no user-servicable parts inside"
+#error "no user-serviceable parts inside"
#endif
#include <sys/_task.h>
diff --git a/freebsd/sys/sys/file.h b/freebsd/sys/sys/file.h
index 4fcbbde0..092362b4 100644
--- a/freebsd/sys/sys/file.h
+++ b/freebsd/sys/sys/file.h
@@ -10,7 +10,7 @@
* 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.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -50,11 +50,10 @@ struct thread;
struct uio;
struct knote;
struct vnode;
-struct socket;
-
#endif /* _KERNEL */
+#define DTYPE_NONE 0 /* not yet initialized */
#define DTYPE_VNODE 1 /* file */
#define DTYPE_SOCKET 2 /* communications endpoint */
#define DTYPE_PIPE 3 /* pipe */
@@ -68,6 +67,7 @@ struct socket;
#define DTYPE_DEV 11 /* Device specific fd type */
#define DTYPE_PROCDESC 12 /* process descriptor */
#define DTYPE_LINUXEFD 13 /* emulation eventfd type */
+#define DTYPE_LINUXTFD 14 /* emulation timerfd type */
#ifdef _KERNEL
@@ -392,10 +392,6 @@ int fgetvp_read(struct thread *td, int fd, cap_rights_t *rightsp,
int fgetvp_write(struct thread *td, int fd, cap_rights_t *rightsp,
struct vnode **vpp);
-int fgetsock(struct thread *td, int fd, cap_rights_t *rightsp,
- struct socket **spp, u_int *fflagp);
-void fputsock(struct socket *sp);
-
static __inline int
_fnoop(void)
{
diff --git a/freebsd/sys/sys/filedesc.h b/freebsd/sys/sys/filedesc.h
index 1e99bfae..6b4dd1ee 100644
--- a/freebsd/sys/sys/filedesc.h
+++ b/freebsd/sys/sys/filedesc.h
@@ -10,7 +10,7 @@
* 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.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
diff --git a/freebsd/sys/sys/gtaskqueue.h b/freebsd/sys/sys/gtaskqueue.h
new file mode 100644
index 00000000..c9b34e4f
--- /dev/null
+++ b/freebsd/sys/sys/gtaskqueue.h
@@ -0,0 +1,124 @@
+/*-
+ * Copyright (c) 2014 Jeffrey Roberson <jeff@freebsd.org>
+ * Copyright (c) 2016 Matthew Macy <mmacy@nextbsd.org>
+ * 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 AUTHOR 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 AUTHOR 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 _SYS_GTASKQUEUE_H_
+#define _SYS_GTASKQUEUE_H_
+#include <sys/taskqueue.h>
+
+#ifndef _KERNEL
+#error "no user-serviceable parts inside"
+#endif
+
+struct gtaskqueue;
+typedef void (*gtaskqueue_enqueue_fn)(void *context);
+
+/*
+ * Taskqueue groups. Manages dynamic thread groups and irq binding for
+ * device and other tasks.
+ */
+
+void gtaskqueue_block(struct gtaskqueue *queue);
+void gtaskqueue_unblock(struct gtaskqueue *queue);
+
+int gtaskqueue_cancel(struct gtaskqueue *queue, struct gtask *gtask);
+void gtaskqueue_drain(struct gtaskqueue *queue, struct gtask *task);
+void gtaskqueue_drain_all(struct gtaskqueue *queue);
+
+int grouptaskqueue_enqueue(struct gtaskqueue *queue, struct gtask *task);
+void taskqgroup_attach(struct taskqgroup *qgroup, struct grouptask *grptask,
+ void *uniq, int irq, char *name);
+int taskqgroup_attach_cpu(struct taskqgroup *qgroup, struct grouptask *grptask,
+ void *uniq, int cpu, int irq, char *name);
+void taskqgroup_detach(struct taskqgroup *qgroup, struct grouptask *gtask);
+struct taskqgroup *taskqgroup_create(char *name);
+void taskqgroup_destroy(struct taskqgroup *qgroup);
+int taskqgroup_adjust(struct taskqgroup *qgroup, int cnt, int stride);
+
+#define TASK_ENQUEUED 0x1
+#define TASK_SKIP_WAKEUP 0x2
+
+
+#define GTASK_INIT(task, flags, priority, func, context) do { \
+ (task)->ta_flags = flags; \
+ (task)->ta_priority = (priority); \
+ (task)->ta_func = (func); \
+ (task)->ta_context = (context); \
+} while (0)
+
+#define GROUPTASK_INIT(gtask, priority, func, context) \
+ GTASK_INIT(&(gtask)->gt_task, TASK_SKIP_WAKEUP, priority, func, context)
+
+#define GROUPTASK_ENQUEUE(gtask) \
+ grouptaskqueue_enqueue((gtask)->gt_taskqueue, &(gtask)->gt_task)
+
+#define TASKQGROUP_DECLARE(name) \
+extern struct taskqgroup *qgroup_##name
+
+#ifdef EARLY_AP_STARTUP
+#define TASKQGROUP_DEFINE(name, cnt, stride) \
+ \
+struct taskqgroup *qgroup_##name; \
+ \
+static void \
+taskqgroup_define_##name(void *arg) \
+{ \
+ qgroup_##name = taskqgroup_create(#name); \
+ taskqgroup_adjust(qgroup_##name, (cnt), (stride)); \
+} \
+ \
+SYSINIT(taskqgroup_##name, SI_SUB_INIT_IF, SI_ORDER_FIRST, \
+ taskqgroup_define_##name, NULL)
+#else /* !EARLY_AP_STARTUP */
+#define TASKQGROUP_DEFINE(name, cnt, stride) \
+ \
+struct taskqgroup *qgroup_##name; \
+ \
+static void \
+taskqgroup_define_##name(void *arg) \
+{ \
+ qgroup_##name = taskqgroup_create(#name); \
+} \
+ \
+SYSINIT(taskqgroup_##name, SI_SUB_INIT_IF, SI_ORDER_FIRST, \
+ taskqgroup_define_##name, NULL); \
+ \
+static void \
+taskqgroup_adjust_##name(void *arg) \
+{ \
+ taskqgroup_adjust(qgroup_##name, (cnt), (stride)); \
+} \
+ \
+SYSINIT(taskqgroup_adj_##name, SI_SUB_SMP, SI_ORDER_ANY, \
+ taskqgroup_adjust_##name, NULL)
+#endif /* EARLY_AP_STARTUP */
+
+TASKQGROUP_DECLARE(net);
+TASKQGROUP_DECLARE(softirq);
+
+#endif /* !_SYS_GTASKQUEUE_H_ */
diff --git a/freebsd/sys/sys/kernel.h b/freebsd/sys/sys/kernel.h
index 8f8f4ea7..3ca8af6e 100644
--- a/freebsd/sys/sys/kernel.h
+++ b/freebsd/sys/sys/kernel.h
@@ -394,7 +394,7 @@ struct tunable_uint64 {
uint64_t *var;
};
#define TUNABLE_UINT64(path, var) \
- static struct tunable_ulong __CONCAT(__tunable_uint64_, __LINE__) = { \
+ static struct tunable_uint64 __CONCAT(__tunable_uint64_, __LINE__) = { \
(path), \
(var), \
}; \
diff --git a/freebsd/sys/sys/libkern.h b/freebsd/sys/sys/libkern.h
index c8fcd877..5986a740 100644
--- a/freebsd/sys/sys/libkern.h
+++ b/freebsd/sys/sys/libkern.h
@@ -10,7 +10,7 @@
* 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.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -53,9 +53,36 @@ extern u_char const bcd2bin_data[];
extern u_char const bin2bcd_data[];
extern char const hex2ascii_data[];
-#define bcd2bin(bcd) (bcd2bin_data[bcd])
-#define bin2bcd(bin) (bin2bcd_data[bin])
-#define hex2ascii(hex) (hex2ascii_data[hex])
+#define LIBKERN_LEN_BCD2BIN 154
+#define LIBKERN_LEN_BIN2BCD 100
+#define LIBKERN_LEN_HEX2ASCII 36
+
+static inline u_char
+bcd2bin(int bcd)
+{
+
+ KASSERT(bcd >= 0 && bcd < LIBKERN_LEN_BCD2BIN,
+ ("invalid bcd %d", bcd));
+ return (bcd2bin_data[bcd]);
+}
+
+static inline u_char
+bin2bcd(int bin)
+{
+
+ KASSERT(bin >= 0 && bin < LIBKERN_LEN_BIN2BCD,
+ ("invalid bin %d", bin));
+ return (bin2bcd_data[bin]);
+}
+
+static inline char
+hex2ascii(int hex)
+{
+
+ KASSERT(hex >= 0 && hex < LIBKERN_LEN_HEX2ASCII,
+ ("invalid hex %d", hex));
+ return (hex2ascii_data[hex]);
+}
static __inline int imax(int a, int b) { return (a > b ? a : b); }
static __inline int imin(int a, int b) { return (a < b ? a : b); }
@@ -231,6 +258,11 @@ crc32(const void *buf, size_t size)
uint32_t
calculate_crc32c(uint32_t crc32c, const unsigned char *buffer,
unsigned int length);
+#ifdef _KERNEL
+#if defined(__amd64__) || defined(__i386__)
+uint32_t sse42_crc32c(uint32_t, const unsigned char *, unsigned);
+#endif
+#endif
LIBKERN_INLINE void *memset(void *, int, size_t);
diff --git a/freebsd/sys/sys/limits.h b/freebsd/sys/sys/limits.h
index edb21d8d..fdf98ba3 100644
--- a/freebsd/sys/sys/limits.h
+++ b/freebsd/sys/sys/limits.h
@@ -10,7 +10,7 @@
* 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.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
diff --git a/freebsd/sys/sys/linker.h b/freebsd/sys/sys/linker.h
index eecb4cdd..330af02e 100644
--- a/freebsd/sys/sys/linker.h
+++ b/freebsd/sys/sys/linker.h
@@ -143,7 +143,7 @@ int linker_file_foreach(linker_predicate_t *_predicate, void *_context);
* Lookup a symbol in a file. If deps is TRUE, look in dependencies
* if not found in file.
*/
-caddr_t linker_file_lookup_symbol(linker_file_t _file, const char* _name,
+caddr_t linker_file_lookup_symbol(linker_file_t _file, const char* _name,
int _deps);
/*
@@ -157,7 +157,7 @@ int linker_file_lookup_set(linker_file_t _file, const char *_name,
/*
* List all functions in a file.
*/
-int linker_file_function_listall(linker_file_t,
+int linker_file_function_listall(linker_file_t,
linker_function_nameval_callback_t, void *);
/*
@@ -217,6 +217,7 @@ void *linker_hwpmc_list_objects(void);
#define MODINFOMD_CTORS_ADDR 0x000a /* address of .ctors */
#define MODINFOMD_CTORS_SIZE 0x000b /* size of .ctors */
#define MODINFOMD_FW_HANDLE 0x000c /* Firmware dependent handle */
+#define MODINFOMD_KEYBUF 0x000d /* Crypto key intake buffer */
#define MODINFOMD_NOCOPY 0x8000 /* don't copy this metadata to the kernel */
#define MODINFOMD_DEPLIST (0x4001 | MODINFOMD_NOCOPY) /* depends on */
diff --git a/freebsd/sys/sys/lockmgr.h b/freebsd/sys/sys/lockmgr.h
index 3019e4c4..60749228 100644
--- a/freebsd/sys/sys/lockmgr.h
+++ b/freebsd/sys/sys/lockmgr.h
@@ -68,6 +68,10 @@ struct thread;
*/
int __lockmgr_args(struct lock *lk, u_int flags, struct lock_object *ilk,
const char *wmesg, int prio, int timo, const char *file, int line);
+int lockmgr_lock_fast_path(struct lock *lk, u_int flags,
+ struct lock_object *ilk, const char *file, int line);
+int lockmgr_unlock_fast_path(struct lock *lk, u_int flags,
+ struct lock_object *ilk);
#if defined(INVARIANTS) || defined(INVARIANT_SUPPORT)
void _lockmgr_assert(const struct lock *lk, int what, const char *file, int line);
#endif
diff --git a/freebsd/sys/sys/lockstat.h b/freebsd/sys/sys/lockstat.h
index 1fc79ffe..705f3bb5 100644
--- a/freebsd/sys/sys/lockstat.h
+++ b/freebsd/sys/sys/lockstat.h
@@ -68,7 +68,7 @@ SDT_PROBE_DECLARE(lockstat, , , thread__spin);
#define LOCKSTAT_WRITER 0
#define LOCKSTAT_READER 1
-extern int lockstat_enabled;
+extern volatile int lockstat_enabled;
#ifdef KDTRACE_HOOKS
@@ -107,6 +107,13 @@ extern int lockstat_enabled;
LOCKSTAT_RECORD1(probe, lp, a); \
} while (0)
+#ifndef LOCK_PROFILING
+#define LOCKSTAT_PROFILE_ENABLED(probe) __predict_false(lockstat_enabled)
+#define LOCKSTAT_OOL_PROFILE_ENABLED(probe) LOCKSTAT_PROFILE_ENABLED(probe)
+#else
+#define LOCKSTAT_OOL_PROFILE_ENABLED(probe) 1
+#endif
+
struct lock_object;
uint64_t lockstat_nsecs(struct lock_object *);
@@ -130,6 +137,12 @@ uint64_t lockstat_nsecs(struct lock_object *);
#define LOCKSTAT_PROFILE_RELEASE_RWLOCK(probe, lp, a) \
LOCKSTAT_PROFILE_RELEASE_LOCK(probe, lp)
+#ifndef LOCK_PROFILING
+#define LOCKSTAT_PROFILE_ENABLED(probe) 0
+#endif
+#define LOCKSTAT_OOL_PROFILE_ENABLED(probe) 1
+
#endif /* !KDTRACE_HOOKS */
+
#endif /* _KERNEL */
#endif /* _SYS_LOCKSTAT_H */
diff --git a/freebsd/sys/sys/malloc.h b/freebsd/sys/sys/malloc.h
index 310d2551..c59456de 100644
--- a/freebsd/sys/sys/malloc.h
+++ b/freebsd/sys/sys/malloc.h
@@ -12,7 +12,7 @@
* 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.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
diff --git a/freebsd/sys/sys/mbuf.h b/freebsd/sys/sys/mbuf.h
index 9ce52a17..4631a535 100644
--- a/freebsd/sys/sys/mbuf.h
+++ b/freebsd/sys/sys/mbuf.h
@@ -130,6 +130,14 @@ struct m_tag {
};
/*
+ * Static network interface owned tag.
+ * Allocated through ifp->if_snd_tag_alloc().
+ */
+struct m_snd_tag {
+ struct ifnet *ifp; /* network interface tag belongs to */
+};
+
+/*
* Record/packet header in first mbuf of chain; valid only if M_PKTHDR is set.
* Size ILP32: 48
* LP64: 56
@@ -137,7 +145,10 @@ struct m_tag {
* they are correct.
*/
struct pkthdr {
- struct ifnet *rcvif; /* rcv interface */
+ union {
+ struct m_snd_tag *snd_tag; /* send tag, if any */
+ struct ifnet *rcvif; /* rcv interface */
+ };
SLIST_HEAD(packet_tags, m_tag) tags; /* list of packet tags */
int32_t len; /* total packet length */
@@ -607,7 +618,7 @@ struct mbuf *m_getjcl(int, short, int, int);
struct mbuf *m_getm2(struct mbuf *, int, int, short, int);
struct mbuf *m_getptr(struct mbuf *, int, int *);
u_int m_length(struct mbuf *, struct mbuf **);
-int m_mbuftouio(struct uio *, struct mbuf *, int);
+int m_mbuftouio(struct uio *, const struct mbuf *, int);
void m_move_pkthdr(struct mbuf *, struct mbuf *);
int m_pkthdr_init(struct mbuf *, int);
struct mbuf *m_prepend(struct mbuf *, int, int);
@@ -1314,5 +1325,18 @@ mbufq_prepend(struct mbufq *mq, struct mbuf *m)
STAILQ_INSERT_HEAD(&mq->mq_head, m, m_stailqpkt);
mq->mq_len++;
}
+
+/*
+ * Note: this doesn't enforce the maximum list size for dst.
+ */
+static inline void
+mbufq_concat(struct mbufq *mq_dst, struct mbufq *mq_src)
+{
+
+ mq_dst->mq_len += mq_src->mq_len;
+ STAILQ_CONCAT(&mq_dst->mq_head, &mq_src->mq_head);
+ mq_src->mq_len = 0;
+}
+
#endif /* _KERNEL */
#endif /* !_SYS_MBUF_H_ */
diff --git a/freebsd/sys/sys/mount.h b/freebsd/sys/sys/mount.h
index acc9b81b..e132159d 100644
--- a/freebsd/sys/sys/mount.h
+++ b/freebsd/sys/sys/mount.h
@@ -10,7 +10,7 @@
* 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.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
diff --git a/freebsd/sys/sys/mutex.h b/freebsd/sys/sys/mutex.h
index 3cec5dbd..3b5d3834 100644
--- a/freebsd/sys/sys/mutex.h
+++ b/freebsd/sys/sys/mutex.h
@@ -104,13 +104,19 @@ void mtx_sysinit(void *arg);
int _mtx_trylock_flags_(volatile uintptr_t *c, int opts, const char *file,
int line);
void mutex_init(void);
-void __mtx_lock_sleep(volatile uintptr_t *c, uintptr_t tid, int opts,
- const char *file, int line);
+#if LOCK_DEBUG > 0
+void __mtx_lock_sleep(volatile uintptr_t *c, uintptr_t v, uintptr_t tid,
+ int opts, const char *file, int line);
void __mtx_unlock_sleep(volatile uintptr_t *c, int opts, const char *file,
int line);
+#else
+void __mtx_lock_sleep(volatile uintptr_t *c, uintptr_t v, uintptr_t tid);
+void __mtx_unlock_sleep(volatile uintptr_t *c);
+#endif
+
#ifdef SMP
-void _mtx_lock_spin_cookie(volatile uintptr_t *c, uintptr_t tid, int opts,
- const char *file, int line);
+void _mtx_lock_spin_cookie(volatile uintptr_t *c, uintptr_t v, uintptr_t tid,
+ int opts, const char *file, int line);
#endif
void __mtx_lock_flags(volatile uintptr_t *c, int opts, const char *file,
int line);
@@ -167,13 +173,20 @@ void thread_lock_flags_(struct thread *, int, const char *, int);
_mtx_destroy(&(m)->mtx_lock)
#define mtx_trylock_flags_(m, o, f, l) \
_mtx_trylock_flags_(&(m)->mtx_lock, o, f, l)
-#define _mtx_lock_sleep(m, t, o, f, l) \
- __mtx_lock_sleep(&(m)->mtx_lock, t, o, f, l)
+#if LOCK_DEBUG > 0
+#define _mtx_lock_sleep(m, v, t, o, f, l) \
+ __mtx_lock_sleep(&(m)->mtx_lock, v, t, o, f, l)
#define _mtx_unlock_sleep(m, o, f, l) \
__mtx_unlock_sleep(&(m)->mtx_lock, o, f, l)
+#else
+#define _mtx_lock_sleep(m, v, t, o, f, l) \
+ __mtx_lock_sleep(&(m)->mtx_lock, v, t)
+#define _mtx_unlock_sleep(m, o, f, l) \
+ __mtx_unlock_sleep(&(m)->mtx_lock)
+#endif
#ifdef SMP
-#define _mtx_lock_spin(m, t, o, f, l) \
- _mtx_lock_spin_cookie(&(m)->mtx_lock, t, o, f, l)
+#define _mtx_lock_spin(m, v, t, o, f, l) \
+ _mtx_lock_spin_cookie(&(m)->mtx_lock, v, t, o, f, l)
#endif
#define _mtx_lock_flags(m, o, f, l) \
__mtx_lock_flags(&(m)->mtx_lock, o, f, l)
@@ -199,6 +212,9 @@ void thread_lock_flags_(struct thread *, int, const char *, int);
#define _mtx_obtain_lock(mp, tid) \
atomic_cmpset_acq_ptr(&(mp)->mtx_lock, MTX_UNOWNED, (tid))
+#define _mtx_obtain_lock_fetch(mp, vp, tid) \
+ atomic_fcmpset_acq_ptr(&(mp)->mtx_lock, vp, (tid))
+
/* Try to release mtx_lock if it is unrecursed and uncontested. */
#define _mtx_release_lock(mp, tid) \
atomic_cmpset_rel_ptr(&(mp)->mtx_lock, (tid), MTX_UNOWNED)
@@ -216,12 +232,11 @@ void thread_lock_flags_(struct thread *, int, const char *, int);
/* Lock a normal mutex. */
#define __mtx_lock(mp, tid, opts, file, line) do { \
uintptr_t _tid = (uintptr_t)(tid); \
+ uintptr_t _v = MTX_UNOWNED; \
\
- if (((mp)->mtx_lock != MTX_UNOWNED || !_mtx_obtain_lock((mp), _tid)))\
- _mtx_lock_sleep((mp), _tid, (opts), (file), (line)); \
- else \
- LOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(adaptive__acquire, \
- mp, 0, 0, file, line); \
+ if (__predict_false(LOCKSTAT_PROFILE_ENABLED(adaptive__acquire) ||\
+ !_mtx_obtain_lock_fetch((mp), &_v, _tid))) \
+ _mtx_lock_sleep((mp), _v, _tid, (opts), (file), (line));\
} while (0)
/*
@@ -233,14 +248,12 @@ void thread_lock_flags_(struct thread *, int, const char *, int);
#ifdef SMP
#define __mtx_lock_spin(mp, tid, opts, file, line) do { \
uintptr_t _tid = (uintptr_t)(tid); \
+ uintptr_t _v = MTX_UNOWNED; \
\
spinlock_enter(); \
- if (((mp)->mtx_lock != MTX_UNOWNED || !_mtx_obtain_lock((mp), _tid))) {\
- if ((mp)->mtx_lock == _tid) \
- (mp)->mtx_recurse++; \
- else \
- _mtx_lock_spin((mp), _tid, (opts), (file), (line)); \
- } else \
+ if (!_mtx_obtain_lock_fetch((mp), &_v, _tid)) \
+ _mtx_lock_spin((mp), _v, _tid, (opts), (file), (line)); \
+ else \
LOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(spin__acquire, \
mp, 0, 0, file, line); \
} while (0)
@@ -291,9 +304,8 @@ void thread_lock_flags_(struct thread *, int, const char *, int);
#define __mtx_unlock(mp, tid, opts, file, line) do { \
uintptr_t _tid = (uintptr_t)(tid); \
\
- if ((mp)->mtx_recurse == 0) \
- LOCKSTAT_PROFILE_RELEASE_LOCK(adaptive__release, mp); \
- if ((mp)->mtx_lock != _tid || !_mtx_release_lock((mp), _tid)) \
+ if (__predict_false(LOCKSTAT_PROFILE_ENABLED(adaptive__release) ||\
+ !_mtx_release_lock((mp), _tid))) \
_mtx_unlock_sleep((mp), (opts), (file), (line)); \
} while (0)
diff --git a/freebsd/sys/sys/nlist_aout.h b/freebsd/sys/sys/nlist_aout.h
index cb3dd859..79260ad6 100644
--- a/freebsd/sys/sys/nlist_aout.h
+++ b/freebsd/sys/sys/nlist_aout.h
@@ -15,7 +15,7 @@
* 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.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
diff --git a/freebsd/sys/sys/nv.h b/freebsd/sys/sys/nv.h
new file mode 100644
index 00000000..fcea2b3e
--- /dev/null
+++ b/freebsd/sys/sys/nv.h
@@ -0,0 +1,246 @@
+/*-
+ * Copyright (c) 2009-2013 The FreeBSD Foundation
+ * Copyright (c) 2013-2015 Mariusz Zaborski <oshogbo@FreeBSD.org>
+ * All rights reserved.
+ *
+ * This software was developed by Pawel Jakub Dawidek under sponsorship from
+ * the FreeBSD Foundation.
+ *
+ * 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_H_
+#define _NV_H_
+
+#include <sys/cdefs.h>
+
+#ifndef _KERNEL
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdio.h>
+#endif
+
+#ifndef _NVLIST_T_DECLARED
+#define _NVLIST_T_DECLARED
+struct nvlist;
+
+typedef struct nvlist nvlist_t;
+#endif
+
+#define NV_NAME_MAX 2048
+
+#define NV_TYPE_NONE 0
+
+#define NV_TYPE_NULL 1
+#define NV_TYPE_BOOL 2
+#define NV_TYPE_NUMBER 3
+#define NV_TYPE_STRING 4
+#define NV_TYPE_NVLIST 5
+#define NV_TYPE_DESCRIPTOR 6
+#define NV_TYPE_BINARY 7
+#define NV_TYPE_BOOL_ARRAY 8
+#define NV_TYPE_NUMBER_ARRAY 9
+#define NV_TYPE_STRING_ARRAY 10
+#define NV_TYPE_NVLIST_ARRAY 11
+#define NV_TYPE_DESCRIPTOR_ARRAY 12
+
+/*
+ * Perform case-insensitive lookups of provided names.
+ */
+#define NV_FLAG_IGNORE_CASE 0x01
+/*
+ * Names don't have to be unique.
+ */
+#define NV_FLAG_NO_UNIQUE 0x02
+
+#if defined(_KERNEL) && defined(MALLOC_DECLARE)
+MALLOC_DECLARE(M_NVLIST);
+#endif
+
+__BEGIN_DECLS
+
+nvlist_t *nvlist_create(int flags);
+void nvlist_destroy(nvlist_t *nvl);
+int nvlist_error(const nvlist_t *nvl);
+bool nvlist_empty(const nvlist_t *nvl);
+int nvlist_flags(const nvlist_t *nvl);
+void nvlist_set_error(nvlist_t *nvl, int error);
+
+nvlist_t *nvlist_clone(const nvlist_t *nvl);
+
+#ifndef _KERNEL
+void nvlist_dump(const nvlist_t *nvl, int fd);
+void nvlist_fdump(const nvlist_t *nvl, FILE *fp);
+#endif
+
+size_t nvlist_size(const nvlist_t *nvl);
+void *nvlist_pack(const nvlist_t *nvl, size_t *sizep);
+nvlist_t *nvlist_unpack(const void *buf, size_t size, int flags);
+
+int nvlist_send(int sock, const nvlist_t *nvl);
+nvlist_t *nvlist_recv(int sock, int flags);
+nvlist_t *nvlist_xfer(int sock, nvlist_t *nvl, int flags);
+
+const char *nvlist_next(const nvlist_t *nvl, int *typep, void **cookiep);
+
+const nvlist_t *nvlist_get_parent(const nvlist_t *nvl, void **cookiep);
+
+const nvlist_t *nvlist_get_array_next(const nvlist_t *nvl);
+bool nvlist_in_array(const nvlist_t *nvl);
+
+const nvlist_t *nvlist_get_pararr(const nvlist_t *nvl, void **cookiep);
+
+/*
+ * The nvlist_exists functions check if the given name (optionally of the given
+ * type) exists on nvlist.
+ */
+
+bool nvlist_exists(const nvlist_t *nvl, const char *name);
+bool nvlist_exists_type(const nvlist_t *nvl, const char *name, int type);
+
+bool nvlist_exists_null(const nvlist_t *nvl, const char *name);
+bool nvlist_exists_bool(const nvlist_t *nvl, const char *name);
+bool nvlist_exists_number(const nvlist_t *nvl, const char *name);
+bool nvlist_exists_string(const nvlist_t *nvl, const char *name);
+bool nvlist_exists_nvlist(const nvlist_t *nvl, const char *name);
+bool nvlist_exists_binary(const nvlist_t *nvl, const char *name);
+bool nvlist_exists_bool_array(const nvlist_t *nvl, const char *name);
+bool nvlist_exists_number_array(const nvlist_t *nvl, const char *name);
+bool nvlist_exists_string_array(const nvlist_t *nvl, const char *name);
+bool nvlist_exists_nvlist_array(const nvlist_t *nvl, const char *name);
+#ifndef _KERNEL
+bool nvlist_exists_descriptor(const nvlist_t *nvl, const char *name);
+bool nvlist_exists_descriptor_array(const nvlist_t *nvl, const char *name);
+#endif
+
+/*
+ * The nvlist_add functions add the given name/value pair.
+ * If a pointer is provided, nvlist_add will internally allocate memory for the
+ * given data (in other words it won't consume provided buffer).
+ */
+
+void nvlist_add_null(nvlist_t *nvl, const char *name);
+void nvlist_add_bool(nvlist_t *nvl, const char *name, bool value);
+void nvlist_add_number(nvlist_t *nvl, const char *name, uint64_t value);
+void nvlist_add_string(nvlist_t *nvl, const char *name, const char *value);
+void nvlist_add_stringf(nvlist_t *nvl, const char *name, const char *valuefmt, ...) __printflike(3, 4);
+#if !defined(_KERNEL) || defined(_VA_LIST_DECLARED)
+void nvlist_add_stringv(nvlist_t *nvl, const char *name, const char *valuefmt, va_list valueap) __printflike(3, 0);
+#endif
+void nvlist_add_nvlist(nvlist_t *nvl, const char *name, const nvlist_t *value);
+void nvlist_add_binary(nvlist_t *nvl, const char *name, const void *value, size_t size);
+void nvlist_add_bool_array(nvlist_t *nvl, const char *name, const bool *value, size_t nitems);
+void nvlist_add_number_array(nvlist_t *nvl, const char *name, const uint64_t *value, size_t nitems);
+void nvlist_add_string_array(nvlist_t *nvl, const char *name, const char * const *value, size_t nitems);
+void nvlist_add_nvlist_array(nvlist_t *nvl, const char *name, const nvlist_t * const *value, size_t nitems);
+#ifndef _KERNEL
+void nvlist_add_descriptor(nvlist_t *nvl, const char *name, int value);
+void nvlist_add_descriptor_array(nvlist_t *nvl, const char *name, const int *value, size_t nitems);
+#endif
+
+/*
+ * The nvlist_move functions add the given name/value pair.
+ * The functions consumes provided buffer.
+ */
+
+void nvlist_move_string(nvlist_t *nvl, const char *name, char *value);
+void nvlist_move_nvlist(nvlist_t *nvl, const char *name, nvlist_t *value);
+void nvlist_move_binary(nvlist_t *nvl, const char *name, void *value, size_t size);
+void nvlist_move_bool_array(nvlist_t *nvl, const char *name, bool *value, size_t nitems);
+void nvlist_move_string_array(nvlist_t *nvl, const char *name, char **value, size_t nitems);
+void nvlist_move_nvlist_array(nvlist_t *nvl, const char *name, nvlist_t **value, size_t nitems);
+void nvlist_move_number_array(nvlist_t *nvl, const char *name, uint64_t *value, size_t nitems);
+#ifndef _KERNEL
+void nvlist_move_descriptor(nvlist_t *nvl, const char *name, int value);
+void nvlist_move_descriptor_array(nvlist_t *nvl, const char *name, int *value, size_t nitems);
+#endif
+
+/*
+ * The nvlist_get functions returns value associated with the given name.
+ * If it returns a pointer, the pointer represents internal buffer and should
+ * not be freed by the caller.
+ */
+
+bool nvlist_get_bool(const nvlist_t *nvl, const char *name);
+uint64_t nvlist_get_number(const nvlist_t *nvl, const char *name);
+const char *nvlist_get_string(const nvlist_t *nvl, const char *name);
+const nvlist_t *nvlist_get_nvlist(const nvlist_t *nvl, const char *name);
+const void *nvlist_get_binary(const nvlist_t *nvl, const char *name, size_t *sizep);
+const bool *nvlist_get_bool_array(const nvlist_t *nvl, const char *name, size_t *nitemsp);
+const uint64_t *nvlist_get_number_array(const nvlist_t *nvl, const char *name, size_t *nitemsp);
+const char * const *nvlist_get_string_array(const nvlist_t *nvl, const char *name, size_t *nitemsp);
+const nvlist_t * const *nvlist_get_nvlist_array(const nvlist_t *nvl, const char *name, size_t *nitemsp);
+#ifndef _KERNEL
+int nvlist_get_descriptor(const nvlist_t *nvl, const char *name);
+const int *nvlist_get_descriptor_array(const nvlist_t *nvl, const char *name, size_t *nitemsp);
+#endif
+
+/*
+ * The nvlist_take functions returns value associated with the given name and
+ * remove the given entry from the nvlist.
+ * The caller is responsible for freeing received data.
+ */
+
+bool nvlist_take_bool(nvlist_t *nvl, const char *name);
+uint64_t nvlist_take_number(nvlist_t *nvl, const char *name);
+char *nvlist_take_string(nvlist_t *nvl, const char *name);
+nvlist_t *nvlist_take_nvlist(nvlist_t *nvl, const char *name);
+void *nvlist_take_binary(nvlist_t *nvl, const char *name, size_t *sizep);
+bool *nvlist_take_bool_array(nvlist_t *nvl, const char *name, size_t *nitemsp);
+uint64_t *nvlist_take_number_array(nvlist_t *nvl, const char *name, size_t *nitemsp);
+char **nvlist_take_string_array(nvlist_t *nvl, const char *name, size_t *nitemsp);
+nvlist_t **nvlist_take_nvlist_array(nvlist_t *nvl, const char *name, size_t *nitemsp);
+#ifndef _KERNEL
+int nvlist_take_descriptor(nvlist_t *nvl, const char *name);
+int *nvlist_take_descriptor_array(nvlist_t *nvl, const char *name, size_t *nitemsp);
+#endif
+
+/*
+ * The nvlist_free functions removes the given name/value pair from the nvlist
+ * and frees memory associated with it.
+ */
+
+void nvlist_free(nvlist_t *nvl, const char *name);
+void nvlist_free_type(nvlist_t *nvl, const char *name, int type);
+
+void nvlist_free_null(nvlist_t *nvl, const char *name);
+void nvlist_free_bool(nvlist_t *nvl, const char *name);
+void nvlist_free_number(nvlist_t *nvl, const char *name);
+void nvlist_free_string(nvlist_t *nvl, const char *name);
+void nvlist_free_nvlist(nvlist_t *nvl, const char *name);
+void nvlist_free_binary(nvlist_t *nvl, const char *name);
+void nvlist_free_bool_array(nvlist_t *nvl, const char *name);
+void nvlist_free_number_array(nvlist_t *nvl, const char *name);
+void nvlist_free_string_array(nvlist_t *nvl, const char *name);
+void nvlist_free_nvlist_array(nvlist_t *nvl, const char *name);
+void nvlist_free_binary_array(nvlist_t *nvl, const char *name);
+#ifndef _KERNEL
+void nvlist_free_descriptor(nvlist_t *nvl, const char *name);
+void nvlist_free_descriptor_array(nvlist_t *nvl, const char *name);
+#endif
+
+__END_DECLS
+
+#endif /* !_NV_H_ */
diff --git a/freebsd/sys/sys/pcpu.h b/freebsd/sys/sys/pcpu.h
index 2d3f3411..8e246004 100644
--- a/freebsd/sys/sys/pcpu.h
+++ b/freebsd/sys/sys/pcpu.h
@@ -11,7 +11,7 @@
* 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.
- * 4. Neither the name of the author nor the names of any co-contributors
+ * 3. Neither the name of the author nor the names of any co-contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
diff --git a/freebsd/sys/sys/pipe.h b/freebsd/sys/sys/pipe.h
index d596b3bb..d37c0986 100755
--- a/freebsd/sys/sys/pipe.h
+++ b/freebsd/sys/sys/pipe.h
@@ -25,7 +25,7 @@
#define _SYS_PIPE_H_
#ifndef _KERNEL
-#error "no user-servicable parts inside"
+#error "no user-serviceable parts inside"
#endif
/*
diff --git a/freebsd/sys/sys/proc.h b/freebsd/sys/sys/proc.h
index ee43997f..7af3dc2e 100644
--- a/freebsd/sys/sys/proc.h
+++ b/freebsd/sys/sys/proc.h
@@ -15,7 +15,7 @@
* 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.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -148,6 +148,7 @@ struct pargs {
* o - ktrace lock
* q - td_contested lock
* r - p_peers lock
+ * s - see sleepq_switch(), sleeping_on_old_rtc(), and sleep(9)
* t - thread lock
* u - process stat lock
* w - process timer lock
@@ -302,7 +303,7 @@ struct thread {
char td_name[MAXCOMLEN + 1]; /* (*) Thread name. */
struct file *td_fpop; /* (k) file referencing cdev under op */
int td_dbgflags; /* (c) Userland debugger flags */
- struct ksiginfo td_dbgksi; /* (c) ksi reflected to debugger. */
+ siginfo_t td_si; /* (c) For debugger or core file */
int td_ng_outbound; /* (k) Thread entered ng from above. */
struct osd td_osd; /* (k) Object specific data. */
struct vm_map_entry *td_map_def_user; /* (k) Deferred entries. */
@@ -312,6 +313,7 @@ struct thread {
int td_dom_rr_idx; /* (k) RR Numa domain selection. */
void *td_su; /* (k) FFS SU private */
sbintime_t td_sleeptimo; /* (t) Sleep timeout. */
+ int td_rtcgen; /* (s) rtc_generation of abs. sleep */
#define td_endzero td_sigmask
/* Copied during fork1() or create_thread(). */
@@ -344,7 +346,7 @@ struct thread {
} td_state; /* (t) thread state */
union {
register_t tdu_retval[2];
- off_t tdu_off;
+ off_t tdu_off;
} td_uretoff; /* (k) Syscall aux returns. */
#else /* __rtems__ */
register_t td_retval[2]; /* (k) Syscall aux returns. */
@@ -372,6 +374,7 @@ struct thread {
void *td_emuldata; /* Emulator state data */
int td_lastcpu; /* (t) Last cpu we were on. */
int td_oncpu; /* (t) Which cpu we are on. */
+ void *td_lkpi_task; /* LinuxKPI task struct pointer */
#endif /* __rtems__ */
};
@@ -527,6 +530,12 @@ do { \
#define TD_ON_UPILOCK(td) ((td)->td_flags & TDF_UPIBLOCKED)
#define TD_IS_IDLETHREAD(td) ((td)->td_flags & TDF_IDLETD)
+#define KTDSTATE(td) \
+ (((td)->td_inhibitors & TDI_SLEEPING) != 0 ? "sleep" : \
+ ((td)->td_inhibitors & TDI_SUSPENDED) != 0 ? "suspended" : \
+ ((td)->td_inhibitors & TDI_SWAPPED) != 0 ? "swapped" : \
+ ((td)->td_inhibitors & TDI_LOCK) != 0 ? "blocked" : \
+ ((td)->td_inhibitors & TDI_IWAIT) != 0 ? "iwait" : "yielding")
#define TD_SET_INHIB(td, inhib) do { \
(td)->td_state = TDS_INHIBITED; \
@@ -660,8 +669,11 @@ struct proc {
our subtree. */
u_int p_xexit; /* (c) Exit code. */
u_int p_xsig; /* (c) Stop/kill sig. */
+ uint16_t p_elf_machine; /* (x) ELF machine type */
+ uint64_t p_elf_flags; /* (x) ELF flags */
+
/* End area that is copied on creation. */
-#define p_endcopy p_xsig
+#define p_endcopy p_elf_flags
struct pgrp *p_pgrp; /* (c + e) Pointer to process group. */
struct knlist *p_klist; /* (c) Knotes attached to this proc. */
int p_numthreads; /* (c) Number of threads. */
@@ -1175,6 +1187,15 @@ 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);
+}
#endif /* __rtems__ */
#endif /* _KERNEL */
diff --git a/freebsd/sys/sys/protosw.h b/freebsd/sys/sys/protosw.h
index 896ec253..33cc2074 100644
--- a/freebsd/sys/sys/protosw.h
+++ b/freebsd/sys/sys/protosw.h
@@ -10,7 +10,7 @@
* 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.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
diff --git a/freebsd/sys/sys/reboot.h b/freebsd/sys/sys/reboot.h
index ebe688e8..ec2a5705 100644
--- a/freebsd/sys/sys/reboot.h
+++ b/freebsd/sys/sys/reboot.h
@@ -10,7 +10,7 @@
* 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.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
diff --git a/freebsd/sys/sys/resourcevar.h b/freebsd/sys/sys/resourcevar.h
index 1d290aaa..d3c50830 100644
--- a/freebsd/sys/sys/resourcevar.h
+++ b/freebsd/sys/sys/resourcevar.h
@@ -10,7 +10,7 @@
* 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.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
diff --git a/freebsd/sys/sys/rwlock.h b/freebsd/sys/sys/rwlock.h
index e0003840..8988ecbd 100644
--- a/freebsd/sys/sys/rwlock.h
+++ b/freebsd/sys/sys/rwlock.h
@@ -61,13 +61,14 @@
#define RW_LOCK_READ_WAITERS 0x02
#define RW_LOCK_WRITE_WAITERS 0x04
#define RW_LOCK_WRITE_SPINNER 0x08
+#define RW_LOCK_WRITER_RECURSED 0x10
#define RW_LOCK_FLAGMASK \
(RW_LOCK_READ | RW_LOCK_READ_WAITERS | RW_LOCK_WRITE_WAITERS | \
- RW_LOCK_WRITE_SPINNER)
+ RW_LOCK_WRITE_SPINNER | RW_LOCK_WRITER_RECURSED)
#define RW_LOCK_WAITERS (RW_LOCK_READ_WAITERS | RW_LOCK_WRITE_WAITERS)
#define RW_OWNER(x) ((x) & ~RW_LOCK_FLAGMASK)
-#define RW_READERS_SHIFT 4
+#define RW_READERS_SHIFT 5
#define RW_READERS(x) (RW_OWNER((x)) >> RW_READERS_SHIFT)
#define RW_READERS_LOCK(x) ((x) << RW_READERS_SHIFT | RW_LOCK_READ)
#define RW_ONE_READER (1 << RW_READERS_SHIFT)
@@ -79,12 +80,17 @@
#define rw_recurse lock_object.lo_data
+#define RW_READ_VALUE(x) ((x)->rw_lock)
+
/* Very simple operations on rw_lock. */
/* Try to obtain a write lock once. */
#define _rw_write_lock(rw, tid) \
atomic_cmpset_acq_ptr(&(rw)->rw_lock, RW_UNLOCKED, (tid))
+#define _rw_write_lock_fetch(rw, vp, tid) \
+ atomic_fcmpset_acq_ptr(&(rw)->rw_lock, vp, (tid))
+
/* Release a write lock quickly if there are no waiters. */
#define _rw_write_unlock(rw, tid) \
atomic_cmpset_rel_ptr(&(rw)->rw_lock, (tid), RW_UNLOCKED)
@@ -99,26 +105,20 @@
/* Acquire a write lock. */
#define __rw_wlock(rw, tid, file, line) do { \
uintptr_t _tid = (uintptr_t)(tid); \
+ uintptr_t _v = RW_UNLOCKED; \
\
- if ((rw)->rw_lock != RW_UNLOCKED || !_rw_write_lock((rw), _tid))\
- _rw_wlock_hard((rw), _tid, (file), (line)); \
- else \
- LOCKSTAT_PROFILE_OBTAIN_RWLOCK_SUCCESS(rw__acquire, rw, \
- 0, 0, file, line, LOCKSTAT_WRITER); \
+ if (__predict_false(LOCKSTAT_PROFILE_ENABLED(rw__acquire) || \
+ !_rw_write_lock_fetch((rw), &_v, _tid))) \
+ _rw_wlock_hard((rw), _v, _tid, (file), (line)); \
} while (0)
/* Release a write lock. */
#define __rw_wunlock(rw, tid, file, line) do { \
uintptr_t _tid = (uintptr_t)(tid); \
\
- if ((rw)->rw_recurse) \
- (rw)->rw_recurse--; \
- else { \
- LOCKSTAT_PROFILE_RELEASE_RWLOCK(rw__release, rw, \
- LOCKSTAT_WRITER); \
- if ((rw)->rw_lock != _tid || !_rw_write_unlock((rw), _tid))\
- _rw_wunlock_hard((rw), _tid, (file), (line)); \
- } \
+ if (__predict_false(LOCKSTAT_PROFILE_ENABLED(rw__release) || \
+ !_rw_write_unlock((rw), _tid))) \
+ _rw_wunlock_hard((rw), _tid, (file), (line)); \
} while (0)
#endif /* __rtems__ */
@@ -139,8 +139,8 @@ void _rw_wunlock_cookie(volatile uintptr_t *c, const char *file, int line);
void __rw_rlock(volatile uintptr_t *c, const char *file, int line);
int __rw_try_rlock(volatile uintptr_t *c, const char *file, int line);
void _rw_runlock_cookie(volatile uintptr_t *c, const char *file, int line);
-void __rw_wlock_hard(volatile uintptr_t *c, uintptr_t tid, const char *file,
- int line);
+void __rw_wlock_hard(volatile uintptr_t *c, uintptr_t v, uintptr_t tid,
+ const char *file, int line);
void __rw_wunlock_hard(volatile uintptr_t *c, uintptr_t tid,
const char *file, int line);
int __rw_try_upgrade(volatile uintptr_t *c, const char *file, int line);
@@ -192,8 +192,8 @@ void _rw_downgrade(struct rwlock *rw, const char *file, int line);
__rw_try_rlock(&(rw)->rw_lock, f, l)
#define _rw_runlock(rw, f, l) \
_rw_runlock_cookie(&(rw)->rw_lock, f, l)
-#define _rw_wlock_hard(rw, t, f, l) \
- __rw_wlock_hard(&(rw)->rw_lock, t, f, l)
+#define _rw_wlock_hard(rw, v, t, f, l) \
+ __rw_wlock_hard(&(rw)->rw_lock, v, t, f, l)
#define _rw_wunlock_hard(rw, t, f, l) \
__rw_wunlock_hard(&(rw)->rw_lock, t, f, l)
#define _rw_try_upgrade(rw, f, l) \
diff --git a/freebsd/sys/sys/sbuf.h b/freebsd/sys/sys/sbuf.h
index 580cbd2e..c05bafd1 100644
--- a/freebsd/sys/sys/sbuf.h
+++ b/freebsd/sys/sys/sbuf.h
@@ -99,6 +99,7 @@ void sbuf_start_section(struct sbuf *, ssize_t *);
ssize_t sbuf_end_section(struct sbuf *, ssize_t, size_t, int);
void sbuf_hexdump(struct sbuf *, const void *, int, const char *,
int);
+void sbuf_putbuf(struct sbuf *);
#ifdef _KERNEL
struct uio;
diff --git a/freebsd/sys/sys/sdt.h b/freebsd/sys/sys/sdt.h
index 25423d76..c680ea85 100644
--- a/freebsd/sys/sys/sdt.h
+++ b/freebsd/sys/sys/sdt.h
@@ -86,6 +86,7 @@
#define SDT_PROVIDER_DECLARE(prov)
#define SDT_PROBE_DEFINE(prov, mod, func, name)
#define SDT_PROBE_DECLARE(prov, mod, func, name)
+#define SDT_PROBE_ENABLED(prov, mod, func, name) 0
#define SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4)
#define SDT_PROBE_ARGTYPE(prov, mod, func, name, num, type, xtype)
@@ -160,6 +161,9 @@ SET_DECLARE(sdt_argtypes_set, struct sdt_argtype);
#define SDT_PROBE_DECLARE(prov, mod, func, name) \
extern struct sdt_probe sdt_##prov##_##mod##_##func##_##name[1]
+#define SDT_PROBE_ENABLED(prov, mod, func, name) \
+ __predict_false((sdt_##prov##_##mod##_##func##_##name->id))
+
#define SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) do { \
if (__predict_false(sdt_##prov##_##mod##_##func##_##name->id)) \
(*sdt_probe_func)(sdt_##prov##_##mod##_##func##_##name->id, \
diff --git a/freebsd/sys/sys/selinfo.h b/freebsd/sys/sys/selinfo.h
index 590d184a..85de231e 100644
--- a/freebsd/sys/sys/selinfo.h
+++ b/freebsd/sys/sys/selinfo.h
@@ -10,7 +10,7 @@
* 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.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
diff --git a/freebsd/sys/sys/sigio.h b/freebsd/sys/sys/sigio.h
index 74047b78..e941ae96 100644
--- a/freebsd/sys/sys/sigio.h
+++ b/freebsd/sys/sys/sigio.h
@@ -10,7 +10,7 @@
* 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.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
diff --git a/freebsd/sys/sys/signalvar.h b/freebsd/sys/sys/signalvar.h
index a2a1d0d8..22f9ef4a 100644
--- a/freebsd/sys/sys/signalvar.h
+++ b/freebsd/sys/sys/signalvar.h
@@ -10,7 +10,7 @@
* 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.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -236,15 +236,17 @@ typedef struct ksiginfo {
#define KSI_TRAP 0x01 /* Generated by trap. */
#define KSI_EXT 0x02 /* Externally managed ksi. */
#define KSI_INS 0x04 /* Directly insert ksi, not the copy */
-#define KSI_SIGQ 0x08 /* Generated by sigqueue, might ret EGAIN. */
+#define KSI_SIGQ 0x08 /* Generated by sigqueue, might ret EAGAIN. */
#define KSI_HEAD 0x10 /* Insert into head, not tail. */
-#define KSI_COPYMASK (KSI_TRAP|KSI_SIGQ)
+#define KSI_PTRACE 0x20 /* Generated by ptrace. */
+#define KSI_COPYMASK (KSI_TRAP | KSI_SIGQ | KSI_PTRACE)
#define KSI_ONQ(ksi) ((ksi)->ksi_sigq != NULL)
typedef struct sigqueue {
sigset_t sq_signals; /* All pending signals. */
sigset_t sq_kill; /* Legacy depth 1 queue. */
+ sigset_t sq_ptrace; /* Depth 1 queue for ptrace(2). */
TAILQ_HEAD(, ksiginfo) sq_list;/* Queued signal info. */
struct proc *sq_proc;
int sq_flags;
@@ -371,7 +373,7 @@ void pgsigio(struct sigio **sigiop, int sig, int checkctty);
void pgsignal(struct pgrp *pgrp, int sig, int checkctty, ksiginfo_t *ksi);
int postsig(int sig);
void kern_psignal(struct proc *p, int sig);
-int ptracestop(struct thread *td, int sig);
+int ptracestop(struct thread *td, int sig, ksiginfo_t *si);
void sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *retmask);
struct sigacts *sigacts_alloc(void);
void sigacts_copy(struct sigacts *dest, struct sigacts *src);
diff --git a/freebsd/sys/sys/sleepqueue.h b/freebsd/sys/sys/sleepqueue.h
index d59dc7e5..30a18933 100644
--- a/freebsd/sys/sys/sleepqueue.h
+++ b/freebsd/sys/sys/sleepqueue.h
@@ -90,11 +90,14 @@ void sleepq_add(void *wchan, struct lock_object *lock, const char *wmesg,
int flags, int queue);
struct sleepqueue *sleepq_alloc(void);
int sleepq_broadcast(void *wchan, int flags, int pri, int queue);
+void sleepq_chains_remove_matching(bool (*matches)(struct thread *));
void sleepq_free(struct sleepqueue *sq);
void sleepq_lock(void *wchan);
struct sleepqueue *sleepq_lookup(void *wchan);
void sleepq_release(void *wchan);
void sleepq_remove(struct thread *td, void *wchan);
+int sleepq_remove_matching(struct sleepqueue *sq, int queue,
+ bool (*matches)(struct thread *), int pri);
int sleepq_signal(void *wchan, int flags, int pri, int queue);
void sleepq_set_timeout_sbt(void *wchan, sbintime_t sbt,
sbintime_t pr, int flags);
diff --git a/freebsd/sys/sys/slicer.h b/freebsd/sys/sys/slicer.h
index 9bf8748f..53f680d8 100644
--- a/freebsd/sys/sys/slicer.h
+++ b/freebsd/sys/sys/slicer.h
@@ -27,26 +27,38 @@
*/
#ifndef _FLASH_SLICER_H_
-#define _FLASH_SLICER_H_
+#define _FLASH_SLICER_H_
#include <sys/types.h>
-#define FLASH_SLICES_MAX_NUM 8
-#define FLASH_SLICES_MAX_NAME_LEN (32 + 1)
+#define FLASH_SLICES_MAX_NUM 8
+#define FLASH_SLICES_MAX_NAME_LEN (32 + 1)
#define FLASH_SLICES_FLAG_NONE 0
#define FLASH_SLICES_FLAG_RO 1 /* Read only */
+#define FLASH_SLICES_FMT "%ss.%s"
+
struct flash_slice {
off_t base;
off_t size;
- char *label;
+ const char *label;
unsigned int flags;
};
#ifdef _KERNEL
-int fdt_flash_fill_slices(device_t, struct flash_slice *, int *) __weak_symbol;
-void flash_register_slicer(int (*)(device_t, struct flash_slice *, int *));
+
+typedef int (*flash_slicer_t)(device_t dev, const char *provider,
+ struct flash_slice *slices, int *slices_num);
+
+#define FLASH_SLICES_TYPE_NAND 0
+#define FLASH_SLICES_TYPE_CFI 1
+#define FLASH_SLICES_TYPE_SPI 2
+#define FLASH_SLICES_TYPE_MMC 3
+
+/* Use NULL for deregistering a slicer */
+void flash_register_slicer(flash_slicer_t slicer, u_int type, bool force);
+
#endif /* _KERNEL */
#endif /* _FLASH_SLICER_H_ */
diff --git a/freebsd/sys/sys/sockbuf.h b/freebsd/sys/sys/sockbuf.h
index 2c03b3ed..b1ebe62f 100644
--- a/freebsd/sys/sys/sockbuf.h
+++ b/freebsd/sys/sys/sockbuf.h
@@ -10,7 +10,7 @@
* 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.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
diff --git a/freebsd/sys/sys/socket.h b/freebsd/sys/sys/socket.h
index 9429f5a1..0ef59dc4 100644
--- a/freebsd/sys/sys/socket.h
+++ b/freebsd/sys/sys/socket.h
@@ -10,7 +10,7 @@
* 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.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -158,6 +158,17 @@ typedef __uintptr_t uintptr_t;
#define SO_USER_COOKIE 0x1015 /* user cookie (dummynet etc.) */
#define SO_PROTOCOL 0x1016 /* get socket protocol (Linux name) */
#define SO_PROTOTYPE SO_PROTOCOL /* alias for SO_PROTOCOL (SunOS name) */
+#define SO_TS_CLOCK 0x1017 /* clock type used for SO_TIMESTAMP */
+#define SO_MAX_PACING_RATE 0x1018 /* socket's max TX pacing rate (Linux name) */
+#endif
+
+#if __BSD_VISIBLE
+#define SO_TS_REALTIME_MICRO 0 /* microsecond resolution, realtime */
+#define SO_TS_BINTIME 1 /* sub-nanosecond resolution, realtime */
+#define SO_TS_REALTIME 2 /* nanosecond resolution, realtime */
+#define SO_TS_MONOTONIC 3 /* nanosecond resolution, monotonic */
+#define SO_TS_DEFAULT SO_TS_REALTIME_MICRO
+#define SO_TS_CLOCK_MAX SO_TS_MONOTONIC
#endif
/*
@@ -414,28 +425,36 @@ struct msghdr {
int msg_flags; /* flags on received message */
};
-#define MSG_OOB 0x1 /* process out-of-band data */
-#define MSG_PEEK 0x2 /* peek at incoming message */
-#define MSG_DONTROUTE 0x4 /* send without using routing tables */
-#define MSG_EOR 0x8 /* data completes record */
-#define MSG_TRUNC 0x10 /* data discarded before delivery */
-#define MSG_CTRUNC 0x20 /* control data lost before delivery */
-#define MSG_WAITALL 0x40 /* wait for full request or error */
+#define MSG_OOB 0x00000001 /* process out-of-band data */
+#define MSG_PEEK 0x00000002 /* peek at incoming message */
+#define MSG_DONTROUTE 0x00000004 /* send without using routing tables */
+#define MSG_EOR 0x00000008 /* data completes record */
+#define MSG_TRUNC 0x00000010 /* data discarded before delivery */
+#define MSG_CTRUNC 0x00000020 /* control data lost before delivery */
+#define MSG_WAITALL 0x00000040 /* wait for full request or error */
+#if __BSD_VISIBLE
+#define MSG_DONTWAIT 0x00000080 /* this message should be nonblocking */
+#define MSG_EOF 0x00000100 /* data completes connection */
+/* 0x00000200 unused */
+/* 0x00000400 unused */
+/* 0x00000800 unused */
+/* 0x00001000 unused */
+#define MSG_NOTIFICATION 0x00002000 /* SCTP notification */
+#define MSG_NBIO 0x00004000 /* FIONBIO mode, used by fifofs */
+#define MSG_COMPAT 0x00008000 /* used in sendit() */
+#endif
+#ifdef _KERNEL
+#define MSG_SOCALLBCK 0x00010000 /* for use by socket callbacks - soreceive (TCP) */
+#endif
#if __POSIX_VISIBLE >= 200809
-#define MSG_NOSIGNAL 0x20000 /* do not generate SIGPIPE on EOF */
+#define MSG_NOSIGNAL 0x00020000 /* do not generate SIGPIPE on EOF */
#endif
#if __BSD_VISIBLE
-#define MSG_DONTWAIT 0x80 /* this message should be nonblocking */
-#define MSG_EOF 0x100 /* data completes connection */
-#define MSG_NOTIFICATION 0x2000 /* SCTP notification */
-#define MSG_NBIO 0x4000 /* FIONBIO mode, used by fifofs */
-#define MSG_COMPAT 0x8000 /* used in sendit() */
-#define MSG_CMSG_CLOEXEC 0x40000 /* make received fds close-on-exec */
-#define MSG_WAITFORONE 0x80000 /* for recvmmsg() */
+#define MSG_CMSG_CLOEXEC 0x00040000 /* make received fds close-on-exec */
+#define MSG_WAITFORONE 0x00080000 /* for recvmmsg() */
#endif
#ifdef _KERNEL
-#define MSG_SOCALLBCK 0x10000 /* for use by socket callbacks - soreceive (TCP) */
-#define MSG_MORETOCOME 0x20000 /* additional data pending */
+#define MSG_MORETOCOME 0x00100000 /* additional data pending */
#endif
/*
@@ -534,6 +553,8 @@ struct sockcred {
#define SCM_TIMESTAMP 0x02 /* timestamp (struct timeval) */
#define SCM_CREDS 0x03 /* process creds (struct cmsgcred) */
#define SCM_BINTIME 0x04 /* timestamp (struct bintime) */
+#define SCM_REALTIME 0x05 /* timestamp (struct timespec) */
+#define SCM_MONOTONIC 0x06 /* timestamp (struct timespec) */
#endif
#if __BSD_VISIBLE
diff --git a/freebsd/sys/sys/socketvar.h b/freebsd/sys/sys/socketvar.h
index 1e599a66..dd1ec474 100644
--- a/freebsd/sys/sys/socketvar.h
+++ b/freebsd/sys/sys/socketvar.h
@@ -10,7 +10,7 @@
* 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.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -127,8 +127,11 @@ struct socket {
int so_fibnum; /* routing domain for this socket */
uint32_t so_user_cookie;
- void *so_pspare[2]; /* packet pacing / general use */
- int so_ispare[2]; /* packet pacing / general use */
+ int so_ts_clock; /* type of the clock used for timestamps */
+ uint32_t so_max_pacing_rate; /* (f) TX rate limit in bytes/s */
+
+ void *so_pspare[2]; /* general use */
+ int so_ispare[2]; /* general use */
};
/*
diff --git a/freebsd/sys/sys/sockopt.h b/freebsd/sys/sys/sockopt.h
index 69d6c6dc..4131a5b7 100644
--- a/freebsd/sys/sys/sockopt.h
+++ b/freebsd/sys/sys/sockopt.h
@@ -10,7 +10,7 @@
* 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.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -34,7 +34,7 @@
#define _SYS_SOCKOPT_H_
#ifndef _KERNEL
-#error "no user-servicable parts inside"
+#error "no user-serviceable parts inside"
#endif
diff --git a/freebsd/sys/sys/sockstate.h b/freebsd/sys/sys/sockstate.h
index 52c85b76..9648f5a3 100644
--- a/freebsd/sys/sys/sockstate.h
+++ b/freebsd/sys/sys/sockstate.h
@@ -10,7 +10,7 @@
* 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.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
diff --git a/freebsd/sys/sys/stdint.h b/freebsd/sys/sys/stdint.h
index 2b253137..4c41ec14 100644
--- a/freebsd/sys/sys/stdint.h
+++ b/freebsd/sys/sys/stdint.h
@@ -70,4 +70,11 @@ typedef __uint_fast64_t uint_fast64_t;
#define WCHAR_MAX __WCHAR_MAX
#endif /* __rtems__ */
+#if __EXT1_VISIBLE
+/* ISO/IEC 9899:2011 K.3.4.4 */
+#ifndef RSIZE_MAX
+#define RSIZE_MAX (SIZE_MAX >> 1)
+#endif
+#endif /* __EXT1_VISIBLE */
+
#endif /* !_SYS_STDINT_H_ */
diff --git a/freebsd/sys/sys/sx.h b/freebsd/sys/sys/sx.h
index c285fa77..0c95df16 100644
--- a/freebsd/sys/sys/sx.h
+++ b/freebsd/sys/sys/sx.h
@@ -94,6 +94,11 @@
#define sx_recurse lock_object.lo_data
+#define SX_READ_VALUE(sx) ((sx)->sx_lock)
+
+#define lv_sx_owner(v) \
+ ((v & SX_LOCK_SHARED) ? NULL : (struct thread *)SX_OWNER(v))
+
/*
* Function prototipes. Routines that start with an underscore are not part
* of the public interface and are wrappered with a macro.
@@ -110,12 +115,10 @@ int _sx_slock(struct sx *sx, int opts, const char *file, int line);
int _sx_xlock(struct sx *sx, int opts, const char *file, int line);
void _sx_sunlock(struct sx *sx, const char *file, int line);
void _sx_xunlock(struct sx *sx, const char *file, int line);
-int _sx_xlock_hard(struct sx *sx, uintptr_t tid, int opts,
+int _sx_xlock_hard(struct sx *sx, uintptr_t v, uintptr_t tid, int opts,
const char *file, int line);
-int _sx_slock_hard(struct sx *sx, int opts, const char *file, int line);
void _sx_xunlock_hard(struct sx *sx, uintptr_t tid, const char *file, int
line);
-void _sx_sunlock_hard(struct sx *sx, const char *file, int line);
#if defined(INVARIANTS) || defined(INVARIANT_SUPPORT)
void _sx_assert(const struct sx *sx, int what, const char *file, int line);
#endif
@@ -149,20 +152,19 @@ struct sx_args {
* deferred to 'tougher' functions.
*/
+#if (LOCK_DEBUG == 0)
/* Acquire an exclusive lock. */
static __inline int
__sx_xlock(struct sx *sx, struct thread *td, int opts, const char *file,
int line)
{
uintptr_t tid = (uintptr_t)td;
+ uintptr_t v = SX_LOCK_UNLOCKED;
int error = 0;
- if (sx->sx_lock != SX_LOCK_UNLOCKED ||
- !atomic_cmpset_acq_ptr(&sx->sx_lock, SX_LOCK_UNLOCKED, tid))
- error = _sx_xlock_hard(sx, tid, opts, file, line);
- else
- LOCKSTAT_PROFILE_OBTAIN_RWLOCK_SUCCESS(sx__acquire, sx,
- 0, 0, file, line, LOCKSTAT_WRITER);
+ if (__predict_false(LOCKSTAT_PROFILE_ENABLED(sx__acquire) ||
+ !atomic_fcmpset_acq_ptr(&sx->sx_lock, &v, tid)))
+ error = _sx_xlock_hard(sx, v, tid, opts, file, line);
return (error);
}
@@ -173,48 +175,11 @@ __sx_xunlock(struct sx *sx, struct thread *td, const char *file, int line)
{
uintptr_t tid = (uintptr_t)td;
- if (sx->sx_recurse == 0)
- LOCKSTAT_PROFILE_RELEASE_RWLOCK(sx__release, sx,
- LOCKSTAT_WRITER);
- if (sx->sx_lock != tid ||
- !atomic_cmpset_rel_ptr(&sx->sx_lock, tid, SX_LOCK_UNLOCKED))
+ if (__predict_false(LOCKSTAT_PROFILE_ENABLED(sx__release) ||
+ !atomic_cmpset_rel_ptr(&sx->sx_lock, tid, SX_LOCK_UNLOCKED)))
_sx_xunlock_hard(sx, tid, file, line);
}
-
-/* Acquire a shared lock. */
-static __inline int
-__sx_slock(struct sx *sx, int opts, const char *file, int line)
-{
- uintptr_t x = sx->sx_lock;
- int error = 0;
-
- if (!(x & SX_LOCK_SHARED) ||
- !atomic_cmpset_acq_ptr(&sx->sx_lock, x, x + SX_ONE_SHARER))
- error = _sx_slock_hard(sx, opts, file, line);
- else
- LOCKSTAT_PROFILE_OBTAIN_RWLOCK_SUCCESS(sx__acquire, sx,
- 0, 0, file, line, LOCKSTAT_READER);
-
- return (error);
-}
-
-/*
- * Release a shared lock. We can just drop a single shared lock so
- * long as we aren't trying to drop the last shared lock when other
- * threads are waiting for an exclusive lock. This takes advantage of
- * the fact that an unlocked lock is encoded as a shared lock with a
- * count of 0.
- */
-static __inline void
-__sx_sunlock(struct sx *sx, const char *file, int line)
-{
- uintptr_t x = sx->sx_lock;
-
- LOCKSTAT_PROFILE_RELEASE_RWLOCK(sx__release, sx, LOCKSTAT_READER);
- if (x == (SX_SHARERS_LOCK(1) | SX_LOCK_EXCLUSIVE_WAITERS) ||
- !atomic_cmpset_rel_ptr(&sx->sx_lock, x, x - SX_ONE_SHARER))
- _sx_sunlock_hard(sx, file, line);
-}
+#endif
#endif /* __rtems__ */
/*
@@ -230,12 +195,6 @@ __sx_sunlock(struct sx *sx, const char *file, int line)
_sx_xlock((sx), SX_INTERRUPTIBLE, (file), (line))
#define sx_xunlock_(sx, file, line) \
_sx_xunlock((sx), (file), (line))
-#define sx_slock_(sx, file, line) \
- (void)_sx_slock((sx), 0, (file), (line))
-#define sx_slock_sig_(sx, file, line) \
- _sx_slock((sx), SX_INTERRUPTIBLE, (file) , (line))
-#define sx_sunlock_(sx, file, line) \
- _sx_sunlock((sx), (file), (line))
#else
#define sx_xlock_(sx, file, line) \
(void)__sx_xlock((sx), curthread, 0, (file), (line))
@@ -243,13 +202,13 @@ __sx_sunlock(struct sx *sx, const char *file, int line)
__sx_xlock((sx), curthread, SX_INTERRUPTIBLE, (file), (line))
#define sx_xunlock_(sx, file, line) \
__sx_xunlock((sx), curthread, (file), (line))
+#endif /* LOCK_DEBUG > 0 || SX_NOINLINE */
#define sx_slock_(sx, file, line) \
- (void)__sx_slock((sx), 0, (file), (line))
+ (void)_sx_slock((sx), 0, (file), (line))
#define sx_slock_sig_(sx, file, line) \
- __sx_slock((sx), SX_INTERRUPTIBLE, (file), (line))
+ _sx_slock((sx), SX_INTERRUPTIBLE, (file) , (line))
#define sx_sunlock_(sx, file, line) \
- __sx_sunlock((sx), (file), (line))
-#endif /* LOCK_DEBUG > 0 || SX_NOINLINE */
+ _sx_sunlock((sx), (file), (line))
#define sx_try_slock(sx) sx_try_slock_((sx), LOCK_FILE, LOCK_LINE)
#define sx_try_xlock(sx) sx_try_xlock_((sx), LOCK_FILE, LOCK_LINE)
#define sx_try_upgrade(sx) sx_try_upgrade_((sx), LOCK_FILE, LOCK_LINE)
diff --git a/freebsd/sys/sys/sysctl.h b/freebsd/sys/sys/sysctl.h
index 988cec2e..71da475b 100644
--- a/freebsd/sys/sys/sysctl.h
+++ b/freebsd/sys/sys/sysctl.h
@@ -13,7 +13,7 @@
* 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.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -1048,6 +1048,9 @@ SYSCTL_DECL(_compat);
SYSCTL_DECL(_regression);
SYSCTL_DECL(_security);
SYSCTL_DECL(_security_bsd);
+#ifdef EXT_RESOURCES
+SYSCTL_DECL(_clock);
+#endif
extern char machine[];
extern char osrelease[];
diff --git a/freebsd/sys/sys/syslog.h b/freebsd/sys/sys/syslog.h
index 61bad21c..f31cfb97 100644
--- a/freebsd/sys/sys/syslog.h
+++ b/freebsd/sys/sys/syslog.h
@@ -10,7 +10,7 @@
* 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.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
diff --git a/freebsd/sys/sys/sysproto.h b/freebsd/sys/sys/sysproto.h
index a1673035..bdd20804 100644
--- a/freebsd/sys/sys/sysproto.h
+++ b/freebsd/sys/sys/sysproto.h
@@ -3,7 +3,6 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: head/sys/kern/syscalls.master 310638 2016-12-27 20:21:11Z jhb
*/
#ifndef _SYS_SYSPROTO_H_
@@ -737,6 +736,12 @@ struct ffclock_setestimate_args {
struct ffclock_getestimate_args {
char cest_l_[PADL_(struct ffclock_estimate *)]; struct ffclock_estimate * cest; char cest_r_[PADR_(struct ffclock_estimate *)];
};
+struct clock_nanosleep_args {
+ char clock_id_l_[PADL_(clockid_t)]; clockid_t clock_id; char clock_id_r_[PADR_(clockid_t)];
+ char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
+ char rqtp_l_[PADL_(const struct timespec *)]; const struct timespec * rqtp; char rqtp_r_[PADR_(const struct timespec *)];
+ char rmtp_l_[PADL_(struct timespec *)]; struct timespec * rmtp; char rmtp_r_[PADR_(struct timespec *)];
+};
struct clock_getcpuclockid2_args {
char id_l_[PADL_(id_t)]; id_t id; char id_r_[PADR_(id_t)];
char which_l_[PADL_(int)]; int which; char which_r_[PADR_(int)];
@@ -1982,6 +1987,7 @@ int sys_nanosleep(struct thread *, struct nanosleep_args *);
int sys_ffclock_getcounter(struct thread *, struct ffclock_getcounter_args *);
int sys_ffclock_setestimate(struct thread *, struct ffclock_setestimate_args *);
int sys_ffclock_getestimate(struct thread *, struct ffclock_getestimate_args *);
+int sys_clock_nanosleep(struct thread *, struct clock_nanosleep_args *);
int sys_clock_getcpuclockid2(struct thread *, struct clock_getcpuclockid2_args *);
int sys_ntp_gettime(struct thread *, struct ntp_gettime_args *);
int sys_minherit(struct thread *, struct minherit_args *);
@@ -2705,7 +2711,7 @@ int freebsd10_pipe(struct thread *, struct freebsd10_pipe_args *);
#define SYS_AUE_shmsys AUE_SHMSYS
#define SYS_AUE_freebsd6_pread AUE_PREAD
#define SYS_AUE_freebsd6_pwrite AUE_PWRITE
-#define SYS_AUE_setfib AUE_NULL
+#define SYS_AUE_setfib AUE_SETFIB
#define SYS_AUE_ntp_adjtime AUE_NTP_ADJTIME
#define SYS_AUE_setgid AUE_SETGID
#define SYS_AUE_setegid AUE_SETEGID
@@ -2752,15 +2758,16 @@ int freebsd10_pipe(struct thread *, struct freebsd10_pipe_args *);
#define SYS_AUE_ffclock_getcounter AUE_NULL
#define SYS_AUE_ffclock_setestimate AUE_NULL
#define SYS_AUE_ffclock_getestimate AUE_NULL
+#define SYS_AUE_clock_nanosleep AUE_NULL
#define SYS_AUE_clock_getcpuclockid2 AUE_NULL
#define SYS_AUE_ntp_gettime AUE_NULL
#define SYS_AUE_minherit AUE_MINHERIT
#define SYS_AUE_rfork AUE_RFORK
#define SYS_AUE_issetugid AUE_ISSETUGID
#define SYS_AUE_lchown AUE_LCHOWN
-#define SYS_AUE_aio_read AUE_NULL
-#define SYS_AUE_aio_write AUE_NULL
-#define SYS_AUE_lio_listio AUE_NULL
+#define SYS_AUE_aio_read AUE_AIO_READ
+#define SYS_AUE_aio_write AUE_AIO_WRITE
+#define SYS_AUE_lio_listio AUE_LIO_LISTIO
#define SYS_AUE_getdents AUE_O_GETDENTS
#define SYS_AUE_lchmod AUE_LCHMOD
#define SYS_AUE_lutimes AUE_LUTIMES
@@ -2785,13 +2792,13 @@ int freebsd10_pipe(struct thread *, struct freebsd10_pipe_args *);
#define SYS_AUE_getsid AUE_GETSID
#define SYS_AUE_setresuid AUE_SETRESUID
#define SYS_AUE_setresgid AUE_SETRESGID
-#define SYS_AUE_aio_return AUE_NULL
-#define SYS_AUE_aio_suspend AUE_NULL
-#define SYS_AUE_aio_cancel AUE_NULL
-#define SYS_AUE_aio_error AUE_NULL
-#define SYS_AUE_freebsd6_aio_read AUE_NULL
-#define SYS_AUE_freebsd6_aio_write AUE_NULL
-#define SYS_AUE_freebsd6_lio_listio AUE_NULL
+#define SYS_AUE_aio_return AUE_AIO_RETURN
+#define SYS_AUE_aio_suspend AUE_AIO_SUSPEND
+#define SYS_AUE_aio_cancel AUE_AIO_CANCEL
+#define SYS_AUE_aio_error AUE_AIO_ERROR
+#define SYS_AUE_freebsd6_aio_read AUE_AIO_READ
+#define SYS_AUE_freebsd6_aio_write AUE_AIO_WRITE
+#define SYS_AUE_freebsd6_lio_listio AUE_LIO_LISTIO
#define SYS_AUE_yield AUE_NULL
#define SYS_AUE_mlockall AUE_MLOCKALL
#define SYS_AUE_munlockall AUE_MUNLOCKALL
@@ -2816,27 +2823,27 @@ int freebsd10_pipe(struct thread *, struct freebsd10_pipe_args *);
#define SYS_AUE_freebsd4_sigreturn AUE_SIGRETURN
#define SYS_AUE_sigtimedwait AUE_SIGWAIT
#define SYS_AUE_sigwaitinfo AUE_NULL
-#define SYS_AUE___acl_get_file AUE_NULL
-#define SYS_AUE___acl_set_file AUE_NULL
-#define SYS_AUE___acl_get_fd AUE_NULL
-#define SYS_AUE___acl_set_fd AUE_NULL
-#define SYS_AUE___acl_delete_file AUE_NULL
-#define SYS_AUE___acl_delete_fd AUE_NULL
-#define SYS_AUE___acl_aclcheck_file AUE_NULL
-#define SYS_AUE___acl_aclcheck_fd AUE_NULL
+#define SYS_AUE___acl_get_file AUE_ACL_GET_FILE
+#define SYS_AUE___acl_set_file AUE_ACL_SET_FILE
+#define SYS_AUE___acl_get_fd AUE_ACL_GET_FD
+#define SYS_AUE___acl_set_fd AUE_ACL_SET_FD
+#define SYS_AUE___acl_delete_file AUE_ACL_DELETE_FILE
+#define SYS_AUE___acl_delete_fd AUE_ACL_DELETE_FD
+#define SYS_AUE___acl_aclcheck_file AUE_ACL_CHECK_FILE
+#define SYS_AUE___acl_aclcheck_fd AUE_ACL_CHECK_FD
#define SYS_AUE_extattrctl AUE_EXTATTRCTL
#define SYS_AUE_extattr_set_file AUE_EXTATTR_SET_FILE
#define SYS_AUE_extattr_get_file AUE_EXTATTR_GET_FILE
#define SYS_AUE_extattr_delete_file AUE_EXTATTR_DELETE_FILE
-#define SYS_AUE_aio_waitcomplete AUE_NULL
+#define SYS_AUE_aio_waitcomplete AUE_AIO_WAITCOMPLETE
#define SYS_AUE_getresuid AUE_GETRESUID
#define SYS_AUE_getresgid AUE_GETRESGID
#define SYS_AUE_kqueue AUE_KQUEUE
-#define SYS_AUE_kevent AUE_NULL
+#define SYS_AUE_kevent AUE_KEVENT
#define SYS_AUE_extattr_set_fd AUE_EXTATTR_SET_FD
#define SYS_AUE_extattr_get_fd AUE_EXTATTR_GET_FD
#define SYS_AUE_extattr_delete_fd AUE_EXTATTR_DELETE_FD
-#define SYS_AUE___setugid AUE_NULL
+#define SYS_AUE___setugid AUE_SETUGID
#define SYS_AUE_eaccess AUE_EACCESS
#define SYS_AUE_afs3_syscall AUE_NULL
#define SYS_AUE_nmount AUE_NMOUNT
@@ -2855,15 +2862,15 @@ int freebsd10_pipe(struct thread *, struct freebsd10_pipe_args *);
#define SYS_AUE_statfs AUE_STATFS
#define SYS_AUE_fstatfs AUE_FSTATFS
#define SYS_AUE_fhstatfs AUE_FHSTATFS
-#define SYS_AUE_ksem_close AUE_NULL
-#define SYS_AUE_ksem_post AUE_NULL
-#define SYS_AUE_ksem_wait AUE_NULL
-#define SYS_AUE_ksem_trywait AUE_NULL
-#define SYS_AUE_ksem_init AUE_NULL
-#define SYS_AUE_ksem_open AUE_NULL
-#define SYS_AUE_ksem_unlink AUE_NULL
-#define SYS_AUE_ksem_getvalue AUE_NULL
-#define SYS_AUE_ksem_destroy AUE_NULL
+#define SYS_AUE_ksem_close AUE_SEMCLOSE
+#define SYS_AUE_ksem_post AUE_SEMPOST
+#define SYS_AUE_ksem_wait AUE_SEMWAIT
+#define SYS_AUE_ksem_trywait AUE_SEMTRYWAIT
+#define SYS_AUE_ksem_init AUE_SEMINIT
+#define SYS_AUE_ksem_open AUE_SEMOPEN
+#define SYS_AUE_ksem_unlink AUE_SEMUNLINK
+#define SYS_AUE_ksem_getvalue AUE_SEMGETVALUE
+#define SYS_AUE_ksem_destroy AUE_SEMDESTROY
#define SYS_AUE___mac_get_pid AUE_NULL
#define SYS_AUE___mac_get_link AUE_NULL
#define SYS_AUE___mac_set_link AUE_NULL
@@ -2877,20 +2884,20 @@ int freebsd10_pipe(struct thread *, struct freebsd10_pipe_args *);
#define SYS_AUE_setcontext AUE_NULL
#define SYS_AUE_swapcontext AUE_NULL
#define SYS_AUE_swapoff AUE_SWAPOFF
-#define SYS_AUE___acl_get_link AUE_NULL
-#define SYS_AUE___acl_set_link AUE_NULL
-#define SYS_AUE___acl_delete_link AUE_NULL
-#define SYS_AUE___acl_aclcheck_link AUE_NULL
+#define SYS_AUE___acl_get_link AUE_ACL_GET_LINK
+#define SYS_AUE___acl_set_link AUE_ACL_SET_LINK
+#define SYS_AUE___acl_delete_link AUE_ACL_DELETE_LINK
+#define SYS_AUE___acl_aclcheck_link AUE_ACL_CHECK_LINK
#define SYS_AUE_sigwait AUE_SIGWAIT
-#define SYS_AUE_thr_create AUE_NULL
-#define SYS_AUE_thr_exit AUE_NULL
+#define SYS_AUE_thr_create AUE_THR_CREATE
+#define SYS_AUE_thr_exit AUE_THR_EXIT
#define SYS_AUE_thr_self AUE_NULL
-#define SYS_AUE_thr_kill AUE_NULL
-#define SYS_AUE_jail_attach AUE_NULL
+#define SYS_AUE_thr_kill AUE_THR_KILL
+#define SYS_AUE_jail_attach AUE_JAIL_ATTACH
#define SYS_AUE_extattr_list_fd AUE_EXTATTR_LIST_FD
#define SYS_AUE_extattr_list_file AUE_EXTATTR_LIST_FILE
#define SYS_AUE_extattr_list_link AUE_EXTATTR_LIST_LINK
-#define SYS_AUE_ksem_timedwait AUE_NULL
+#define SYS_AUE_ksem_timedwait AUE_SEMWAIT
#define SYS_AUE_thr_suspend AUE_NULL
#define SYS_AUE_thr_wake AUE_NULL
#define SYS_AUE_kldunloadf AUE_MODUNLOAD
@@ -2904,29 +2911,29 @@ int freebsd10_pipe(struct thread *, struct freebsd10_pipe_args *);
#define SYS_AUE_setaudit_addr AUE_SETAUDIT_ADDR
#define SYS_AUE_auditctl AUE_AUDITCTL
#define SYS_AUE__umtx_op AUE_NULL
-#define SYS_AUE_thr_new AUE_NULL
+#define SYS_AUE_thr_new AUE_THR_NEW
#define SYS_AUE_sigqueue AUE_NULL
-#define SYS_AUE_kmq_open AUE_NULL
-#define SYS_AUE_kmq_setattr AUE_NULL
-#define SYS_AUE_kmq_timedreceive AUE_NULL
-#define SYS_AUE_kmq_timedsend AUE_NULL
-#define SYS_AUE_kmq_notify AUE_NULL
-#define SYS_AUE_kmq_unlink AUE_NULL
+#define SYS_AUE_kmq_open AUE_MQ_OPEN
+#define SYS_AUE_kmq_setattr AUE_MQ_SETATTR
+#define SYS_AUE_kmq_timedreceive AUE_MQ_TIMEDRECEIVE
+#define SYS_AUE_kmq_timedsend AUE_MQ_TIMEDSEND
+#define SYS_AUE_kmq_notify AUE_MQ_NOTIFY
+#define SYS_AUE_kmq_unlink AUE_MQ_UNLINK
#define SYS_AUE_abort2 AUE_NULL
#define SYS_AUE_thr_set_name AUE_NULL
-#define SYS_AUE_aio_fsync AUE_NULL
+#define SYS_AUE_aio_fsync AUE_AIO_FSYNC
#define SYS_AUE_rtprio_thread AUE_RTPRIO
-#define SYS_AUE_sctp_peeloff AUE_NULL
-#define SYS_AUE_sctp_generic_sendmsg AUE_NULL
-#define SYS_AUE_sctp_generic_sendmsg_iov AUE_NULL
-#define SYS_AUE_sctp_generic_recvmsg AUE_NULL
+#define SYS_AUE_sctp_peeloff AUE_SCTP_PEELOFF
+#define SYS_AUE_sctp_generic_sendmsg AUE_SCTP_GENERIC_SENDMSG
+#define SYS_AUE_sctp_generic_sendmsg_iov AUE_SCTP_GENERIC_SENDMSG_IOV
+#define SYS_AUE_sctp_generic_recvmsg AUE_SCTP_GENERIC_RECVMSG
#define SYS_AUE_pread AUE_PREAD
#define SYS_AUE_pwrite AUE_PWRITE
#define SYS_AUE_mmap AUE_MMAP
#define SYS_AUE_lseek AUE_LSEEK
#define SYS_AUE_truncate AUE_TRUNCATE
#define SYS_AUE_ftruncate AUE_FTRUNCATE
-#define SYS_AUE_thr_kill2 AUE_KILL
+#define SYS_AUE_thr_kill2 AUE_THR_KILL2
#define SYS_AUE_shm_open AUE_SHMOPEN
#define SYS_AUE_shm_unlink AUE_SHMUNLINK
#define SYS_AUE_cpuset AUE_NULL
@@ -2951,9 +2958,9 @@ int freebsd10_pipe(struct thread *, struct freebsd10_pipe_args *);
#define SYS_AUE_unlinkat AUE_UNLINKAT
#define SYS_AUE_posix_openpt AUE_POSIX_OPENPT
#define SYS_AUE_gssd_syscall AUE_NULL
-#define SYS_AUE_jail_get AUE_NULL
-#define SYS_AUE_jail_set AUE_NULL
-#define SYS_AUE_jail_remove AUE_NULL
+#define SYS_AUE_jail_get AUE_JAIL_GET
+#define SYS_AUE_jail_set AUE_JAIL_SET
+#define SYS_AUE_jail_remove AUE_JAIL_REMOVE
#define SYS_AUE_closefrom AUE_CLOSEFROM
#define SYS_AUE___semctl AUE_SEMCTL
#define SYS_AUE_msgctl AUE_MSGCTL
@@ -2966,15 +2973,15 @@ int freebsd10_pipe(struct thread *, struct freebsd10_pipe_args *);
#define SYS_AUE_pdkill AUE_PDKILL
#define SYS_AUE_pdgetpid AUE_PDGETPID
#define SYS_AUE_pselect AUE_SELECT
-#define SYS_AUE_getloginclass AUE_NULL
-#define SYS_AUE_setloginclass AUE_NULL
+#define SYS_AUE_getloginclass AUE_GETLOGINCLASS
+#define SYS_AUE_setloginclass AUE_SETLOGINCLASS
#define SYS_AUE_rctl_get_racct AUE_NULL
#define SYS_AUE_rctl_get_rules AUE_NULL
#define SYS_AUE_rctl_get_limits AUE_NULL
#define SYS_AUE_rctl_add_rule AUE_NULL
#define SYS_AUE_rctl_remove_rule AUE_NULL
-#define SYS_AUE_posix_fallocate AUE_NULL
-#define SYS_AUE_posix_fadvise AUE_NULL
+#define SYS_AUE_posix_fallocate AUE_POSIX_FALLOCATE
+#define SYS_AUE_posix_fadvise AUE_POSIX_FADVISE
#define SYS_AUE_wait6 AUE_WAIT6
#define SYS_AUE_cap_rights_limit AUE_CAP_RIGHTS_LIMIT
#define SYS_AUE_cap_ioctls_limit AUE_CAP_IOCTLS_LIMIT
@@ -2986,8 +2993,8 @@ int freebsd10_pipe(struct thread *, struct freebsd10_pipe_args *);
#define SYS_AUE_chflagsat AUE_CHFLAGSAT
#define SYS_AUE_accept4 AUE_ACCEPT
#define SYS_AUE_pipe2 AUE_PIPE
-#define SYS_AUE_aio_mlock AUE_NULL
-#define SYS_AUE_procctl AUE_NULL
+#define SYS_AUE_aio_mlock AUE_AIO_MLOCK
+#define SYS_AUE_procctl AUE_PROCCTL
#define SYS_AUE_ppoll AUE_POLL
#define SYS_AUE_futimens AUE_FUTIMES
#define SYS_AUE_utimensat AUE_FUTIMESAT
diff --git a/freebsd/sys/sys/systm.h b/freebsd/sys/sys/systm.h
index 3512c49e..ee799320 100644
--- a/freebsd/sys/sys/systm.h
+++ b/freebsd/sys/sys/systm.h
@@ -15,7 +15,7 @@
* 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.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -45,6 +45,8 @@
#include <sys/queue.h>
#include <sys/stdint.h> /* for people using printf mainly */
+__NULLABILITY_PRAGMA_PUSH
+
#ifndef __rtems__
extern int cold; /* nonzero if we are doing a cold boot */
extern int suspend_blocked; /* block suspend due to pending shutdown */
@@ -150,12 +152,22 @@ void kassert_panic(const char *fmt, ...) __printflike(1, 2);
* going to run the thread that holds any lock we need.
*/
#ifndef __rtems__
-#define SCHEDULER_STOPPED() __predict_false(curthread->td_stopsched)
+#define SCHEDULER_STOPPED_TD(td) ({ \
+ MPASS((td) == curthread); \
+ __predict_false((td)->td_stopsched); \
+})
#else /* __rtems__ */
-#define SCHEDULER_STOPPED() 0
+#define SCHEDULER_STOPPED_TD(td) 0
#endif /* __rtems__ */
+#define SCHEDULER_STOPPED() SCHEDULER_STOPPED_TD(curthread)
/*
+ * Align variables.
+ */
+#define __read_mostly __section(".data.read_mostly")
+#define __exclusive_cache_line __aligned(CACHE_LINE_SIZE) \
+ __section(".data.exclusive_cache_line")
+/*
* XXX the hints declarations are even more misplaced than most declarations
* in this file, since they are needed in one file (per arch) and only used
* in two files.
@@ -272,25 +284,25 @@ int vsnprintf(char *, size_t, const char *, __va_list) __printflike(3, 0);
int vsnrprintf(char *, size_t, int, const char *, __va_list) __printflike(4, 0);
int vsprintf(char *buf, const char *, __va_list) __printflike(2, 0);
int ttyprintf(struct tty *, const char *, ...) __printflike(2, 3);
-int sscanf(const char *, char const *, ...) __nonnull(1) __nonnull(2) __scanflike(2, 3);
-int vsscanf(const char *, char const *, __va_list) __nonnull(1) __nonnull(2) __scanflike(2, 0);
-long strtol(const char *, char **, int) __nonnull(1);
-u_long strtoul(const char *, char **, int) __nonnull(1);
+int sscanf(const char *, char const * _Nonnull, ...) __scanflike(2, 3);
+int vsscanf(const char * _Nonnull, char const * _Nonnull, __va_list) __scanflike(2, 0);
+long strtol(const char *, char **, int);
+u_long strtoul(const char *, char **, int);
#ifndef __rtems__
-quad_t strtoq(const char *, char **, int) __nonnull(1);
-u_quad_t strtouq(const char *, char **, int) __nonnull(1);
+quad_t strtoq(const char *, char **, int);
+u_quad_t strtouq(const char *, char **, int);
#else /* __rtems__ */
long long strtoll(const char *, char **, int);
unsigned long long strtoull(const char *, char **, int);
-static inline quad_t __nonnull(1)
+static inline quad_t
strtoq(const char *nptr, char **endptr, int base)
{
return (strtoll(nptr, endptr, base));
}
-static inline u_quad_t __nonnull(1)
+static inline u_quad_t
strtouq(const char *nptr, char **endptr, int base)
{
@@ -308,34 +320,34 @@ void hexdump(const void *ptr, int length, const char *hdr, int flags);
#define ovbcopy(f, t, l) bcopy((f), (t), (l))
#ifndef __rtems__
-void bcopy(const void *from, void *to, size_t len) __nonnull(1) __nonnull(2);
-void bzero(void *buf, size_t len) __nonnull(1);
+void bcopy(const void * _Nonnull from, void * _Nonnull to, size_t len);
+void bzero(void * _Nonnull buf, size_t len);
#else /* __rtems__ */
-#define bcopy(src, dst, len) memmove((dst), (src), (len))
-#define bzero(buf, size) memset((buf), 0, (size))
+#define bcopy(src, dst, len) memmove((dst), (src), (len))
+#define bzero(buf, size) memset((buf), 0, (size))
#endif /* __rtems__ */
-void explicit_bzero(void *, size_t) __nonnull(1);
+void explicit_bzero(void * _Nonnull, size_t);
-void *memcpy(void *to, const void *from, size_t len) __nonnull(1) __nonnull(2);
-void *memmove(void *dest, const void *src, size_t n) __nonnull(1) __nonnull(2);
+void *memcpy(void * _Nonnull to, const void * _Nonnull from, size_t len);
+void *memmove(void * _Nonnull dest, const void * _Nonnull src, size_t n);
-int copystr(const void * __restrict kfaddr, void * __restrict kdaddr,
- size_t len, size_t * __restrict lencopied)
- __nonnull(1) __nonnull(2);
#ifndef __rtems__
-int copyinstr(const void * __restrict udaddr, void * __restrict kaddr,
- size_t len, size_t * __restrict lencopied)
- __nonnull(1) __nonnull(2);
-int copyin(const void * __restrict udaddr, void * __restrict kaddr,
- size_t len) __nonnull(1) __nonnull(2);
-int copyin_nofault(const void * __restrict udaddr, void * __restrict kaddr,
- size_t len) __nonnull(1) __nonnull(2);
-int copyout(const void * __restrict kaddr, void * __restrict udaddr,
- size_t len) __nonnull(1) __nonnull(2);
-int copyout_nofault(const void * __restrict kaddr, void * __restrict udaddr,
- size_t len) __nonnull(1) __nonnull(2);
+int copystr(const void * _Nonnull __restrict kfaddr,
+ void * _Nonnull __restrict kdaddr, size_t len,
+ size_t * __restrict lencopied);
+int copyinstr(const void * __restrict udaddr,
+ void * _Nonnull __restrict kaddr, size_t len,
+ size_t * __restrict lencopied);
+int copyin(const void * _Nonnull __restrict udaddr,
+ void * _Nonnull __restrict kaddr, size_t len);
+int copyin_nofault(const void * _Nonnull __restrict udaddr,
+ void * _Nonnull __restrict kaddr, size_t len);
+int copyout(const void * _Nonnull __restrict kaddr,
+ void * _Nonnull __restrict udaddr, size_t len);
+int copyout_nofault(const void * _Nonnull __restrict kaddr,
+ void * _Nonnull __restrict udaddr, size_t len);
#else /* __rtems__ */
-static inline int __nonnull(1) __nonnull(2)
+static inline int
copyinstr(const void * __restrict udaddr, void * __restrict kaddr,
size_t len, size_t * __restrict lencopied)
{
@@ -348,7 +360,7 @@ copyinstr(const void * __restrict udaddr, void * __restrict kaddr,
return (0);
}
-static inline int __nonnull(1) __nonnull(2)
+static inline int
copyin(const void * __restrict udaddr, void * __restrict kaddr,
size_t len)
{
@@ -357,14 +369,14 @@ copyin(const void * __restrict udaddr, void * __restrict kaddr,
return (0);
}
-static inline int __nonnull(1) __nonnull(2)
+static inline int
copyin_nofault(const void * __restrict udaddr, void * __restrict kaddr,
size_t len)
{
return copyin(udaddr, kaddr, len);
}
-static inline int __nonnull(1) __nonnull(2)
+static inline int
copyout(const void * __restrict kaddr, void * __restrict udaddr,
size_t len)
{
@@ -373,7 +385,7 @@ copyout(const void * __restrict kaddr, void * __restrict udaddr,
return (0);
}
-static inline int __nonnull(1) __nonnull(2)
+static inline int
copyout_nofault(const void * __restrict kaddr, void * __restrict udaddr,
size_t len)
{
@@ -437,7 +449,6 @@ sbintime_t cpu_idleclock(void);
void cpu_activeclock(void);
void cpu_new_callout(int cpu, sbintime_t bt, sbintime_t bt_opt);
void cpu_et_frequency(struct eventtimer *et, uint64_t newfreq);
-extern int cpu_deepest_sleep;
extern int cpu_disable_c2_sleep;
extern int cpu_disable_c3_sleep;
@@ -505,8 +516,8 @@ static __inline void splx(intrmask_t ipl __unused) { return; }
* Common `proc' functions are declared here so that proc.h can be included
* less often.
*/
-int _sleep(void *chan, struct lock_object *lock, int pri, const char *wmesg,
- sbintime_t sbt, sbintime_t pr, int flags) __nonnull(1);
+int _sleep(void * _Nonnull chan, struct lock_object *lock, int pri,
+ const char *wmesg, sbintime_t sbt, sbintime_t pr, int flags);
#define msleep(chan, mtx, pri, wmesg, timo) \
_sleep((chan), &(mtx)->lock_object, (pri), (wmesg), \
tick_sbt * (timo), 0, C_HARDCLOCK)
@@ -514,8 +525,8 @@ int _sleep(void *chan, struct lock_object *lock, int pri, const char *wmesg,
_sleep((chan), &(mtx)->lock_object, (pri), (wmesg), (bt), (pr), \
(flags))
#ifndef __rtems__
-int msleep_spin_sbt(void *chan, struct mtx *mtx, const char *wmesg,
- sbintime_t sbt, sbintime_t pr, int flags) __nonnull(1);
+int msleep_spin_sbt(void * _Nonnull chan, struct mtx *mtx,
+ const char *wmesg, sbintime_t sbt, sbintime_t pr, int flags);
#else /* __rtems__ */
#define msleep_spin_sbt(chan, mtx, wmesg, sbt, pr, flags) \
msleep_sbt(chan, mtx, 0, wmesg, sbt, pr, flags)
@@ -535,8 +546,8 @@ int pause_sbt(const char *wmesg, sbintime_t sbt, sbintime_t pr,
0, C_HARDCLOCK)
#define tsleep_sbt(chan, pri, wmesg, bt, pr, flags) \
_sleep((chan), NULL, (pri), (wmesg), (bt), (pr), (flags))
-void wakeup(void *chan) __nonnull(1);
-void wakeup_one(void *chan) __nonnull(1);
+void wakeup(void * chan);
+void wakeup_one(void * chan);
/*
* Common `struct cdev *' stuff are declared here to avoid #include poisoning
@@ -580,8 +591,8 @@ void free_unr(struct unrhdr *uh, u_int item);
void intr_prof_stack_use(struct thread *td, struct trapframe *frame);
-extern void (*softdep_ast_cleanup)(void);
-
void counted_warning(unsigned *counter, const char *msg);
+__NULLABILITY_PRAGMA_POP
+
#endif /* !_SYS_SYSTM_H_ */
diff --git a/freebsd/sys/sys/taskqueue.h b/freebsd/sys/sys/taskqueue.h
index a6c66558..583f796e 100644
--- a/freebsd/sys/sys/taskqueue.h
+++ b/freebsd/sys/sys/taskqueue.h
@@ -30,7 +30,7 @@
#define _SYS_TASKQUEUE_H_
#ifndef _KERNEL
-#error "no user-servicable parts inside"
+#error "no user-serviceable parts inside"
#endif
#include <sys/queue.h>
@@ -79,6 +79,7 @@ int taskqueue_start_threads_cpuset(struct taskqueue **tqp, int count,
int taskqueue_enqueue(struct taskqueue *queue, struct task *task);
int taskqueue_enqueue_timeout(struct taskqueue *queue,
struct timeout_task *timeout_task, int ticks);
+int taskqueue_poll_is_busy(struct taskqueue *queue, struct task *task);
int taskqueue_cancel(struct taskqueue *queue, struct task *task,
u_int *pendp);
int taskqueue_cancel_timeout(struct taskqueue *queue,
diff --git a/freebsd/sys/sys/tty.h b/freebsd/sys/sys/tty.h
index 4d082667..a82aedf4 100644
--- a/freebsd/sys/sys/tty.h
+++ b/freebsd/sys/sys/tty.h
@@ -62,6 +62,7 @@ struct tty {
struct mtx *t_mtx; /* TTY lock. */
struct mtx t_mtxobj; /* Per-TTY lock (when not borrowing). */
TAILQ_ENTRY(tty) t_list; /* (l) TTY list entry. */
+ int t_drainwait; /* (t) TIOCDRAIN timeout seconds. */
unsigned int t_flags; /* (t) Terminal option flags. */
/* Keep flags in sync with db_show_tty and pstat(8). */
#define TF_NOPREFIX 0x00001 /* Don't prepend "tty" to device name. */
diff --git a/freebsd/sys/sys/ttyqueue.h b/freebsd/sys/sys/ttyqueue.h
index 2d1a565a..c8d85d62 100644
--- a/freebsd/sys/sys/ttyqueue.h
+++ b/freebsd/sys/sys/ttyqueue.h
@@ -69,7 +69,7 @@ struct ttyoutq {
#ifdef _KERNEL
/* Input queue handling routines. */
-void ttyinq_setsize(struct ttyinq *ti, struct tty *tp, size_t len);
+int ttyinq_setsize(struct ttyinq *ti, struct tty *tp, size_t len);
void ttyinq_free(struct ttyinq *ti);
int ttyinq_read_uio(struct ttyinq *ti, struct tty *tp, struct uio *uio,
size_t readlen, size_t flushlen);
@@ -136,7 +136,7 @@ void ttyinq_line_iterate_from_reprintpos(struct ttyinq *ti,
/* Output queue handling routines. */
void ttyoutq_flush(struct ttyoutq *to);
-void ttyoutq_setsize(struct ttyoutq *to, struct tty *tp, size_t len);
+int ttyoutq_setsize(struct ttyoutq *to, struct tty *tp, size_t len);
void ttyoutq_free(struct ttyoutq *to);
size_t ttyoutq_read(struct ttyoutq *to, void *buf, size_t len);
int ttyoutq_read_uio(struct ttyoutq *to, struct tty *tp, struct uio *uio);
diff --git a/freebsd/sys/sys/ucred.h b/freebsd/sys/sys/ucred.h
index ae3fcdeb..bf5d99d8 100644
--- a/freebsd/sys/sys/ucred.h
+++ b/freebsd/sys/sys/ucred.h
@@ -10,7 +10,7 @@
* 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.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
diff --git a/freebsd/sys/sys/un.h b/freebsd/sys/sys/un.h
index 7837e76e..27d6a499 100644
--- a/freebsd/sys/sys/un.h
+++ b/freebsd/sys/sys/un.h
@@ -10,7 +10,7 @@
* 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.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
diff --git a/freebsd/sys/sys/unpcb.h b/freebsd/sys/sys/unpcb.h
index cdb5c4d0..619b68dd 100644
--- a/freebsd/sys/sys/unpcb.h
+++ b/freebsd/sys/sys/unpcb.h
@@ -10,7 +10,7 @@
* 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.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
diff --git a/freebsd/sys/sys/user.h b/freebsd/sys/sys/user.h
index 9dad4d0a..762841ee 100644
--- a/freebsd/sys/sys/user.h
+++ b/freebsd/sys/sys/user.h
@@ -12,7 +12,7 @@
* 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.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
diff --git a/freebsd/sys/sys/vmmeter.h b/freebsd/sys/sys/vmmeter.h
index 31312b0a..b5d0ef14 100644
--- a/freebsd/sys/sys/vmmeter.h
+++ b/freebsd/sys/sys/vmmeter.h
@@ -10,7 +10,7 @@
* 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.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
diff --git a/freebsd/sys/sys/vnode.h b/freebsd/sys/sys/vnode.h
index e125b0de..0d8c6521 100644
--- a/freebsd/sys/sys/vnode.h
+++ b/freebsd/sys/sys/vnode.h
@@ -10,7 +10,7 @@
* 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.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*