summaryrefslogtreecommitdiffstats
path: root/freebsd/sys/sys
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2018-08-09 14:02:09 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-09-21 10:29:38 +0200
commitbb80d9df8bac71eedee1a6787ca63aef972a7e48 (patch)
tree1b5cb9443c5ead5706c35afb618abbbd1592315e /freebsd/sys/sys
parentUpdate to FreeBSD head 2017-10-01 (diff)
downloadrtems-libbsd-bb80d9df8bac71eedee1a6787ca63aef972a7e48.tar.bz2
Update to FreeBSD head 2017-12-01
Git mirror commit e724f51f811a4b2bd29447f8b85ab5c2f9b88266. Update #3472.
Diffstat (limited to 'freebsd/sys/sys')
-rw-r--r--freebsd/sys/sys/_bus_dma.h2
-rw-r--r--freebsd/sys/sys/_callout.h2
-rw-r--r--freebsd/sys/sys/_lock.h2
-rw-r--r--freebsd/sys/sys/_lockmgr.h2
-rw-r--r--freebsd/sys/sys/_mutex.h2
-rw-r--r--freebsd/sys/sys/_null.h2
-rw-r--r--freebsd/sys/sys/_pctrie.h4
-rw-r--r--freebsd/sys/sys/_rmlock.h2
-rw-r--r--freebsd/sys/sys/_rwlock.h2
-rw-r--r--freebsd/sys/sys/_semaphore.h2
-rw-r--r--freebsd/sys/sys/_sx.h2
-rw-r--r--freebsd/sys/sys/_task.h2
-rw-r--r--freebsd/sys/sys/_unrhdr.h2
-rw-r--r--freebsd/sys/sys/acl.h2
-rw-r--r--freebsd/sys/sys/aio.h4
-rw-r--r--freebsd/sys/sys/ata.h2
-rw-r--r--freebsd/sys/sys/blist.h4
-rw-r--r--freebsd/sys/sys/buf.h2
-rw-r--r--freebsd/sys/sys/buf_ring.h2
-rw-r--r--freebsd/sys/sys/bufobj.h2
-rw-r--r--freebsd/sys/sys/bus.h10
-rw-r--r--freebsd/sys/sys/bus_dma.h2
-rw-r--r--freebsd/sys/sys/callout.h2
-rw-r--r--freebsd/sys/sys/capability.h2
-rw-r--r--freebsd/sys/sys/caprights.h2
-rw-r--r--freebsd/sys/sys/condvar.h2
-rw-r--r--freebsd/sys/sys/conf.h29
-rw-r--r--freebsd/sys/sys/cons.h2
-rw-r--r--freebsd/sys/sys/counter.h2
-rw-r--r--freebsd/sys/sys/cpu.h2
-rw-r--r--freebsd/sys/sys/ctype.h2
-rw-r--r--freebsd/sys/sys/domain.h2
-rw-r--r--freebsd/sys/sys/eventhandler.h69
-rw-r--r--freebsd/sys/sys/eventvar.h2
-rw-r--r--freebsd/sys/sys/fail.h2
-rw-r--r--freebsd/sys/sys/file.h2
-rw-r--r--freebsd/sys/sys/filedesc.h2
-rw-r--r--freebsd/sys/sys/firmware.h2
-rw-r--r--freebsd/sys/sys/gpio.h2
-rw-r--r--freebsd/sys/sys/hash.h2
-rw-r--r--freebsd/sys/sys/hhook.h2
-rw-r--r--freebsd/sys/sys/interrupt.h2
-rw-r--r--freebsd/sys/sys/jail.h2
-rw-r--r--freebsd/sys/sys/kenv.h2
-rw-r--r--freebsd/sys/sys/kernel.h2
-rw-r--r--freebsd/sys/sys/khelp.h2
-rw-r--r--freebsd/sys/sys/kobj.h2
-rw-r--r--freebsd/sys/sys/kthread.h2
-rw-r--r--freebsd/sys/sys/ktr.h2
-rw-r--r--freebsd/sys/sys/ktr_class.h2
-rw-r--r--freebsd/sys/sys/libkern.h2
-rw-r--r--freebsd/sys/sys/limits.h2
-rw-r--r--freebsd/sys/sys/linker.h2
-rwxr-xr-xfreebsd/sys/sys/linker_set.h5
-rw-r--r--freebsd/sys/sys/lock_profile.h2
-rw-r--r--freebsd/sys/sys/lockmgr.h2
-rw-r--r--freebsd/sys/sys/lockstat.h2
-rw-r--r--freebsd/sys/sys/loginclass.h2
-rw-r--r--freebsd/sys/sys/mac.h2
-rw-r--r--freebsd/sys/sys/malloc.h2
-rw-r--r--freebsd/sys/sys/mbuf.h94
-rw-r--r--freebsd/sys/sys/module.h2
-rw-r--r--freebsd/sys/sys/module_khelp.h2
-rw-r--r--freebsd/sys/sys/mount.h2
-rw-r--r--freebsd/sys/sys/mqueue.h2
-rw-r--r--freebsd/sys/sys/mutex.h81
-rw-r--r--freebsd/sys/sys/nlist_aout.h2
-rw-r--r--freebsd/sys/sys/osd.h2
-rw-r--r--freebsd/sys/sys/pciio.h2
-rw-r--r--freebsd/sys/sys/pcpu.h2
-rw-r--r--freebsd/sys/sys/priv.h4
-rw-r--r--freebsd/sys/sys/proc.h3
-rw-r--r--freebsd/sys/sys/protosw.h2
-rw-r--r--freebsd/sys/sys/racct.h2
-rw-r--r--freebsd/sys/sys/random.h16
-rw-r--r--freebsd/sys/sys/reboot.h3
-rw-r--r--freebsd/sys/sys/refcount.h2
-rw-r--r--freebsd/sys/sys/resourcevar.h2
-rw-r--r--freebsd/sys/sys/rmlock.h24
-rw-r--r--freebsd/sys/sys/rtprio.h2
-rw-r--r--freebsd/sys/sys/runq.h2
-rw-r--r--freebsd/sys/sys/rwlock.h77
-rw-r--r--freebsd/sys/sys/sbuf.h2
-rw-r--r--freebsd/sys/sys/sdt.h12
-rw-r--r--freebsd/sys/sys/selinfo.h2
-rw-r--r--freebsd/sys/sys/serial.h2
-rw-r--r--freebsd/sys/sys/sf_buf.h2
-rw-r--r--freebsd/sys/sys/sigio.h2
-rw-r--r--freebsd/sys/sys/signalvar.h2
-rw-r--r--freebsd/sys/sys/sleepqueue.h2
-rw-r--r--freebsd/sys/sys/slicer.h2
-rw-r--r--freebsd/sys/sys/smp.h2
-rw-r--r--freebsd/sys/sys/sockbuf.h32
-rw-r--r--freebsd/sys/sys/socketvar.h132
-rw-r--r--freebsd/sys/sys/sockopt.h2
-rw-r--r--freebsd/sys/sys/stddef.h2
-rw-r--r--freebsd/sys/sys/stdint.h2
-rw-r--r--freebsd/sys/sys/sx.h77
-rw-r--r--freebsd/sys/sys/sysctl.h7
-rw-r--r--freebsd/sys/sys/syslog.h2
-rw-r--r--freebsd/sys/sys/systm.h5
-rw-r--r--freebsd/sys/sys/taskqueue.h2
-rw-r--r--freebsd/sys/sys/timeet.h2
-rw-r--r--freebsd/sys/sys/tree.h2
-rw-r--r--freebsd/sys/sys/tty.h2
-rw-r--r--freebsd/sys/sys/ttydevsw.h2
-rw-r--r--freebsd/sys/sys/ttydisc.h2
-rw-r--r--freebsd/sys/sys/ttyhook.h2
-rw-r--r--freebsd/sys/sys/ttyqueue.h2
-rw-r--r--freebsd/sys/sys/ucred.h2
-rw-r--r--freebsd/sys/sys/un.h2
-rw-r--r--freebsd/sys/sys/unpcb.h54
-rw-r--r--freebsd/sys/sys/user.h2
-rw-r--r--freebsd/sys/sys/uuid.h2
-rw-r--r--freebsd/sys/sys/vmmeter.h39
-rw-r--r--freebsd/sys/sys/vnode.h2
-rw-r--r--freebsd/sys/sys/watchdog.h2
117 files changed, 722 insertions, 251 deletions
diff --git a/freebsd/sys/sys/_bus_dma.h b/freebsd/sys/sys/_bus_dma.h
index 91318d01..c2a17301 100644
--- a/freebsd/sys/sys/_bus_dma.h
+++ b/freebsd/sys/sys/_bus_dma.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright 2006 John-Mark Gurney.
* All rights reserved.
*
diff --git a/freebsd/sys/sys/_callout.h b/freebsd/sys/sys/_callout.h
index 53df18e9..60b02f56 100644
--- a/freebsd/sys/sys/_callout.h
+++ b/freebsd/sys/sys/_callout.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
diff --git a/freebsd/sys/sys/_lock.h b/freebsd/sys/sys/_lock.h
index e92430c4..ae10254c 100644
--- a/freebsd/sys/sys/_lock.h
+++ b/freebsd/sys/sys/_lock.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1997 Berkeley Software Design, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/freebsd/sys/sys/_lockmgr.h b/freebsd/sys/sys/_lockmgr.h
index 0367ff1e..62e50df1 100644
--- a/freebsd/sys/sys/_lockmgr.h
+++ b/freebsd/sys/sys/_lockmgr.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2008 Attilio Rao <attilio@FreeBSD.org>
* All rights reserved.
*
diff --git a/freebsd/sys/sys/_mutex.h b/freebsd/sys/sys/_mutex.h
index 96f53238..5252aee1 100644
--- a/freebsd/sys/sys/_mutex.h
+++ b/freebsd/sys/sys/_mutex.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1997 Berkeley Software Design, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/freebsd/sys/sys/_null.h b/freebsd/sys/sys/_null.h
index 92706c6a..8fa5e424 100644
--- a/freebsd/sys/sys/_null.h
+++ b/freebsd/sys/sys/_null.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2003 Marcel Moolenaar
* All rights reserved.
*
diff --git a/freebsd/sys/sys/_pctrie.h b/freebsd/sys/sys/_pctrie.h
index c6d13baa..d9a98a78 100644
--- a/freebsd/sys/sys/_pctrie.h
+++ b/freebsd/sys/sys/_pctrie.h
@@ -1,4 +1,6 @@
-/*
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2013 EMC Corp.
* Copyright (c) 2011 Jeffrey Roberson <jeff@freebsd.org>
* Copyright (c) 2008 Mayur Shardul <mayur.shardul@gmail.com>
diff --git a/freebsd/sys/sys/_rmlock.h b/freebsd/sys/sys/_rmlock.h
index adc2bc56..28e3cb34 100644
--- a/freebsd/sys/sys/_rmlock.h
+++ b/freebsd/sys/sys/_rmlock.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 2007 Stephan Uphoff <ups@FreeBSD.org>
* All rights reserved.
*
diff --git a/freebsd/sys/sys/_rwlock.h b/freebsd/sys/sys/_rwlock.h
index 029fb98b..318592d5 100644
--- a/freebsd/sys/sys/_rwlock.h
+++ b/freebsd/sys/sys/_rwlock.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2006 John Baldwin <jhb@FreeBSD.org>
* All rights reserved.
*
diff --git a/freebsd/sys/sys/_semaphore.h b/freebsd/sys/sys/_semaphore.h
index 560076c8..b5c48251 100644
--- a/freebsd/sys/sys/_semaphore.h
+++ b/freebsd/sys/sys/_semaphore.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2002 Alfred Perlstein <alfred@FreeBSD.org>
* All rights reserved.
*
diff --git a/freebsd/sys/sys/_sx.h b/freebsd/sys/sys/_sx.h
index b07ac47a..328a43a4 100644
--- a/freebsd/sys/sys/_sx.h
+++ b/freebsd/sys/sys/_sx.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2007 Attilio Rao <attilio@freebsd.org>
* All rights reserved.
*
diff --git a/freebsd/sys/sys/_task.h b/freebsd/sys/sys/_task.h
index d46659f4..392dc874 100644
--- a/freebsd/sys/sys/_task.h
+++ b/freebsd/sys/sys/_task.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2000 Doug Rabson
* All rights reserved.
*
diff --git a/freebsd/sys/sys/_unrhdr.h b/freebsd/sys/sys/_unrhdr.h
index f3c25d16..65abe578 100644
--- a/freebsd/sys/sys/_unrhdr.h
+++ b/freebsd/sys/sys/_unrhdr.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2004 Poul-Henning Kamp
* All rights reserved.
*
diff --git a/freebsd/sys/sys/acl.h b/freebsd/sys/sys/acl.h
index 9806a54a..196447a6 100644
--- a/freebsd/sys/sys/acl.h
+++ b/freebsd/sys/sys/acl.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 1999-2001 Robert N. M. Watson
* Copyright (c) 2008 Edward Tomasz Napierała <trasz@FreeBSD.org>
* All rights reserved.
diff --git a/freebsd/sys/sys/aio.h b/freebsd/sys/sys/aio.h
index ab6f766f..2843042b 100644
--- a/freebsd/sys/sys/aio.h
+++ b/freebsd/sys/sys/aio.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 1997 John S. Dyson. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -256,7 +258,7 @@ int aio_suspend(const struct aiocb * const[], int, const struct timespec *);
*/
int aio_mlock(struct aiocb *);
-#ifdef __BSD_VISIBLE
+#if __BSD_VISIBLE
ssize_t aio_waitcomplete(struct aiocb **, struct timespec *);
#endif
diff --git a/freebsd/sys/sys/ata.h b/freebsd/sys/sys/ata.h
index 4d3b3e7f..f8a332c3 100644
--- a/freebsd/sys/sys/ata.h
+++ b/freebsd/sys/sys/ata.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2000 - 2008 Søren Schmidt <sos@FreeBSD.org>
* All rights reserved.
*
diff --git a/freebsd/sys/sys/blist.h b/freebsd/sys/sys/blist.h
index 486e04eb..22d834f7 100644
--- a/freebsd/sys/sys/blist.h
+++ b/freebsd/sys/sys/blist.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1998 Matthew Dillon. All Rights Reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -82,7 +84,7 @@ typedef struct blist {
daddr_t bl_blocks; /* area of coverage */
u_daddr_t bl_radix; /* coverage radix */
daddr_t bl_cursor; /* next-fit search starts at */
- blmeta_t *bl_root; /* root of radix tree */
+ blmeta_t bl_root[1]; /* root of radix tree */
} *blist_t;
#define BLIST_META_RADIX 16
diff --git a/freebsd/sys/sys/buf.h b/freebsd/sys/sys/buf.h
index 5d4f0dc6..77acac5b 100644
--- a/freebsd/sys/sys/buf.h
+++ b/freebsd/sys/sys/buf.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1982, 1986, 1989, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
diff --git a/freebsd/sys/sys/buf_ring.h b/freebsd/sys/sys/buf_ring.h
index 3655775e..0b633238 100644
--- a/freebsd/sys/sys/buf_ring.h
+++ b/freebsd/sys/sys/buf_ring.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2007-2009 Kip Macy <kmacy@freebsd.org>
* All rights reserved.
*
diff --git a/freebsd/sys/sys/bufobj.h b/freebsd/sys/sys/bufobj.h
index 2dc440a6..fb3f0873 100644
--- a/freebsd/sys/sys/bufobj.h
+++ b/freebsd/sys/sys/bufobj.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2004 Poul-Henning Kamp
* All rights reserved.
*
diff --git a/freebsd/sys/sys/bus.h b/freebsd/sys/sys/bus.h
index 626026dc..7a3f6b1a 100644
--- a/freebsd/sys/sys/bus.h
+++ b/freebsd/sys/sys/bus.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 1997,1998,2003 Doug Rabson
* All rights reserved.
*
@@ -491,6 +493,7 @@ struct resource_spec {
int rid;
int flags;
};
+#define RESOURCE_SPEC_END {-1, 0, 0}
int bus_alloc_resources(device_t dev, struct resource_spec *rs,
struct resource **res);
@@ -632,7 +635,6 @@ struct sysctl_oid *devclass_get_sysctl_tree(devclass_t dc);
/*
* Access functions for device resources.
*/
-
int resource_int_value(const char *name, int unit, const char *resname,
int *result);
int resource_long_value(const char *name, int unit, const char *resname,
@@ -644,12 +646,6 @@ int resource_find_match(int *anchor, const char **name, int *unit,
const char *resname, const char *value);
int resource_find_dev(int *anchor, const char *name, int *unit,
const char *resname, const char *value);
-int resource_set_int(const char *name, int unit, const char *resname,
- int value);
-int resource_set_long(const char *name, int unit, const char *resname,
- long value);
-int resource_set_string(const char *name, int unit, const char *resname,
- const char *value);
int resource_unset_value(const char *name, int unit, const char *resname);
/*
diff --git a/freebsd/sys/sys/bus_dma.h b/freebsd/sys/sys/bus_dma.h
index 04dbe0cb..c5799661 100644
--- a/freebsd/sys/sys/bus_dma.h
+++ b/freebsd/sys/sys/bus_dma.h
@@ -1,6 +1,8 @@
/* $NetBSD: bus.h,v 1.12 1997/10/01 08:25:15 fvdl Exp $ */
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-NetBSD
+ *
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
* All rights reserved.
*
diff --git a/freebsd/sys/sys/callout.h b/freebsd/sys/sys/callout.h
index 68861957..a0b45d98 100644
--- a/freebsd/sys/sys/callout.h
+++ b/freebsd/sys/sys/callout.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
diff --git a/freebsd/sys/sys/capability.h b/freebsd/sys/sys/capability.h
index 3bdaf203..4b07c090 100644
--- a/freebsd/sys/sys/capability.h
+++ b/freebsd/sys/sys/capability.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2014 Robert N. M. Watson
* All rights reserved.
*
diff --git a/freebsd/sys/sys/caprights.h b/freebsd/sys/sys/caprights.h
index eb8e454f..8698483c 100644
--- a/freebsd/sys/sys/caprights.h
+++ b/freebsd/sys/sys/caprights.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2013 FreeBSD Foundation
* All rights reserved.
*
diff --git a/freebsd/sys/sys/condvar.h b/freebsd/sys/sys/condvar.h
index c4666694..cf3cc6ba 100644
--- a/freebsd/sys/sys/condvar.h
+++ b/freebsd/sys/sys/condvar.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2000 Jake Burkholder <jake@freebsd.org>.
* All rights reserved.
*
diff --git a/freebsd/sys/sys/conf.h b/freebsd/sys/sys/conf.h
index 8bf6a3ed..7f240f68 100644
--- a/freebsd/sys/sys/conf.h
+++ b/freebsd/sys/sys/conf.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
* Copyright (c) 2000
@@ -364,26 +366,29 @@ struct dumperinfo {
off_t mediaoffset; /* Initial offset in bytes. */
off_t mediasize; /* Space available in bytes. */
void *blockbuf; /* Buffer for padding shorter dump blocks */
+ off_t dumpoff; /* Offset of ongoing kernel dump. */
struct kerneldumpcrypto *kdc; /* Kernel dump crypto. */
+ struct kerneldumpgz *kdgz; /* Kernel dump compression. */
};
-int set_dumper(struct dumperinfo *di, const char *devname, struct thread *td,
- uint8_t encrypt, const uint8_t *key, uint32_t encryptedkeysize,
- const uint8_t *encryptedkey);
-void dump_init_header(const struct dumperinfo *di, struct kerneldumpheader *kdh,
- char *magic, uint32_t archver, uint64_t dumplen);
-int dump_start(struct dumperinfo *di, struct kerneldumpheader *kdh,
- off_t *dumplop);
-int dump_finish(struct dumperinfo *di, struct kerneldumpheader *kdh,
- off_t dumplo);
-int dump_write(struct dumperinfo *, void *, vm_offset_t, off_t, size_t);
-int doadump(boolean_t);
#ifndef __rtems__
extern int dumping; /* system is dumping */
#else /* __rtems__ */
-#define dumping 0
+#define dumping 0
#endif /* __rtems__ */
+int doadump(boolean_t);
+int set_dumper(struct dumperinfo *di, const char *devname, struct thread *td,
+ uint8_t compression, uint8_t encryption, const uint8_t *key,
+ uint32_t encryptedkeysize, const uint8_t *encryptedkey);
+
+int dump_start(struct dumperinfo *di, struct kerneldumpheader *kdh);
+int dump_append(struct dumperinfo *, void *, vm_offset_t, size_t);
+int dump_write(struct dumperinfo *, void *, vm_offset_t, off_t, size_t);
+int dump_finish(struct dumperinfo *di, struct kerneldumpheader *kdh);
+void dump_init_header(const struct dumperinfo *di, struct kerneldumpheader *kdh,
+ char *magic, uint32_t archver, uint64_t dumplen);
+
#endif /* _KERNEL */
#endif /* !_SYS_CONF_H_ */
diff --git a/freebsd/sys/sys/cons.h b/freebsd/sys/sys/cons.h
index 78cba61e..aded0459 100644
--- a/freebsd/sys/sys/cons.h
+++ b/freebsd/sys/sys/cons.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1988 University of Utah.
* Copyright (c) 1991 The Regents of the University of California.
* All rights reserved.
diff --git a/freebsd/sys/sys/counter.h b/freebsd/sys/sys/counter.h
index 5046d41d..418141a5 100644
--- a/freebsd/sys/sys/counter.h
+++ b/freebsd/sys/sys/counter.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2012 Gleb Smirnoff <glebius@FreeBSD.org>
* All rights reserved.
*
diff --git a/freebsd/sys/sys/cpu.h b/freebsd/sys/sys/cpu.h
index f159e376..b3b745ab 100644
--- a/freebsd/sys/sys/cpu.h
+++ b/freebsd/sys/sys/cpu.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2005-2007 Nate Lawson (SDG)
* All rights reserved.
*
diff --git a/freebsd/sys/sys/ctype.h b/freebsd/sys/sys/ctype.h
index 57b848b5..b2a1fa93 100644
--- a/freebsd/sys/sys/ctype.h
+++ b/freebsd/sys/sys/ctype.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1982, 1988, 1991, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
diff --git a/freebsd/sys/sys/domain.h b/freebsd/sys/sys/domain.h
index 64da7ed7..513d624b 100644
--- a/freebsd/sys/sys/domain.h
+++ b/freebsd/sys/sys/domain.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
diff --git a/freebsd/sys/sys/eventhandler.h b/freebsd/sys/sys/eventhandler.h
index b071c639..cc423752 100644
--- a/freebsd/sys/sys/eventhandler.h
+++ b/freebsd/sys/sys/eventhandler.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 1999 Michael Smith <msmith@freebsd.org>
* All rights reserved.
*
@@ -51,8 +53,7 @@ struct eventhandler_entry_vimage {
struct eventhandler_list {
char *el_name;
- int el_flags;
-#define EHL_INITTED (1<<0)
+ int el_flags; /* Unused. */
u_int el_runcount;
struct mtx el_lock;
TAILQ_ENTRY(eventhandler_list) el_link;
@@ -72,8 +73,6 @@ typedef struct eventhandler_entry *eventhandler_tag;
struct eventhandler_entry *_ep; \
struct eventhandler_entry_ ## name *_t; \
\
- KASSERT((list)->el_flags & EHL_INITTED, \
- ("eventhandler_invoke: running non-inited list")); \
EHL_LOCK_ASSERT((list), MA_OWNED); \
(list)->el_runcount++; \
KASSERT((list)->el_runcount > 0, \
@@ -98,10 +97,41 @@ typedef struct eventhandler_entry *eventhandler_tag;
} while (0)
/*
- * Slow handlers are entirely dynamic; lists are created
- * when entries are added to them, and thus have no concept of "owner",
- *
- * Slow handlers need to be declared, but do not need to be defined. The
+ * You can optionally use the EVENTHANDLER_LIST and EVENTHANDLER_DIRECT macros
+ * to pre-define a symbol for the eventhandler list. This symbol can be used by
+ * EVENTHANDLER_DIRECT_INVOKE, which has the advantage of not needing to do a
+ * locked search of the global list of eventhandler lists. At least
+ * EVENTHANDLER_LIST_DEFINE must be be used for EVENTHANDLER_DIRECT_INVOKE to
+ * work. EVENTHANDLER_LIST_DECLARE is only needed if the call to
+ * EVENTHANDLER_DIRECT_INVOKE is in a different compilation unit from
+ * EVENTHANDLER_LIST_DEFINE. If the events are even relatively high frequency
+ * it is suggested that you directly define a list for them.
+ */
+#define EVENTHANDLER_LIST_DECLARE(name) \
+extern struct eventhandler_list *_eventhandler_list_ ## name \
+
+#define EVENTHANDLER_LIST_DEFINE(name) \
+struct eventhandler_list *_eventhandler_list_ ## name ; \
+static void _ehl_init_ ## name (void * ctx __unused) \
+{ \
+ _eventhandler_list_ ## name = eventhandler_create_list(#name); \
+} \
+SYSINIT(name ## _ehl_init, SI_SUB_EVENTHANDLER, SI_ORDER_ANY, \
+ _ehl_init_ ## name, NULL); \
+ struct __hack
+
+#define EVENTHANDLER_DIRECT_INVOKE(name, ...) do { \
+ struct eventhandler_list *_el; \
+ \
+ _el = _eventhandler_list_ ## name ; \
+ if (!TAILQ_EMPTY(&_el->el_entries)) { \
+ EHL_LOCK(_el); \
+ _EVENTHANDLER_INVOKE(name, _el , ## __VA_ARGS__); \
+ } \
+} while (0)
+
+/*
+ * Event handlers need to be declared, but do not need to be defined. The
* declaration must be in scope wherever the handler is to be invoked.
*/
#define EVENTHANDLER_DECLARE(name, type) \
@@ -141,14 +171,24 @@ do { \
if ((_el = eventhandler_find_list(#name)) != NULL) \
eventhandler_deregister(_el, tag); \
} while(0)
-
+
+#define EVENTHANDLER_DEREGISTER_NOWAIT(name, tag) \
+do { \
+ struct eventhandler_list *_el; \
+ \
+ if ((_el = eventhandler_find_list(#name)) != NULL) \
+ eventhandler_deregister_nowait(_el, tag); \
+} while(0)
eventhandler_tag eventhandler_register(struct eventhandler_list *list,
const char *name, void *func, void *arg, int priority);
void eventhandler_deregister(struct eventhandler_list *list,
eventhandler_tag tag);
+void eventhandler_deregister_nowait(struct eventhandler_list *list,
+ eventhandler_tag tag);
struct eventhandler_list *eventhandler_find_list(const char *name);
void eventhandler_prune_list(struct eventhandler_list *list);
+struct eventhandler_list *eventhandler_create_list(const char *name);
#ifdef VIMAGE
typedef void (*vimage_iterator_func_t)(void *, ...);
@@ -284,4 +324,15 @@ typedef void (*swapoff_fn)(void *, struct swdevt *);
EVENTHANDLER_DECLARE(swapon, swapon_fn);
EVENTHANDLER_DECLARE(swapoff, swapoff_fn);
+/* newbus device events */
+enum evhdev_detach {
+ EVHDEV_DETACH_BEGIN, /* Before detach() is called */
+ EVHDEV_DETACH_COMPLETE, /* After detach() returns 0 */
+ EVHDEV_DETACH_FAILED /* After detach() returns err */
+};
+typedef void (*device_attach_fn)(void *, device_t);
+typedef void (*device_detach_fn)(void *, device_t, enum evhdev_detach);
+EVENTHANDLER_DECLARE(device_attach, device_attach_fn);
+EVENTHANDLER_DECLARE(device_detach, device_detach_fn);
+
#endif /* _SYS_EVENTHANDLER_H_ */
diff --git a/freebsd/sys/sys/eventvar.h b/freebsd/sys/sys/eventvar.h
index 335a6191..8afaa1aa 100644
--- a/freebsd/sys/sys/eventvar.h
+++ b/freebsd/sys/sys/eventvar.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 1999,2000 Jonathan Lemon <jlemon@FreeBSD.org>
* All rights reserved.
*
diff --git a/freebsd/sys/sys/fail.h b/freebsd/sys/sys/fail.h
index 34695bc8..41e07bae 100644
--- a/freebsd/sys/sys/fail.h
+++ b/freebsd/sys/sys/fail.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2009 Isilon Inc http://www.isilon.com/
*
* Redistribution and use in source and binary forms, with or without
diff --git a/freebsd/sys/sys/file.h b/freebsd/sys/sys/file.h
index 2adbd0af..a566e69c 100644
--- a/freebsd/sys/sys/file.h
+++ b/freebsd/sys/sys/file.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1982, 1986, 1989, 1993
* The Regents of the University of California. All rights reserved.
*
diff --git a/freebsd/sys/sys/filedesc.h b/freebsd/sys/sys/filedesc.h
index 457898ef..5a0b2db1 100644
--- a/freebsd/sys/sys/filedesc.h
+++ b/freebsd/sys/sys/filedesc.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
diff --git a/freebsd/sys/sys/firmware.h b/freebsd/sys/sys/firmware.h
index ce02831a..8a9b2cf2 100644
--- a/freebsd/sys/sys/firmware.h
+++ b/freebsd/sys/sys/firmware.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2005, Sam Leffler <sam@errno.com>
* All rights reserved.
*
diff --git a/freebsd/sys/sys/gpio.h b/freebsd/sys/sys/gpio.h
index dbe55872..2505269d 100644
--- a/freebsd/sys/sys/gpio.h
+++ b/freebsd/sys/sys/gpio.h
@@ -1,6 +1,8 @@
/* $NetBSD: gpio.h,v 1.7 2009/09/25 20:27:50 mbalmer Exp $ */
/* $OpenBSD: gpio.h,v 1.7 2008/11/26 14:51:20 mbalmer Exp $ */
/*-
+ * SPDX-License-Identifier: (BSD-2-Clause-FreeBSD AND ISC)
+ *
* Copyright (c) 2009, Oleksandr Tymoshenko <gonzo@FreeBSD.org>
* All rights reserved.
*
diff --git a/freebsd/sys/sys/hash.h b/freebsd/sys/sys/hash.h
index 8abf17bb..35e76ec7 100644
--- a/freebsd/sys/sys/hash.h
+++ b/freebsd/sys/sys/hash.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2001 Tobias Weingartner
* All rights reserved.
*
diff --git a/freebsd/sys/sys/hhook.h b/freebsd/sys/sys/hhook.h
index 1d60dd3b..76c827e6 100644
--- a/freebsd/sys/sys/hhook.h
+++ b/freebsd/sys/sys/hhook.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2010,2013 Lawrence Stewart <lstewart@freebsd.org>
* Copyright (c) 2010 The FreeBSD Foundation
* All rights reserved.
diff --git a/freebsd/sys/sys/interrupt.h b/freebsd/sys/sys/interrupt.h
index 44b769f2..7c9aad4d 100644
--- a/freebsd/sys/sys/interrupt.h
+++ b/freebsd/sys/sys/interrupt.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 1997, Stefan Esser <se@freebsd.org>
* All rights reserved.
*
diff --git a/freebsd/sys/sys/jail.h b/freebsd/sys/sys/jail.h
index bc9025cf..3bbbf5e0 100644
--- a/freebsd/sys/sys/jail.h
+++ b/freebsd/sys/sys/jail.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 1999 Poul-Henning Kamp.
* Copyright (c) 2009 James Gritton.
* All rights reserved.
diff --git a/freebsd/sys/sys/kenv.h b/freebsd/sys/sys/kenv.h
index 0a30ddb3..fd1ae31f 100644
--- a/freebsd/sys/sys/kenv.h
+++ b/freebsd/sys/sys/kenv.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2002 Maxime Henrion <mux@FreeBSD.org>
* All rights reserved.
*
diff --git a/freebsd/sys/sys/kernel.h b/freebsd/sys/sys/kernel.h
index 051173f7..1cc03275 100644
--- a/freebsd/sys/sys/kernel.h
+++ b/freebsd/sys/sys/kernel.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-4-Clause
+ *
* Copyright (c) 1995 Terrence R. Lambert
* All rights reserved.
*
diff --git a/freebsd/sys/sys/khelp.h b/freebsd/sys/sys/khelp.h
index f542b148..54c4791d 100644
--- a/freebsd/sys/sys/khelp.h
+++ b/freebsd/sys/sys/khelp.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2010 Lawrence Stewart <lstewart@freebsd.org>
* Copyright (c) 2010 The FreeBSD Foundation
* All rights reserved.
diff --git a/freebsd/sys/sys/kobj.h b/freebsd/sys/sys/kobj.h
index 862e79f0..5f8b2bb0 100644
--- a/freebsd/sys/sys/kobj.h
+++ b/freebsd/sys/sys/kobj.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2000,2003 Doug Rabson
* All rights reserved.
*
diff --git a/freebsd/sys/sys/kthread.h b/freebsd/sys/sys/kthread.h
index b6304f52..e6f1fa41 100644
--- a/freebsd/sys/sys/kthread.h
+++ b/freebsd/sys/sys/kthread.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 1999 Peter Wemm <peter@FreeBSD.org>
* All rights reserved.
*
diff --git a/freebsd/sys/sys/ktr.h b/freebsd/sys/sys/ktr.h
index 07d7c45b..d9bd2bf6 100644
--- a/freebsd/sys/sys/ktr.h
+++ b/freebsd/sys/sys/ktr.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1996 Berkeley Software Design, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/freebsd/sys/sys/ktr_class.h b/freebsd/sys/sys/ktr_class.h
index 4bfc895b..9190ce27 100644
--- a/freebsd/sys/sys/ktr_class.h
+++ b/freebsd/sys/sys/ktr_class.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1996 Berkeley Software Design, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/freebsd/sys/sys/libkern.h b/freebsd/sys/sys/libkern.h
index ab47eeaa..4d043f5a 100644
--- a/freebsd/sys/sys/libkern.h
+++ b/freebsd/sys/sys/libkern.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
diff --git a/freebsd/sys/sys/limits.h b/freebsd/sys/sys/limits.h
index fdf98ba3..2de06c61 100644
--- a/freebsd/sys/sys/limits.h
+++ b/freebsd/sys/sys/limits.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
*
diff --git a/freebsd/sys/sys/linker.h b/freebsd/sys/sys/linker.h
index 330af02e..6d560574 100644
--- a/freebsd/sys/sys/linker.h
+++ b/freebsd/sys/sys/linker.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 1997-2000 Doug Rabson
* All rights reserved.
*
diff --git a/freebsd/sys/sys/linker_set.h b/freebsd/sys/sys/linker_set.h
index a310b066..7e33c93f 100755
--- a/freebsd/sys/sys/linker_set.h
+++ b/freebsd/sys/sys/linker_set.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 1999 John D. Polstra
* Copyright (c) 1999,2001 Peter Wemm <peter@FreeBSD.org>
* All rights reserved.
@@ -104,10 +106,7 @@
RTEMS_BSD_DEFINE_RWSET_ITEM(set, sym, const void *) = &sym
#endif /* __rtems__ */
#else /* !__GNUCLIKE___SECTION */
-#ifndef lint
#error this file needs to be ported to your compiler
-#endif /* lint */
-#define __MAKE_SET(set, sym) extern void const * const (__set_##set##_sym_##sym)
#endif /* __GNUCLIKE___SECTION */
/*
diff --git a/freebsd/sys/sys/lock_profile.h b/freebsd/sys/sys/lock_profile.h
index bf73ca14..7c7edee4 100644
--- a/freebsd/sys/sys/lock_profile.h
+++ b/freebsd/sys/sys/lock_profile.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2006 Kip Macy kmacy@FreeBSD.org
* Copyright (c) 2006 Kris Kennaway kris@FreeBSD.org
* Copyright (c) 2006 Dag-Erling Smorgrav des@des.no
diff --git a/freebsd/sys/sys/lockmgr.h b/freebsd/sys/sys/lockmgr.h
index 60749228..03ae6f9e 100644
--- a/freebsd/sys/sys/lockmgr.h
+++ b/freebsd/sys/sys/lockmgr.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2008 Attilio Rao <attilio@FreeBSD.org>
* All rights reserved.
*
diff --git a/freebsd/sys/sys/lockstat.h b/freebsd/sys/sys/lockstat.h
index 64745052..50747e89 100644
--- a/freebsd/sys/sys/lockstat.h
+++ b/freebsd/sys/sys/lockstat.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2008-2009 Stacey Son <sson@FreeBSD.org>
*
* Redistribution and use in source and binary forms, with or without
diff --git a/freebsd/sys/sys/loginclass.h b/freebsd/sys/sys/loginclass.h
index 6783123a..9bc14766 100644
--- a/freebsd/sys/sys/loginclass.h
+++ b/freebsd/sys/sys/loginclass.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2011 The FreeBSD Foundation
* All rights reserved.
*
diff --git a/freebsd/sys/sys/mac.h b/freebsd/sys/sys/mac.h
index 0aa89608..bc12cb75 100644
--- a/freebsd/sys/sys/mac.h
+++ b/freebsd/sys/sys/mac.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 1999-2002 Robert N. M. Watson
* Copyright (c) 2001-2005 Networks Associates Technology, Inc.
* Copyright (c) 2005-2006 SPARTA, Inc.
diff --git a/freebsd/sys/sys/malloc.h b/freebsd/sys/sys/malloc.h
index c93439f3..c5ab6125 100644
--- a/freebsd/sys/sys/malloc.h
+++ b/freebsd/sys/sys/malloc.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1987, 1993
* The Regents of the University of California.
* Copyright (c) 2005, 2009 Robert N. M. Watson
diff --git a/freebsd/sys/sys/mbuf.h b/freebsd/sys/sys/mbuf.h
index ec98aaec..4a91b794 100644
--- a/freebsd/sys/sys/mbuf.h
+++ b/freebsd/sys/sys/mbuf.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1982, 1986, 1988, 1993
* The Regents of the University of California.
* All rights reserved.
@@ -154,14 +156,20 @@ struct pkthdr {
/* Layer crossing persistent information. */
uint32_t flowid; /* packet's 4-tuple system */
- uint64_t csum_flags; /* checksum and offload features */
+ uint32_t csum_flags; /* checksum and offload features */
uint16_t fibnum; /* this packet should use this fib */
uint8_t cosqos; /* class/quality of service */
uint8_t rsstype; /* hash type */
- uint8_t l2hlen; /* layer 2 header length */
- uint8_t l3hlen; /* layer 3 header length */
- uint8_t l4hlen; /* layer 4 header length */
- uint8_t l5hlen; /* layer 5 header length */
+ union {
+ uint64_t rcv_tstmp; /* timestamp in ns */
+ struct {
+ uint8_t l2hlen; /* layer 2 hdr len */
+ uint8_t l3hlen; /* layer 3 hdr len */
+ uint8_t l4hlen; /* layer 4 hdr len */
+ uint8_t l5hlen; /* layer 5 hdr len */
+ uint32_t spare;
+ };
+ };
union {
uint8_t eight[8];
uint16_t sixteen[4];
@@ -197,17 +205,33 @@ struct pkthdr {
* Compile-time assertions in uipc_mbuf.c test these values to ensure that
* they are correct.
*/
+typedef void m_ext_free_t(struct mbuf *);
struct m_ext {
union {
- volatile u_int ext_count; /* value of ref count info */
- volatile u_int *ext_cnt; /* pointer to ref count info */
+ /*
+ * If EXT_FLAG_EMBREF is set, then we use refcount in the
+ * mbuf, the 'ext_count' member. Otherwise, we have a
+ * shadow copy and we use pointer 'ext_cnt'. The original
+ * mbuf is responsible to carry the pointer to free routine
+ * and its arguments. They aren't copied into shadows in
+ * mb_dupcl() to avoid dereferencing next cachelines.
+ */
+ volatile u_int ext_count;
+ volatile u_int *ext_cnt;
};
- caddr_t ext_buf; /* start of buffer */
+ char *ext_buf; /* start of buffer */
uint32_t ext_size; /* size of buffer, for ext_free */
uint32_t ext_type:8, /* type of external storage */
ext_flags:24; /* external storage mbuf flags */
- void (*ext_free) /* free routine if not the usual */
- (struct mbuf *, void *, void *);
+ /*
+ * Fields below store the free context for the external storage.
+ * They are valid only in the refcount carrying mbuf, the one with
+ * EXT_FLAG_EMBREF flag, with exclusion for EXT_EXTREF type, where
+ * the free context is copied into all mbufs that use same external
+ * storage.
+ */
+#define m_ext_copylen offsetof(struct m_ext, ext_free)
+ m_ext_free_t *ext_free; /* free routine if not the usual */
void *ext_arg1; /* optional argument pointer */
void *ext_arg2; /* optional argument pointer */
};
@@ -277,6 +301,10 @@ struct mbuf {
#define M_VLANTAG 0x00000080 /* ether_vtag is valid */
#define M_UNUSED_8 0x00000100 /* --available-- */
#define M_NOFREE 0x00000200 /* do not free mbuf, embedded in cluster */
+#define M_TSTMP 0x00000400 /* rcv_tstmp field is valid */
+#define M_TSTMP_HPREC 0x00000800 /* rcv_tstmp is high-prec, typically
+ hw-stamped on port (useful for IEEE 1588
+ and 802.1AS) */
#define M_PROTO1 0x00001000 /* protocol-specific */
#define M_PROTO2 0x00002000 /* protocol-specific */
@@ -304,15 +332,15 @@ struct mbuf {
* Flags preserved when copying m_pkthdr.
*/
#define M_COPYFLAGS \
- (M_PKTHDR|M_EOR|M_RDONLY|M_BCAST|M_MCAST|M_PROMISC|M_VLANTAG| \
- M_PROTOFLAGS)
+ (M_PKTHDR|M_EOR|M_RDONLY|M_BCAST|M_MCAST|M_PROMISC|M_VLANTAG|M_TSTMP| \
+ M_TSTMP_HPREC|M_PROTOFLAGS)
/*
* Mbuf flag description for use with printf(9) %b identifier.
*/
#define M_FLAG_BITS \
"\20\1M_EXT\2M_PKTHDR\3M_EOR\4M_RDONLY\5M_BCAST\6M_MCAST" \
- "\7M_PROMISC\10M_VLANTAG"
+ "\7M_PROMISC\10M_VLANTAG\13M_TSTMP\14M_TSTMP_HPREC"
#define M_FLAG_PROTOBITS \
"\15M_PROTO1\16M_PROTO2\17M_PROTO3\20M_PROTO4\21M_PROTO5" \
"\22M_PROTO6\23M_PROTO7\24M_PROTO8\25M_PROTO9\26M_PROTO10" \
@@ -412,9 +440,6 @@ struct mbuf {
#define EXT_JUMBO16 5 /* jumbo cluster 16184 bytes */
#define EXT_PACKET 6 /* mbuf+cluster from packet zone */
#define EXT_MBUF 7 /* external mbuf reference */
-#ifndef __rtems__
-#define EXT_SFBUF_NOCACHE 8 /* sendfile(2)'s sf_buf not to be cached */
-#endif /* __rtems__ */
#define EXT_VENDOR1 224 /* for vendor-internal use */
#define EXT_VENDOR2 225 /* for vendor-internal use */
@@ -440,10 +465,10 @@ struct mbuf {
#define EXT_FLAG_NOFREE 0x000010 /* don't free mbuf to pool, notyet */
-#define EXT_FLAG_VENDOR1 0x010000 /* for vendor-internal use */
-#define EXT_FLAG_VENDOR2 0x020000 /* for vendor-internal use */
-#define EXT_FLAG_VENDOR3 0x040000 /* for vendor-internal use */
-#define EXT_FLAG_VENDOR4 0x080000 /* for vendor-internal use */
+#define EXT_FLAG_VENDOR1 0x010000 /* These flags are vendor */
+#define EXT_FLAG_VENDOR2 0x020000 /* or submodule specific, */
+#define EXT_FLAG_VENDOR3 0x040000 /* not used by mbuf code. */
+#define EXT_FLAG_VENDOR4 0x080000 /* Set/read by submodule. */
#define EXT_FLAG_EXP1 0x100000 /* for experimental use */
#define EXT_FLAG_EXP2 0x200000 /* for experimental use */
@@ -460,12 +485,6 @@ struct mbuf {
"\30EXT_FLAG_EXP4"
/*
- * External reference/free functions.
- */
-void sf_ext_free(void *, void *);
-void sf_ext_free_nocache(void *, void *);
-
-/*
* Flags indicating checksum, segmentation and other offload work to be
* done, or already done, by hardware or lower layers. It is split into
* separate inbound and outbound flags.
@@ -614,9 +633,8 @@ struct mbuf *m_devget(char *, int, int, struct ifnet *,
void (*)(char *, caddr_t, u_int));
struct mbuf *m_dup(const struct mbuf *, int);
int m_dup_pkthdr(struct mbuf *, const struct mbuf *, int);
-void m_extadd(struct mbuf *, caddr_t, u_int,
- void (*)(struct mbuf *, void *, void *), void *, void *,
- int, int);
+void m_extadd(struct mbuf *, char *, u_int, m_ext_free_t,
+ void *, void *, int, int);
u_int m_fixhdr(struct mbuf *);
struct mbuf *m_fragment(struct mbuf *, int, int);
void m_freem(struct mbuf *);
@@ -671,8 +689,8 @@ m_gettype(int size)
* Associated an external reference counted buffer with an mbuf.
*/
static __inline void
-m_extaddref(struct mbuf *m, caddr_t buf, u_int size, u_int *ref_cnt,
- void (*freef)(struct mbuf *, void *, void *), void *arg1, void *arg2)
+m_extaddref(struct mbuf *m, char *buf, u_int size, u_int *ref_cnt,
+ m_ext_free_t freef, void *arg1, void *arg2)
{
KASSERT(ref_cnt != NULL, ("%s: ref_cnt not provided", __func__));
@@ -869,7 +887,7 @@ m_extrefcnt(struct mbuf *m)
#define MGETHDR(m, how, type) ((m) = m_gethdr((how), (type)))
#define MCLGET(m, how) m_clget((m), (how))
#define MEXTADD(m, buf, size, free, arg1, arg2, flags, type) \
- m_extadd((m), (caddr_t)(buf), (size), (free), (arg1), (arg2), \
+ m_extadd((m), (char *)(buf), (size), (free), (arg1), (arg2), \
(flags), (type))
#define m_getm(m, len, how, type) \
m_getm2((m), (len), (how), (type), M_PKTHDR)
@@ -1345,5 +1363,17 @@ mbufq_concat(struct mbufq *mq_dst, struct mbufq *mq_src)
mq_src->mq_len = 0;
}
+#ifdef _SYS_TIMESPEC_H_
+static inline void
+mbuf_tstmp2timespec(struct mbuf *m, struct timespec *ts)
+{
+
+ KASSERT((m->m_flags & M_PKTHDR) != 0, ("mbuf %p no M_PKTHDR", m));
+ KASSERT((m->m_flags & M_TSTMP) != 0, ("mbuf %p no M_TSTMP", m));
+ ts->tv_sec = m->m_pkthdr.rcv_tstmp / 1000000000;
+ ts->tv_nsec = m->m_pkthdr.rcv_tstmp % 1000000000;
+}
+#endif
+
#endif /* _KERNEL */
#endif /* !_SYS_MBUF_H_ */
diff --git a/freebsd/sys/sys/module.h b/freebsd/sys/sys/module.h
index 75471611..eb8b03d8 100644
--- a/freebsd/sys/sys/module.h
+++ b/freebsd/sys/sys/module.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 1997 Doug Rabson
* All rights reserved.
*
diff --git a/freebsd/sys/sys/module_khelp.h b/freebsd/sys/sys/module_khelp.h
index 371e4c31..a6644027 100644
--- a/freebsd/sys/sys/module_khelp.h
+++ b/freebsd/sys/sys/module_khelp.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2010 Lawrence Stewart <lstewart@freebsd.org>
* Copyright (c) 2010 The FreeBSD Foundation
* All rights reserved.
diff --git a/freebsd/sys/sys/mount.h b/freebsd/sys/sys/mount.h
index 152b2586..362c54e9 100644
--- a/freebsd/sys/sys/mount.h
+++ b/freebsd/sys/sys/mount.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1989, 1991, 1993
* The Regents of the University of California. All rights reserved.
*
diff --git a/freebsd/sys/sys/mqueue.h b/freebsd/sys/sys/mqueue.h
index 36e89fa2..ca9fd13c 100644
--- a/freebsd/sys/sys/mqueue.h
+++ b/freebsd/sys/sys/mqueue.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2005 David Xu <davidxu@freebsd.org>
* All rights reserved.
*
diff --git a/freebsd/sys/sys/mutex.h b/freebsd/sys/sys/mutex.h
index bd773b58..52587064 100644
--- a/freebsd/sys/sys/mutex.h
+++ b/freebsd/sys/sys/mutex.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1997 Berkeley Software Design, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -68,15 +70,11 @@
* State bits kept in mutex->mtx_lock, for the DEFAULT lock type. None of this,
* with the exception of MTX_UNOWNED, applies to spin locks.
*/
+#define MTX_UNOWNED 0x00000000 /* Cookie for free mutex */
#define MTX_RECURSED 0x00000001 /* lock recursed (for MTX_DEF only) */
#define MTX_CONTESTED 0x00000002 /* lock contested (for MTX_DEF only) */
-#define MTX_UNOWNED 0x00000004 /* Cookie for free mutex */
-#define MTX_FLAGMASK (MTX_RECURSED | MTX_CONTESTED | MTX_UNOWNED)
-
-/*
- * Value stored in mutex->mtx_lock to denote a destroyed mutex.
- */
-#define MTX_DESTROYED (MTX_CONTESTED | MTX_UNOWNED)
+#define MTX_DESTROYED 0x00000004 /* lock destroyed */
+#define MTX_FLAGMASK (MTX_RECURSED | MTX_CONTESTED | MTX_DESTROYED)
/*
* Prototypes
@@ -101,6 +99,7 @@ void _mtx_destroy(volatile uintptr_t *c);
#endif /* __rtems__ */
void mtx_sysinit(void *arg);
#ifndef __rtems__
+int _mtx_trylock_flags_int(struct mtx *m, int opts LOCK_FILE_LINE_ARG_DEF);
int _mtx_trylock_flags_(volatile uintptr_t *c, int opts, const char *file,
int line);
#endif /* __rtems__ */
@@ -109,16 +108,20 @@ void mutex_init(void);
#if LOCK_DEBUG > 0
void __mtx_lock_sleep(volatile uintptr_t *c, uintptr_t v, int opts,
const char *file, int line);
-void __mtx_unlock_sleep(volatile uintptr_t *c, int opts, const char *file,
- int line);
+void __mtx_unlock_sleep(volatile uintptr_t *c, uintptr_t v, int opts,
+ const char *file, int line);
#else
void __mtx_lock_sleep(volatile uintptr_t *c, uintptr_t v);
-void __mtx_unlock_sleep(volatile uintptr_t *c);
+void __mtx_unlock_sleep(volatile uintptr_t *c, uintptr_t v);
#endif
#ifdef SMP
-void _mtx_lock_spin_cookie(volatile uintptr_t *c, uintptr_t v, uintptr_t tid,
- int opts, const char *file, int line);
+#if LOCK_DEBUG > 0
+void _mtx_lock_spin_cookie(volatile uintptr_t *c, uintptr_t v, int opts,
+ const char *file, int line);
+#else
+void _mtx_lock_spin_cookie(volatile uintptr_t *c, uintptr_t v);
+#endif
#endif
void __mtx_lock_flags(volatile uintptr_t *c, int opts, const char *file,
int line);
@@ -150,11 +153,31 @@ void _mtx_assert(struct mtx *m, int what, const char *file, int line);
#endif
#ifndef __rtems__
void thread_lock_flags_(struct thread *, int, const char *, int);
+#if LOCK_DEBUG > 0
+void _thread_lock(struct thread *td, int opts, const char *file, int line);
+#else
+void _thread_lock(struct thread *);
+#endif
+#if defined(LOCK_PROFILING) || defined(KLD_MODULE)
#define thread_lock(tdp) \
thread_lock_flags_((tdp), 0, __FILE__, __LINE__)
+#elif LOCK_DEBUG > 0
+#define thread_lock(tdp) \
+ _thread_lock((tdp), 0, __FILE__, __LINE__)
+#else
+#define thread_lock(tdp) \
+ _thread_lock((tdp))
+#endif
+
+#if LOCK_DEBUG > 0
#define thread_lock_flags(tdp, opt) \
thread_lock_flags_((tdp), (opt), __FILE__, __LINE__)
+#else
+#define thread_lock_flags(tdp, opt) \
+ _thread_lock(tdp)
+#endif
+
#define thread_unlock(tdp) \
mtx_unlock_spin((tdp)->td_lock)
#else /* __rtems__ */
@@ -178,17 +201,22 @@ void thread_lock_flags_(struct thread *, int, const char *, int);
#if LOCK_DEBUG > 0
#define _mtx_lock_sleep(m, v, o, f, l) \
__mtx_lock_sleep(&(m)->mtx_lock, v, o, f, l)
-#define _mtx_unlock_sleep(m, o, f, l) \
- __mtx_unlock_sleep(&(m)->mtx_lock, o, f, l)
+#define _mtx_unlock_sleep(m, v, o, f, l) \
+ __mtx_unlock_sleep(&(m)->mtx_lock, v, o, f, l)
#else
#define _mtx_lock_sleep(m, v, o, f, l) \
__mtx_lock_sleep(&(m)->mtx_lock, v)
-#define _mtx_unlock_sleep(m, o, f, l) \
- __mtx_unlock_sleep(&(m)->mtx_lock)
+#define _mtx_unlock_sleep(m, v, o, f, l) \
+ __mtx_unlock_sleep(&(m)->mtx_lock, v)
#endif
#ifdef SMP
-#define _mtx_lock_spin(m, v, t, o, f, l) \
- _mtx_lock_spin_cookie(&(m)->mtx_lock, v, t, o, f, l)
+#if LOCK_DEBUG > 0
+#define _mtx_lock_spin(m, v, o, f, l) \
+ _mtx_lock_spin_cookie(&(m)->mtx_lock, v, o, f, l)
+#else
+#define _mtx_lock_spin(m, v, o, f, l) \
+ _mtx_lock_spin_cookie(&(m)->mtx_lock, v)
+#endif
#endif
#define _mtx_lock_flags(m, o, f, l) \
__mtx_lock_flags(&(m)->mtx_lock, o, f, l)
@@ -225,6 +253,9 @@ void thread_lock_flags_(struct thread *, int, const char *, int);
#define _mtx_release_lock_quick(mp) \
atomic_store_rel_ptr(&(mp)->mtx_lock, MTX_UNOWNED)
+#define _mtx_release_lock_fetch(mp, vp) \
+ atomic_fcmpset_rel_ptr(&(mp)->mtx_lock, (vp), MTX_UNOWNED)
+
/*
* Full lock operations that are suitable to be inlined in non-debug
* kernels. If the lock cannot be acquired or released trivially then
@@ -253,11 +284,9 @@ void thread_lock_flags_(struct thread *, int, const char *, int);
uintptr_t _v = MTX_UNOWNED; \
\
spinlock_enter(); \
- 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); \
+ if (__predict_false(LOCKSTAT_PROFILE_ENABLED(spin__acquire) || \
+ !_mtx_obtain_lock_fetch((mp), &_v, _tid))) \
+ _mtx_lock_spin((mp), _v, (opts), (file), (line)); \
} while (0)
#define __mtx_trylock_spin(mp, tid, opts, file, line) __extension__ ({ \
uintptr_t _tid = (uintptr_t)(tid); \
@@ -304,11 +333,11 @@ void thread_lock_flags_(struct thread *, int, const char *, int);
/* Unlock a normal mutex. */
#define __mtx_unlock(mp, tid, opts, file, line) do { \
- uintptr_t _tid = (uintptr_t)(tid); \
+ uintptr_t _v = (uintptr_t)(tid); \
\
if (__predict_false(LOCKSTAT_PROFILE_ENABLED(adaptive__release) ||\
- !_mtx_release_lock((mp), _tid))) \
- _mtx_unlock_sleep((mp), (opts), (file), (line)); \
+ !_mtx_release_lock_fetch((mp), &_v))) \
+ _mtx_unlock_sleep((mp), _v, (opts), (file), (line)); \
} while (0)
/*
diff --git a/freebsd/sys/sys/nlist_aout.h b/freebsd/sys/sys/nlist_aout.h
index 79260ad6..0e1fa284 100644
--- a/freebsd/sys/sys/nlist_aout.h
+++ b/freebsd/sys/sys/nlist_aout.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
diff --git a/freebsd/sys/sys/osd.h b/freebsd/sys/sys/osd.h
index c838e97d..a9824184 100644
--- a/freebsd/sys/sys/osd.h
+++ b/freebsd/sys/sys/osd.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2007 Pawel Jakub Dawidek <pjd@FreeBSD.org>
* All rights reserved.
*
diff --git a/freebsd/sys/sys/pciio.h b/freebsd/sys/sys/pciio.h
index d70bfbcf..80d2019b 100644
--- a/freebsd/sys/sys/pciio.h
+++ b/freebsd/sys/sys/pciio.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 1997, Stefan Esser <se@FreeBSD.ORG>
* Copyright (c) 1997, 1998, 1999, Kenneth D. Merry <ken@FreeBSD.ORG>
* All rights reserved.
diff --git a/freebsd/sys/sys/pcpu.h b/freebsd/sys/sys/pcpu.h
index 4430cc87..bfa7f34d 100644
--- a/freebsd/sys/sys/pcpu.h
+++ b/freebsd/sys/sys/pcpu.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 2001 Wind River Systems, Inc.
* All rights reserved.
* Written by: John Baldwin <jhb@FreeBSD.org>
diff --git a/freebsd/sys/sys/priv.h b/freebsd/sys/sys/priv.h
index ec0943aa..52f1dbd2 100644
--- a/freebsd/sys/sys/priv.h
+++ b/freebsd/sys/sys/priv.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2006 nCircle Network Security, Inc.
* All rights reserved.
*
@@ -266,7 +268,7 @@
#define PRIV_VFS_GETFH 327 /* Can retrieve file handles. */
#define PRIV_VFS_GETQUOTA 328 /* getquota(). */
#define PRIV_VFS_LINK 329 /* bsd.hardlink_check_uid */
-#define PRIV_VFS_MKNOD_BAD 330 /* Can mknod() to mark bad inodes. */
+#define PRIV_VFS_MKNOD_BAD 330 /* Was: mknod() can mark bad inodes. */
#define PRIV_VFS_MKNOD_DEV 331 /* Can mknod() to create dev nodes. */
#define PRIV_VFS_MKNOD_WHT 332 /* Can mknod() to create whiteout. */
#define PRIV_VFS_MOUNT 333 /* Can mount(). */
diff --git a/freebsd/sys/sys/proc.h b/freebsd/sys/sys/proc.h
index b28c19e6..7178c316 100644
--- a/freebsd/sys/sys/proc.h
+++ b/freebsd/sys/sys/proc.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1986, 1989, 1991, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
@@ -1005,6 +1007,7 @@ extern struct proc *initproc, *pageproc; /* Process slots for init, pager. */
extern struct uma_zone *proc_zone;
struct proc *pfind(pid_t); /* Find process by id. */
+struct proc *pfind_any(pid_t); /* Find (zombie) process by id. */
struct proc *pfind_locked(pid_t pid);
struct pgrp *pgfind(pid_t); /* Find process group by id. */
struct proc *zpfind(pid_t); /* Find zombie process by id. */
diff --git a/freebsd/sys/sys/protosw.h b/freebsd/sys/sys/protosw.h
index 33cc2074..096b5077 100644
--- a/freebsd/sys/sys/protosw.h
+++ b/freebsd/sys/sys/protosw.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
diff --git a/freebsd/sys/sys/racct.h b/freebsd/sys/sys/racct.h
index 9b8143f2..ec3322bd 100644
--- a/freebsd/sys/sys/racct.h
+++ b/freebsd/sys/sys/racct.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2010 The FreeBSD Foundation
* All rights reserved.
*
diff --git a/freebsd/sys/sys/random.h b/freebsd/sys/sys/random.h
index 770a2f76..b022f5a3 100644
--- a/freebsd/sys/sys/random.h
+++ b/freebsd/sys/sys/random.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2000-2015, 2017 Mark R. V. Murray
* All rights reserved.
*
@@ -68,9 +70,9 @@ read_random(void *ptr, u_int n)
#endif
/*
- * Note: if you add or remove members of random_entropy_source, remember to also update the
- * KASSERT regarding what valid members are in random_harvest_internal(), and remember the
- * strings in the static array random_source_descr[] in random_harvestq.c.
+ * Note: if you add or remove members of random_entropy_source, remember to
+ * also update the strings in the static array random_source_descr[] in
+ * random_harvestq.c.
*
* NOTE: complain loudly to markm@ or on the lists if this enum gets more than 32
* distinct values (0-31)! ENTROPYSOURCE may be == 32, but not > 32.
@@ -91,7 +93,8 @@ enum random_entropy_source {
RANDOM_UMA, /* Special!! UMA/SLAB Allocator */
RANDOM_ENVIRONMENTAL_END = RANDOM_UMA,
/* Fast hardware random-number sources from here on. */
- RANDOM_PURE_OCTEON,
+ RANDOM_PURE_START,
+ RANDOM_PURE_OCTEON = RANDOM_PURE_START,
RANDOM_PURE_SAFE,
RANDOM_PURE_GLXSB,
RANDOM_PURE_UBSEC,
@@ -105,6 +108,7 @@ enum random_entropy_source {
};
#define RANDOM_HARVEST_EVERYTHING_MASK ((1 << (RANDOM_ENVIRONMENTAL_END + 1)) - 1)
+#define RANDOM_HARVEST_PURE_MASK (((1 << ENTROPYSOURCE) - 1) & (-1UL << RANDOM_PURE_START))
#define RANDOM_LEGACY_BOOT_ENTROPY_MODULE "/boot/entropy"
#define RANDOM_CACHED_BOOT_ENTROPY_MODULE "boot_entropy_cache"
@@ -114,10 +118,14 @@ enum random_entropy_source {
void random_harvest_queue(const void *, u_int, u_int, enum random_entropy_source);
void random_harvest_fast(const void *, u_int, u_int, enum random_entropy_source);
void random_harvest_direct(const void *, u_int, u_int, enum random_entropy_source);
+void random_harvest_register_source(enum random_entropy_source);
+void random_harvest_deregister_source(enum random_entropy_source);
#else
#define random_harvest_queue(a, b, c, d) do {} while (0)
#define random_harvest_fast(a, b, c, d) do {} while (0)
#define random_harvest_direct(a, b, c, d) do {} while (0)
+#define random_harvest_register_source(a) do {} while (0)
+#define random_harvest_deregister_source(a) do {} while (0)
#endif
#if defined(RANDOM_ENABLE_UMA)
diff --git a/freebsd/sys/sys/reboot.h b/freebsd/sys/sys/reboot.h
index ec2a5705..d0dff609 100644
--- a/freebsd/sys/sys/reboot.h
+++ b/freebsd/sys/sys/reboot.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1982, 1986, 1988, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
@@ -60,6 +62,7 @@
#define RB_RESERVED2 0x80000 /* reserved for internal use of boot blocks */
#define RB_PAUSE 0x100000 /* pause after each output line during probe */
#define RB_REROOT 0x200000 /* unmount the rootfs and mount it again */
+#define RB_POWERCYCLE 0x400000 /* Power cycle if possible */
#define RB_MULTIPLE 0x20000000 /* use multiple consoles */
#define RB_BOOTINFO 0x80000000 /* have `struct bootinfo *' arg */
diff --git a/freebsd/sys/sys/refcount.h b/freebsd/sys/sys/refcount.h
index ea846f8c..e6b26ce4 100644
--- a/freebsd/sys/sys/refcount.h
+++ b/freebsd/sys/sys/refcount.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2005 John Baldwin <jhb@FreeBSD.org>
* All rights reserved.
*
diff --git a/freebsd/sys/sys/resourcevar.h b/freebsd/sys/sys/resourcevar.h
index d3c50830..b84bc432 100644
--- a/freebsd/sys/sys/resourcevar.h
+++ b/freebsd/sys/sys/resourcevar.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
diff --git a/freebsd/sys/sys/rmlock.h b/freebsd/sys/sys/rmlock.h
index c14dcb15..1dd2740c 100644
--- a/freebsd/sys/sys/rmlock.h
+++ b/freebsd/sys/sys/rmlock.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 2007 Stephan Uphoff <ups@FreeBSD.org>
* All rights reserved.
*
@@ -120,35 +122,21 @@ void _rm_assert(const struct rmlock *rm, int what, const char *file,
struct rm_args {
struct rmlock *ra_rm;
const char *ra_desc;
+ int ra_flags;
};
-struct rm_args_flags {
- struct rmlock *ra_rm;
- const char *ra_desc;
- int ra_opts;
-};
-
-#define RM_SYSINIT(name, rm, desc) \
+#define RM_SYSINIT_FLAGS(name, rm, desc, flags) \
static struct rm_args name##_args = { \
(rm), \
(desc), \
+ (flags), \
}; \
SYSINIT(name##_rm_sysinit, SI_SUB_LOCK, SI_ORDER_MIDDLE, \
rm_sysinit, &name##_args); \
SYSUNINIT(name##_rm_sysuninit, SI_SUB_LOCK, SI_ORDER_MIDDLE, \
rm_destroy, (rm))
-
-#define RM_SYSINIT_FLAGS(name, rm, desc, opts) \
- static struct rm_args name##_args = { \
- (rm), \
- (desc), \
- (opts), \
- }; \
- SYSINIT(name##_rm_sysinit, SI_SUB_LOCK, SI_ORDER_MIDDLE, \
- rm_sysinit_flags, &name##_args); \
- SYSUNINIT(name##_rm_sysuninit, SI_SUB_LOCK, SI_ORDER_MIDDLE, \
- rm_destroy, (rm))
+#define RM_SYSINIT(name, rm, desc) RM_SYSINIT_FLAGS(name, rm, desc, 0)
#if defined(INVARIANTS) || defined(INVARIANT_SUPPORT)
#define RA_LOCKED LA_LOCKED
diff --git a/freebsd/sys/sys/rtprio.h b/freebsd/sys/sys/rtprio.h
index 7ffdb732..52915603 100644
--- a/freebsd/sys/sys/rtprio.h
+++ b/freebsd/sys/sys/rtprio.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-4-Clause
+ *
* Copyright (c) 1994, Henrik Vestergaard Draboel
* All rights reserved.
*
diff --git a/freebsd/sys/sys/runq.h b/freebsd/sys/sys/runq.h
index 50c00eb6..0e3113b1 100644
--- a/freebsd/sys/sys/runq.h
+++ b/freebsd/sys/sys/runq.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2001 Jake Burkholder <jake@FreeBSD.org>
* All rights reserved.
*
diff --git a/freebsd/sys/sys/rwlock.h b/freebsd/sys/sys/rwlock.h
index 8c1f8e6d..531f10d2 100644
--- a/freebsd/sys/sys/rwlock.h
+++ b/freebsd/sys/sys/rwlock.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2006 John Baldwin <jhb@FreeBSD.org>
* All rights reserved.
*
@@ -95,6 +97,9 @@
#define _rw_write_unlock(rw, tid) \
atomic_cmpset_rel_ptr(&(rw)->rw_lock, (tid), RW_UNLOCKED)
+#define _rw_write_unlock_fetch(rw, tid) \
+ atomic_fcmpset_rel_ptr(&(rw)->rw_lock, (tid), RW_UNLOCKED)
+
/*
* Full lock operations that are suitable to be inlined in non-debug
* kernels. If the lock cannot be acquired or released trivially then
@@ -109,16 +114,16 @@
\
if (__predict_false(LOCKSTAT_PROFILE_ENABLED(rw__acquire) || \
!_rw_write_lock_fetch((rw), &_v, _tid))) \
- _rw_wlock_hard((rw), _v, _tid, (file), (line)); \
+ _rw_wlock_hard((rw), _v, (file), (line)); \
} while (0)
/* Release a write lock. */
#define __rw_wunlock(rw, tid, file, line) do { \
- uintptr_t _tid = (uintptr_t)(tid); \
+ uintptr_t _v = (uintptr_t)(tid); \
\
if (__predict_false(LOCKSTAT_PROFILE_ENABLED(rw__release) || \
- !_rw_write_unlock((rw), _tid))) \
- _rw_wunlock_hard((rw), _tid, (file), (line)); \
+ !_rw_write_unlock_fetch((rw), &_v))) \
+ _rw_wunlock_hard((rw), _v, (file), (line)); \
} while (0)
#endif /* __rtems__ */
@@ -134,16 +139,22 @@ void rw_sysinit(void *arg);
void rw_sysinit_flags(void *arg);
int _rw_wowned(const volatile uintptr_t *c);
void _rw_wlock_cookie(volatile uintptr_t *c, const char *file, int line);
+int __rw_try_wlock_int(struct rwlock *rw LOCK_FILE_LINE_ARG_DEF);
int __rw_try_wlock(volatile uintptr_t *c, const char *file, int line);
void _rw_wunlock_cookie(volatile uintptr_t *c, const char *file, int line);
+void __rw_rlock_int(struct rwlock *rw LOCK_FILE_LINE_ARG_DEF);
void __rw_rlock(volatile uintptr_t *c, const char *file, int line);
+int __rw_try_rlock_int(struct rwlock *rw LOCK_FILE_LINE_ARG_DEF);
int __rw_try_rlock(volatile uintptr_t *c, const char *file, int line);
+void _rw_runlock_cookie_int(struct rwlock *rw LOCK_FILE_LINE_ARG_DEF);
void _rw_runlock_cookie(volatile uintptr_t *c, 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);
+void __rw_wlock_hard(volatile uintptr_t *c, uintptr_t v
+ LOCK_FILE_LINE_ARG_DEF);
+void __rw_wunlock_hard(volatile uintptr_t *c, uintptr_t v
+ LOCK_FILE_LINE_ARG_DEF);
+int __rw_try_upgrade_int(struct rwlock *rw LOCK_FILE_LINE_ARG_DEF);
int __rw_try_upgrade(volatile uintptr_t *c, const char *file, int line);
+void __rw_downgrade_int(struct rwlock *rw LOCK_FILE_LINE_ARG_DEF);
void __rw_downgrade(volatile uintptr_t *c, const char *file, int line);
#if defined(INVARIANTS) || defined(INVARIANT_SUPPORT)
void __rw_assert(const volatile uintptr_t *c, int what, const char *file,
@@ -190,20 +201,38 @@ void _rw_assert(const struct rwlock *rw, int what, const char *file,
__rw_try_wlock(&(rw)->rw_lock, f, l)
#define _rw_wunlock(rw, f, l) \
_rw_wunlock_cookie(&(rw)->rw_lock, f, l)
-#define _rw_rlock(rw, f, l) \
- __rw_rlock(&(rw)->rw_lock, f, l)
#define _rw_try_rlock(rw, f, l) \
__rw_try_rlock(&(rw)->rw_lock, f, l)
+#if LOCK_DEBUG > 0
+#define _rw_rlock(rw, f, l) \
+ __rw_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, 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)
+#else
+#define _rw_rlock(rw, f, l) \
+ __rw_rlock_int((struct rwlock *)rw)
+#define _rw_runlock(rw, f, l) \
+ _rw_runlock_cookie_int((struct rwlock *)rw)
+#endif
+#if LOCK_DEBUG > 0
+#define _rw_wlock_hard(rw, v, f, l) \
+ __rw_wlock_hard(&(rw)->rw_lock, v, f, l)
+#define _rw_wunlock_hard(rw, v, f, l) \
+ __rw_wunlock_hard(&(rw)->rw_lock, v, f, l)
#define _rw_try_upgrade(rw, f, l) \
__rw_try_upgrade(&(rw)->rw_lock, f, l)
#define _rw_downgrade(rw, f, l) \
__rw_downgrade(&(rw)->rw_lock, f, l)
+#else
+#define _rw_wlock_hard(rw, v, f, l) \
+ __rw_wlock_hard(&(rw)->rw_lock, v)
+#define _rw_wunlock_hard(rw, v, f, l) \
+ __rw_wunlock_hard(&(rw)->rw_lock, v)
+#define _rw_try_upgrade(rw, f, l) \
+ __rw_try_upgrade_int(rw)
+#define _rw_downgrade(rw, f, l) \
+ __rw_downgrade_int(rw)
+#endif
#if defined(INVARIANTS) || defined(INVARIANT_SUPPORT)
#define _rw_assert(rw, w, f, l) \
__rw_assert(&(rw)->rw_lock, w, f, l)
@@ -248,35 +277,21 @@ void _rw_assert(const struct rwlock *rw, int what, const char *file,
struct rw_args {
void *ra_rw;
const char *ra_desc;
-};
-
-struct rw_args_flags {
- void *ra_rw;
- const char *ra_desc;
int ra_flags;
};
-#define RW_SYSINIT(name, rw, desc) \
+#define RW_SYSINIT_FLAGS(name, rw, desc, flags) \
static struct rw_args name##_args = { \
(rw), \
(desc), \
+ (flags), \
}; \
SYSINIT(name##_rw_sysinit, SI_SUB_LOCK, SI_ORDER_MIDDLE, \
rw_sysinit, &name##_args); \
SYSUNINIT(name##_rw_sysuninit, SI_SUB_LOCK, SI_ORDER_MIDDLE, \
_rw_destroy, __DEVOLATILE(void *, &(rw)->rw_lock))
-
-#define RW_SYSINIT_FLAGS(name, rw, desc, flags) \
- static struct rw_args_flags name##_args = { \
- (rw), \
- (desc), \
- (flags), \
- }; \
- SYSINIT(name##_rw_sysinit, SI_SUB_LOCK, SI_ORDER_MIDDLE, \
- rw_sysinit_flags, &name##_args); \
- SYSUNINIT(name##_rw_sysuninit, SI_SUB_LOCK, SI_ORDER_MIDDLE, \
- _rw_destroy, __DEVOLATILE(void *, &(rw)->rw_lock))
+#define RW_SYSINIT(name, rw, desc) RW_SYSINIT_FLAGS(name, rw, desc, 0)
/*
* Options passed to rw_init_flags().
diff --git a/freebsd/sys/sys/sbuf.h b/freebsd/sys/sys/sbuf.h
index d0f908be..8e958cbe 100644
--- a/freebsd/sys/sys/sbuf.h
+++ b/freebsd/sys/sys/sbuf.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2000-2008 Poul-Henning Kamp
* Copyright (c) 2000-2008 Dag-Erling Coïdan Smørgrav
* All rights reserved.
diff --git a/freebsd/sys/sys/sdt.h b/freebsd/sys/sys/sdt.h
index c680ea85..424a0e3a 100644
--- a/freebsd/sys/sys/sdt.h
+++ b/freebsd/sys/sys/sdt.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright 2006-2008 John Birrell <jb@FreeBSD.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -80,13 +82,14 @@
#include <sys/cdefs.h>
#include <sys/linker_set.h>
+extern volatile bool sdt_probes_enabled;
+
#ifndef KDTRACE_HOOKS
#define SDT_PROVIDER_DEFINE(prov)
#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)
@@ -161,14 +164,13 @@ 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)) \
+ if (__predict_false(sdt_probes_enabled)) { \
+ if (__predict_false(sdt_##prov##_##mod##_##func##_##name->id)) \
(*sdt_probe_func)(sdt_##prov##_##mod##_##func##_##name->id, \
(uintptr_t) arg0, (uintptr_t) arg1, (uintptr_t) arg2, \
(uintptr_t) arg3, (uintptr_t) arg4); \
+ } \
} while (0)
#define SDT_PROBE_ARGTYPE(prov, mod, func, name, num, type, xtype) \
diff --git a/freebsd/sys/sys/selinfo.h b/freebsd/sys/sys/selinfo.h
index 85de231e..c5f3ad6b 100644
--- a/freebsd/sys/sys/selinfo.h
+++ b/freebsd/sys/sys/selinfo.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
diff --git a/freebsd/sys/sys/serial.h b/freebsd/sys/sys/serial.h
index 1a149a96..3293ebda 100644
--- a/freebsd/sys/sys/serial.h
+++ b/freebsd/sys/sys/serial.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2004 Poul-Henning Kamp
* All rights reserved.
*
diff --git a/freebsd/sys/sys/sf_buf.h b/freebsd/sys/sys/sf_buf.h
index 6aebe430..08f1d9d7 100644
--- a/freebsd/sys/sys/sf_buf.h
+++ b/freebsd/sys/sys/sf_buf.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2014 Gleb Smirnoff <glebius@FreeBSD.org>
* Copyright (c) 2003-2004 Alan L. Cox <alc@cs.rice.edu>
* All rights reserved.
diff --git a/freebsd/sys/sys/sigio.h b/freebsd/sys/sys/sigio.h
index e941ae96..6730f48a 100644
--- a/freebsd/sys/sys/sigio.h
+++ b/freebsd/sys/sys/sigio.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
diff --git a/freebsd/sys/sys/signalvar.h b/freebsd/sys/sys/signalvar.h
index 22f9ef4a..8735e3a0 100644
--- a/freebsd/sys/sys/signalvar.h
+++ b/freebsd/sys/sys/signalvar.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
diff --git a/freebsd/sys/sys/sleepqueue.h b/freebsd/sys/sys/sleepqueue.h
index 30a18933..07530e3b 100644
--- a/freebsd/sys/sys/sleepqueue.h
+++ b/freebsd/sys/sys/sleepqueue.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2004 John Baldwin <jhb@FreeBSD.org>
* All rights reserved.
*
diff --git a/freebsd/sys/sys/slicer.h b/freebsd/sys/sys/slicer.h
index 53f680d8..1565ecce 100644
--- a/freebsd/sys/sys/slicer.h
+++ b/freebsd/sys/sys/slicer.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2012 Semihalf.
* All rights reserved.
*
diff --git a/freebsd/sys/sys/smp.h b/freebsd/sys/sys/smp.h
index 9253304f..f1950fa2 100644
--- a/freebsd/sys/sys/smp.h
+++ b/freebsd/sys/sys/smp.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: Beerware
+ *
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <phk@FreeBSD.org> wrote this file. As long as you retain this notice you
diff --git a/freebsd/sys/sys/sockbuf.h b/freebsd/sys/sys/sockbuf.h
index c9cb4dd7..91a30b6f 100644
--- a/freebsd/sys/sys/sockbuf.h
+++ b/freebsd/sys/sys/sockbuf.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1982, 1986, 1990, 1993
* The Regents of the University of California. All rights reserved.
*
@@ -32,15 +34,9 @@
*/
#ifndef _SYS_SOCKBUF_H_
#define _SYS_SOCKBUF_H_
-#include <sys/_lock.h>
-#include <sys/_mutex.h>
-#include <sys/_sx.h>
-#include <sys/_task.h>
-
-#define SB_MAX (2*1024*1024) /* default for max chars in sockbuf */
/*
- * Constants for sb_flags field of struct sockbuf.
+ * Constants for sb_flags field of struct sockbuf/xsockbuf.
*/
#define SB_WAIT 0x04 /* someone is waiting for data/space */
#define SB_SEL 0x08 /* someone is selecting */
@@ -59,24 +55,20 @@
#define SBS_CANTRCVMORE 0x0020 /* can't receive more data from peer */
#define SBS_RCVATMARK 0x0040 /* at mark on input */
+#if defined(_KERNEL) || defined(_WANT_SOCKET)
+#include <sys/_lock.h>
+#include <sys/_mutex.h>
+#include <sys/_sx.h>
+#include <sys/_task.h>
+
+#define SB_MAX (2*1024*1024) /* default for max chars in sockbuf */
+
struct mbuf;
struct sockaddr;
struct socket;
struct thread;
struct selinfo;
-struct xsockbuf {
- u_int sb_cc;
- u_int sb_hiwat;
- u_int sb_mbcnt;
- u_int sb_mcnt;
- u_int sb_ccnt;
- u_int sb_mbmax;
- int sb_lowat;
- int sb_timeo;
- short sb_flags;
-};
-
/*
* Variables for socket buffering.
*
@@ -115,6 +107,7 @@ struct sockbuf {
#endif /* __rtems__ */
};
+#endif /* defined(_KERNEL) || defined(_WANT_SOCKET) */
#ifdef _KERNEL
/*
@@ -176,7 +169,6 @@ struct mbuf *
sbsndptr(struct sockbuf *sb, u_int off, u_int len, u_int *moff);
struct mbuf *
sbsndmbuf(struct sockbuf *sb, u_int off, u_int *moff);
-void sbtoxsockbuf(struct sockbuf *sb, struct xsockbuf *xsb);
int sbwait(struct sockbuf *sb);
int sblock(struct sockbuf *sb, int flags);
void sbunlock(struct sockbuf *sb);
diff --git a/freebsd/sys/sys/socketvar.h b/freebsd/sys/sys/socketvar.h
index 0c5b95ec..d58ac2ea 100644
--- a/freebsd/sys/sys/socketvar.h
+++ b/freebsd/sys/sys/socketvar.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1982, 1986, 1990, 1993
* The Regents of the University of California. All rights reserved.
*
@@ -34,6 +36,12 @@
#ifndef _SYS_SOCKETVAR_H_
#define _SYS_SOCKETVAR_H_
+/*
+ * Socket generation count type. Also used in xinpcb, xtcpcb, xunpcb.
+ */
+typedef uint64_t so_gen_t;
+
+#if defined(_KERNEL) || defined(_WANT_SOCKET)
#include <sys/queue.h> /* for TAILQ macros */
#include <sys/selinfo.h> /* for struct selinfo */
#include <sys/_lock.h>
@@ -41,7 +49,6 @@
#include <sys/osd.h>
#include <sys/_sx.h>
#include <sys/sockbuf.h>
-#include <sys/sockstate.h>
#ifdef _KERNEL
#include <sys/caprights.h>
#include <sys/sockopt.h>
@@ -55,7 +62,6 @@ struct vnet;
* handle on protocol and pointer to protocol
* private data and error information.
*/
-typedef uint64_t so_gen_t;
typedef int so_upcall_t(struct socket *, void *, int);
struct socket;
@@ -167,6 +173,39 @@ struct socket {
};
};
};
+#endif /* defined(_KERNEL) || defined(_WANT_SOCKET) */
+
+/*
+ * Socket state bits.
+ *
+ * Historically, this bits were all kept in the so_state field. For
+ * locking reasons, they are now in multiple fields, as they are
+ * locked differently. so_state maintains basic socket state protected
+ * by the socket lock. so_qstate holds information about the socket
+ * accept queues. Each socket buffer also has a state field holding
+ * information relevant to that socket buffer (can't send, rcv). Many
+ * fields will be read without locks to improve performance and avoid
+ * lock order issues. However, this approach must be used with caution.
+ */
+#define SS_NOFDREF 0x0001 /* no file table ref any more */
+#define SS_ISCONNECTED 0x0002 /* socket connected to a peer */
+#define SS_ISCONNECTING 0x0004 /* in process of connecting to peer */
+#define SS_ISDISCONNECTING 0x0008 /* in process of disconnecting */
+#define SS_NBIO 0x0100 /* non-blocking ops */
+#define SS_ASYNC 0x0200 /* async i/o notify */
+#define SS_ISCONFIRMING 0x0400 /* deciding to accept connection req */
+#define SS_ISDISCONNECTED 0x2000 /* socket disconnected from peer */
+
+/*
+ * Protocols can mark a socket as SS_PROTOREF to indicate that, following
+ * pru_detach, they still want the socket to persist, and will free it
+ * themselves when they are done. Protocols should only ever call sofree()
+ * following setting this flag in pru_detach(), and never otherwise, as
+ * sofree() bypasses socket reference counting.
+ */
+#define SS_PROTOREF 0x4000 /* strong protocol reference */
+
+#ifdef _KERNEL
#define SOCK_MTX(so) &(so)->so_lock
#define SOCK_LOCK(so) mtx_lock(&(so)->so_lock)
@@ -194,32 +233,6 @@ struct socket {
} while (0)
/*
- * Externalized form of struct socket used by the sysctl(3) interface.
- */
-struct xsocket {
- size_t xso_len; /* length of this structure */
- struct socket *xso_so; /* makes a convenient handle sometimes */
- short so_type;
- short so_options;
- short so_linger;
- short so_state;
- caddr_t so_pcb; /* another convenient handle */
- int xso_protocol;
- int xso_family;
- u_int so_qlen;
- u_int so_incqlen;
- u_int so_qlimit;
- short so_timeo;
- u_short so_error;
- pid_t so_pgid;
- u_long so_oobmark;
- struct xsockbuf so_rcv, so_snd;
- uid_t so_uid; /* XXX */
-};
-
-#ifdef _KERNEL
-
-/*
* Macros for sockets and socket buffering.
*/
@@ -424,7 +437,6 @@ int sosend_generic(struct socket *so, struct sockaddr *addr,
struct uio *uio, struct mbuf *top, struct mbuf *control,
int flags, struct thread *td);
int soshutdown(struct socket *so, int how);
-void sotoxsocket(struct socket *so, struct xsocket *xso);
void soupcall_clear(struct socket *, int);
void soupcall_set(struct socket *, int, so_upcall_t, void *);
void solisten_upcall_set(struct socket *, so_upcall_t, void *);
@@ -437,6 +449,14 @@ void sowakeup_aio(struct socket *so, struct sockbuf *sb);
void solisten_wakeup(struct socket *);
int selsocket(struct socket *so, int events, struct timeval *tv,
struct thread *td);
+void soisconnected(struct socket *so);
+void soisconnecting(struct socket *so);
+void soisdisconnected(struct socket *so);
+void soisdisconnecting(struct socket *so);
+void socantrcvmore(struct socket *so);
+void socantrcvmore_locked(struct socket *so);
+void socantsendmore(struct socket *so);
+void socantsendmore_locked(struct socket *so);
/*
* Accept filter functions (duh).
@@ -453,4 +473,58 @@ int accept_filt_generic_mod_event(module_t mod, int event, void *data);
#endif /* _KERNEL */
+/*
+ * Structure to export socket from kernel to utilities, via sysctl(3).
+ */
+struct xsocket {
+ size_t xso_len; /* length of this structure */
+ union {
+ void *xso_so; /* kernel address of struct socket */
+ int64_t ph_so;
+ };
+ union {
+ void *so_pcb; /* kernel address of struct inpcb */
+ int64_t ph_pcb;
+ };
+ uint64_t so_oobmark;
+ int64_t so_spare64[8];
+ int32_t xso_protocol;
+ int32_t xso_family;
+ uint32_t so_qlen;
+ uint32_t so_incqlen;
+ uint32_t so_qlimit;
+ pid_t so_pgid;
+ uid_t so_uid;
+ int32_t so_spare32[8];
+ int16_t so_type;
+ int16_t so_options;
+ int16_t so_linger;
+ int16_t so_state;
+ int16_t so_timeo;
+ uint16_t so_error;
+ struct xsockbuf {
+ uint32_t sb_cc;
+ uint32_t sb_hiwat;
+ uint32_t sb_mbcnt;
+ uint32_t sb_mcnt;
+ uint32_t sb_ccnt;
+ uint32_t sb_mbmax;
+ int32_t sb_lowat;
+ int32_t sb_timeo;
+ int16_t sb_flags;
+ } so_rcv, so_snd;
+};
+
+#ifdef _KERNEL
+void sotoxsocket(struct socket *so, struct xsocket *xso);
+void sbtoxsockbuf(struct sockbuf *sb, struct xsockbuf *xsb);
+#endif
+
+/*
+ * Socket buffer state bits. Exported via libprocstat(3).
+ */
+#define SBS_CANTSENDMORE 0x0010 /* can't send more data to peer */
+#define SBS_CANTRCVMORE 0x0020 /* can't receive more data from peer */
+#define SBS_RCVATMARK 0x0040 /* at mark on input */
+
#endif /* !_SYS_SOCKETVAR_H_ */
diff --git a/freebsd/sys/sys/sockopt.h b/freebsd/sys/sys/sockopt.h
index 029e5b4a..7f19ecf8 100644
--- a/freebsd/sys/sys/sockopt.h
+++ b/freebsd/sys/sys/sockopt.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1982, 1986, 1990, 1993
* The Regents of the University of California. All rights reserved.
*
diff --git a/freebsd/sys/sys/stddef.h b/freebsd/sys/sys/stddef.h
index 9b6ac537..76aabd86 100644
--- a/freebsd/sys/sys/stddef.h
+++ b/freebsd/sys/sys/stddef.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2002 Maxime Henrion <mux@FreeBSD.org>
* All rights reserved.
*
diff --git a/freebsd/sys/sys/stdint.h b/freebsd/sys/sys/stdint.h
index 4c41ec14..98915f72 100644
--- a/freebsd/sys/sys/stdint.h
+++ b/freebsd/sys/sys/stdint.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2001 Mike Barcroft <mike@FreeBSD.org>
* All rights reserved.
*
diff --git a/freebsd/sys/sys/sx.h b/freebsd/sys/sys/sx.h
index 0c95df16..33143057 100644
--- a/freebsd/sys/sys/sx.h
+++ b/freebsd/sys/sys/sx.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2007 Attilio Rao <attilio@freebsd.org>
* Copyright (c) 2001 Jason Evans <jasone@freebsd.org>
* All rights reserved.
@@ -43,10 +45,10 @@
#endif
#ifdef __rtems__
-#define SX_NOINLINE 1
-#define _sx_slock _bsd__sx_xlock
-#define sx_try_slock_ _bsd_sx_try_xlock_
-#define _sx_sunlock _bsd__sx_xunlock
+#define SX_NOINLINE 1
+#define sx_try_xlock_ _bsd_sx_try_slock_int
+#define sx_try_xlock_int _bsd_sx_try_slock_int
+#define _sx_sunlock _bsd__sx_sunlock_int
#endif /* __rtems__ */
/*
* In general, the sx locks and rwlocks use very similar algorithms.
@@ -107,18 +109,45 @@ void sx_sysinit(void *arg);
#define sx_init(sx, desc) sx_init_flags((sx), (desc), 0)
void sx_init_flags(struct sx *sx, const char *description, int opts);
void sx_destroy(struct sx *sx);
+int sx_try_slock_int(struct sx *sx LOCK_FILE_LINE_ARG_DEF);
+#ifndef __rtems__
int sx_try_slock_(struct sx *sx, const char *file, int line);
+int sx_try_xlock_int(struct sx *sx LOCK_FILE_LINE_ARG_DEF);
int sx_try_xlock_(struct sx *sx, const char *file, int line);
+#endif /* __rtems__ */
+int sx_try_upgrade_int(struct sx *sx LOCK_FILE_LINE_ARG_DEF);
+#ifndef __rtems__
int sx_try_upgrade_(struct sx *sx, const char *file, int line);
+#endif /* __rtems__ */
+void sx_downgrade_int(struct sx *sx LOCK_FILE_LINE_ARG_DEF);
+#ifndef __rtems__
void sx_downgrade_(struct sx *sx, const char *file, int line);
+#endif /* __rtems__ */
+int _sx_slock_int(struct sx *sx, int opts LOCK_FILE_LINE_ARG_DEF);
+#ifndef __rtems__
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);
+#else /* __rtems__ */
+#if (LOCK_DEBUG > 0)
+#define _sx_xlock(sx, opts, file, line) \
+ _bsd__sx_slock_int(sx, opts, file, line)
+#else
+#define _sx_xlock(sx, opts, file, line) _bsd__sx_slock_int(sx, opts)
+#endif
+#endif /* __rtems__ */
+void _sx_sunlock_int(struct sx *sx LOCK_FILE_LINE_ARG_DEF);
+#ifndef __rtems__
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 v, uintptr_t tid, int opts,
- const char *file, int line);
-void _sx_xunlock_hard(struct sx *sx, uintptr_t tid, const char *file, int
- line);
+int _sx_xlock_hard(struct sx *sx, uintptr_t x, int opts LOCK_FILE_LINE_ARG_DEF);
+void _sx_xunlock_hard(struct sx *sx, uintptr_t x LOCK_FILE_LINE_ARG_DEF);
+#else /* __rtems__ */
+#if (LOCK_DEBUG > 0)
+#define _sx_xunlock(sx, file, line) _bsd__sx_sunlock_int(sx, file, line)
+#else
+#define _sx_xunlock(sx, file, line) _bsd__sx_sunlock_int(sx)
+#endif
+#endif /* __rtems__ */
#if defined(INVARIANTS) || defined(INVARIANT_SUPPORT)
void _sx_assert(const struct sx *sx, int what, const char *file, int line);
#endif
@@ -164,7 +193,7 @@ __sx_xlock(struct sx *sx, struct thread *td, int opts, const char *file,
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);
+ error = _sx_xlock_hard(sx, v, opts);
return (error);
}
@@ -173,11 +202,11 @@ __sx_xlock(struct sx *sx, struct thread *td, int opts, const char *file,
static __inline void
__sx_xunlock(struct sx *sx, struct thread *td, const char *file, int line)
{
- uintptr_t tid = (uintptr_t)td;
+ uintptr_t x = (uintptr_t)td;
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);
+ !atomic_fcmpset_rel_ptr(&sx->sx_lock, &x, SX_LOCK_UNLOCKED)))
+ _sx_xunlock_hard(sx, x);
}
#endif
#endif /* __rtems__ */
@@ -203,6 +232,7 @@ __sx_xunlock(struct sx *sx, struct thread *td, const char *file, int line)
#define sx_xunlock_(sx, file, line) \
__sx_xunlock((sx), curthread, (file), (line))
#endif /* LOCK_DEBUG > 0 || SX_NOINLINE */
+#if (LOCK_DEBUG > 0)
#define sx_slock_(sx, file, line) \
(void)_sx_slock((sx), 0, (file), (line))
#define sx_slock_sig_(sx, file, line) \
@@ -213,6 +243,18 @@ __sx_xunlock(struct sx *sx, struct thread *td, const char *file, int 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)
#define sx_downgrade(sx) sx_downgrade_((sx), LOCK_FILE, LOCK_LINE)
+#else
+#define sx_slock_(sx, file, line) \
+ (void)_sx_slock_int((sx), 0)
+#define sx_slock_sig_(sx, file, line) \
+ _sx_slock_int((sx), SX_INTERRUPTIBLE)
+#define sx_sunlock_(sx, file, line) \
+ _sx_sunlock_int((sx))
+#define sx_try_slock(sx) sx_try_slock_int((sx))
+#define sx_try_xlock(sx) sx_try_xlock_int((sx))
+#define sx_try_upgrade(sx) sx_try_upgrade_int((sx))
+#define sx_downgrade(sx) sx_downgrade_int((sx))
+#endif
#ifdef INVARIANTS
#define sx_assert_(sx, what, file, line) \
_sx_assert((sx), (what), (file), (line))
@@ -240,9 +282,6 @@ __sx_xunlock(struct sx *sx, struct thread *td, const char *file, int line)
#define sx_xlocked(sx) \
(((sx)->sx_lock & ~(SX_LOCK_FLAGMASK & ~SX_LOCK_SHARED)) == \
(uintptr_t)curthread)
-#else /* __rtems__ */
-int sx_xlocked(struct sx *sx);
-#endif /* __rtems__ */
#define sx_unlock_(sx, file, line) do { \
if (sx_xlocked(sx)) \
@@ -252,6 +291,14 @@ int sx_xlocked(struct sx *sx);
} while (0)
#define sx_unlock(sx) sx_unlock_((sx), LOCK_FILE, LOCK_LINE)
+#else /* __rtems__ */
+int sx_xlocked(struct sx *sx);
+#if (LOCK_DEBUG > 0)
+#define sx_unlock(sx) _sx_sunlock_int((sx), LOCK_FILE, LOCK_LINE)
+#else
+#define sx_unlock(sx) _sx_sunlock_int((sx))
+#endif
+#endif /* __rtems__ */
#define sx_sleep(chan, sx, pri, wmesg, timo) \
_sleep((chan), &(sx)->lock_object, (pri), (wmesg), \
diff --git a/freebsd/sys/sys/sysctl.h b/freebsd/sys/sys/sysctl.h
index 71da475b..874d226f 100644
--- a/freebsd/sys/sys/sysctl.h
+++ b/freebsd/sys/sys/sysctl.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
*
@@ -83,6 +85,7 @@ struct ctlname {
#define CTLFLAG_RD 0x80000000 /* Allow reads of variable */
#define CTLFLAG_WR 0x40000000 /* Allow writes to the variable */
#define CTLFLAG_RW (CTLFLAG_RD|CTLFLAG_WR)
+#define CTLFLAG_DORMANT 0x20000000 /* This sysctl is not active yet */
#define CTLFLAG_ANYBODY 0x10000000 /* All users can set this var */
#define CTLFLAG_SECURE 0x08000000 /* Permit set only if securelevel<=0 */
#define CTLFLAG_PRISON 0x04000000 /* Prisoned roots can fiddle */
@@ -144,7 +147,7 @@ struct ctlname {
#define REQ_WIRED 2
/* definitions for sysctl_req 'flags' member */
-#if defined(__amd64__) || defined(__powerpc64__) ||\
+#if defined(__aarch64__) || defined(__amd64__) || defined(__powerpc64__) ||\
(defined(__mips__) && defined(__mips_n64))
#define SCTL_MASK32 1 /* 32 bit emulation */
#endif
@@ -223,6 +226,8 @@ int sysctl_dpcpu_quad(SYSCTL_HANDLER_ARGS);
* These functions are used to add/remove an oid from the mib.
*/
void sysctl_register_oid(struct sysctl_oid *oidp);
+void sysctl_register_disabled_oid(struct sysctl_oid *oidp);
+void sysctl_enable_oid(struct sysctl_oid *oidp);
void sysctl_unregister_oid(struct sysctl_oid *oidp);
/* Declare a static oid to allow child oids to be added to it. */
diff --git a/freebsd/sys/sys/syslog.h b/freebsd/sys/sys/syslog.h
index f31cfb97..071b6842 100644
--- a/freebsd/sys/sys/syslog.h
+++ b/freebsd/sys/sys/syslog.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1982, 1986, 1988, 1993
* The Regents of the University of California. All rights reserved.
*
diff --git a/freebsd/sys/sys/systm.h b/freebsd/sys/sys/systm.h
index 92be461b..e89719b8 100644
--- a/freebsd/sys/sys/systm.h
+++ b/freebsd/sys/sys/systm.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1982, 1988, 1991, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
@@ -38,10 +40,10 @@
#ifndef _SYS_SYSTM_H_
#define _SYS_SYSTM_H_
+#include <sys/cdefs.h>
#include <machine/atomic.h>
#include <machine/cpufunc.h>
#include <sys/callout.h>
-#include <sys/cdefs.h>
#include <sys/queue.h>
#include <sys/stdint.h> /* for people using printf mainly */
#ifdef __rtems__
@@ -596,6 +598,7 @@ struct unrhdr;
struct unrhdr *new_unrhdr(int low, int high, struct mtx *mutex);
void init_unrhdr(struct unrhdr *uh, int low, int high, struct mtx *mutex);
void delete_unrhdr(struct unrhdr *uh);
+void clear_unrhdr(struct unrhdr *uh);
void clean_unrhdr(struct unrhdr *uh);
void clean_unrhdrl(struct unrhdr *uh);
int alloc_unr(struct unrhdr *uh);
diff --git a/freebsd/sys/sys/taskqueue.h b/freebsd/sys/sys/taskqueue.h
index b5091d32..7ba9e268 100644
--- a/freebsd/sys/sys/taskqueue.h
+++ b/freebsd/sys/sys/taskqueue.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2000 Doug Rabson
* All rights reserved.
*
diff --git a/freebsd/sys/sys/timeet.h b/freebsd/sys/sys/timeet.h
index 3d50e51d..dc43337d 100644
--- a/freebsd/sys/sys/timeet.h
+++ b/freebsd/sys/sys/timeet.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2010-2013 Alexander Motin <mav@FreeBSD.org>
* All rights reserved.
*
diff --git a/freebsd/sys/sys/tree.h b/freebsd/sys/sys/tree.h
index c9df686f..539afb42 100644
--- a/freebsd/sys/sys/tree.h
+++ b/freebsd/sys/sys/tree.h
@@ -3,6 +3,8 @@
/* $FreeBSD$ */
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
* All rights reserved.
*
diff --git a/freebsd/sys/sys/tty.h b/freebsd/sys/sys/tty.h
index c37d0bf3..92ad89a6 100644
--- a/freebsd/sys/sys/tty.h
+++ b/freebsd/sys/sys/tty.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org>
* All rights reserved.
*
diff --git a/freebsd/sys/sys/ttydevsw.h b/freebsd/sys/sys/ttydevsw.h
index 98bebca7..b189335c 100644
--- a/freebsd/sys/sys/ttydevsw.h
+++ b/freebsd/sys/sys/ttydevsw.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org>
* All rights reserved.
*
diff --git a/freebsd/sys/sys/ttydisc.h b/freebsd/sys/sys/ttydisc.h
index 74a1a0ed..2ab0c05c 100644
--- a/freebsd/sys/sys/ttydisc.h
+++ b/freebsd/sys/sys/ttydisc.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org>
* All rights reserved.
*
diff --git a/freebsd/sys/sys/ttyhook.h b/freebsd/sys/sys/ttyhook.h
index 2a6d0887..0697a488 100644
--- a/freebsd/sys/sys/ttyhook.h
+++ b/freebsd/sys/sys/ttyhook.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org>
* All rights reserved.
*
diff --git a/freebsd/sys/sys/ttyqueue.h b/freebsd/sys/sys/ttyqueue.h
index c8d85d62..c1ddaa42 100644
--- a/freebsd/sys/sys/ttyqueue.h
+++ b/freebsd/sys/sys/ttyqueue.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org>
* All rights reserved.
*
diff --git a/freebsd/sys/sys/ucred.h b/freebsd/sys/sys/ucred.h
index bf5d99d8..37a93357 100644
--- a/freebsd/sys/sys/ucred.h
+++ b/freebsd/sys/sys/ucred.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
*
diff --git a/freebsd/sys/sys/un.h b/freebsd/sys/sys/un.h
index 27d6a499..f83652e0 100644
--- a/freebsd/sys/sys/un.h
+++ b/freebsd/sys/sys/un.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
diff --git a/freebsd/sys/sys/unpcb.h b/freebsd/sys/sys/unpcb.h
index 76bc63a9..1ab3457d 100644
--- a/freebsd/sys/sys/unpcb.h
+++ b/freebsd/sys/sys/unpcb.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1982, 1986, 1989, 1993
* The Regents of the University of California. All rights reserved.
*
@@ -33,6 +35,9 @@
#ifndef _SYS_UNPCB_H_
#define _SYS_UNPCB_H_
+typedef uint64_t unp_gen_t;
+
+#if defined(_KERNEL) || defined(_WANT_UNPCB)
#include <sys/queue.h>
#include <sys/ucred.h>
@@ -61,7 +66,6 @@
* so that changes in the sockbuf may be computed to modify
* back pressure on the sender accordingly.
*/
-typedef u_quad_t unp_gen_t;
LIST_HEAD(unp_head, unpcb);
struct unpcb {
@@ -78,8 +82,6 @@ struct unpcb {
struct unp_head unp_refs; /* referencing socket linked list */
LIST_ENTRY(unpcb) unp_reflink; /* link in unp_refs list */
struct sockaddr_un *unp_addr; /* bound address of socket */
- int reserved1;
- int reserved2;
unp_gen_t unp_gencnt; /* generation count of this instance */
short unp_flags; /* flags */
short unp_gcflag; /* Garbage collector flags. */
@@ -120,32 +122,50 @@ struct unpcb {
#define sotounpcb(so) ((struct unpcb *)((so)->so_pcb))
-/* Hack alert -- this structure depends on <sys/socketvar.h>. */
+#endif /* _KERNEL || _WANT_UNPCB */
+
+/*
+ * UNPCB structure exported to user-land via sysctl(3).
+ *
+ * Fields prefixed with "xu_" are unique to the export structure, and fields
+ * with "unp_" or other prefixes match corresponding fields of 'struct unpcb'.
+ *
+ * Legend:
+ * (s) - used by userland utilities in src
+ * (p) - used by utilities in ports
+ * (3) - is known to be used by third party software not in ports
+ * (n) - no known usage
+ *
+ * Evil hack: declare only if sys/socketvar.h have been included.
+ */
#ifdef _SYS_SOCKETVAR_H_
struct xunpcb {
- size_t xu_len; /* length of this structure */
- struct unpcb *xu_unpp; /* to help netstat, fstat */
- struct unpcb xu_unp; /* our information */
+ size_t xu_len; /* length of this structure */
+ void *xu_unpp; /* to help netstat, fstat */
+ void *unp_vnode; /* (s) */
+ void *unp_conn; /* (s) */
+ void *xu_firstref; /* (s) */
+ void *xu_nextref; /* (s) */
+ unp_gen_t unp_gencnt; /* (s) */
+ int64_t xu_spare64[8];
+ int32_t xu_spare32[8];
union {
- struct sockaddr_un xuu_addr; /* our bound address */
+ struct sockaddr_un xu_addr; /* our bound address */
char xu_dummy1[256];
- } xu_au;
-#define xu_addr xu_au.xuu_addr
+ };
union {
- struct sockaddr_un xuu_caddr; /* their bound address */
+ struct sockaddr_un xu_caddr; /* their bound address */
char xu_dummy2[256];
- } xu_cau;
-#define xu_caddr xu_cau.xuu_caddr
- struct xsocket xu_socket;
- u_quad_t xu_alignment_hack;
-};
+ };
+ struct xsocket xu_socket;
+} __aligned(8);
struct xunpgen {
size_t xug_len;
u_int xug_count;
unp_gen_t xug_gen;
so_gen_t xug_sogen;
-};
+} __aligned(8);;
#endif /* _SYS_SOCKETVAR_H_ */
#endif /* _SYS_UNPCB_H_ */
diff --git a/freebsd/sys/sys/user.h b/freebsd/sys/sys/user.h
index 9fdb9dd6..f6aa2b3f 100644
--- a/freebsd/sys/sys/user.h
+++ b/freebsd/sys/sys/user.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1982, 1986, 1989, 1991, 1993
* The Regents of the University of California.
* Copyright (c) 2007 Robert N. M. Watson
diff --git a/freebsd/sys/sys/uuid.h b/freebsd/sys/sys/uuid.h
index 97971fd7..e60af218 100644
--- a/freebsd/sys/sys/uuid.h
+++ b/freebsd/sys/sys/uuid.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2002 Marcel Moolenaar
* All rights reserved.
*
diff --git a/freebsd/sys/sys/vmmeter.h b/freebsd/sys/sys/vmmeter.h
index bc536f71..33d96b26 100644
--- a/freebsd/sys/sys/vmmeter.h
+++ b/freebsd/sys/sys/vmmeter.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
@@ -41,20 +43,23 @@
/* Systemwide totals computed every five seconds. */
struct vmtotal {
- int16_t t_rq; /* length of the run queue */
- int16_t t_dw; /* jobs in ``disk wait'' (neg priority) */
- int16_t t_pw; /* jobs in page wait */
- int16_t t_sl; /* jobs sleeping in core */
- int16_t t_sw; /* swapped out runnable/short block jobs */
- int32_t t_vm; /* total virtual memory */
- int32_t t_avm; /* active virtual memory */
- int32_t t_rm; /* total real memory in use */
- int32_t t_arm; /* active real memory */
- int32_t t_vmshr; /* shared virtual memory */
- int32_t t_avmshr; /* active shared virtual memory */
- int32_t t_rmshr; /* shared real memory */
- int32_t t_armshr; /* active shared real memory */
- int32_t t_free; /* free memory pages */
+ uint64_t t_vm; /* total virtual memory */
+ uint64_t t_avm; /* active virtual memory */
+ uint64_t t_rm; /* total real memory in use */
+ uint64_t t_arm; /* active real memory */
+ uint64_t t_vmshr; /* shared virtual memory */
+ uint64_t t_avmshr; /* active shared virtual memory */
+ uint64_t t_rmshr; /* shared real memory */
+ uint64_t t_armshr; /* active shared real memory */
+ uint64_t t_free; /* free memory pages */
+ int16_t t_rq; /* length of the run queue */
+ int16_t t_dw; /* jobs in ``disk wait'' (neg
+ priority) */
+ int16_t t_pw; /* jobs in page wait */
+ int16_t t_sl; /* jobs sleeping in core */
+ int16_t t_sw; /* swapped out runnable/short
+ block jobs */
+ uint16_t t_pad[3];
};
#if defined(_KERNEL) || defined(_WANT_VMMETER)
@@ -131,7 +136,6 @@ struct vmmeter {
u_int v_free_reserved; /* (c) pages reserved for deadlock */
u_int v_free_target; /* (c) pages desired free */
u_int v_free_min; /* (c) pages desired free */
- u_int v_free_count; /* (f) pages free */
u_int v_inactive_target; /* (c) pages desired inactive */
u_int v_pageout_free_min; /* (c) min pages reserved for kernel */
u_int v_interrupt_free_min; /* (c) reserved pages for int code */
@@ -141,6 +145,7 @@ struct vmmeter {
u_int v_inactive_count VMMETER_ALIGNED; /* (a) pages inactive */
u_int v_laundry_count VMMETER_ALIGNED; /* (a) pages eligible for
laundering */
+ u_int v_free_count VMMETER_ALIGNED; /* (f) pages free */
};
#endif /* _KERNEL || _WANT_VMMETER */
@@ -208,10 +213,10 @@ vm_paging_target(void)
* Returns TRUE if the pagedaemon needs to be woken up.
*/
static inline int
-vm_paging_needed(void)
+vm_paging_needed(u_int free_count)
{
- return (vm_cnt.v_free_count < vm_pageout_wakeup_thresh);
+ return (free_count < vm_pageout_wakeup_thresh);
}
/*
diff --git a/freebsd/sys/sys/vnode.h b/freebsd/sys/sys/vnode.h
index 0c533063..ac6f4f4e 100644
--- a/freebsd/sys/sys/vnode.h
+++ b/freebsd/sys/sys/vnode.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
*
diff --git a/freebsd/sys/sys/watchdog.h b/freebsd/sys/sys/watchdog.h
index 92c47dee..1b85ce7a 100644
--- a/freebsd/sys/sys/watchdog.h
+++ b/freebsd/sys/sys/watchdog.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2003 Poul-Henning Kamp
* Copyright (c) 2013 iXsystems.com,
* author: Alfred Perlstein <alfred@freebsd.org>