[Midnightbsd-cvs] src [9912] trunk/sys/sys: sync with freebsd 10-stable
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Fri May 25 08:38:16 EDT 2018
Revision: 9912
http://svnweb.midnightbsd.org/src/?rev=9912
Author: laffer1
Date: 2018-05-25 08:38:16 -0400 (Fri, 25 May 2018)
Log Message:
-----------
sync with freebsd 10-stable
Modified Paths:
--------------
trunk/sys/sys/_mutex.h
trunk/sys/sys/_rmlock.h
trunk/sys/sys/_rwlock.h
trunk/sys/sys/_semaphore.h
trunk/sys/sys/_stdint.h
trunk/sys/sys/_termios.h
trunk/sys/sys/_types.h
trunk/sys/sys/_umtx.h
trunk/sys/sys/aac_ioctl.h
trunk/sys/sys/acct.h
trunk/sys/sys/acl.h
trunk/sys/sys/aio.h
trunk/sys/sys/alq.h
trunk/sys/sys/ata.h
trunk/sys/sys/bio.h
trunk/sys/sys/bitstring.h
trunk/sys/sys/blist.h
trunk/sys/sys/buf.h
trunk/sys/sys/buf_ring.h
trunk/sys/sys/bufobj.h
trunk/sys/sys/bus.h
trunk/sys/sys/bus_dma.h
trunk/sys/sys/callout.h
trunk/sys/sys/capability.h
trunk/sys/sys/cdio.h
trunk/sys/sys/condvar.h
trunk/sys/sys/conf.h
trunk/sys/sys/cons.h
trunk/sys/sys/consio.h
trunk/sys/sys/cpuctl.h
trunk/sys/sys/cpuset.h
trunk/sys/sys/devicestat.h
trunk/sys/sys/digiio.h
trunk/sys/sys/disk.h
trunk/sys/sys/disklabel.h
trunk/sys/sys/diskmbr.h
trunk/sys/sys/diskpc98.h
trunk/sys/sys/domain.h
trunk/sys/sys/dtrace_bsd.h
trunk/sys/sys/dvdio.h
trunk/sys/sys/elf32.h
trunk/sys/sys/elf64.h
trunk/sys/sys/elf_common.h
trunk/sys/sys/elf_generic.h
trunk/sys/sys/endian.h
trunk/sys/sys/errno.h
trunk/sys/sys/eui64.h
trunk/sys/sys/event.h
trunk/sys/sys/eventhandler.h
trunk/sys/sys/eventvar.h
trunk/sys/sys/exec.h
trunk/sys/sys/extattr.h
trunk/sys/sys/fail.h
trunk/sys/sys/fbio.h
trunk/sys/sys/fcntl.h
trunk/sys/sys/fdcio.h
trunk/sys/sys/file.h
trunk/sys/sys/filedesc.h
trunk/sys/sys/filio.h
trunk/sys/sys/firmware.h
trunk/sys/sys/fnv_hash.h
trunk/sys/sys/gmon.h
trunk/sys/sys/gpio.h
trunk/sys/sys/hash.h
trunk/sys/sys/hhook.h
trunk/sys/sys/iconv.h
trunk/sys/sys/imgact.h
trunk/sys/sys/imgact_aout.h
trunk/sys/sys/imgact_elf.h
trunk/sys/sys/ioctl.h
trunk/sys/sys/ioctl_compat.h
trunk/sys/sys/ipc.h
trunk/sys/sys/ipmi.h
trunk/sys/sys/jail.h
trunk/sys/sys/kbio.h
trunk/sys/sys/kdb.h
trunk/sys/sys/kernel.h
trunk/sys/sys/kerneldump.h
trunk/sys/sys/kobj.h
trunk/sys/sys/ksem.h
trunk/sys/sys/ksyms.h
trunk/sys/sys/ktr.h
trunk/sys/sys/ktrace.h
trunk/sys/sys/libkern.h
trunk/sys/sys/link_elf.h
trunk/sys/sys/linker.h
trunk/sys/sys/linker_set.h
trunk/sys/sys/lock.h
trunk/sys/sys/lock_profile.h
trunk/sys/sys/lockmgr.h
trunk/sys/sys/lockstat.h
trunk/sys/sys/malloc.h
trunk/sys/sys/mbpool.h
trunk/sys/sys/mbuf.h
trunk/sys/sys/mchain.h
trunk/sys/sys/mdioctl.h
trunk/sys/sys/memrange.h
trunk/sys/sys/mman.h
trunk/sys/sys/module.h
trunk/sys/sys/module_khelp.h
trunk/sys/sys/mount.h
trunk/sys/sys/mouse.h
trunk/sys/sys/mpt_ioctl.h
trunk/sys/sys/msgbuf.h
trunk/sys/sys/mtio.h
trunk/sys/sys/mutex.h
trunk/sys/sys/namei.h
trunk/sys/sys/nlist_aout.h
trunk/sys/sys/osd.h
trunk/sys/sys/param.h
trunk/sys/sys/pciio.h
trunk/sys/sys/pcpu.h
trunk/sys/sys/pioctl.h
trunk/sys/sys/pipe.h
trunk/sys/sys/pmc.h
trunk/sys/sys/pmckern.h
trunk/sys/sys/pmclog.h
trunk/sys/sys/poll.h
trunk/sys/sys/posix4.h
trunk/sys/sys/power.h
trunk/sys/sys/priority.h
trunk/sys/sys/priv.h
trunk/sys/sys/proc.h
trunk/sys/sys/procdesc.h
trunk/sys/sys/procfs.h
trunk/sys/sys/protosw.h
trunk/sys/sys/ptio.h
trunk/sys/sys/ptrace.h
trunk/sys/sys/queue.h
trunk/sys/sys/racct.h
trunk/sys/sys/random.h
trunk/sys/sys/rangelock.h
trunk/sys/sys/rctl.h
trunk/sys/sys/reboot.h
trunk/sys/sys/refcount.h
trunk/sys/sys/regression.h
trunk/sys/sys/resource.h
trunk/sys/sys/resourcevar.h
trunk/sys/sys/rman.h
trunk/sys/sys/rmlock.h
trunk/sys/sys/rtprio.h
trunk/sys/sys/runq.h
trunk/sys/sys/rwlock.h
trunk/sys/sys/sbuf.h
trunk/sys/sys/sched.h
trunk/sys/sys/sdt.h
trunk/sys/sys/select.h
trunk/sys/sys/selinfo.h
trunk/sys/sys/sem.h
trunk/sys/sys/sema.h
trunk/sys/sys/serial.h
trunk/sys/sys/sf_buf.h
trunk/sys/sys/sglist.h
trunk/sys/sys/shm.h
trunk/sys/sys/sigio.h
trunk/sys/sys/signal.h
trunk/sys/sys/signalvar.h
trunk/sys/sys/sleepqueue.h
trunk/sys/sys/smp.h
trunk/sys/sys/sockbuf.h
trunk/sys/sys/socket.h
trunk/sys/sys/socketvar.h
trunk/sys/sys/sockio.h
trunk/sys/sys/sockopt.h
trunk/sys/sys/sockstate.h
trunk/sys/sys/soundcard.h
trunk/sys/sys/stack.h
trunk/sys/sys/stat.h
trunk/sys/sys/statvfs.h
trunk/sys/sys/stdint.h
trunk/sys/sys/sun_disklabel.h
trunk/sys/sys/syscall.mk
trunk/sys/sys/syscallsubr.h
trunk/sys/sys/sysctl.h
trunk/sys/sys/sysent.h
trunk/sys/sys/syslog.h
trunk/sys/sys/sysproto.h
trunk/sys/sys/systm.h
Added Paths:
-----------
trunk/sys/sys/_bitset.h
trunk/sys/sys/_ffcounter.h
trunk/sys/sys/_pctrie.h
trunk/sys/sys/_unrhdr.h
trunk/sys/sys/bitset.h
trunk/sys/sys/boot.h
trunk/sys/sys/busdma_bufalloc.h
trunk/sys/sys/caprights.h
trunk/sys/sys/capsicum.h
trunk/sys/sys/counter.h
trunk/sys/sys/dnv.h
trunk/sys/sys/efi.h
trunk/sys/sys/imgact_binmisc.h
trunk/sys/sys/nv.h
trunk/sys/sys/nv_impl.h
trunk/sys/sys/nvlist_impl.h
trunk/sys/sys/nvpair_impl.h
trunk/sys/sys/pctrie.h
trunk/sys/sys/procctl.h
Added: trunk/sys/sys/_bitset.h
===================================================================
--- trunk/sys/sys/_bitset.h (rev 0)
+++ trunk/sys/sys/_bitset.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -0,0 +1,62 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2008, Jeffrey Roberson <jeff at freebsd.org>
+ * All rights reserved.
+ *
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice unmodified, this list of conditions, and the following
+ * disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD: stable/10/sys/sys/_bitset.h 290739 2015-11-13 01:37:08Z markj $
+ */
+
+#ifndef _SYS__BITSET_H_
+#define _SYS__BITSET_H_
+
+/*
+ * Macros addressing word and bit within it, tuned to make compiler
+ * optimize cases when SETSIZE fits into single machine word.
+ */
+#define _BITSET_BITS (sizeof(long) * NBBY)
+
+#define __bitset_words(_s) (howmany(_s, _BITSET_BITS))
+
+#define __bitset_mask(_s, n) \
+ (1L << ((__bitset_words((_s)) == 1) ? \
+ (__size_t)(n) : ((n) % _BITSET_BITS)))
+
+#define __bitset_word(_s, n) \
+ ((__bitset_words((_s)) == 1) ? 0 : ((n) / _BITSET_BITS))
+
+#define BITSET_DEFINE(t, _s) \
+struct t { \
+ long __bits[__bitset_words((_s))]; \
+}
+
+#define BITSET_T_INITIALIZER(x) \
+ { .__bits = { x } }
+
+#define BITSET_FSET(n) \
+ [ 0 ... ((n) - 1) ] = (-1L)
+
+#endif /* !_SYS__BITSET_H_ */
Property changes on: trunk/sys/sys/_bitset.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/_ffcounter.h
===================================================================
--- trunk/sys/sys/_ffcounter.h (rev 0)
+++ trunk/sys/sys/_ffcounter.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -0,0 +1,43 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2011 The University of Melbourne
+ * All rights reserved.
+ *
+ * This software was developed by Julien Ridoux at the University of Melbourne
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: stable/10/sys/sys/_ffcounter.h 227723 2011-11-19 14:10:16Z lstewart $
+ */
+
+#ifndef _SYS__FFCOUNTER_H_
+#define _SYS__FFCOUNTER_H_
+
+/*
+ * The feed-forward clock counter. The fundamental element of a feed-forward
+ * clock is a wide monotonically increasing counter that accumulates at the same
+ * rate as the selected timecounter.
+ */
+typedef uint64_t ffcounter;
+
+#endif /* _SYS__FFCOUNTER_H_ */
Property changes on: trunk/sys/sys/_ffcounter.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/sys/sys/_mutex.h
===================================================================
--- trunk/sys/sys/_mutex.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/_mutex.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1997 Berkeley Software Design, Inc. All rights reserved.
*
@@ -25,14 +26,22 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/_mutex.h 242901 2012-11-11 23:25:47Z attilio $
*/
#ifndef _SYS__MUTEX_H_
#define _SYS__MUTEX_H_
+#include <machine/param.h>
+
/*
* Sleep/spin mutex.
+ *
+ * All mutex implementations must always have a member called mtx_lock.
+ * Other locking primitive structures are not allowed to use this name
+ * for their members.
+ * If this rule needs to change, the bits in the mutex implementation must
+ * be modified appropriately.
*/
struct mtx {
struct lock_object lock_object; /* Common lock properties. */
@@ -39,4 +48,18 @@
volatile uintptr_t mtx_lock; /* Owner and flags. */
};
+/*
+ * Members of struct mtx_padalign must mirror members of struct mtx.
+ * mtx_padalign mutexes can use the mtx(9) API transparently without
+ * modification.
+ * Pad-aligned mutexes used within structures should generally be the
+ * first member of the struct. Otherwise, the compiler can generate
+ * additional padding for the struct to keep a correct alignment for
+ * the mutex.
+ */
+struct mtx_padalign {
+ struct lock_object lock_object; /* Common lock properties. */
+ volatile uintptr_t mtx_lock; /* Owner and flags. */
+} __aligned(CACHE_LINE_SIZE);
+
#endif /* !_SYS__MUTEX_H_ */
Added: trunk/sys/sys/_pctrie.h
===================================================================
--- trunk/sys/sys/_pctrie.h (rev 0)
+++ trunk/sys/sys/_pctrie.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -0,0 +1,52 @@
+/* $MidnightBSD$ */
+/*
+ * Copyright (c) 2013 EMC Corp.
+ * Copyright (c) 2011 Jeffrey Roberson <jeff at freebsd.org>
+ * Copyright (c) 2008 Mayur Shardul <mayur.shardul at gmail.com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: stable/10/sys/sys/_pctrie.h 250551 2013-05-12 04:05:01Z jeff $
+ */
+
+#ifndef __SYS_PCTRIE_H_
+#define __SYS_PCTRIE_H_
+
+/*
+ * Radix tree root.
+ */
+struct pctrie {
+ uintptr_t pt_root;
+};
+
+#ifdef _KERNEL
+
+static __inline boolean_t
+pctrie_is_empty(struct pctrie *ptree)
+{
+
+ return (ptree->pt_root == 0);
+}
+
+#endif /* _KERNEL */
+#endif /* !__SYS_PCTRIE_H_ */
Property changes on: trunk/sys/sys/_pctrie.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/sys/sys/_rmlock.h
===================================================================
--- trunk/sys/sys/_rmlock.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/_rmlock.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2007 Stephan Uphoff <ups at FreeBSD.org>
* All rights reserved.
@@ -26,17 +27,12 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/_rmlock.h 252209 2013-06-25 18:44:15Z jhb $
*/
#ifndef _SYS__RMLOCK_H_
#define _SYS__RMLOCK_H_
-/*
- * XXXUPS remove as soon as we have per cpu variable
- * linker sets and can define rm_queue in _rm_lock.h
-*/
-#include <sys/pcpu.h>
/*
* Mostly reader/occasional writer lock.
*/
@@ -43,15 +39,23 @@
LIST_HEAD(rmpriolist,rm_priotracker);
+struct rm_queue {
+ struct rm_queue *volatile rmq_next;
+ struct rm_queue *volatile rmq_prev;
+};
+
struct rmlock {
- struct lock_object lock_object;
+ struct lock_object lock_object;
volatile cpuset_t rm_writecpus;
LIST_HEAD(,rm_priotracker) rm_activeReaders;
union {
+ struct lock_object _rm_wlock_object;
struct mtx _rm_lock_mtx;
struct sx _rm_lock_sx;
} _rm_lock;
};
+
+#define rm_wlock_object _rm_lock._rm_wlock_object
#define rm_lock_mtx _rm_lock._rm_lock_mtx
#define rm_lock_sx _rm_lock._rm_lock_sx
Modified: trunk/sys/sys/_rwlock.h
===================================================================
--- trunk/sys/sys/_rwlock.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/_rwlock.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2006 John Baldwin <jhb at FreeBSD.org>
* All rights reserved.
@@ -10,9 +11,6 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -26,14 +24,22 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/_rwlock.h 262192 2014-02-18 20:27:17Z jhb $
*/
#ifndef _SYS__RWLOCK_H_
#define _SYS__RWLOCK_H_
+#include <machine/param.h>
+
/*
* Reader/writer lock.
+ *
+ * All reader/writer lock implementations must always have a member
+ * called rw_lock. Other locking primitive structures are not allowed to
+ * use this name for their members.
+ * If this rule needs to change, the bits in the reader/writer lock
+ * implementation must be modified appropriately.
*/
struct rwlock {
struct lock_object lock_object;
@@ -40,4 +46,18 @@
volatile uintptr_t rw_lock;
};
+/*
+ * Members of struct rwlock_padalign must mirror members of struct rwlock.
+ * rwlock_padalign rwlocks can use the rwlock(9) API transparently without
+ * modification.
+ * Pad-aligned rwlocks used within structures should generally be the
+ * first member of the struct. Otherwise, the compiler can generate
+ * additional padding for the struct to keep a correct alignment for
+ * the rwlock.
+ */
+struct rwlock_padalign {
+ struct lock_object lock_object;
+ volatile uintptr_t rw_lock;
+} __aligned(CACHE_LINE_SIZE);
+
#endif /* !_SYS__RWLOCK_H_ */
Modified: trunk/sys/sys/_semaphore.h
===================================================================
--- trunk/sys/sys/_semaphore.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/_semaphore.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2002 Alfred Perlstein <alfred at FreeBSD.org>
* All rights reserved.
@@ -23,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/_semaphore.h 201546 2010-01-05 02:37:59Z davidxu $
*/
#ifndef __SEMAPHORE_H_
#define __SEMAPHORE_H_
Modified: trunk/sys/sys/_stdint.h
===================================================================
--- trunk/sys/sys/_stdint.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/_stdint.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2011 David E. O'Brien <obrien at FreeBSD.org>
* Copyright (c) 2001 Mike Barcroft <mike at FreeBSD.org>
@@ -24,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/_stdint.h 291134 2015-11-21 16:21:27Z kib $
*/
#ifndef _SYS__STDINT_H_
@@ -78,5 +79,13 @@
typedef __uintptr_t uintptr_t;
#define _UINTPTR_T_DECLARED
#endif
+#ifndef _INTMAX_T_DECLARED
+typedef __intmax_t intmax_t;
+#define _INTMAX_T_DECLARED
+#endif
+#ifndef _UINTMAX_T_DECLARED
+typedef __uintmax_t uintmax_t;
+#define _UINTMAX_T_DECLARED
+#endif
#endif /* !_SYS__STDINT_H_ */
Modified: trunk/sys/sys/_termios.h
===================================================================
--- trunk/sys/sys/_termios.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/_termios.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1988, 1989, 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -27,7 +28,7 @@
* SUCH DAMAGE.
*
* @(#)termios.h 8.3 (Berkeley) 3/28/94
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/_termios.h 319653 2017-06-07 11:43:36Z kib $
*/
#ifndef _SYS__TERMIOS_H_
@@ -42,15 +43,15 @@
*/
#define VEOF 0 /* ICANON */
#define VEOL 1 /* ICANON */
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define VEOL2 2 /* ICANON together with IEXTEN */
#endif
#define VERASE 3 /* ICANON */
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define VWERASE 4 /* ICANON together with IEXTEN */
#endif
#define VKILL 5 /* ICANON */
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define VREPRINT 6 /* ICANON together with IEXTEN */
#define VERASE2 7 /* ICANON */
#endif
@@ -58,18 +59,18 @@
#define VINTR 8 /* ISIG */
#define VQUIT 9 /* ISIG */
#define VSUSP 10 /* ISIG */
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define VDSUSP 11 /* ISIG together with IEXTEN */
#endif
#define VSTART 12 /* IXON, IXOFF */
#define VSTOP 13 /* IXON, IXOFF */
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define VLNEXT 14 /* IEXTEN */
#define VDISCARD 15 /* IEXTEN */
#endif
#define VMIN 16 /* !ICANON */
#define VTIME 17 /* !ICANON */
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define VSTATUS 18 /* ICANON together with IEXTEN */
/* 19 spare 2 */
#endif
@@ -91,16 +92,16 @@
#define ICRNL 0x00000100 /* map CR to NL (ala CRMOD) */
#define IXON 0x00000200 /* enable output flow control */
#define IXOFF 0x00000400 /* enable input flow control */
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define IXANY 0x00000800 /* any char will restart after stop */
#define IMAXBEL 0x00002000 /* ring bell on input queue full */
-#endif /*_POSIX_SOURCE */
+#endif
/*
* Output flags - software output processing
*/
#define OPOST 0x00000001 /* enable following output processing */
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define ONLCR 0x00000002 /* map NL to CR-NL (ala CRMOD) */
#define TABDLY 0x00000004 /* tab delay mask */
#define TAB0 0x00000000 /* no tab delay and expansion */
@@ -109,12 +110,12 @@
#define OCRNL 0x00000010 /* map CR to NL on output */
#define ONOCR 0x00000020 /* no CR output at column 0 */
#define ONLRET 0x00000040 /* NL performs CR function */
-#endif /*_POSIX_SOURCE */
+#endif
/*
* Control flags - hardware control of terminal
*/
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define CIGNORE 0x00000001 /* ignore control flags */
#endif
#define CSIZE 0x00000300 /* character size mask */
@@ -128,7 +129,7 @@
#define PARODD 0x00002000 /* odd parity, else even */
#define HUPCL 0x00004000 /* hang up on last close */
#define CLOCAL 0x00008000 /* ignore modem status lines */
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define CCTS_OFLOW 0x00010000 /* CTS flow control of output */
#define CRTSCTS (CCTS_OFLOW | CRTS_IFLOW)
#define CRTS_IFLOW 0x00020000 /* RTS flow control of input */
@@ -146,30 +147,30 @@
* input flag.
*/
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define ECHOKE 0x00000001 /* visual erase for line kill */
-#endif /*_POSIX_SOURCE */
+#endif
#define ECHOE 0x00000002 /* visually erase chars */
#define ECHOK 0x00000004 /* echo NL after line kill */
#define ECHO 0x00000008 /* enable echoing */
#define ECHONL 0x00000010 /* echo NL even if ECHO is off */
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define ECHOPRT 0x00000020 /* visual erase mode for hardcopy */
#define ECHOCTL 0x00000040 /* echo control chars as ^(Char) */
-#endif /*_POSIX_SOURCE */
+#endif
#define ISIG 0x00000080 /* enable signals INTR, QUIT, [D]SUSP */
#define ICANON 0x00000100 /* canonicalize input lines */
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define ALTWERASE 0x00000200 /* use alternate WERASE algorithm */
-#endif /*_POSIX_SOURCE */
+#endif
#define IEXTEN 0x00000400 /* enable DISCARD and LNEXT */
#define EXTPROC 0x00000800 /* external processing */
#define TOSTOP 0x00400000 /* stop background jobs from output */
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define FLUSHO 0x00800000 /* output being flushed (state) */
#define NOKERNINFO 0x02000000 /* no kernel output from VSTATUS */
#define PENDIN 0x20000000 /* XXX retype pending input (state) */
-#endif /*_POSIX_SOURCE */
+#endif
#define NOFLSH 0x80000000 /* don't flush after interrupt */
/*
@@ -191,7 +192,7 @@
#define B9600 9600
#define B19200 19200
#define B38400 38400
-#ifndef _POSIX_SOURCE
+#if __BSD_VISIBLE
#define B7200 7200
#define B14400 14400
#define B28800 28800
@@ -203,7 +204,7 @@
#define B921600 921600
#define EXTA 19200
#define EXTB 38400
-#endif /* !_POSIX_SOURCE */
+#endif
typedef unsigned int tcflag_t;
typedef unsigned char cc_t;
Modified: trunk/sys/sys/_types.h
===================================================================
--- trunk/sys/sys/_types.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/_types.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2002 Mike Barcroft <mike at FreeBSD.org>
* All rights reserved.
@@ -23,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/_types.h 309258 2016-11-28 18:36:37Z jhb $
*/
#ifndef _SYS__TYPES_H_
@@ -38,7 +39,6 @@
typedef __uint32_t __blksize_t; /* file block size */
typedef __int64_t __blkcnt_t; /* file block count */
typedef __int32_t __clockid_t; /* clock_gettime()... */
-typedef __uint64_t __cap_rights_t; /* capability rights */
typedef __uint32_t __fflags_t; /* file flags */
typedef __uint64_t __fsblkcnt_t;
typedef __uint64_t __fsfilcnt_t;
@@ -80,16 +80,31 @@
* ANSI C), but they use __ct_rune_t instead of int.
*
* NOTE: rune_t is not covered by ANSI nor other standards, and should not
- * be instantiated outside of lib/libc/locale. Use wchar_t. wchar_t and
- * rune_t must be the same type. Also, wint_t must be no narrower than
- * wchar_t, and should be able to hold all members of the largest
- * character set plus one extra value (WEOF), and must be at least 16 bits.
+ * be instantiated outside of lib/libc/locale. Use wchar_t. wint_t and
+ * rune_t must be the same type. Also, wint_t should be able to hold all
+ * members of the largest character set plus one extra value (WEOF), and
+ * must be at least 16 bits.
*/
typedef int __ct_rune_t; /* arg type for ctype funcs */
typedef __ct_rune_t __rune_t; /* rune_t (see above) */
-typedef __ct_rune_t __wchar_t; /* wchar_t (see above) */
typedef __ct_rune_t __wint_t; /* wint_t (see above) */
+/* Clang already provides these types as built-ins, but only in C++ mode. */
+#if !defined(__clang__) || !defined(__cplusplus)
+typedef __uint_least16_t __char16_t;
+typedef __uint_least32_t __char32_t;
+#endif
+/* In C++11, char16_t and char32_t are built-in types. */
+#if defined(__cplusplus) && __cplusplus >= 201103L
+#define _CHAR16_T_DECLARED
+#define _CHAR32_T_DECLARED
+#endif
+
+typedef struct {
+ long long __max_align1 __aligned(_Alignof(long long));
+ long double __max_align2 __aligned(_Alignof(long double));
+} __max_align_t;
+
typedef __uint32_t __dev_t; /* device number */
typedef __uint32_t __fixpt_t; /* fixed point number */
Modified: trunk/sys/sys/_umtx.h
===================================================================
--- trunk/sys/sys/_umtx.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/_umtx.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2010, David Xu <davidxu at freebsd.org>
* All rights reserved.
@@ -23,7 +24,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/_umtx.h 232144 2012-02-25 02:12:17Z davidxu $
*
*/
@@ -31,6 +32,7 @@
#define _SYS__UMTX_H_
#include <sys/_types.h>
+#include <sys/_timespec.h>
struct umtx {
volatile unsigned long u_owner; /* Owner of the mutex. */
@@ -64,4 +66,10 @@
__uint32_t _flags;
};
+struct _umtx_time {
+ struct timespec _timeout;
+ __uint32_t _flags;
+ __uint32_t _clockid;
+};
+
#endif /* !_SYS__UMTX_H_ */
Added: trunk/sys/sys/_unrhdr.h
===================================================================
--- trunk/sys/sys/_unrhdr.h (rev 0)
+++ trunk/sys/sys/_unrhdr.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -0,0 +1,52 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2004 Poul-Henning Kamp
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: stable/10/sys/sys/_unrhdr.h 255057 2013-08-30 07:37:45Z kib $
+ */
+
+#ifndef _SYS_UNRHDR_H
+#define _SYS_UNRHDR_H
+
+#include <sys/queue.h>
+
+struct mtx;
+
+/* Header element for a unr number space. */
+
+struct unrhdr {
+ TAILQ_HEAD(unrhd,unr) head;
+ u_int low; /* Lowest item */
+ u_int high; /* Highest item */
+ u_int busy; /* Count of allocated items */
+ u_int alloc; /* Count of memory allocations */
+ u_int first; /* items in allocated from start */
+ u_int last; /* items free at end */
+ struct mtx *mtx;
+ TAILQ_HEAD(unrfr,unr) ppfree; /* Items to be freed after mtx
+ lock dropped */
+};
+
+#endif
Property changes on: trunk/sys/sys/_unrhdr.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/sys/sys/aac_ioctl.h
===================================================================
--- trunk/sys/sys/aac_ioctl.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/aac_ioctl.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2000 Michael Smith
* Copyright (c) 2000 Scott Long
@@ -25,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/aac_ioctl.h 331637 2018-03-27 17:52:52Z brooks $
*/
/*
@@ -173,6 +174,14 @@
caddr_t AifFib;
};
+#ifdef _KERNEL
+struct get_adapter_fib_ioctl32 {
+ u_int32_t AdapterFibContext;
+ int Wait;
+ u_int32_t AifFib;
+};
+#endif
+
struct aac_query_disk {
int32_t ContainerNumber;
int32_t Bus;
Modified: trunk/sys/sys/acct.h
===================================================================
--- trunk/sys/sys/acct.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/acct.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1990, 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -32,7 +33,7 @@
* SUCH DAMAGE.
*
* @(#)acct.h 8.4 (Berkeley) 1/9/95
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/acct.h 169857 2007-05-22 06:51:38Z dds $
*/
#ifndef _SYS_ACCT_H_
Modified: trunk/sys/sys/acl.h
===================================================================
--- trunk/sys/sys/acl.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/acl.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1999-2001 Robert N. M. Watson
* Copyright (c) 2008 Edward Tomasz Napierała <trasz at FreeBSD.org>
@@ -26,7 +27,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/acl.h 290893 2015-11-15 23:54:34Z ngie $
*/
/*
* Developed by the TrustedBSD Project.
@@ -249,11 +250,12 @@
#define ACL_ENTRY_INHERIT_ONLY 0x0008
#define ACL_ENTRY_SUCCESSFUL_ACCESS 0x0010
#define ACL_ENTRY_FAILED_ACCESS 0x0020
+#define ACL_ENTRY_INHERITED 0x0080
#define ACL_FLAGS_BITS (ACL_ENTRY_FILE_INHERIT | \
ACL_ENTRY_DIRECTORY_INHERIT | ACL_ENTRY_NO_PROPAGATE_INHERIT | \
ACL_ENTRY_INHERIT_ONLY | ACL_ENTRY_SUCCESSFUL_ACCESS | \
- ACL_ENTRY_FAILED_ACCESS)
+ ACL_ENTRY_FAILED_ACCESS | ACL_ENTRY_INHERITED)
/*
* Undefined value in ae_id field. ae_id should be set to this value
Modified: trunk/sys/sys/aio.h
===================================================================
--- trunk/sys/sys/aio.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/aio.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1997 John S. Dyson. All rights reserved.
*
@@ -13,7 +14,7 @@
* bad that happens because of using this software isn't the responsibility
* of the author. This software is distributed AS-IS.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/aio.h 328294 2018-01-23 18:22:41Z jhb $
*/
#ifndef _SYS_AIO_H_
@@ -37,6 +38,7 @@
#define LIO_READ 0x2
#ifdef _KERNEL
#define LIO_SYNC 0x3
+#define LIO_MLOCK 0x4
#endif
/*
@@ -124,7 +126,12 @@
*/
int aio_suspend(const struct aiocb * const[], int, const struct timespec *);
-#ifdef __BSD_VISIBLE
+/*
+ * Asynchronous mlock
+ */
+int aio_mlock(struct aiocb *);
+
+#if __BSD_VISIBLE
int aio_waitcomplete(struct aiocb **, struct timespec *);
#endif
Modified: trunk/sys/sys/alq.h
===================================================================
--- trunk/sys/sys/alq.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/alq.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2002, Jeffrey Roberson <jeff at freebsd.org>
* Copyright (c) 2008-2009, Lawrence Stewart <lstewart at freebsd.org>
@@ -29,7 +30,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/alq.h 207223 2010-04-26 13:48:22Z lstewart $
*
*/
#ifndef _SYS_ALQ_H_
Modified: trunk/sys/sys/ata.h
===================================================================
--- trunk/sys/sys/ata.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/ata.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,5 +1,6 @@
+/* $MidnightBSD$ */
/*-
- * Copyright (c) 2000 - 2008 S\xF8ren Schmidt <sos at FreeBSD.org>
+ * Copyright (c) 2000 - 2008 Søren Schmidt <sos at FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -23,7 +24,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/ata.h 322081 2017-08-05 08:37:38Z mav $
*/
#ifndef _SYS_ATA_H_
@@ -68,8 +69,8 @@
/*049*/ u_int16_t capabilities1;
#define ATA_SUPPORT_DMA 0x0100
#define ATA_SUPPORT_LBA 0x0200
-#define ATA_SUPPORT_IORDY 0x0400
-#define ATA_SUPPORT_IORDYDIS 0x0800
+#define ATA_SUPPORT_IORDYDIS 0x0400
+#define ATA_SUPPORT_IORDY 0x0800
#define ATA_SUPPORT_OVERLAP 0x4000
/*050*/ u_int16_t capabilities2;
@@ -130,6 +131,7 @@
#define ATA_SATA_CURR_GEN_MASK 0x0006
#define ATA_SUPPORT_NCQ_STREAM 0x0010
#define ATA_SUPPORT_NCQ_QMANAGEMENT 0x0020
+#define ATA_SUPPORT_RCVSND_FPDMA_QUEUED 0x0040
/*78*/ u_int16_t satasupport;
#define ATA_SUPPORT_NONZERO 0x0002
#define ATA_SUPPORT_AUTOACTIVATE 0x0004
@@ -214,6 +216,8 @@
#define ATA_PSS_LSPPS 0x000F
#define ATA_PSS_LSSABOVE512 0x1000
#define ATA_PSS_MULTLS 0x2000
+#define ATA_PSS_VALID_MASK 0xC000
+#define ATA_PSS_VALID_VALUE 0x4000
/*107*/ u_int16_t isd;
/*108*/ u_int16_t wwn[4];
u_int16_t reserved112[5];
@@ -249,7 +253,7 @@
u_int16_t reserved170[6];
/*176*/ u_int8_t media_serial[60];
/*206*/ u_int16_t sct;
- u_int16_t reserved206[2];
+ u_int16_t reserved207[2];
/*209*/ u_int16_t lsalign;
/*210*/ u_int16_t wrv_sectors_m3_1;
u_int16_t wrv_sectors_m3_2;
@@ -259,6 +263,8 @@
/*215*/ u_int16_t nv_cache_size_1;
u_int16_t nv_cache_size_2;
/*217*/ u_int16_t media_rotation_rate;
+#define ATA_RATE_NOT_REPORTED 0x0000
+#define ATA_RATE_NON_ROTATING 0x0001
u_int16_t reserved218;
/*219*/ u_int16_t nv_cache_opt;
/*220*/ u_int16_t wrv_mode;
@@ -330,6 +336,7 @@
#define ATA_UDMA6 0x46
#define ATA_SA150 0x47
#define ATA_SA300 0x48
+#define ATA_SA600 0x49
#define ATA_DMA_MAX 0x4f
@@ -347,6 +354,7 @@
#define ATA_READ_NATIVE_MAX_ADDRESS48 0x27 /* read native max addr 48bit */
#define ATA_READ_MUL48 0x29 /* read multi 48bit LBA */
#define ATA_READ_STREAM_DMA48 0x2a /* read DMA stream 48bit LBA */
+#define ATA_READ_LOG_EXT 0x2f /* read log ext - PIO Data-In */
#define ATA_READ_STREAM48 0x2b /* read stream 48bit LBA */
#define ATA_WRITE 0x30 /* write */
#define ATA_WRITE48 0x34 /* write 48bit LBA */
@@ -361,8 +369,19 @@
#define ATA_WRITE_LOG_EXT 0x3f
#define ATA_READ_VERIFY 0x40
#define ATA_READ_VERIFY48 0x42
+#define ATA_WRITE_UNCORRECTABLE48 0x45 /* write uncorrectable 48bit LBA */
+#define ATA_WU_PSEUDO 0x55 /* pseudo-uncorrectable error */
+#define ATA_WU_FLAGGED 0xaa /* flagged-uncorrectable error */
+#define ATA_READ_LOG_DMA_EXT 0x47 /* read log DMA ext - PIO Data-In */
#define ATA_READ_FPDMA_QUEUED 0x60 /* read DMA NCQ */
#define ATA_WRITE_FPDMA_QUEUED 0x61 /* write DMA NCQ */
+#define ATA_NCQ_NON_DATA 0x63 /* NCQ non-data command */
+#define ATA_SEND_FPDMA_QUEUED 0x64 /* send DMA NCQ */
+#define ATA_SFPDMA_DSM 0x00 /* Data set management */
+#define ATA_SFPDMA_DSM_TRIM 0x01 /* Set trim bit in auxiliary */
+#define ATA_SFPDMA_HYBRID_EVICT 0x01 /* Hybrid Evict */
+#define ATA_SFPDMA_WLDMA 0x02 /* Write Log DMA EXT */
+#define ATA_RECV_FPDMA_QUEUED 0x65 /* receive DMA NCQ */
#define ATA_SEP_ATTN 0x67 /* SEP request */
#define ATA_SEEK 0x70 /* seek */
#define ATA_PACKET_CMD 0xa0 /* packet command */
@@ -384,6 +403,7 @@
#define ATA_IDLE_CMD 0xe3 /* idle */
#define ATA_READ_BUFFER 0xe4 /* read buffer */
#define ATA_READ_PM 0xe4 /* read portmultiplier */
+#define ATA_CHECK_POWER_MODE 0xe5 /* device power mode */
#define ATA_SLEEP 0xe6 /* sleep */
#define ATA_FLUSHCACHE 0xe7 /* flush cache to disk */
#define ATA_WRITE_PM 0xe8 /* write portmultiplier */
Modified: trunk/sys/sys/bio.h
===================================================================
--- trunk/sys/sys/bio.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/bio.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1982, 1986, 1989, 1993
* The Regents of the University of California. All rights reserved.
@@ -32,7 +33,7 @@
* SUCH DAMAGE.
*
* @(#)buf.h 8.9 (Berkeley) 3/30/95
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/bio.h 292348 2015-12-16 19:01:14Z ken $
*/
#ifndef _SYS_BIO_H_
@@ -41,24 +42,32 @@
#include <sys/queue.h>
/* bio_cmd */
-#define BIO_READ 0x01
-#define BIO_WRITE 0x02
-#define BIO_DELETE 0x04
-#define BIO_GETATTR 0x08
-#define BIO_FLUSH 0x10
+#define BIO_READ 0x01 /* Read I/O data */
+#define BIO_WRITE 0x02 /* Write I/O data */
+#define BIO_DELETE 0x04 /* TRIM or free blocks, i.e. mark as unused */
+#define BIO_GETATTR 0x08 /* Get GEOM attributes of object */
+#define BIO_FLUSH 0x10 /* Commit outstanding I/O now */
#define BIO_CMD0 0x20 /* Available for local hacks */
#define BIO_CMD1 0x40 /* Available for local hacks */
#define BIO_CMD2 0x80 /* Available for local hacks */
/* bio_flags */
-#define BIO_ERROR 0x01
-#define BIO_DONE 0x02
-#define BIO_ONQUEUE 0x04
+#define BIO_ERROR 0x01 /* An error occurred processing this bio. */
+#define BIO_DONE 0x02 /* This bio is finished. */
+#define BIO_ONQUEUE 0x04 /* This bio is in a queue & not yet taken. */
+/*
+ * This bio must be executed after all previous bios in the queue have been
+ * executed, and before any successive bios can be executed.
+ */
#define BIO_ORDERED 0x08
+#define BIO_UNMAPPED 0x10
+#define BIO_TRANSIENT_MAPPING 0x20
+#define BIO_VLIST 0x40
#ifdef _KERNEL
struct disk;
struct bio;
+struct vm_map;
/* Empty classifier tag, to prevent further classification. */
#define BIO_NOTCLASSIFIED (void *)(~0UL)
@@ -78,6 +87,9 @@
off_t bio_offset; /* Offset into file. */
long bio_bcount; /* Valid bytes in buffer. */
caddr_t bio_data; /* Memory, superblocks, indirect etc. */
+ struct vm_page **bio_ma; /* Or unmapped. */
+ int bio_ma_offset; /* Offset in the first page of bio_ma. */
+ int bio_ma_n; /* Number of pages in bio_ma. */
int bio_error; /* Errno for BIO_ERROR. */
long bio_resid; /* Remaining I/O in bytes. */
void (*bio_done)(struct bio *);
@@ -121,6 +133,9 @@
struct bio *insert_point;
};
+extern struct vm_map *bio_transient_map;
+extern int bio_transient_maxcnt;
+
void biodone(struct bio *bp);
void biofinish(struct bio *bp, struct devstat *stat, int error);
int biowait(struct bio *bp, const char *wchan);
Added: trunk/sys/sys/bitset.h
===================================================================
--- trunk/sys/sys/bitset.h (rev 0)
+++ trunk/sys/sys/bitset.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -0,0 +1,235 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2008, Jeffrey Roberson <jeff at freebsd.org>
+ * All rights reserved.
+ *
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice unmodified, this list of conditions, and the following
+ * disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD: stable/10/sys/sys/bitset.h 320940 2017-07-13 08:33:02Z kib $
+ */
+
+#ifndef _SYS_BITSET_H_
+#define _SYS_BITSET_H_
+
+#define BIT_CLR(_s, n, p) \
+ ((p)->__bits[__bitset_word(_s, n)] &= ~__bitset_mask((_s), (n)))
+
+#define BIT_COPY(_s, f, t) (void)(*(t) = *(f))
+
+#define BIT_ISSET(_s, n, p) \
+ ((((p)->__bits[__bitset_word(_s, n)] & __bitset_mask((_s), (n))) != 0))
+
+#define BIT_SET(_s, n, p) \
+ ((p)->__bits[__bitset_word(_s, n)] |= __bitset_mask((_s), (n)))
+
+#define BIT_ZERO(_s, p) do { \
+ __size_t __i; \
+ for (__i = 0; __i < __bitset_words((_s)); __i++) \
+ (p)->__bits[__i] = 0L; \
+} while (0)
+
+#define BIT_FILL(_s, p) do { \
+ __size_t __i; \
+ for (__i = 0; __i < __bitset_words((_s)); __i++) \
+ (p)->__bits[__i] = -1L; \
+} while (0)
+
+#define BIT_SETOF(_s, n, p) do { \
+ BIT_ZERO(_s, p); \
+ (p)->__bits[__bitset_word(_s, n)] = __bitset_mask((_s), (n)); \
+} while (0)
+
+/* Is p empty. */
+#define BIT_EMPTY(_s, p) __extension__ ({ \
+ __size_t __i; \
+ for (__i = 0; __i < __bitset_words((_s)); __i++) \
+ if ((p)->__bits[__i]) \
+ break; \
+ __i == __bitset_words((_s)); \
+})
+
+/* Is p full set. */
+#define BIT_ISFULLSET(_s, p) __extension__ ({ \
+ __size_t __i; \
+ for (__i = 0; __i < __bitset_words((_s)); __i++) \
+ if ((p)->__bits[__i] != (long)-1) \
+ break; \
+ __i == __bitset_words((_s)); \
+})
+
+/* Is c a subset of p. */
+#define BIT_SUBSET(_s, p, c) __extension__ ({ \
+ __size_t __i; \
+ for (__i = 0; __i < __bitset_words((_s)); __i++) \
+ if (((c)->__bits[__i] & \
+ (p)->__bits[__i]) != \
+ (c)->__bits[__i]) \
+ break; \
+ __i == __bitset_words((_s)); \
+})
+
+/* Are there any common bits between b & c? */
+#define BIT_OVERLAP(_s, p, c) __extension__ ({ \
+ __size_t __i; \
+ for (__i = 0; __i < __bitset_words((_s)); __i++) \
+ if (((c)->__bits[__i] & \
+ (p)->__bits[__i]) != 0) \
+ break; \
+ __i != __bitset_words((_s)); \
+})
+
+/* Compare two sets, returns 0 if equal 1 otherwise. */
+#define BIT_CMP(_s, p, c) __extension__ ({ \
+ __size_t __i; \
+ for (__i = 0; __i < __bitset_words((_s)); __i++) \
+ if (((c)->__bits[__i] != \
+ (p)->__bits[__i])) \
+ break; \
+ __i != __bitset_words((_s)); \
+})
+
+#define BIT_OR(_s, d, s) do { \
+ __size_t __i; \
+ for (__i = 0; __i < __bitset_words((_s)); __i++) \
+ (d)->__bits[__i] |= (s)->__bits[__i]; \
+} while (0)
+
+#define BIT_OR2(_s, d, s1, s2) do { \
+ __size_t __i; \
+ for (__i = 0; __i < __bitset_words((_s)); __i++) \
+ (d)->__bits[__i] = (s1)->__bits[__i] | (s2)->__bits[__i];\
+} while (0)
+
+#define BIT_AND(_s, d, s) do { \
+ __size_t __i; \
+ for (__i = 0; __i < __bitset_words((_s)); __i++) \
+ (d)->__bits[__i] &= (s)->__bits[__i]; \
+} while (0)
+
+#define BIT_AND2(_s, d, s1, s2) do { \
+ __size_t __i; \
+ for (__i = 0; __i < __bitset_words((_s)); __i++) \
+ (d)->__bits[__i] = (s1)->__bits[__i] & (s2)->__bits[__i];\
+} while (0)
+
+#define BIT_NAND(_s, d, s) do { \
+ __size_t __i; \
+ for (__i = 0; __i < __bitset_words((_s)); __i++) \
+ (d)->__bits[__i] &= ~(s)->__bits[__i]; \
+} while (0)
+
+#define BIT_NAND2(_s, d, s1, s2) do { \
+ __size_t __i; \
+ for (__i = 0; __i < __bitset_words((_s)); __i++) \
+ (d)->__bits[__i] = (s1)->__bits[__i] & ~(s2)->__bits[__i];\
+} while (0)
+
+#define BIT_XOR(_s, d, s) do { \
+ __size_t __i; \
+ for (__i = 0; __i < __bitset_words((_s)); __i++) \
+ (d)->__bits[__i] ^= (s)->__bits[__i]; \
+} while (0)
+
+#define BIT_XOR2(_s, d, s1, s2) do { \
+ __size_t __i; \
+ for (__i = 0; __i < __bitset_words((_s)); __i++) \
+ (d)->__bits[__i] = (s1)->__bits[__i] ^ (s2)->__bits[__i];\
+} while (0)
+
+#define BIT_CLR_ATOMIC(_s, n, p) \
+ atomic_clear_long(&(p)->__bits[__bitset_word(_s, n)], \
+ __bitset_mask((_s), n))
+
+#define BIT_SET_ATOMIC(_s, n, p) \
+ atomic_set_long(&(p)->__bits[__bitset_word(_s, n)], \
+ __bitset_mask((_s), n))
+
+#define BIT_SET_ATOMIC_ACQ(_s, n, p) \
+ atomic_set_acq_long(&(p)->__bits[__bitset_word(_s, n)], \
+ __bitset_mask((_s), n))
+
+/* Convenience functions catering special cases. */
+#define BIT_AND_ATOMIC(_s, d, s) do { \
+ __size_t __i; \
+ for (__i = 0; __i < __bitset_words((_s)); __i++) \
+ atomic_clear_long(&(d)->__bits[__i], \
+ ~(s)->__bits[__i]); \
+} while (0)
+
+#define BIT_OR_ATOMIC(_s, d, s) do { \
+ __size_t __i; \
+ for (__i = 0; __i < __bitset_words((_s)); __i++) \
+ atomic_set_long(&(d)->__bits[__i], \
+ (s)->__bits[__i]); \
+} while (0)
+
+#define BIT_COPY_STORE_REL(_s, f, t) do { \
+ __size_t __i; \
+ for (__i = 0; __i < __bitset_words((_s)); __i++) \
+ atomic_store_rel_long(&(t)->__bits[__i], \
+ (f)->__bits[__i]); \
+} while (0)
+
+#define BIT_FFS(_s, p) __extension__ ({ \
+ __size_t __i; \
+ int __bit; \
+ \
+ __bit = 0; \
+ for (__i = 0; __i < __bitset_words((_s)); __i++) { \
+ if ((p)->__bits[__i] != 0) { \
+ __bit = ffsl((p)->__bits[__i]); \
+ __bit += __i * _BITSET_BITS; \
+ break; \
+ } \
+ } \
+ __bit; \
+})
+
+#define BIT_FLS(_s, p) __extension__ ({ \
+ __size_t __i; \
+ int __bit; \
+ \
+ __bit = 0; \
+ for (__i = __bitset_words((_s)); __i > 0; __i--) { \
+ if ((p)->__bits[__i - 1] != 0) { \
+ __bit = flsl((p)->__bits[__i - 1]); \
+ __bit += (__i - 1) * _BITSET_BITS; \
+ break; \
+ } \
+ } \
+ __bit; \
+})
+
+#define BIT_COUNT(_s, p) __extension__ ({ \
+ __size_t __i; \
+ int __count; \
+ \
+ __count = 0; \
+ for (__i = 0; __i < __bitset_words((_s)); __i++) \
+ __count += __bitcountl((p)->__bits[__i]); \
+ __count; \
+})
+
+#endif /* !_SYS_BITSET_H_ */
Property changes on: trunk/sys/sys/bitset.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/sys/sys/bitstring.h
===================================================================
--- trunk/sys/sys/bitstring.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/bitstring.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
@@ -29,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/bitstring.h 139825 2005-01-07 02:29:27Z imp $
*/
#ifndef _SYS_BITSTRING_H_
Modified: trunk/sys/sys/blist.h
===================================================================
--- trunk/sys/sys/blist.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/blist.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1998 Matthew Dillon. All Rights Reserved.
* Redistribution and use in source and binary forms, with or without
@@ -44,12 +45,12 @@
* ops.
*
* SWAPBLK_NONE is returned on failure. This module is typically
- * capable of managing up to (2^31) blocks per blist, though
+ * capable of managing up to (2^63) blocks per blist, though
* the memory utilization would be insane if you actually did
* that. Managing something like 512MB worth of 4K blocks
* eats around 32 KBytes of memory.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/blist.h 321459 2017-07-25 04:13:43Z alc $
*/
@@ -56,7 +57,7 @@
#ifndef _SYS_BLIST_H_
#define _SYS_BLIST_H_
-typedef u_int32_t u_daddr_t; /* unsigned disk address */
+typedef uint64_t u_daddr_t; /* unsigned disk address */
/*
* note: currently use SWAPBLK_NONE as an absolute value rather then
@@ -67,7 +68,7 @@
#define SWAPBLK_NONE ((daddr_t)((u_daddr_t)SWAPBLK_MASK + 1))/* flag */
/*
- * blmeta and bl_bitmap_t MUST be a power of 2 in size.
+ * Both blmeta and bmu_bitmap MUST be a power of 2 in size.
*/
typedef struct blmeta {
@@ -82,9 +83,8 @@
daddr_t bl_blocks; /* area of coverage */
daddr_t bl_radix; /* coverage radix */
daddr_t bl_skip; /* starting skip */
- daddr_t bl_free; /* number of free blocks */
+ daddr_t bl_cursor; /* next-fit search starts at */
blmeta_t *bl_root; /* root of radix tree */
- daddr_t bl_rootblks; /* daddr_t blks allocated for tree */
} *blist_t;
#define BLIST_META_RADIX 16
@@ -92,13 +92,14 @@
#define BLIST_MAX_ALLOC BLIST_BMAP_RADIX
-extern blist_t blist_create(daddr_t blocks, int flags);
-extern void blist_destroy(blist_t blist);
-extern daddr_t blist_alloc(blist_t blist, daddr_t count);
-extern void blist_free(blist_t blist, daddr_t blkno, daddr_t count);
-extern int blist_fill(blist_t bl, daddr_t blkno, daddr_t count);
-extern void blist_print(blist_t blist);
-extern void blist_resize(blist_t *pblist, daddr_t count, int freenew, int flags);
+daddr_t blist_alloc(blist_t blist, daddr_t count);
+daddr_t blist_avail(blist_t blist);
+blist_t blist_create(daddr_t blocks, int flags);
+void blist_destroy(blist_t blist);
+daddr_t blist_fill(blist_t bl, daddr_t blkno, daddr_t count);
+void blist_free(blist_t blist, daddr_t blkno, daddr_t count);
+void blist_print(blist_t blist);
+void blist_resize(blist_t *pblist, daddr_t count, int freenew, int flags);
#endif /* _SYS_BLIST_H_ */
Added: trunk/sys/sys/boot.h
===================================================================
--- trunk/sys/sys/boot.h (rev 0)
+++ trunk/sys/sys/boot.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -0,0 +1,56 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2014 Roger Pau Monné <roger.pau at citrix.com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: stable/10/sys/sys/boot.h 271132 2014-09-04 20:47:14Z emaste $
+ */
+
+#ifndef _SYS_BOOT_H_
+#define _SYS_BOOT_H_
+
+/*
+ * Return a 'boothowto' value corresponding to the kernel arguments in
+ * (kargs) and any relevant environment variables.
+ */
+static struct
+{
+ const char *ev;
+ int mask;
+} howto_names[] = {
+ { "boot_askname", RB_ASKNAME},
+ { "boot_cdrom", RB_CDROM},
+ { "boot_ddb", RB_KDB},
+ { "boot_dfltroot", RB_DFLTROOT},
+ { "boot_gdb", RB_GDB},
+ { "boot_multicons", RB_MULTIPLE},
+ { "boot_mute", RB_MUTE},
+ { "boot_pause", RB_PAUSE},
+ { "boot_serial", RB_SERIAL},
+ { "boot_single", RB_SINGLE},
+ { "boot_verbose", RB_VERBOSE},
+ { NULL, 0}
+};
+
+#endif /* !_SYS_BOOT_H_ */
Property changes on: trunk/sys/sys/boot.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/sys/sys/buf.h
===================================================================
--- trunk/sys/sys/buf.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/buf.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1982, 1986, 1989, 1993
* The Regents of the University of California. All rights reserved.
@@ -32,7 +33,7 @@
* SUCH DAMAGE.
*
* @(#)buf.h 8.9 (Berkeley) 3/30/95
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/buf.h 300060 2016-05-17 15:18:01Z pfg $
*/
#ifndef _SYS_BUF_H_
@@ -106,8 +107,6 @@
daddr_t b_blkno; /* Underlying physical block number. */
off_t b_offset; /* Offset into file. */
TAILQ_ENTRY(buf) b_bobufs; /* (V) Buffer's associated vnode. */
- struct buf *b_left; /* (V) splay tree link */
- struct buf *b_right; /* (V) splay tree link */
uint32_t b_vflags; /* (V) BV_* flags */
TAILQ_ENTRY(buf) b_freelist; /* (Q) Free list position inactive. */
unsigned short b_qindex; /* (Q) buffer queue index */
@@ -117,6 +116,7 @@
long b_bufsize; /* Allocated buffer size. */
long b_runningbufspace; /* when I/O is running, pipelining */
caddr_t b_kvabase; /* base kva for buffer */
+ caddr_t b_kvaalloc; /* allocated kva for B_KVAALLOC */
int b_kvasize; /* size of kva for buffer */
daddr_t b_lblkno; /* Logical block number. */
struct vnode *b_vp; /* Device vnode. */
@@ -202,10 +202,10 @@
#define B_PERSISTENT 0x00000100 /* Perm. ref'ed while EXT2FS mounted. */
#define B_DONE 0x00000200 /* I/O completed. */
#define B_EINTR 0x00000400 /* I/O was interrupted */
-#define B_00000800 0x00000800 /* Available flag. */
-#define B_00001000 0x00001000 /* Available flag. */
+#define B_UNMAPPED 0x00000800 /* KVA is not mapped. */
+#define B_KVAALLOC 0x00001000 /* But allocated. */
#define B_INVAL 0x00002000 /* Does not contain valid info. */
-#define B_BARRIER 0x00004000 /* Write this and all preceeding first. */
+#define B_BARRIER 0x00004000 /* Write this and all preceding first. */
#define B_NOCACHE 0x00008000 /* Do not cache block after use. */
#define B_MALLOC 0x00010000 /* malloced b_data */
#define B_CLUSTEROK 0x00020000 /* Pagein op, so swap() can count it. */
@@ -216,7 +216,7 @@
#define B_RELBUF 0x00400000 /* Release VMIO buffer. */
#define B_00800000 0x00800000 /* Available flag. */
#define B_NOCOPY 0x01000000 /* Don't copy-on-write this buf. */
-#define B_NEEDSGIANT 0x02000000 /* Buffer's vnode needs giant. */
+#define B_INFREECNT 0x02000000 /* buf is counted in numfreebufs */
#define B_PAGING 0x04000000 /* volatile paging I/O -- bypass VMIO */
#define B_MANAGED 0x08000000 /* Managed by FS. */
#define B_RAM 0x10000000 /* Read ahead mark (flag) */
@@ -225,10 +225,10 @@
#define B_REMFREE 0x80000000 /* Delayed bremfree */
#define PRINT_BUF_FLAGS "\20\40remfree\37cluster\36vmio\35ram\34managed" \
- "\33paging\32needsgiant\31nocopy\30b23\27relbuf\26dirty\25b20" \
+ "\33paging\32infreecnt\31nocopy\30b23\27relbuf\26dirty\25b20" \
"\24b19\23b18\22clusterok\21malloc\20nocache\17b14\16inval" \
- "\15b12\14b11\13eintr\12done\11persist\10delwri\7validsuspwrt" \
- "\6cache\5deferred\4direct\3async\2needcommit\1age"
+ "\15kvaalloc\14unmapped\13eintr\12done\11persist\10delwri" \
+ "\7validsuspwrt\6cache\5deferred\4direct\3async\2needcommit\1age"
/*
* These flags are kept in b_xflags.
@@ -249,9 +249,9 @@
#define BV_SCANNED 0x00000001 /* VOP_FSYNC funcs mark written bufs */
#define BV_BKGRDINPROG 0x00000002 /* Background write in progress */
#define BV_BKGRDWAIT 0x00000004 /* Background write waiting */
-#define BV_INFREECNT 0x80000000 /* buf is counted in numfreebufs */
+#define BV_BKGRDERR 0x00000008 /* Error from background write */
-#define PRINT_BUF_VFLAGS "\20\40infreecnt\3bkgrdwait\2bkgrdinprog\1scanned"
+#define PRINT_BUF_VFLAGS "\20\4bkgrderr\3bkgrdwait\2bkgrdinprog\1scanned"
#ifdef _KERNEL
/*
@@ -272,7 +272,7 @@
* Get a lock sleeping non-interruptably until it becomes available.
*/
#define BUF_LOCK(bp, locktype, interlock) \
- _lockmgr_args(&(bp)->b_lock, (locktype), (interlock), \
+ _lockmgr_args_rw(&(bp)->b_lock, (locktype), (interlock), \
LK_WMESG_DEFAULT, LK_PRIO_DEFAULT, LK_TIMO_DEFAULT, \
LOCK_FILE, LOCK_LINE)
@@ -280,7 +280,7 @@
* Get a lock sleeping with specified interruptably and timeout.
*/
#define BUF_TIMELOCK(bp, locktype, interlock, wmesg, catch, timo) \
- _lockmgr_args(&(bp)->b_lock, (locktype) | LK_TIMELOCK, \
+ _lockmgr_args_rw(&(bp)->b_lock, (locktype) | LK_TIMELOCK, \
(interlock), (wmesg), (PRIBIO + 4) | (catch), (timo), \
LOCK_FILE, LOCK_LINE)
@@ -427,7 +427,6 @@
{
if (bioops.io_deallocate)
(*bioops.io_deallocate)(bp);
- BUF_LOCKFREE(bp);
}
static __inline int
@@ -454,7 +453,9 @@
*/
#define GB_LOCK_NOWAIT 0x0001 /* Fail if we block on a buf lock. */
#define GB_NOCREAT 0x0002 /* Don't create a buf if not found. */
-#define GB_NOWAIT_BD 0x0004 /* Do not wait for bufdaemon */
+#define GB_NOWAIT_BD 0x0004 /* Do not wait for bufdaemon. */
+#define GB_UNMAPPED 0x0008 /* Do not mmap buffer pages. */
+#define GB_KVAALLOC 0x0010 /* But allocate KVA. */
#ifdef _KERNEL
extern int nbuf; /* The number of buffer headers */
@@ -466,31 +467,32 @@
extern int bdwriteskip;
extern int dirtybufferflushes;
extern int altbufferflushes;
-extern int buf_maxio; /* nominal maximum I/O for buffer */
extern struct buf *buf; /* The buffer headers. */
-extern char *buffers; /* The buffer contents. */
-extern int bufpages; /* Number of memory pages in the buffer pool. */
extern struct buf *swbuf; /* Swap I/O buffer headers. */
extern int nswbuf; /* Number of swap I/O buffer headers. */
extern int cluster_pbuf_freecnt; /* Number of pbufs for clusters */
extern int vnode_pbuf_freecnt; /* Number of pbufs for vnode pager */
+extern caddr_t unmapped_buf;
void runningbufwakeup(struct buf *);
void waitrunningbufspace(void);
caddr_t kern_vfs_bio_buffer_alloc(caddr_t v, long physmem_est);
void bufinit(void);
+void bdata2bio(struct buf *bp, struct bio *bip);
void bwillwrite(void);
int buf_dirty_count_severe(void);
void bremfree(struct buf *);
void bremfreef(struct buf *); /* XXX Force bremfree, only for nfs. */
-int bread(struct vnode *, daddr_t, int, struct ucred *, struct buf **);
-int bread_gb(struct vnode *, daddr_t, int, struct ucred *,
- int gbflags, struct buf **);
-void breada(struct vnode *, daddr_t *, int *, int, struct ucred *);
-int breadn(struct vnode *, daddr_t, int, daddr_t *, int *, int,
- struct ucred *, struct buf **);
+#define bread(vp, blkno, size, cred, bpp) \
+ breadn_flags(vp, blkno, size, NULL, NULL, 0, cred, 0, bpp)
+#define bread_gb(vp, blkno, size, cred, gbflags, bpp) \
+ breadn_flags(vp, blkno, size, NULL, NULL, 0, cred, \
+ gbflags, bpp)
+#define breadn(vp, blkno, size, rablkno, rabsize, cnt, cred, bpp) \
+ breadn_flags(vp, blkno, size, rablkno, rabsize, cnt, cred, 0, bpp)
int breadn_flags(struct vnode *, daddr_t, int, daddr_t *, int *, int,
struct ucred *, int, struct buf **);
+void breada(struct vnode *, daddr_t *, int *, int, struct ucred *);
void bdwrite(struct buf *);
void bawrite(struct buf *);
void babarrierwrite(struct buf *);
@@ -501,6 +503,7 @@
void brelse(struct buf *);
void bqrelse(struct buf *);
int vfs_bio_awrite(struct buf *);
+void vfs_drain_busy_pages(struct buf *bp);
struct buf * getpbuf(int *);
struct buf *incore(struct bufobj *, daddr_t);
struct buf *gbincore(struct bufobj *, daddr_t);
@@ -513,18 +516,15 @@
void bd_speedup(void);
int cluster_read(struct vnode *, u_quad_t, daddr_t, long,
- struct ucred *, long, int, struct buf **);
-int cluster_wbuild(struct vnode *, long, daddr_t, int);
-void cluster_write(struct vnode *, struct buf *, u_quad_t, int);
-int cluster_read_gb(struct vnode *, u_quad_t, daddr_t, long,
struct ucred *, long, int, int, struct buf **);
-int cluster_wbuild_gb(struct vnode *, long, daddr_t, int, int);
-void cluster_write_gb(struct vnode *, struct buf *, u_quad_t, int, int);
+int cluster_wbuild(struct vnode *, long, daddr_t, int, int);
+void cluster_write(struct vnode *, struct buf *, u_quad_t, int, int);
+void vfs_bio_bzero_buf(struct buf *bp, int base, int size);
void vfs_bio_set_valid(struct buf *, int base, int size);
void vfs_bio_clrbuf(struct buf *);
void vfs_busy_pages(struct buf *, int clear_modify);
void vfs_unbusy_pages(struct buf *);
-int vmapbuf(struct buf *);
+int vmapbuf(struct buf *, int);
void vunmapbuf(struct buf *);
void relpbuf(struct buf *, int *);
void brelvp(struct buf *);
Modified: trunk/sys/sys/buf_ring.h
===================================================================
--- trunk/sys/sys/buf_ring.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/buf_ring.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2007-2009 Kip Macy <kmacy at freebsd.org>
* All rights reserved.
@@ -23,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/buf_ring.h 301913 2016-06-15 05:16:37Z sephe $
*
*/
@@ -47,25 +48,14 @@
int br_prod_size;
int br_prod_mask;
uint64_t br_drops;
- uint64_t br_prod_bufs;
- /*
- * Pad out to next L2 cache line
- */
- uint64_t _pad0[11];
-
- volatile uint32_t br_cons_head;
+ volatile uint32_t br_cons_head __aligned(CACHE_LINE_SIZE);
volatile uint32_t br_cons_tail;
int br_cons_size;
int br_cons_mask;
-
- /*
- * Pad out to next L2 cache line
- */
- uint64_t _pad1[14];
#ifdef DEBUG_BUFRING
struct mtx *br_lock;
#endif
- void *br_ring[0];
+ void *br_ring[0] __aligned(CACHE_LINE_SIZE);
};
/*
@@ -75,9 +65,7 @@
static __inline int
buf_ring_enqueue(struct buf_ring *br, void *buf)
{
- uint32_t prod_head, prod_next;
- uint32_t cons_tail;
- int success;
+ uint32_t prod_head, prod_next, cons_tail;
#ifdef DEBUG_BUFRING
int i;
for (i = br->br_cons_head; i != br->br_prod_head;
@@ -89,35 +77,34 @@
critical_enter();
do {
prod_head = br->br_prod_head;
+ prod_next = (prod_head + 1) & br->br_prod_mask;
cons_tail = br->br_cons_tail;
- prod_next = (prod_head + 1) & br->br_prod_mask;
-
if (prod_next == cons_tail) {
- br->br_drops++;
- critical_exit();
- return (ENOBUFS);
+ rmb();
+ if (prod_head == br->br_prod_head &&
+ cons_tail == br->br_cons_tail) {
+ br->br_drops++;
+ critical_exit();
+ return (ENOBUFS);
+ }
+ continue;
}
-
- success = atomic_cmpset_int(&br->br_prod_head, prod_head,
- prod_next);
- } while (success == 0);
+ } while (!atomic_cmpset_acq_int(&br->br_prod_head, prod_head, prod_next));
#ifdef DEBUG_BUFRING
if (br->br_ring[prod_head] != NULL)
panic("dangling value in enqueue");
#endif
br->br_ring[prod_head] = buf;
- wmb();
/*
* If there are other enqueues in progress
- * that preceeded us, we need to wait for them
+ * that preceded us, we need to wait for them
* to complete
*/
while (br->br_prod_tail != prod_head)
cpu_spinwait();
- br->br_prod_bufs++;
- br->br_prod_tail = prod_next;
+ atomic_store_rel_int(&br->br_prod_tail, prod_next);
critical_exit();
return (0);
}
@@ -130,41 +117,32 @@
buf_ring_dequeue_mc(struct buf_ring *br)
{
uint32_t cons_head, cons_next;
- uint32_t prod_tail;
void *buf;
- int success;
critical_enter();
do {
cons_head = br->br_cons_head;
- prod_tail = br->br_prod_tail;
+ cons_next = (cons_head + 1) & br->br_cons_mask;
- cons_next = (cons_head + 1) & br->br_cons_mask;
-
- if (cons_head == prod_tail) {
+ if (cons_head == br->br_prod_tail) {
critical_exit();
return (NULL);
}
-
- success = atomic_cmpset_int(&br->br_cons_head, cons_head,
- cons_next);
- } while (success == 0);
+ } while (!atomic_cmpset_acq_int(&br->br_cons_head, cons_head, cons_next));
buf = br->br_ring[cons_head];
#ifdef DEBUG_BUFRING
br->br_ring[cons_head] = NULL;
#endif
- rmb();
-
/*
* If there are other dequeues in progress
- * that preceeded us, we need to wait for them
+ * that preceded us, we need to wait for them
* to complete
*/
while (br->br_cons_tail != cons_head)
cpu_spinwait();
- br->br_cons_tail = cons_next;
+ atomic_store_rel_int(&br->br_cons_tail, cons_next);
critical_exit();
return (buf);
@@ -286,6 +264,37 @@
return (br->br_ring[br->br_cons_head]);
}
+static __inline void *
+buf_ring_peek_clear_sc(struct buf_ring *br)
+{
+#ifdef DEBUG_BUFRING
+ void *ret;
+
+ if (!mtx_owned(br->br_lock))
+ panic("lock not held on single consumer dequeue");
+#endif
+ /*
+ * I believe it is safe to not have a memory barrier
+ * here because we control cons and tail is worst case
+ * a lagging indicator so we worst case we might
+ * return NULL immediately after a buffer has been enqueued
+ */
+ if (br->br_cons_head == br->br_prod_tail)
+ return (NULL);
+
+#ifdef DEBUG_BUFRING
+ /*
+ * Single consumer, i.e. cons_head will not move while we are
+ * running, so atomic_swap_ptr() is not necessary here.
+ */
+ ret = br->br_ring[br->br_cons_head];
+ br->br_ring[br->br_cons_head] = NULL;
+ return (ret);
+#else
+ return (br->br_ring[br->br_cons_head]);
+#endif
+}
+
static __inline int
buf_ring_full(struct buf_ring *br)
{
Modified: trunk/sys/sys/bufobj.h
===================================================================
--- trunk/sys/sys/bufobj.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/bufobj.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2004 Poul-Henning Kamp
* All rights reserved.
@@ -23,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/bufobj.h 275956 2014-12-20 15:46:15Z kib $
*/
/*
@@ -53,7 +54,8 @@
#include <sys/queue.h>
#include <sys/_lock.h>
-#include <sys/_mutex.h>
+#include <sys/_rwlock.h>
+#include <sys/_pctrie.h>
struct bufobj;
struct buf_ops;
@@ -65,7 +67,7 @@
/* A Buffer splay list */
struct bufv {
struct buflists bv_hd; /* Sorted blocklist */
- struct buf *bv_root; /* Buf splay tree */
+ struct pctrie bv_root; /* Buf trie */
int bv_cnt; /* Number of buffers */
};
@@ -88,13 +90,8 @@
#define BO_BDFLUSH(bo, bp) ((bo)->bo_ops->bop_bdflush((bo), (bp)))
struct bufobj {
- struct mtx bo_mtx; /* Mutex which protects "i" things */
- struct bufv bo_clean; /* i Clean buffers */
- struct bufv bo_dirty; /* i Dirty buffers */
- long bo_numoutput; /* i Writes in progress */
- u_int bo_flag; /* i Flags */
+ struct rwlock bo_lock; /* Lock which protects "i" things */
struct buf_ops *bo_ops; /* - Buffer operations */
- int bo_bsize; /* - Block size for i/o */
struct vm_object *bo_object; /* v Place to store VM object */
LIST_ENTRY(bufobj) bo_synclist; /* S dirty vnode list */
void *bo_private; /* private pointer */
@@ -103,6 +100,11 @@
* XXX: only to keep the syncer working
* XXX: for now.
*/
+ struct bufv bo_clean; /* i Clean buffers */
+ struct bufv bo_dirty; /* i Dirty buffers */
+ long bo_numoutput; /* i Writes in progress */
+ u_int bo_flag; /* i Flags */
+ int bo_bsize; /* - Block size for i/o */
};
/*
@@ -111,13 +113,16 @@
*/
#define BO_ONWORKLST (1 << 0) /* On syncer work-list */
#define BO_WWAIT (1 << 1) /* Wait for output to complete */
-#define BO_NEEDSGIANT (1 << 2) /* Require giant for child buffers. */
+#define BO_DEAD (1 << 2) /* Dead; only with INVARIANTS */
-#define BO_MTX(bo) (&(bo)->bo_mtx)
-#define BO_LOCK(bo) mtx_lock(BO_MTX((bo)))
-#define BO_UNLOCK(bo) mtx_unlock(BO_MTX((bo)))
-#define ASSERT_BO_LOCKED(bo) mtx_assert(BO_MTX((bo)), MA_OWNED)
-#define ASSERT_BO_UNLOCKED(bo) mtx_assert(BO_MTX((bo)), MA_NOTOWNED)
+#define BO_LOCKPTR(bo) (&(bo)->bo_lock)
+#define BO_LOCK(bo) rw_wlock(BO_LOCKPTR((bo)))
+#define BO_UNLOCK(bo) rw_wunlock(BO_LOCKPTR((bo)))
+#define BO_RLOCK(bo) rw_rlock(BO_LOCKPTR((bo)))
+#define BO_RUNLOCK(bo) rw_runlock(BO_LOCKPTR((bo)))
+#define ASSERT_BO_WLOCKED(bo) rw_assert(BO_LOCKPTR((bo)), RA_WLOCKED)
+#define ASSERT_BO_LOCKED(bo) rw_assert(BO_LOCKPTR((bo)), RA_LOCKED)
+#define ASSERT_BO_UNLOCKED(bo) rw_assert(BO_LOCKPTR((bo)), RA_UNLOCKED)
void bufobj_wdrop(struct bufobj *bo);
void bufobj_wref(struct bufobj *bo);
Modified: trunk/sys/sys/bus.h
===================================================================
--- trunk/sys/sys/bus.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/bus.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1997,1998,2003 Doug Rabson
* All rights reserved.
@@ -23,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/bus.h 308318 2016-11-04 21:43:10Z jhb $
*/
#ifndef _SYS_BUS_H_
@@ -31,6 +32,7 @@
#include <machine/_limits.h>
#include <sys/_bus_dma.h>
+#include <sys/ioccom.h>
/**
* @defgroup NEWBUS newbus - a generic framework for managing devices
@@ -75,9 +77,47 @@
/* XXX more driver info? */
};
+/**
+ * @brief Device request structure used for ioctl's.
+ *
+ * Used for ioctl's on /dev/devctl2. All device ioctl's
+ * must have parameter definitions which begin with dr_name.
+ */
+struct devreq_buffer {
+ void *buffer;
+ size_t length;
+};
+
+struct devreq {
+ char dr_name[128];
+ int dr_flags; /* request-specific flags */
+ union {
+ struct devreq_buffer dru_buffer;
+ void *dru_data;
+ } dr_dru;
+#define dr_buffer dr_dru.dru_buffer /* variable-sized buffer */
+#define dr_data dr_dru.dru_data /* fixed-size buffer */
+};
+
+#define DEV_ATTACH _IOW('D', 1, struct devreq)
+#define DEV_DETACH _IOW('D', 2, struct devreq)
+#define DEV_ENABLE _IOW('D', 3, struct devreq)
+#define DEV_DISABLE _IOW('D', 4, struct devreq)
+#define DEV_SET_DRIVER _IOW('D', 7, struct devreq)
+#define DEV_CLEAR_DRIVER _IOW('D', 8, struct devreq)
+
+/* Flags for DEV_DETACH and DEV_DISABLE. */
+#define DEVF_FORCE_DETACH 0x0000001
+
+/* Flags for DEV_SET_DRIVER. */
+#define DEVF_SET_DRIVER_DETACH 0x0000001 /* Detach existing driver. */
+
+/* Flags for DEV_CLEAR_DRIVER. */
+#define DEVF_CLEAR_DRIVER_DETACH 0x0000001 /* Detach existing driver. */
+
#ifdef _KERNEL
-#include <sys/queue.h>
+#include <sys/eventhandler.h>
#include <sys/kobj.h>
/**
@@ -94,6 +134,14 @@
void devctl_queue_data(char *__data);
/**
+ * Device name parsers. Hook to allow device enumerators to map
+ * scheme-specific names to a device.
+ */
+typedef void (*dev_lookup_fn)(void *arg, const char *name,
+ device_t *result);
+EVENTHANDLER_DECLARE(dev_lookup, dev_lookup_fn);
+
+/**
* @brief A device driver (included mainly for compatibility with
* FreeBSD 4.x).
*/
@@ -178,11 +226,8 @@
* spls implicit in names like INTR_TYPE_TTY. In the meantime, don't
* confuse things by renaming them (Grog, 18 July 2000).
*
- * We define this in terms of bits because some devices may belong
- * to multiple classes (and therefore need to be included in
- * multiple interrupt masks, which is what this really serves to
- * indicate. Buses which do interrupt remapping will want to
- * change their type to reflect what sort of devices are underneath.
+ * Buses which do interrupt remapping will want to change their type
+ * to reflect what sort of devices are underneath.
*/
enum intr_type {
INTR_TYPE_TTY = 1,
@@ -276,6 +321,9 @@
int resource_list_release(struct resource_list *rl,
device_t bus, device_t child,
int type, int rid, struct resource *res);
+int resource_list_release_active(struct resource_list *rl,
+ device_t bus, device_t child,
+ int type);
struct resource *
resource_list_reserve(struct resource_list *rl,
device_t bus, device_t child,
@@ -332,6 +380,7 @@
bus_generic_get_resource_list (device_t, device_t);
void bus_generic_new_pass(device_t dev);
int bus_print_child_header(device_t dev, device_t child);
+int bus_print_child_domain(device_t dev, device_t child);
int bus_print_child_footer(device_t dev, device_t child);
int bus_generic_print_child(device_t dev, device_t child);
int bus_generic_probe(device_t dev);
@@ -363,6 +412,8 @@
int bus_generic_write_ivar(device_t dev, device_t child, int which,
uintptr_t value);
+int bus_generic_get_domain(device_t dev, device_t child, int *domain);
+
/*
* Wrapper functions for the BUS_*_RESOURCE methods to make client code
* a little simpler.
@@ -389,6 +440,7 @@
int bus_deactivate_resource(device_t dev, int type, int rid,
struct resource *r);
bus_dma_tag_t bus_get_dma_tag(device_t dev);
+int bus_get_domain(device_t dev, int *domain);
int bus_release_resource(device_t dev, int type, int rid,
struct resource *r);
int bus_free_resource(device_t dev, int type, struct resource *r);
@@ -450,7 +502,9 @@
int device_is_alive(device_t dev); /* did probe succeed? */
int device_is_attached(device_t dev); /* did attach succeed? */
int device_is_enabled(device_t dev);
+int device_is_suspended(device_t dev);
int device_is_quiet(device_t dev);
+device_t device_lookup_by_name(const char *name);
int device_print_prettyname(device_t dev);
int device_printf(device_t dev, const char *, ...) __printflike(2, 3);
int device_probe(device_t dev);
@@ -513,6 +567,8 @@
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);
+
/*
* Functions for maintaining and checking consistency of
* bus information exported to userspace.
@@ -569,6 +625,12 @@
#define BUS_PASS_SCHEDULER 60 /* Start scheduler. */
#define BUS_PASS_DEFAULT __INT_MAX /* Everything else. */
+#define BUS_PASS_ORDER_FIRST 0
+#define BUS_PASS_ORDER_EARLY 2
+#define BUS_PASS_ORDER_MIDDLE 5
+#define BUS_PASS_ORDER_LATE 7
+#define BUS_PASS_ORDER_LAST 9
+
extern int bus_current_pass;
void bus_set_pass(int pass);
Modified: trunk/sys/sys/bus_dma.h
===================================================================
--- trunk/sys/sys/bus_dma.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/bus_dma.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/* $NetBSD: bus.h,v 1.12 1997/10/01 08:25:15 fvdl Exp $ */
/*-
@@ -16,13 +17,6 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
@@ -67,7 +61,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-/* $MidnightBSD$ */
+/* $FreeBSD: stable/10/sys/sys/bus_dma.h 263687 2014-03-24 13:48:04Z emaste $ */
#ifndef _BUS_DMA_H_
#define _BUS_DMA_H_
@@ -109,8 +103,14 @@
*/
#define BUS_DMA_KEEP_PG_OFFSET 0x400
+#define BUS_DMA_LOAD_MBUF 0x800
+
/* Forwards needed by prototypes below. */
+union ccb;
+struct bio;
struct mbuf;
+struct memdesc;
+struct pmap;
struct uio;
/*
@@ -169,7 +169,7 @@
*/
/* XXX Should probably allow specification of alignment */
int bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment,
- bus_size_t boundary, bus_addr_t lowaddr,
+ bus_addr_t boundary, bus_addr_t lowaddr,
bus_addr_t highaddr, bus_dma_filter_t *filtfunc,
void *filtfuncarg, bus_size_t maxsize, int nsegments,
bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc,
@@ -191,6 +191,65 @@
typedef void bus_dmamap_callback2_t(void *, bus_dma_segment_t *, int, bus_size_t, int);
/*
+ * Map the buffer buf into bus space using the dmamap map.
+ */
+int bus_dmamap_load(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf,
+ bus_size_t buflen, bus_dmamap_callback_t *callback,
+ void *callback_arg, int flags);
+
+/*
+ * Like bus_dmamap_load but for mbufs. Note the use of the
+ * bus_dmamap_callback2_t interface.
+ */
+int bus_dmamap_load_mbuf(bus_dma_tag_t dmat, bus_dmamap_t map,
+ struct mbuf *mbuf,
+ bus_dmamap_callback2_t *callback, void *callback_arg,
+ int flags);
+
+int bus_dmamap_load_mbuf_sg(bus_dma_tag_t dmat, bus_dmamap_t map,
+ struct mbuf *mbuf, bus_dma_segment_t *segs,
+ int *nsegs, int flags);
+
+/*
+ * Like bus_dmamap_load but for uios. Note the use of the
+ * bus_dmamap_callback2_t interface.
+ */
+int bus_dmamap_load_uio(bus_dma_tag_t dmat, bus_dmamap_t map,
+ struct uio *ui,
+ bus_dmamap_callback2_t *callback, void *callback_arg,
+ int flags);
+
+/*
+ * Like bus_dmamap_load but for cam control blocks.
+ */
+int bus_dmamap_load_ccb(bus_dma_tag_t dmat, bus_dmamap_t map, union ccb *ccb,
+ bus_dmamap_callback_t *callback, void *callback_arg,
+ int flags);
+
+/*
+ * Like bus_dmamap_load but for bios.
+ */
+int bus_dmamap_load_bio(bus_dma_tag_t dmat, bus_dmamap_t map, struct bio *bio,
+ bus_dmamap_callback_t *callback, void *callback_arg,
+ int flags);
+
+/*
+ * Loads any memory descriptor.
+ */
+int bus_dmamap_load_mem(bus_dma_tag_t dmat, bus_dmamap_t map,
+ struct memdesc *mem, bus_dmamap_callback_t *callback,
+ void *callback_arg, int flags);
+
+/*
+ * Placeholder for use by busdma implementations which do not benefit
+ * from optimized procedure to load an array of vm_page_t. Falls back
+ * to do _bus_dmamap_load_phys() in loop.
+ */
+int bus_dmamap_load_ma_triv(bus_dma_tag_t dmat, bus_dmamap_t map,
+ struct vm_page **ma, bus_size_t tlen, int ma_offs, int flags,
+ bus_dma_segment_t *segs, int *segp);
+
+/*
* XXX sparc64 uses the same interface, but a much different implementation.
* <machine/bus_dma.h> for the sparc64 arch contains the equivalent
* declarations.
@@ -224,35 +283,6 @@
void bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map);
/*
- * Map the buffer buf into bus space using the dmamap map.
- */
-int bus_dmamap_load(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf,
- bus_size_t buflen, bus_dmamap_callback_t *callback,
- void *callback_arg, int flags);
-
-/*
- * Like bus_dmamap_load but for mbufs. Note the use of the
- * bus_dmamap_callback2_t interface.
- */
-int bus_dmamap_load_mbuf(bus_dma_tag_t dmat, bus_dmamap_t map,
- struct mbuf *mbuf,
- bus_dmamap_callback2_t *callback, void *callback_arg,
- int flags);
-
-int bus_dmamap_load_mbuf_sg(bus_dma_tag_t dmat, bus_dmamap_t map,
- struct mbuf *mbuf, bus_dma_segment_t *segs,
- int *nsegs, int flags);
-
-/*
- * Like bus_dmamap_load but for uios. Note the use of the
- * bus_dmamap_callback2_t interface.
- */
-int bus_dmamap_load_uio(bus_dma_tag_t dmat, bus_dmamap_t map,
- struct uio *ui,
- bus_dmamap_callback2_t *callback, void *callback_arg,
- int flags);
-
-/*
* Perform a synchronization operation on the given map.
*/
void _bus_dmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_dmasync_op_t);
@@ -272,6 +302,40 @@
_bus_dmamap_unload(dmat, dmamap); \
} while (0)
+/*
+ * The following functions define the interface between the MD and MI
+ * busdma layers. These are not intended for consumption by driver
+ * software.
+ */
+void __bus_dmamap_waitok(bus_dma_tag_t dmat, bus_dmamap_t map,
+ struct memdesc *mem,
+ bus_dmamap_callback_t *callback,
+ void *callback_arg);
+
+#define _bus_dmamap_waitok(dmat, map, mem, callback, callback_arg) \
+ do { \
+ if ((map) != NULL) \
+ __bus_dmamap_waitok(dmat, map, mem, callback, \
+ callback_arg); \
+ } while (0);
+
+int _bus_dmamap_load_buffer(bus_dma_tag_t dmat, bus_dmamap_t map,
+ void *buf, bus_size_t buflen, struct pmap *pmap,
+ int flags, bus_dma_segment_t *segs, int *segp);
+
+int _bus_dmamap_load_phys(bus_dma_tag_t dmat, bus_dmamap_t map,
+ vm_paddr_t paddr, bus_size_t buflen,
+ int flags, bus_dma_segment_t *segs, int *segp);
+
+int _bus_dmamap_load_ma(bus_dma_tag_t dmat, bus_dmamap_t map,
+ struct vm_page **ma, bus_size_t tlen, int ma_offs, int flags,
+ bus_dma_segment_t *segs, int *segp);
+
+bus_dma_segment_t *_bus_dmamap_complete(bus_dma_tag_t dmat,
+ bus_dmamap_t map,
+ bus_dma_segment_t *segs,
+ int nsegs, int error);
+
#endif /* __sparc64__ */
#endif /* _BUS_DMA_H_ */
Added: trunk/sys/sys/busdma_bufalloc.h
===================================================================
--- trunk/sys/sys/busdma_bufalloc.h (rev 0)
+++ trunk/sys/sys/busdma_bufalloc.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -0,0 +1,120 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2012 Ian Lepore
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $FreeBSD: stable/10/sys/sys/busdma_bufalloc.h 287945 2015-09-17 23:31:44Z rstone $
+ */
+
+/*
+ * A buffer pool manager, for use by a platform's busdma implementation.
+ */
+
+#ifndef _MACHINE_BUSDMA_BUFALLOC_H_
+#define _MACHINE_BUSDMA_BUFALLOC_H_
+
+#include <machine/bus.h>
+#include <vm/uma.h>
+
+/*
+ * Information about a buffer zone, returned by busdma_bufalloc_findzone().
+ */
+struct busdma_bufzone {
+ bus_size_t size;
+ uma_zone_t umazone;
+ char name[24];
+};
+
+/*
+ * Opaque handle type returned by busdma_bufalloc_create().
+ */
+struct busdma_bufalloc;
+typedef struct busdma_bufalloc *busdma_bufalloc_t;
+
+/*
+ * Create an allocator that manages a pool of DMA buffers.
+ *
+ * The allocator manages a collection of uma(9) zones of buffers in power-of-two
+ * sized increments ranging from minimum_alignment to the platform's PAGE_SIZE.
+ * The buffers within each zone are aligned on boundaries corresponding to the
+ * buffer size, and thus by implication each buffer is contiguous within a page
+ * and does not cross a power of two boundary larger than the buffer size.
+ * These rules are intended to make it easy for a busdma implementation to
+ * check whether a tag's constraints allow use of a buffer from the allocator.
+ *
+ * minimum_alignment is also the minimum buffer allocation size. For platforms
+ * with software-assisted cache coherency, this is typically the data cache line
+ * size (and MUST not be smaller than the cache line size).
+ *
+ * name appears in zone stats as 'dma name nnnnn' where 'dma' is fixed and
+ * 'nnnnn' is the size of buffers in that zone.
+ *
+ * If if the alloc/free function pointers are NULL, the regular uma internal
+ * allocators are used (I.E., you get "plain old kernel memory"). On a platform
+ * with an exclusion zone that applies to all DMA operations, a custom allocator
+ * could be used to ensure no buffer memory is ever allocated from that zone,
+ * allowing the bus_dmamem_alloc() implementation to make the assumption that
+ * buffers provided by the allocation could never lead to the need for a bounce.
+ */
+busdma_bufalloc_t busdma_bufalloc_create(const char *name,
+ bus_size_t minimum_alignment,
+ uma_alloc uma_alloc_func, uma_free uma_free_func,
+ u_int32_t uma_zcreate_flags);
+
+/*
+ * Destroy an allocator created by busdma_bufalloc_create().
+ * Safe to call with a NULL pointer.
+ */
+void busdma_bufalloc_destroy(busdma_bufalloc_t ba);
+
+/*
+ * Return a pointer to the busdma_bufzone that should be used to allocate or
+ * free a buffer of the given size. Returns NULL if the size is larger than the
+ * largest zone handled by the allocator.
+ */
+struct busdma_bufzone * busdma_bufalloc_findzone(busdma_bufalloc_t ba,
+ bus_size_t size);
+
+/*
+ * These built-in allocation routines are available for managing a pools of
+ * uncacheable memory on platforms that support VM_MEMATTR_UNCACHEABLE.
+ *
+ * Allocation is done using kmem_alloc_attr() with these parameters:
+ * lowaddr = 0
+ * highaddr = BUS_SPACE_MAXADDR
+ * memattr = VM_MEMATTR_UNCACHEABLE.
+ *
+ * If your platform has no exclusion region (lowaddr/highaddr), and its pmap
+ * routines support pmap_page_set_memattr() and the VM_MEMATTR_UNCACHEABLE flag
+ * you can probably use these when you need uncacheable buffers.
+ */
+void * busdma_bufalloc_alloc_uncacheable(uma_zone_t zone, vm_size_t size,
+ uint8_t *pflag, int wait);
+void busdma_bufalloc_free_uncacheable(void *item, vm_size_t size,
+ uint8_t pflag);
+
+#endif /* _MACHINE_BUSDMA_BUFALLOC_H_ */
+
Property changes on: trunk/sys/sys/busdma_bufalloc.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/sys/sys/callout.h
===================================================================
--- trunk/sys/sys/callout.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/callout.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
@@ -32,7 +33,7 @@
* SUCH DAMAGE.
*
* @(#)callout.h 8.2 (Berkeley) 1/21/94
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/callout.h 314667 2017-03-04 13:03:31Z avg $
*/
#ifndef _SYS_CALLOUT_H_
@@ -43,35 +44,85 @@
#define CALLOUT_LOCAL_ALLOC 0x0001 /* was allocated from callfree */
#define CALLOUT_ACTIVE 0x0002 /* callout is currently active */
#define CALLOUT_PENDING 0x0004 /* callout is waiting for timeout */
-#define CALLOUT_MPSAFE 0x0008 /* callout handler is mp safe */
+#define CALLOUT_MPSAFE 0x0008 /* deprecated */
#define CALLOUT_RETURNUNLOCKED 0x0010 /* handler returns with mtx unlocked */
#define CALLOUT_SHAREDLOCK 0x0020 /* callout lock held in shared mode */
#define CALLOUT_DFRMIGRATION 0x0040 /* callout in deferred migration mode */
+#define CALLOUT_PROCESSED 0x0080 /* callout in wheel or processing list? */
+#define CALLOUT_DIRECT 0x0100 /* allow exec from hw int context */
+#define C_DIRECT_EXEC 0x0001 /* direct execution of callout */
+#define C_PRELBITS 7
+#define C_PRELRANGE ((1 << C_PRELBITS) - 1)
+#define C_PREL(x) (((x) + 1) << 1)
+#define C_PRELGET(x) (int)((((x) >> 1) & C_PRELRANGE) - 1)
+#define C_HARDCLOCK 0x0100 /* align to hardclock() calls */
+#define C_ABSOLUTE 0x0200 /* event time is absolute. */
+#define C_PRECALC 0x0400 /* event time is pre-calculated. */
+
struct callout_handle {
struct callout *callout;
};
+/* Flags for callout_stop_safe() */
+#define CS_DRAIN 0x0001 /* callout_drain(), wait allowed */
+#define CS_MIGRBLOCK 0x0002 /* Block migration, return value
+ indicates that the callout was
+ executing */
+
#ifdef _KERNEL
-extern int ncallout;
-
+/*
+ * Note the flags field is actually *two* fields. The c_flags
+ * field is the one that caller operations that may, or may not have
+ * a lock touches i.e. callout_deactivate(). The other, the c_iflags,
+ * is the internal flags that *must* be kept correct on which the
+ * callout system depend on e.g. callout_pending().
+ * The c_iflag is used internally by the callout system to determine which
+ * list the callout is on and track internal state. Callers *should not*
+ * use the c_flags field directly but should use the macros provided.
+ *
+ * The c_iflags field holds internal flags that are protected by internal
+ * locks of the callout subsystem. The c_flags field holds external flags.
+ * The caller must hold its own lock while manipulating or reading external
+ * flags via callout_active(), callout_deactivate(), callout_reset*(), or
+ * callout_stop() to avoid races.
+ */
#define callout_active(c) ((c)->c_flags & CALLOUT_ACTIVE)
#define callout_deactivate(c) ((c)->c_flags &= ~CALLOUT_ACTIVE)
-#define callout_drain(c) _callout_stop_safe(c, 1)
+#define callout_drain(c) _callout_stop_safe(c, CS_DRAIN)
void callout_init(struct callout *, int);
void _callout_init_lock(struct callout *, struct lock_object *, int);
#define callout_init_mtx(c, mtx, flags) \
_callout_init_lock((c), ((mtx) != NULL) ? &(mtx)->lock_object : \
NULL, (flags))
+#define callout_init_rm(c, rm, flags) \
+ _callout_init_lock((c), ((rm) != NULL) ? &(rm)->lock_object : \
+ NULL, (flags))
#define callout_init_rw(c, rw, flags) \
_callout_init_lock((c), ((rw) != NULL) ? &(rw)->lock_object : \
NULL, (flags))
-#define callout_pending(c) ((c)->c_flags & CALLOUT_PENDING)
-int callout_reset_on(struct callout *, int, void (*)(void *), void *, int);
+#define callout_pending(c) ((c)->c_iflags & CALLOUT_PENDING)
+int callout_reset_sbt_on(struct callout *, sbintime_t, sbintime_t,
+ void (*)(void *), void *, int, int);
+#define callout_reset_sbt(c, sbt, pr, fn, arg, flags) \
+ callout_reset_sbt_on((c), (sbt), (pr), (fn), (arg), -1, (flags))
+#define callout_reset_sbt_curcpu(c, sbt, pr, fn, arg, flags) \
+ callout_reset_sbt_on((c), (sbt), (pr), (fn), (arg), PCPU_GET(cpuid),\
+ (flags))
+#define callout_reset_on(c, to_ticks, fn, arg, cpu) \
+ callout_reset_sbt_on((c), tick_sbt * (to_ticks), 0, (fn), (arg), \
+ (cpu), C_HARDCLOCK)
#define callout_reset(c, on_tick, fn, arg) \
- callout_reset_on((c), (on_tick), (fn), (arg), (c)->c_cpu)
+ callout_reset_on((c), (on_tick), (fn), (arg), -1)
#define callout_reset_curcpu(c, on_tick, fn, arg) \
callout_reset_on((c), (on_tick), (fn), (arg), PCPU_GET(cpuid))
+#define callout_schedule_sbt_on(c, sbt, pr, cpu, flags) \
+ callout_reset_sbt_on((c), (sbt), (pr), (c)->c_func, (c)->c_arg, \
+ (cpu), (flags))
+#define callout_schedule_sbt(c, sbt, pr, flags) \
+ callout_schedule_sbt_on((c), (sbt), (pr), -1, (flags))
+#define callout_schedule_sbt_curcpu(c, sbt, pr, flags) \
+ callout_schedule_sbt_on((c), (sbt), (pr), PCPU_GET(cpuid), (flags))
int callout_schedule(struct callout *, int);
int callout_schedule_on(struct callout *, int, int);
#define callout_schedule_curcpu(c, on_tick) \
@@ -78,10 +129,10 @@
callout_schedule_on((c), (on_tick), PCPU_GET(cpuid))
#define callout_stop(c) _callout_stop_safe(c, 0)
int _callout_stop_safe(struct callout *, int);
-void callout_tick(void);
-int callout_tickstofirst(int limit);
-extern void (*callout_new_inserted)(int cpu, int ticks);
+void callout_process(sbintime_t now);
+void callout_when(sbintime_t sbt, sbintime_t precision, int flags,
+ sbintime_t *sbt_res, sbintime_t *prec_res);
#endif
#endif /* _SYS_CALLOUT_H_ */
Modified: trunk/sys/sys/capability.h
===================================================================
--- trunk/sys/sys/capability.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/capability.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,5 +1,6 @@
+/* $MidnightBSD$ */
/*-
- * Copyright (c) 2008-2010 Robert N. M. Watson
+ * Copyright (c) 2014 Robert N. M. Watson
* All rights reserved.
*
* This software was developed at the University of Cambridge Computer
@@ -26,184 +27,18 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/capability.h 280224 2015-03-18 15:20:08Z rwatson $
*/
/*
- * Definitions for FreeBSD capabilities facility.
+ * Historically, the key userspace and kernel Capsicum definitions were found
+ * in this file. However, it conflicted with POSIX.1e's capability.h, so has
+ * been renamed capsicum.h. The file remains for backwards compatibility
+ * reasons as a nested include.
*/
#ifndef _SYS_CAPABILITY_H_
#define _SYS_CAPABILITY_H_
-#include <sys/cdefs.h>
-#include <sys/types.h>
+#include <sys/capsicum.h>
-#include <sys/file.h>
-
-/*
- * Possible rights on capabilities.
- *
- * Notes:
- * Some system calls don't require a capability in order to perform an
- * operation on an fd. These include: close, dup, dup2.
- *
- * sendfile is authorized using CAP_READ on the file and CAP_WRITE on the
- * socket.
- *
- * mmap() and aio*() system calls will need special attention as they may
- * involve reads or writes depending a great deal on context.
- */
-
-/* General file I/O. */
-#define CAP_READ 0x0000000000000001ULL /* read/recv */
-#define CAP_WRITE 0x0000000000000002ULL /* write/send */
-#define CAP_MMAP 0x0000000000000004ULL /* mmap */
-#define CAP_MAPEXEC 0x0000000000000008ULL /* mmap(2) as exec */
-#define CAP_FEXECVE 0x0000000000000010ULL
-#define CAP_FSYNC 0x0000000000000020ULL
-#define CAP_FTRUNCATE 0x0000000000000040ULL
-#define CAP_SEEK 0x0000000000000080ULL
-
-/* VFS methods. */
-#define CAP_FCHFLAGS 0x0000000000000100ULL
-#define CAP_FCHDIR 0x0000000000000200ULL
-#define CAP_FCHMOD 0x0000000000000400ULL
-#define CAP_FCHOWN 0x0000000000000800ULL
-#define CAP_FCNTL 0x0000000000001000ULL
-#define CAP_FPATHCONF 0x0000000000002000ULL
-#define CAP_FLOCK 0x0000000000004000ULL
-#define CAP_FSCK 0x0000000000008000ULL
-#define CAP_FSTAT 0x0000000000010000ULL
-#define CAP_FSTATFS 0x0000000000020000ULL
-#define CAP_FUTIMES 0x0000000000040000ULL
-#define CAP_CREATE 0x0000000000080000ULL
-#define CAP_DELETE 0x0000000000100000ULL
-#define CAP_MKDIR 0x0000000000200000ULL
-#define CAP_RMDIR 0x0000000000400000ULL
-#define CAP_MKFIFO 0x0000000000800000ULL
-
-/* Lookups - used to constrain *at() calls. */
-#define CAP_LOOKUP 0x0000000001000000ULL
-
-/* Extended attributes. */
-#define CAP_EXTATTR_DELETE 0x0000000002000000ULL
-#define CAP_EXTATTR_GET 0x0000000004000000ULL
-#define CAP_EXTATTR_LIST 0x0000000008000000ULL
-#define CAP_EXTATTR_SET 0x0000000010000000ULL
-
-/* Access Control Lists. */
-#define CAP_ACL_CHECK 0x0000000020000000ULL
-#define CAP_ACL_DELETE 0x0000000040000000ULL
-#define CAP_ACL_GET 0x0000000080000000ULL
-#define CAP_ACL_SET 0x0000000100000000ULL
-
-/* Socket operations. */
-#define CAP_ACCEPT 0x0000000200000000ULL
-#define CAP_BIND 0x0000000400000000ULL
-#define CAP_CONNECT 0x0000000800000000ULL
-#define CAP_GETPEERNAME 0x0000001000000000ULL
-#define CAP_GETSOCKNAME 0x0000002000000000ULL
-#define CAP_GETSOCKOPT 0x0000004000000000ULL
-#define CAP_LISTEN 0x0000008000000000ULL
-#define CAP_PEELOFF 0x0000010000000000ULL
-#define CAP_SETSOCKOPT 0x0000020000000000ULL
-#define CAP_SHUTDOWN 0x0000040000000000ULL
-
-#define CAP_SOCK_ALL \
- (CAP_ACCEPT | CAP_BIND | CAP_CONNECT \
- | CAP_GETPEERNAME | CAP_GETSOCKNAME | CAP_GETSOCKOPT \
- | CAP_LISTEN | CAP_PEELOFF | CAP_SETSOCKOPT | CAP_SHUTDOWN)
-
-/* Mandatory Access Control. */
-#define CAP_MAC_GET 0x0000080000000000ULL
-#define CAP_MAC_SET 0x0000100000000000ULL
-
-/* Methods on semaphores. */
-#define CAP_SEM_GETVALUE 0x0000200000000000ULL
-#define CAP_SEM_POST 0x0000400000000000ULL
-#define CAP_SEM_WAIT 0x0000800000000000ULL
-
-/* kqueue events. */
-#define CAP_POLL_EVENT 0x0001000000000000ULL
-#define CAP_POST_EVENT 0x0002000000000000ULL
-
-/* Strange and powerful rights that should not be given lightly. */
-#define CAP_IOCTL 0x0004000000000000ULL
-#define CAP_TTYHOOK 0x0008000000000000ULL
-
-/* Process management via process descriptors. */
-#define CAP_PDGETPID 0x0010000000000000ULL
-#define CAP_PDWAIT 0x0020000000000000ULL
-#define CAP_PDKILL 0x0040000000000000ULL
-
-/* The mask of all valid method rights. */
-#define CAP_MASK_VALID 0x007fffffffffffffULL
-
-#ifdef _KERNEL
-
-#define IN_CAPABILITY_MODE(td) (td->td_ucred->cr_flags & CRED_FLAG_CAPMODE)
-
-/*
- * Create a capability to wrap a file object.
- */
-int kern_capwrap(struct thread *td, struct file *fp, cap_rights_t rights,
- int *capfd);
-
-/*
- * Unwrap a capability if its rights mask is a superset of 'rights'.
- *
- * Unwrapping a non-capability is effectively a no-op; the value of fp_cap
- * is simply copied into fpp.
- */
-int cap_funwrap(struct file *fp_cap, cap_rights_t rights,
- struct file **fpp);
-int cap_funwrap_mmap(struct file *fp_cap, cap_rights_t rights,
- u_char *maxprotp, struct file **fpp);
-
-/*
- * For the purposes of procstat(1) and similar tools, allow kern_descrip.c to
- * extract the rights from a capability. However, this should not be used by
- * kernel code generally, instead cap_funwrap() should be used in order to
- * keep all access control in one place.
- */
-cap_rights_t cap_rights(struct file *fp_cap);
-
-#else /* !_KERNEL */
-
-__BEGIN_DECLS
-
-/*
- * cap_enter(): Cause the process to enter capability mode, which will
- * prevent it from directly accessing global namespaces. System calls will
- * be limited to process-local, process-inherited, or file descriptor
- * operations. If already in capability mode, a no-op.
- *
- * Currently, process-inherited operations are not properly handled -- in
- * particular, we're interested in things like waitpid(2), kill(2), etc,
- * being properly constrained. One possible solution is to introduce process
- * descriptors.
- */
-int cap_enter(void);
-
-/*
- * cap_getmode(): Are we in capability mode?
- */
-int cap_getmode(u_int* modep);
-
-/*
- * cap_new(): Create a new capability derived from an existing file
- * descriptor with the specified rights. If the existing file descriptor is
- * a capability, then the new rights must be a subset of the existing rights.
- */
-int cap_new(int fd, cap_rights_t rights);
-
-/*
- * cap_getrights(): Query the rights on a capability.
- */
-int cap_getrights(int fd, cap_rights_t *rightsp);
-
-__END_DECLS
-
-#endif /* !_KERNEL */
-
#endif /* !_SYS_CAPABILITY_H_ */
Added: trunk/sys/sys/caprights.h
===================================================================
--- trunk/sys/sys/caprights.h (rev 0)
+++ trunk/sys/sys/caprights.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -0,0 +1,62 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2013 FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Pawel Jakub Dawidek under sponsorship from
+ * the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: stable/10/sys/sys/caprights.h 255219 2013-09-05 00:09:56Z pjd $
+ */
+
+#ifndef _SYS_CAPRIGHTS_H_
+#define _SYS_CAPRIGHTS_H_
+
+/*
+ * The top two bits in the first element of the cr_rights[] array contain
+ * total number of elements in the array - 2. This means if those two bits are
+ * equal to 0, we have 2 array elements.
+ * The top two bits in all remaining array elements should be 0.
+ * The next five bits contain array index. Only one bit is used and bit position
+ * in this five-bits range defines array index. This means there can be at most
+ * five array elements.
+ */
+#define CAP_RIGHTS_VERSION_00 0
+/*
+#define CAP_RIGHTS_VERSION_01 1
+#define CAP_RIGHTS_VERSION_02 2
+#define CAP_RIGHTS_VERSION_03 3
+*/
+#define CAP_RIGHTS_VERSION CAP_RIGHTS_VERSION_00
+
+struct cap_rights {
+ uint64_t cr_rights[CAP_RIGHTS_VERSION + 2];
+};
+
+#ifndef _CAP_RIGHTS_T_DECLARED
+#define _CAP_RIGHTS_T_DECLARED
+typedef struct cap_rights cap_rights_t;
+#endif
+
+#endif /* !_SYS_CAPRIGHTS_H_ */
Property changes on: trunk/sys/sys/caprights.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/capsicum.h
===================================================================
--- trunk/sys/sys/capsicum.h (rev 0)
+++ trunk/sys/sys/capsicum.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -0,0 +1,423 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2008-2010 Robert N. M. Watson
+ * Copyright (c) 2012 FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed at the University of Cambridge Computer
+ * Laboratory with support from a grant from Google, Inc.
+ *
+ * Portions of this software were developed by Pawel Jakub Dawidek under
+ * sponsorship from the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: stable/10/sys/sys/capsicum.h 293474 2016-01-09 14:20:23Z dchagin $
+ */
+
+/*
+ * Definitions for FreeBSD capabilities facility.
+ */
+#ifndef _SYS_CAPSICUM_H_
+#define _SYS_CAPSICUM_H_
+
+#include <sys/cdefs.h>
+#include <sys/param.h>
+
+#include <sys/caprights.h>
+#include <sys/file.h>
+#include <sys/fcntl.h>
+
+#ifndef _KERNEL
+#include <stdbool.h>
+#endif
+
+#define CAPRIGHT(idx, bit) ((1ULL << (57 + (idx))) | (bit))
+
+/*
+ * Possible rights on capabilities.
+ *
+ * Notes:
+ * Some system calls don't require a capability in order to perform an
+ * operation on an fd. These include: close, dup, dup2.
+ *
+ * sendfile is authorized using CAP_READ on the file and CAP_WRITE on the
+ * socket.
+ *
+ * mmap() and aio*() system calls will need special attention as they may
+ * involve reads or writes depending a great deal on context.
+ */
+
+/* INDEX 0 */
+
+/*
+ * General file I/O.
+ */
+/* Allows for openat(O_RDONLY), read(2), readv(2). */
+#define CAP_READ CAPRIGHT(0, 0x0000000000000001ULL)
+/* Allows for openat(O_WRONLY | O_APPEND), write(2), writev(2). */
+#define CAP_WRITE CAPRIGHT(0, 0x0000000000000002ULL)
+/* Allows for lseek(fd, 0, SEEK_CUR). */
+#define CAP_SEEK_TELL CAPRIGHT(0, 0x0000000000000004ULL)
+/* Allows for lseek(2). */
+#define CAP_SEEK (CAP_SEEK_TELL | 0x0000000000000008ULL)
+/* Allows for aio_read(2), pread(2), preadv(2). */
+#define CAP_PREAD (CAP_SEEK | CAP_READ)
+/*
+ * Allows for aio_write(2), openat(O_WRONLY) (without O_APPEND), pwrite(2),
+ * pwritev(2).
+ */
+#define CAP_PWRITE (CAP_SEEK | CAP_WRITE)
+/* Allows for mmap(PROT_NONE). */
+#define CAP_MMAP CAPRIGHT(0, 0x0000000000000010ULL)
+/* Allows for mmap(PROT_READ). */
+#define CAP_MMAP_R (CAP_MMAP | CAP_SEEK | CAP_READ)
+/* Allows for mmap(PROT_WRITE). */
+#define CAP_MMAP_W (CAP_MMAP | CAP_SEEK | CAP_WRITE)
+/* Allows for mmap(PROT_EXEC). */
+#define CAP_MMAP_X (CAP_MMAP | CAP_SEEK | 0x0000000000000020ULL)
+/* Allows for mmap(PROT_READ | PROT_WRITE). */
+#define CAP_MMAP_RW (CAP_MMAP_R | CAP_MMAP_W)
+/* Allows for mmap(PROT_READ | PROT_EXEC). */
+#define CAP_MMAP_RX (CAP_MMAP_R | CAP_MMAP_X)
+/* Allows for mmap(PROT_WRITE | PROT_EXEC). */
+#define CAP_MMAP_WX (CAP_MMAP_W | CAP_MMAP_X)
+/* Allows for mmap(PROT_READ | PROT_WRITE | PROT_EXEC). */
+#define CAP_MMAP_RWX (CAP_MMAP_R | CAP_MMAP_W | CAP_MMAP_X)
+/* Allows for openat(O_CREAT). */
+#define CAP_CREATE CAPRIGHT(0, 0x0000000000000040ULL)
+/* Allows for openat(O_EXEC) and fexecve(2) in turn. */
+#define CAP_FEXECVE CAPRIGHT(0, 0x0000000000000080ULL)
+/* Allows for openat(O_SYNC), openat(O_FSYNC), fsync(2), aio_fsync(2). */
+#define CAP_FSYNC CAPRIGHT(0, 0x0000000000000100ULL)
+/* Allows for openat(O_TRUNC), ftruncate(2). */
+#define CAP_FTRUNCATE CAPRIGHT(0, 0x0000000000000200ULL)
+
+/* Lookups - used to constrain *at() calls. */
+#define CAP_LOOKUP CAPRIGHT(0, 0x0000000000000400ULL)
+
+/* VFS methods. */
+/* Allows for fchdir(2). */
+#define CAP_FCHDIR CAPRIGHT(0, 0x0000000000000800ULL)
+/* Allows for fchflags(2). */
+#define CAP_FCHFLAGS CAPRIGHT(0, 0x0000000000001000ULL)
+/* Allows for fchflags(2) and chflagsat(2). */
+#define CAP_CHFLAGSAT (CAP_FCHFLAGS | CAP_LOOKUP)
+/* Allows for fchmod(2). */
+#define CAP_FCHMOD CAPRIGHT(0, 0x0000000000002000ULL)
+/* Allows for fchmod(2) and fchmodat(2). */
+#define CAP_FCHMODAT (CAP_FCHMOD | CAP_LOOKUP)
+/* Allows for fchown(2). */
+#define CAP_FCHOWN CAPRIGHT(0, 0x0000000000004000ULL)
+/* Allows for fchown(2) and fchownat(2). */
+#define CAP_FCHOWNAT (CAP_FCHOWN | CAP_LOOKUP)
+/* Allows for fcntl(2). */
+#define CAP_FCNTL CAPRIGHT(0, 0x0000000000008000ULL)
+/*
+ * Allows for flock(2), openat(O_SHLOCK), openat(O_EXLOCK),
+ * fcntl(F_SETLK_REMOTE), fcntl(F_SETLKW), fcntl(F_SETLK), fcntl(F_GETLK).
+ */
+#define CAP_FLOCK CAPRIGHT(0, 0x0000000000010000ULL)
+/* Allows for fpathconf(2). */
+#define CAP_FPATHCONF CAPRIGHT(0, 0x0000000000020000ULL)
+/* Allows for UFS background-fsck operations. */
+#define CAP_FSCK CAPRIGHT(0, 0x0000000000040000ULL)
+/* Allows for fstat(2). */
+#define CAP_FSTAT CAPRIGHT(0, 0x0000000000080000ULL)
+/* Allows for fstat(2), fstatat(2) and faccessat(2). */
+#define CAP_FSTATAT (CAP_FSTAT | CAP_LOOKUP)
+/* Allows for fstatfs(2). */
+#define CAP_FSTATFS CAPRIGHT(0, 0x0000000000100000ULL)
+/* Allows for futimens(2) and futimes(2). */
+#define CAP_FUTIMES CAPRIGHT(0, 0x0000000000200000ULL)
+/* Allows for futimens(2), futimes(2), futimesat(2) and utimensat(2). */
+#define CAP_FUTIMESAT (CAP_FUTIMES | CAP_LOOKUP)
+/* Allows for linkat(2) and renameat(2) (destination directory descriptor). */
+#define CAP_LINKAT (CAP_LOOKUP | 0x0000000000400000ULL)
+/* Allows for mkdirat(2). */
+#define CAP_MKDIRAT (CAP_LOOKUP | 0x0000000000800000ULL)
+/* Allows for mkfifoat(2). */
+#define CAP_MKFIFOAT (CAP_LOOKUP | 0x0000000001000000ULL)
+/* Allows for mknodat(2). */
+#define CAP_MKNODAT (CAP_LOOKUP | 0x0000000002000000ULL)
+/* Allows for renameat(2). */
+#define CAP_RENAMEAT (CAP_LOOKUP | 0x0000000004000000ULL)
+/* Allows for symlinkat(2). */
+#define CAP_SYMLINKAT (CAP_LOOKUP | 0x0000000008000000ULL)
+/*
+ * Allows for unlinkat(2) and renameat(2) if destination object exists and
+ * will be removed.
+ */
+#define CAP_UNLINKAT (CAP_LOOKUP | 0x0000000010000000ULL)
+
+/* Socket operations. */
+/* Allows for accept(2) and accept4(2). */
+#define CAP_ACCEPT CAPRIGHT(0, 0x0000000020000000ULL)
+/* Allows for bind(2). */
+#define CAP_BIND CAPRIGHT(0, 0x0000000040000000ULL)
+/* Allows for connect(2). */
+#define CAP_CONNECT CAPRIGHT(0, 0x0000000080000000ULL)
+/* Allows for getpeername(2). */
+#define CAP_GETPEERNAME CAPRIGHT(0, 0x0000000100000000ULL)
+/* Allows for getsockname(2). */
+#define CAP_GETSOCKNAME CAPRIGHT(0, 0x0000000200000000ULL)
+/* Allows for getsockopt(2). */
+#define CAP_GETSOCKOPT CAPRIGHT(0, 0x0000000400000000ULL)
+/* Allows for listen(2). */
+#define CAP_LISTEN CAPRIGHT(0, 0x0000000800000000ULL)
+/* Allows for sctp_peeloff(2). */
+#define CAP_PEELOFF CAPRIGHT(0, 0x0000001000000000ULL)
+#define CAP_RECV CAP_READ
+#define CAP_SEND CAP_WRITE
+/* Allows for setsockopt(2). */
+#define CAP_SETSOCKOPT CAPRIGHT(0, 0x0000002000000000ULL)
+/* Allows for shutdown(2). */
+#define CAP_SHUTDOWN CAPRIGHT(0, 0x0000004000000000ULL)
+
+/* Allows for bindat(2) on a directory descriptor. */
+#define CAP_BINDAT (CAP_LOOKUP | 0x0000008000000000ULL)
+/* Allows for connectat(2) on a directory descriptor. */
+#define CAP_CONNECTAT (CAP_LOOKUP | 0x0000010000000000ULL)
+
+#define CAP_SOCK_CLIENT \
+ (CAP_CONNECT | CAP_GETPEERNAME | CAP_GETSOCKNAME | CAP_GETSOCKOPT | \
+ CAP_PEELOFF | CAP_RECV | CAP_SEND | CAP_SETSOCKOPT | CAP_SHUTDOWN)
+#define CAP_SOCK_SERVER \
+ (CAP_ACCEPT | CAP_BIND | CAP_GETPEERNAME | CAP_GETSOCKNAME | \
+ CAP_GETSOCKOPT | CAP_LISTEN | CAP_PEELOFF | CAP_RECV | CAP_SEND | \
+ CAP_SETSOCKOPT | CAP_SHUTDOWN)
+
+/* All used bits for index 0. */
+#define CAP_ALL0 CAPRIGHT(0, 0x0000007FFFFFFFFFULL)
+
+/* Available bits for index 0. */
+#define CAP_UNUSED0_40 CAPRIGHT(0, 0x0000008000000000ULL)
+/* ... */
+#define CAP_UNUSED0_57 CAPRIGHT(0, 0x0100000000000000ULL)
+
+/* INDEX 1 */
+
+/* Mandatory Access Control. */
+/* Allows for mac_get_fd(3). */
+#define CAP_MAC_GET CAPRIGHT(1, 0x0000000000000001ULL)
+/* Allows for mac_set_fd(3). */
+#define CAP_MAC_SET CAPRIGHT(1, 0x0000000000000002ULL)
+
+/* Methods on semaphores. */
+#define CAP_SEM_GETVALUE CAPRIGHT(1, 0x0000000000000004ULL)
+#define CAP_SEM_POST CAPRIGHT(1, 0x0000000000000008ULL)
+#define CAP_SEM_WAIT CAPRIGHT(1, 0x0000000000000010ULL)
+
+/* Allows select(2) and poll(2) on descriptor. */
+#define CAP_EVENT CAPRIGHT(1, 0x0000000000000020ULL)
+/* Allows for kevent(2) on kqueue descriptor with eventlist != NULL. */
+#define CAP_KQUEUE_EVENT CAPRIGHT(1, 0x0000000000000040ULL)
+
+/* Strange and powerful rights that should not be given lightly. */
+/* Allows for ioctl(2). */
+#define CAP_IOCTL CAPRIGHT(1, 0x0000000000000080ULL)
+#define CAP_TTYHOOK CAPRIGHT(1, 0x0000000000000100ULL)
+
+/* Process management via process descriptors. */
+/* Allows for pdgetpid(2). */
+#define CAP_PDGETPID CAPRIGHT(1, 0x0000000000000200ULL)
+/* Allows for pdwait4(2). */
+#define CAP_PDWAIT CAPRIGHT(1, 0x0000000000000400ULL)
+/* Allows for pdkill(2). */
+#define CAP_PDKILL CAPRIGHT(1, 0x0000000000000800ULL)
+
+/* Extended attributes. */
+/* Allows for extattr_delete_fd(2). */
+#define CAP_EXTATTR_DELETE CAPRIGHT(1, 0x0000000000001000ULL)
+/* Allows for extattr_get_fd(2). */
+#define CAP_EXTATTR_GET CAPRIGHT(1, 0x0000000000002000ULL)
+/* Allows for extattr_list_fd(2). */
+#define CAP_EXTATTR_LIST CAPRIGHT(1, 0x0000000000004000ULL)
+/* Allows for extattr_set_fd(2). */
+#define CAP_EXTATTR_SET CAPRIGHT(1, 0x0000000000008000ULL)
+
+/* Access Control Lists. */
+/* Allows for acl_valid_fd_np(3). */
+#define CAP_ACL_CHECK CAPRIGHT(1, 0x0000000000010000ULL)
+/* Allows for acl_delete_fd_np(3). */
+#define CAP_ACL_DELETE CAPRIGHT(1, 0x0000000000020000ULL)
+/* Allows for acl_get_fd(3) and acl_get_fd_np(3). */
+#define CAP_ACL_GET CAPRIGHT(1, 0x0000000000040000ULL)
+/* Allows for acl_set_fd(3) and acl_set_fd_np(3). */
+#define CAP_ACL_SET CAPRIGHT(1, 0x0000000000080000ULL)
+
+/* Allows for kevent(2) on kqueue descriptor with changelist != NULL. */
+#define CAP_KQUEUE_CHANGE CAPRIGHT(1, 0x0000000000100000ULL)
+
+#define CAP_KQUEUE (CAP_KQUEUE_EVENT | CAP_KQUEUE_CHANGE)
+
+/* All used bits for index 1. */
+#define CAP_ALL1 CAPRIGHT(1, 0x00000000001FFFFFULL)
+
+/* Available bits for index 1. */
+#define CAP_UNUSED1_22 CAPRIGHT(1, 0x0000000000200000ULL)
+/* ... */
+#define CAP_UNUSED1_57 CAPRIGHT(1, 0x0100000000000000ULL)
+
+/* Backward compatibility. */
+#define CAP_POLL_EVENT CAP_EVENT
+
+#define CAP_ALL(rights) do { \
+ (rights)->cr_rights[0] = \
+ ((uint64_t)CAP_RIGHTS_VERSION << 62) | CAP_ALL0; \
+ (rights)->cr_rights[1] = CAP_ALL1; \
+} while (0)
+
+#define CAP_NONE(rights) do { \
+ (rights)->cr_rights[0] = \
+ ((uint64_t)CAP_RIGHTS_VERSION << 62) | CAPRIGHT(0, 0ULL); \
+ (rights)->cr_rights[1] = CAPRIGHT(1, 0ULL); \
+} while (0)
+
+#define CAPRVER(right) ((int)((right) >> 62))
+#define CAPVER(rights) CAPRVER((rights)->cr_rights[0])
+#define CAPARSIZE(rights) (CAPVER(rights) + 2)
+#define CAPIDXBIT(right) ((int)(((right) >> 57) & 0x1F))
+
+/*
+ * Allowed fcntl(2) commands.
+ */
+#define CAP_FCNTL_GETFL (1 << F_GETFL)
+#define CAP_FCNTL_SETFL (1 << F_SETFL)
+#if __BSD_VISIBLE || __XSI_VISIBLE || __POSIX_VISIBLE >= 200112
+#define CAP_FCNTL_GETOWN (1 << F_GETOWN)
+#define CAP_FCNTL_SETOWN (1 << F_SETOWN)
+#endif
+#if __BSD_VISIBLE || __XSI_VISIBLE || __POSIX_VISIBLE >= 200112
+#define CAP_FCNTL_ALL (CAP_FCNTL_GETFL | CAP_FCNTL_SETFL | \
+ CAP_FCNTL_GETOWN | CAP_FCNTL_SETOWN)
+#else
+#define CAP_FCNTL_ALL (CAP_FCNTL_GETFL | CAP_FCNTL_SETFL)
+#endif
+
+#define CAP_IOCTLS_ALL SSIZE_MAX
+
+#define cap_rights_init(...) \
+ __cap_rights_init(CAP_RIGHTS_VERSION, __VA_ARGS__, 0ULL)
+cap_rights_t *__cap_rights_init(int version, cap_rights_t *rights, ...);
+
+#define cap_rights_set(rights, ...) \
+ __cap_rights_set((rights), __VA_ARGS__, 0ULL)
+cap_rights_t *__cap_rights_set(cap_rights_t *rights, ...);
+
+#define cap_rights_clear(rights, ...) \
+ __cap_rights_clear((rights), __VA_ARGS__, 0ULL)
+cap_rights_t *__cap_rights_clear(cap_rights_t *rights, ...);
+
+#define cap_rights_is_set(rights, ...) \
+ __cap_rights_is_set((rights), __VA_ARGS__, 0ULL)
+bool __cap_rights_is_set(const cap_rights_t *rights, ...);
+
+bool cap_rights_is_valid(const cap_rights_t *rights);
+cap_rights_t *cap_rights_merge(cap_rights_t *dst, const cap_rights_t *src);
+cap_rights_t *cap_rights_remove(cap_rights_t *dst, const cap_rights_t *src);
+bool cap_rights_contains(const cap_rights_t *big, const cap_rights_t *little);
+
+#ifdef _KERNEL
+
+#include <sys/systm.h>
+
+#define IN_CAPABILITY_MODE(td) ((td->td_ucred->cr_flags & CRED_FLAG_CAPMODE) != 0)
+
+struct filedesc;
+struct filedescent;
+
+/*
+ * Test whether a capability grants the requested rights.
+ */
+int cap_check(const cap_rights_t *havep, const cap_rights_t *needp);
+/*
+ * Convert capability rights into VM access flags.
+ */
+u_char cap_rights_to_vmprot(cap_rights_t *havep);
+
+/*
+ * For the purposes of procstat(1) and similar tools, allow kern_descrip.c to
+ * extract the rights from a capability.
+ */
+cap_rights_t *cap_rights_fde(struct filedescent *fde);
+cap_rights_t *cap_rights(struct filedesc *fdp, int fd);
+
+int cap_ioctl_check(struct filedesc *fdp, int fd, u_long cmd);
+int cap_fcntl_check_fde(struct filedescent *fde, int cmd);
+int cap_fcntl_check(struct filedesc *fdp, int fd, int cmd);
+
+#else /* !_KERNEL */
+
+__BEGIN_DECLS
+/*
+ * cap_enter(): Cause the process to enter capability mode, which will
+ * prevent it from directly accessing global namespaces. System calls will
+ * be limited to process-local, process-inherited, or file descriptor
+ * operations. If already in capability mode, a no-op.
+ */
+int cap_enter(void);
+
+/*
+ * Are we sandboxed (in capability mode)?
+ * This is a libc wrapper around the cap_getmode(2) system call.
+ */
+bool cap_sandboxed(void);
+
+/*
+ * cap_getmode(): Are we in capability mode?
+ */
+int cap_getmode(u_int *modep);
+
+/*
+ * Limits capability rights for the given descriptor (CAP_*).
+ */
+int cap_rights_limit(int fd, const cap_rights_t *rights);
+/*
+ * Returns capability rights for the given descriptor.
+ */
+#define cap_rights_get(fd, rights) __cap_rights_get(CAP_RIGHTS_VERSION, (fd), (rights))
+int __cap_rights_get(int version, int fd, cap_rights_t *rightsp);
+/*
+ * Limits allowed ioctls for the given descriptor.
+ */
+int cap_ioctls_limit(int fd, const unsigned long *cmds, size_t ncmds);
+/*
+ * Returns array of allowed ioctls for the given descriptor.
+ * If all ioctls are allowed, the cmds array is not populated and
+ * the function returns CAP_IOCTLS_ALL.
+ */
+ssize_t cap_ioctls_get(int fd, unsigned long *cmds, size_t maxcmds);
+/*
+ * Limits allowed fcntls for the given descriptor (CAP_FCNTL_*).
+ */
+int cap_fcntls_limit(int fd, uint32_t fcntlrights);
+/*
+ * Returns bitmask of allowed fcntls for the given descriptor.
+ */
+int cap_fcntls_get(int fd, uint32_t *fcntlrightsp);
+
+__END_DECLS
+
+#endif /* !_KERNEL */
+
+#endif /* !_SYS_CAPSICUM_H_ */
Property changes on: trunk/sys/sys/capsicum.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/sys/sys/cdio.h
===================================================================
--- trunk/sys/sys/cdio.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/cdio.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,7 +1,8 @@
+/* $MidnightBSD$ */
/*
* 16 Feb 93 Julian Elischer (julian at dialix.oz.au)
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/cdio.h 141031 2005-01-30 08:12:37Z sobomax $
*/
/*
Modified: trunk/sys/sys/condvar.h
===================================================================
--- trunk/sys/sys/condvar.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/condvar.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2000 Jake Burkholder <jake at freebsd.org>.
* All rights reserved.
@@ -23,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/condvar.h 247785 2013-03-04 12:20:48Z davide $
*/
#ifndef _SYS_CONDVAR_H_
@@ -55,8 +56,10 @@
void _cv_wait(struct cv *cvp, struct lock_object *lock);
void _cv_wait_unlock(struct cv *cvp, struct lock_object *lock);
int _cv_wait_sig(struct cv *cvp, struct lock_object *lock);
-int _cv_timedwait(struct cv *cvp, struct lock_object *lock, int timo);
-int _cv_timedwait_sig(struct cv *cvp, struct lock_object *lock, int timo);
+int _cv_timedwait_sbt(struct cv *cvp, struct lock_object *lock,
+ sbintime_t sbt, sbintime_t pr, int flags);
+int _cv_timedwait_sig_sbt(struct cv *cvp, struct lock_object *lock,
+ sbintime_t sbt, sbintime_t pr, int flags);
void cv_signal(struct cv *cvp);
void cv_broadcastpri(struct cv *cvp, int pri);
@@ -68,9 +71,15 @@
#define cv_wait_sig(cvp, lock) \
_cv_wait_sig((cvp), &(lock)->lock_object)
#define cv_timedwait(cvp, lock, timo) \
- _cv_timedwait((cvp), &(lock)->lock_object, (timo))
+ _cv_timedwait_sbt((cvp), &(lock)->lock_object, \
+ tick_sbt * (timo), 0, C_HARDCLOCK)
+#define cv_timedwait_sbt(cvp, lock, sbt, pr, flags) \
+ _cv_timedwait_sbt((cvp), &(lock)->lock_object, (sbt), (pr), (flags))
#define cv_timedwait_sig(cvp, lock, timo) \
- _cv_timedwait_sig((cvp), &(lock)->lock_object, (timo))
+ _cv_timedwait_sig_sbt((cvp), &(lock)->lock_object, \
+ tick_sbt * (timo), 0, C_HARDCLOCK)
+#define cv_timedwait_sig_sbt(cvp, lock, sbt, pr, flags) \
+ _cv_timedwait_sig_sbt((cvp), &(lock)->lock_object, (sbt), (pr), (flags))
#define cv_broadcast(cvp) cv_broadcastpri(cvp, 0)
Modified: trunk/sys/sys/conf.h
===================================================================
--- trunk/sys/sys/conf.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/conf.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
@@ -34,7 +35,7 @@
* SUCH DAMAGE.
*
* @(#)conf.h 8.5 (Berkeley) 1/9/95
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/conf.h 317917 2017-05-07 20:21:59Z rmacklem $
*/
#ifndef _SYS_CONF_H_
@@ -52,19 +53,17 @@
struct file;
struct cdev {
- struct mount *si_mountpt;
+ void *si_spare0;
u_int si_flags;
#define SI_ETERNAL 0x0001 /* never destroyed */
-#define SI_ALIAS 0x0002 /* carrier of alias name */
-#define SI_NAMED 0x0004 /* make_dev{_alias} has been called */
-#define SI_CHEAPCLONE 0x0008 /* can be removed_dev'ed when vnode reclaims */
-#define SI_CHILD 0x0010 /* child of another struct cdev **/
-#define SI_DEVOPEN 0x0020 /* opened by device */
-#define SI_CONSOPEN 0x0040 /* opened by console */
-#define SI_DUMPDEV 0x0080 /* is kernel dumpdev */
-#define SI_CANDELETE 0x0100 /* can do BIO_DELETE */
-#define SI_CLONELIST 0x0200 /* on a clone list */
+#define SI_ALIAS 0x0002 /* carrier of alias name */
+#define SI_NAMED 0x0004 /* make_dev{_alias} has been called */
+#define SI_CHEAPCLONE 0x0008 /* can be removed_dev'ed when vnode reclaims */
+#define SI_CHILD 0x0010 /* child of another struct cdev **/
+#define SI_DUMPDEV 0x0080 /* is kernel dumpdev */
+#define SI_CLONELIST 0x0200 /* on a clone list */
#define SI_UNMAPPED 0x0400 /* can handle unmapped I/O */
+#define SI_NOSPLIT 0x0800 /* I/O should not be split up */
struct timespec si_atime;
struct timespec si_ctime;
struct timespec si_mtime;
@@ -79,7 +78,7 @@
LIST_HEAD(, cdev) si_children;
LIST_ENTRY(cdev) si_siblings;
struct cdev *si_parent;
- char *si_name;
+ struct mount *si_mountpt;
void *si_drv1, *si_drv2;
struct cdevsw *si_devsw;
int si_iosize_max; /* maximum I/O size (for physio &al) */
@@ -88,10 +87,10 @@
union {
struct snapdata *__sid_snapdata;
} __si_u;
- char __si_namebuf[SPECNAMELEN + 1];
+ char si_name[SPECNAMELEN + 1];
};
-#define si_snapdata __si_u.__sid_snapdata
+#define si_snapdata __si_u.__sid_snapdata
#ifdef _KERNEL
@@ -158,9 +157,9 @@
#define D_TAPE 0x0001
#define D_DISK 0x0002
#define D_TTY 0x0004
-#define D_MEM 0x0008
+#define D_MEM 0x0008 /* /dev/(k)mem */
-#ifdef _KERNEL
+#ifdef _KERNEL
#define D_TYPEMASK 0xffff
@@ -168,25 +167,23 @@
* Flags for d_flags which the drivers can set.
*/
#define D_TRACKCLOSE 0x00080000 /* track all closes */
-#define D_MMAP_ANON 0x00100000 /* special treatment in vm_mmap.c */
-#define D_PSEUDO 0x00200000 /* make_dev() can return NULL */
-#define D_NEEDGIANT 0x00400000 /* driver want Giant */
+#define D_MMAP_ANON 0x00100000 /* special treatment in vm_mmap.c */
+#define D_NEEDGIANT 0x00400000 /* driver want Giant */
#define D_NEEDMINOR 0x00800000 /* driver uses clone_create() */
-#define D_UNMAPPED_IO 0x01000000 /* d_strategy can accept unmapped IO */
/*
* Version numbers.
*/
-#define D_VERSION_00 0x20011966
-#define D_VERSION_01 0x17032005 /* Add d_uid,gid,mode & kind */
-#define D_VERSION_02 0x28042009 /* Add d_mmap_single */
-#define D_VERSION_03 0x17122009 /* d_mmap takes memattr,vm_ooffset_t */
-#define D_VERSION D_VERSION_03
+#define D_VERSION_00 0x20011966
+#define D_VERSION_01 0x17032005 /* Add d_uid,gid,mode & kind */
+#define D_VERSION_02 0x28042009 /* Add d_mmap_single */
+#define D_VERSION_03 0x17122009 /* d_mmap takes memattr,vm_ooffset_t */
+#define D_VERSION D_VERSION_03
/*
* Flags used for internal housekeeping
*/
-#define D_INIT 0x80000000 /* cdevsw initialized */
+#define D_INIT 0x80000000 /* cdevsw initialized */
/*
* Character device switch table
@@ -231,21 +228,45 @@
/* Do not initialize fields hereafter */
};
-#define DEV_MODULE(name, evh, arg) \
+#define DEV_MODULE_ORDERED(name, evh, arg, ord) \
static moduledata_t name##_mod = { \
#name, \
evh, \
arg \
}; \
-DECLARE_MODULE(name, name##_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE)
+DECLARE_MODULE(name, name##_mod, SI_SUB_DRIVERS, ord)
+#define DEV_MODULE(name, evh, arg) \
+ DEV_MODULE_ORDERED(name, evh, arg, SI_ORDER_MIDDLE)
void clone_setup(struct clonedevs **cdp);
void clone_cleanup(struct clonedevs **);
-#define CLONE_UNITMASK 0xfffff
-#define CLONE_FLAG0 (CLONE_UNITMASK + 1)
+#define CLONE_UNITMASK 0xfffff
+#define CLONE_FLAG0 (CLONE_UNITMASK + 1)
int clone_create(struct clonedevs **, struct cdevsw *, int *unit, struct cdev **dev, int extra);
+#define MAKEDEV_REF 0x01
+#define MAKEDEV_WHTOUT 0x02
+#define MAKEDEV_NOWAIT 0x04
+#define MAKEDEV_WAITOK 0x08
+#define MAKEDEV_ETERNAL 0x10
+#define MAKEDEV_CHECKNAME 0x20
+struct make_dev_args {
+ size_t mda_size;
+ int mda_flags;
+ struct cdevsw *mda_devsw;
+ struct ucred *mda_cr;
+ uid_t mda_uid;
+ gid_t mda_gid;
+ int mda_mode;
+ int mda_unit;
+ void *mda_si_drv1;
+ void *mda_si_drv2;
+};
+void make_dev_args_init_impl(struct make_dev_args *_args, size_t _sz);
+#define make_dev_args_init(a) \
+ make_dev_args_init_impl((a), sizeof(struct make_dev_args))
+
int count_dev(struct cdev *_dev);
void delist_dev(struct cdev *_dev);
void destroy_dev(struct cdev *_dev);
@@ -267,12 +288,6 @@
struct cdev *make_dev_cred(struct cdevsw *_devsw, int _unit,
struct ucred *_cr, uid_t _uid, gid_t _gid, int _perms,
const char *_fmt, ...) __printflike(7, 8);
-#define MAKEDEV_REF 0x01
-#define MAKEDEV_WHTOUT 0x02
-#define MAKEDEV_NOWAIT 0x04
-#define MAKEDEV_WAITOK 0x08
-#define MAKEDEV_ETERNAL 0x10
-#define MAKEDEV_CHECKNAME 0x20
struct cdev *make_dev_credf(int _flags,
struct cdevsw *_devsw, int _unit,
struct ucred *_cr, uid_t _uid, gid_t _gid, int _mode,
@@ -280,16 +295,17 @@
int make_dev_p(int _flags, struct cdev **_cdev, struct cdevsw *_devsw,
struct ucred *_cr, uid_t _uid, gid_t _gid, int _mode,
const char *_fmt, ...) __printflike(8, 9);
+int make_dev_s(struct make_dev_args *_args, struct cdev **_cdev,
+ const char *_fmt, ...) __printflike(3, 4);
struct cdev *make_dev_alias(struct cdev *_pdev, const char *_fmt, ...)
__printflike(2, 3);
int make_dev_alias_p(int _flags, struct cdev **_cdev, struct cdev *_pdev,
const char *_fmt, ...) __printflike(4, 5);
int make_dev_physpath_alias(int _flags, struct cdev **_cdev,
- struct cdev *_pdev, struct cdev *_old_alias,
- const char *_physpath);
+ struct cdev *_pdev, struct cdev *_old_alias,
+ const char *_physpath);
void dev_lock(void);
void dev_unlock(void);
-void setconf(void);
#ifdef KLD_MODULE
#define MAKEDEV_ETERNAL_KLD 0
@@ -299,9 +315,9 @@
#define dev2unit(d) ((d)->si_drv0)
-typedef void (*cdevpriv_dtr_t)(void *data);
+typedef void d_priv_dtor_t(void *data);
int devfs_get_cdevpriv(void **datap);
-int devfs_set_cdevpriv(void *priv, cdevpriv_dtr_t dtr);
+int devfs_set_cdevpriv(void *priv, d_priv_dtor_t *dtr);
void devfs_clear_cdevpriv(void);
void devfs_fpdrop(struct file *fp); /* XXX This is not public KPI */
@@ -320,6 +336,7 @@
#define GID_BIN 7
#define GID_GAMES 13
#define GID_DIALER 68
+#define GID_NOGROUP 65533
#define GID_NOBODY 65534
typedef void (*dev_clone_fn)(void *arg, struct ucred *cred, char *name,
@@ -339,7 +356,7 @@
off_t mediasize; /* Space available in bytes. */
};
-int set_dumper(struct dumperinfo *);
+int set_dumper(struct dumperinfo *, const char *_devname, struct thread *td);
int dump_write(struct dumperinfo *, void *, vm_offset_t, off_t, size_t);
void dumpsys(struct dumperinfo *);
int doadump(boolean_t);
Modified: trunk/sys/sys/cons.h
===================================================================
--- trunk/sys/sys/cons.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/cons.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1988 University of Utah.
* Copyright (c) 1991 The Regents of the University of California.
@@ -32,7 +33,7 @@
* SUCH DAMAGE.
*
* from: @(#)cons.h 7.2 (Berkeley) 5/9/91
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/cons.h 270988 2014-09-02 22:01:14Z emaste $
*/
#ifndef _MACHINE_CONS_H_
@@ -133,6 +134,12 @@
void constty_set(struct tty *tp);
void constty_clear(void);
+/* sc(4) / vt(4) coexistence shim */
+#define VTY_SC 0x01
+#define VTY_VT 0x02
+int vty_enabled(unsigned int);
+void vty_set_preferred(unsigned int);
+
#endif /* _KERNEL */
#endif /* !_MACHINE_CONS_H_ */
Modified: trunk/sys/sys/consio.h
===================================================================
--- trunk/sys/sys/consio.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/consio.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,5 +1,6 @@
+/* $MidnightBSD$ */
/*-
- * Copyright (c) 1991-1996 S\xF8ren Schmidt
+ * Copyright (c) 1991-1996 Søren Schmidt
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -25,7 +26,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/consio.h 273921 2014-10-31 23:10:58Z dumbbell $
*/
#ifndef _SYS_CONSIO_H_
@@ -184,7 +185,7 @@
#define CONS_CURSOR_ATTRS (CONS_BLINK_CURSOR | CONS_CHAR_CURSOR | \
CONS_HIDDEN_CURSOR)
#define CONS_RESET_CURSOR (1 << 30)
-#define CONS_LOCAL_CURSOR (1 << 31)
+#define CONS_LOCAL_CURSOR (1U << 31)
#define CONS_CURSOR_FLAGS (CONS_RESET_CURSOR | CONS_LOCAL_CURSOR)
struct cshape {
/* shape[0]: flags, shape[1]: base, shape[2]: height */
@@ -209,6 +210,28 @@
};
typedef struct fnt16 fnt16_t;
+struct vfnt_map {
+ uint32_t src;
+ uint16_t dst;
+ uint16_t len;
+};
+typedef struct vfnt_map vfnt_map_t;
+
+#define VFNT_MAP_NORMAL 0
+#define VFNT_MAP_NORMAL_RIGHT 1
+#define VFNT_MAP_BOLD 2
+#define VFNT_MAP_BOLD_RIGHT 3
+#define VFNT_MAPS 4
+struct vfnt {
+ vfnt_map_t *map[VFNT_MAPS];
+ uint8_t *glyphs;
+ unsigned int map_count[VFNT_MAPS];
+ unsigned int glyph_count;
+ unsigned int width;
+ unsigned int height;
+};
+typedef struct vfnt vfnt_t;
+
#define PIO_FONT8x8 _IOW('c', 64, fnt8_t)
#define GIO_FONT8x8 _IOR('c', 65, fnt8_t)
#define PIO_FONT8x14 _IOW('c', 66, fnt14_t)
@@ -215,6 +238,9 @@
#define GIO_FONT8x14 _IOR('c', 67, fnt14_t)
#define PIO_FONT8x16 _IOW('c', 68, fnt16_t)
#define GIO_FONT8x16 _IOR('c', 69, fnt16_t)
+#define PIO_VFONT _IOW('c', 70, vfnt_t)
+#define GIO_VFONT _IOR('c', 71, vfnt_t)
+#define PIO_VFONT_DEFAULT _IO('c', 72)
/* get video mode information */
struct colors {
Added: trunk/sys/sys/counter.h
===================================================================
--- trunk/sys/sys/counter.h (rev 0)
+++ trunk/sys/sys/counter.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -0,0 +1,64 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2012 Gleb Smirnoff <glebius at FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: stable/10/sys/sys/counter.h 263088 2014-03-12 11:09:17Z glebius $
+ */
+
+#ifndef __SYS_COUNTER_H__
+#define __SYS_COUNTER_H__
+
+typedef uint64_t *counter_u64_t;
+
+#ifdef _KERNEL
+#include <machine/counter.h>
+
+counter_u64_t counter_u64_alloc(int);
+void counter_u64_free(counter_u64_t);
+
+void counter_u64_zero(counter_u64_t);
+uint64_t counter_u64_fetch(counter_u64_t);
+
+#define COUNTER_ARRAY_ALLOC(a, n, wait) do { \
+ for (int i = 0; i < (n); i++) \
+ (a)[i] = counter_u64_alloc(wait); \
+} while (0)
+
+#define COUNTER_ARRAY_FREE(a, n) do { \
+ for (int i = 0; i < (n); i++) \
+ counter_u64_free((a)[i]); \
+} while (0)
+
+#define COUNTER_ARRAY_COPY(a, dstp, n) do { \
+ for (int i = 0; i < (n); i++) \
+ ((uint64_t *)(dstp))[i] = counter_u64_fetch((a)[i]);\
+} while (0)
+
+#define COUNTER_ARRAY_ZERO(a, n) do { \
+ for (int i = 0; i < (n); i++) \
+ counter_u64_zero((a)[i]); \
+} while (0)
+#endif /* _KERNEL */
+#endif /* ! __SYS_COUNTER_H__ */
Property changes on: trunk/sys/sys/counter.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/sys/sys/cpuctl.h
===================================================================
--- trunk/sys/sys/cpuctl.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/cpuctl.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2006-2008 Stanislav Sedov <stas at FreeBSD.org>
* All rights reserved.
@@ -23,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/cpuctl.h 268157 2014-07-02 13:09:26Z kib $
*/
#ifndef _CPUCTL_H_
@@ -35,11 +36,17 @@
} cpuctl_msr_args_t;
typedef struct {
- int level; /* CPUID level */
+ int level; /* CPUID level */
uint32_t data[4];
} cpuctl_cpuid_args_t;
typedef struct {
+ int level; /* CPUID level */
+ int level_type; /* CPUID level type */
+ uint32_t data[4];
+} cpuctl_cpuid_count_args_t;
+
+typedef struct {
void *data;
size_t size;
} cpuctl_update_args_t;
@@ -50,5 +57,6 @@
#define CPUCTL_UPDATE _IOWR('c', 4, cpuctl_update_args_t)
#define CPUCTL_MSRSBIT _IOWR('c', 5, cpuctl_msr_args_t)
#define CPUCTL_MSRCBIT _IOWR('c', 6, cpuctl_msr_args_t)
+#define CPUCTL_CPUID_COUNT _IOWR('c', 7, cpuctl_cpuid_count_args_t)
#endif /* _CPUCTL_H_ */
Modified: trunk/sys/sys/cpuset.h
===================================================================
--- trunk/sys/sys/cpuset.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/cpuset.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2008, Jeffrey Roberson <jeff at freebsd.org>
* All rights reserved.
@@ -26,7 +27,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/cpuset.h 281538 2015-04-14 20:05:26Z jhb $
*/
#ifndef _SYS_CPUSET_H_
@@ -34,125 +35,34 @@
#include <sys/_cpuset.h>
+#include <sys/bitset.h>
+
#define CPUSETBUFSIZ ((2 + sizeof(long) * 2) * _NCPUWORDS)
-/*
- * Macros addressing word and bit within it, tuned to make compiler
- * optimize cases when CPU_SETSIZE fits into single machine word.
- */
-#define __cpuset_mask(n) \
- ((long)1 << ((_NCPUWORDS == 1) ? (__size_t)(n) : ((n) % _NCPUBITS)))
-#define __cpuset_word(n) ((_NCPUWORDS == 1) ? 0 : ((n) / _NCPUBITS))
+#define CPU_CLR(n, p) BIT_CLR(CPU_SETSIZE, n, p)
+#define CPU_COPY(f, t) BIT_COPY(CPU_SETSIZE, f, t)
+#define CPU_ISSET(n, p) BIT_ISSET(CPU_SETSIZE, n, p)
+#define CPU_SET(n, p) BIT_SET(CPU_SETSIZE, n, p)
+#define CPU_ZERO(p) BIT_ZERO(CPU_SETSIZE, p)
+#define CPU_FILL(p) BIT_FILL(CPU_SETSIZE, p)
+#define CPU_SETOF(n, p) BIT_SETOF(CPU_SETSIZE, n, p)
+#define CPU_EMPTY(p) BIT_EMPTY(CPU_SETSIZE, p)
+#define CPU_ISFULLSET(p) BIT_ISFULLSET(CPU_SETSIZE, p)
+#define CPU_SUBSET(p, c) BIT_SUBSET(CPU_SETSIZE, p, c)
+#define CPU_OVERLAP(p, c) BIT_OVERLAP(CPU_SETSIZE, p, c)
+#define CPU_CMP(p, c) BIT_CMP(CPU_SETSIZE, p, c)
+#define CPU_OR(d, s) BIT_OR(CPU_SETSIZE, d, s)
+#define CPU_AND(d, s) BIT_AND(CPU_SETSIZE, d, s)
+#define CPU_NAND(d, s) BIT_NAND(CPU_SETSIZE, d, s)
+#define CPU_CLR_ATOMIC(n, p) BIT_CLR_ATOMIC(CPU_SETSIZE, n, p)
+#define CPU_SET_ATOMIC(n, p) BIT_SET_ATOMIC(CPU_SETSIZE, n, p)
+#define CPU_SET_ATOMIC_ACQ(n, p) BIT_SET_ATOMIC_ACQ(CPU_SETSIZE, n, p)
+#define CPU_AND_ATOMIC(n, p) BIT_AND_ATOMIC(CPU_SETSIZE, n, p)
+#define CPU_OR_ATOMIC(d, s) BIT_OR_ATOMIC(CPU_SETSIZE, d, s)
+#define CPU_COPY_STORE_REL(f, t) BIT_COPY_STORE_REL(CPU_SETSIZE, f, t)
+#define CPU_FFS(p) BIT_FFS(CPU_SETSIZE, p)
+#define CPU_COUNT(p) BIT_COUNT(CPU_SETSIZE, p)
-#define CPU_CLR(n, p) ((p)->__bits[__cpuset_word(n)] &= ~__cpuset_mask(n))
-#define CPU_COPY(f, t) (void)(*(t) = *(f))
-#define CPU_ISSET(n, p) (((p)->__bits[__cpuset_word(n)] & __cpuset_mask(n)) != 0)
-#define CPU_SET(n, p) ((p)->__bits[__cpuset_word(n)] |= __cpuset_mask(n))
-#define CPU_ZERO(p) do { \
- __size_t __i; \
- for (__i = 0; __i < _NCPUWORDS; __i++) \
- (p)->__bits[__i] = 0; \
-} while (0)
-
-#define CPU_FILL(p) do { \
- __size_t __i; \
- for (__i = 0; __i < _NCPUWORDS; __i++) \
- (p)->__bits[__i] = -1; \
-} while (0)
-
-#define CPU_SETOF(n, p) do { \
- CPU_ZERO(p); \
- ((p)->__bits[__cpuset_word(n)] = __cpuset_mask(n)); \
-} while (0)
-
-/* Is p empty. */
-#define CPU_EMPTY(p) __extension__ ({ \
- __size_t __i; \
- for (__i = 0; __i < _NCPUWORDS; __i++) \
- if ((p)->__bits[__i]) \
- break; \
- __i == _NCPUWORDS; \
-})
-
-/* Is p full set. */
-#define CPU_ISFULLSET(p) __extension__ ({ \
- __size_t __i; \
- for (__i = 0; __i < _NCPUWORDS; __i++) \
- if ((p)->__bits[__i] != (long)-1) \
- break; \
- __i == _NCPUWORDS; \
-})
-
-/* Is c a subset of p. */
-#define CPU_SUBSET(p, c) __extension__ ({ \
- __size_t __i; \
- for (__i = 0; __i < _NCPUWORDS; __i++) \
- if (((c)->__bits[__i] & \
- (p)->__bits[__i]) != \
- (c)->__bits[__i]) \
- break; \
- __i == _NCPUWORDS; \
-})
-
-/* Are there any common bits between b & c? */
-#define CPU_OVERLAP(p, c) __extension__ ({ \
- __size_t __i; \
- for (__i = 0; __i < _NCPUWORDS; __i++) \
- if (((c)->__bits[__i] & \
- (p)->__bits[__i]) != 0) \
- break; \
- __i != _NCPUWORDS; \
-})
-
-/* Compare two sets, returns 0 if equal 1 otherwise. */
-#define CPU_CMP(p, c) __extension__ ({ \
- __size_t __i; \
- for (__i = 0; __i < _NCPUWORDS; __i++) \
- if (((c)->__bits[__i] != \
- (p)->__bits[__i])) \
- break; \
- __i != _NCPUWORDS; \
-})
-
-#define CPU_OR(d, s) do { \
- __size_t __i; \
- for (__i = 0; __i < _NCPUWORDS; __i++) \
- (d)->__bits[__i] |= (s)->__bits[__i]; \
-} while (0)
-
-#define CPU_AND(d, s) do { \
- __size_t __i; \
- for (__i = 0; __i < _NCPUWORDS; __i++) \
- (d)->__bits[__i] &= (s)->__bits[__i]; \
-} while (0)
-
-#define CPU_NAND(d, s) do { \
- __size_t __i; \
- for (__i = 0; __i < _NCPUWORDS; __i++) \
- (d)->__bits[__i] &= ~(s)->__bits[__i]; \
-} while (0)
-
-#define CPU_CLR_ATOMIC(n, p) \
- atomic_clear_long(&(p)->__bits[__cpuset_word(n)], __cpuset_mask(n))
-
-#define CPU_SET_ATOMIC(n, p) \
- atomic_set_long(&(p)->__bits[__cpuset_word(n)], __cpuset_mask(n))
-
-/* Convenience functions catering special cases. */
-#define CPU_OR_ATOMIC(d, s) do { \
- __size_t __i; \
- for (__i = 0; __i < _NCPUWORDS; __i++) \
- atomic_set_long(&(d)->__bits[__i], \
- (s)->__bits[__i]); \
-} while (0)
-
-#define CPU_COPY_STORE_REL(f, t) do { \
- __size_t __i; \
- for (__i = 0; __i < _NCPUWORDS; __i++) \
- atomic_store_rel_long(&(t)->__bits[__i], \
- (f)->__bits[__i]); \
-} while (0)
-
/*
* Valid cpulevel_t values.
*/
@@ -213,9 +123,11 @@
int cpuset_setthread(lwpid_t id, cpuset_t *);
int cpuset_create_root(struct prison *, struct cpuset **);
int cpuset_setproc_update_set(struct proc *, struct cpuset *);
-int cpusetobj_ffs(const cpuset_t *);
char *cpusetobj_strprint(char *, const cpuset_t *);
int cpusetobj_strscan(cpuset_t *, const char *);
+#ifdef DDB
+void ddb_display_cpuset(const cpuset_t *);
+#endif
#else
__BEGIN_DECLS
Modified: trunk/sys/sys/devicestat.h
===================================================================
--- trunk/sys/sys/devicestat.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/devicestat.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1997, 1998, 1999 Kenneth D. Merry.
* All rights reserved.
@@ -25,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/devicestat.h 260385 2014-01-07 01:32:23Z scottl $
*/
#ifndef _DEVICESTAT_H
@@ -199,6 +200,8 @@
devstat_trans_flags flags,
struct bintime *now, struct bintime *then);
void devstat_end_transaction_bio(struct devstat *ds, struct bio *bp);
+void devstat_end_transaction_bio_bt(struct devstat *ds, struct bio *bp,
+ struct bintime *now);
#endif
#endif /* _DEVICESTAT_H */
Modified: trunk/sys/sys/digiio.h
===================================================================
--- trunk/sys/sys/digiio.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/digiio.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2001 Brian Somers <brian at Awfulhak.org>
* based on work by Slawa Olhovchenkov
@@ -26,7 +27,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/digiio.h 162711 2006-09-27 19:57:02Z ru $
*/
/*
Modified: trunk/sys/sys/disk.h
===================================================================
--- trunk/sys/sys/disk.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/disk.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
@@ -6,7 +7,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/disk.h 279005 2015-02-19 14:40:50Z mav $
*
*/
@@ -14,6 +15,7 @@
#define _SYS_DISK_H_
#include <sys/ioccom.h>
+#include <sys/types.h>
#ifdef _KERNEL
@@ -124,4 +126,15 @@
* occupant of that location.
*/
+struct diocgattr_arg {
+ char name[64];
+ int len;
+ union {
+ char str[DISK_IDENT_SIZE];
+ off_t off;
+ int i;
+ } value;
+};
+#define DIOCGATTR _IOWR('d', 142, struct diocgattr_arg)
+
#endif /* _SYS_DISK_H_ */
Modified: trunk/sys/sys/disklabel.h
===================================================================
--- trunk/sys/sys/disklabel.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/disklabel.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1987, 1988, 1993
* The Regents of the University of California. All rights reserved.
@@ -27,7 +28,7 @@
* SUCH DAMAGE.
*
* @(#)disklabel.h 8.2 (Berkeley) 7/10/94
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/disklabel.h 322860 2017-08-24 21:44:23Z mckusick $
*/
#ifndef _SYS_DISKLABEL_H_
@@ -229,6 +230,8 @@
#define FS_NTFS 18 /* Windows/NT file system */
#define FS_CCD 20 /* concatenated disk component */
#define FS_JFS2 21 /* IBM JFS2 */
+#define FS_HAMMER 22 /* DragonFlyBSD Hammer FS */
+#define FS_HAMMER2 23 /* DragonFlyBSD Hammer2 FS */
#define FS_UDF 24 /* UDF */
#define FS_EFS 26 /* SGI's Extent File system */
#define FS_ZFS 27 /* Sun's ZFS */
@@ -258,8 +261,8 @@
"?",
"ccd",
"jfs",
- "?",
- "?",
+ "HAMMER",
+ "HAMMER2",
"UDF",
"?",
"EFS",
@@ -282,15 +285,8 @@
#define D_CHAIN 0x10 /* can do back-back transfers */
/*
- * Disklabel-specific ioctls.
- *
* NB: <sys/disk.h> defines ioctls from 'd'/128 and up.
*/
- /* get and set disklabel */
-#define DIOCGDINFO _IOR('d', 101, struct disklabel)/* get */
-#define DIOCSDINFO _IOW('d', 102, struct disklabel)/* set */
-#define DIOCWDINFO _IOW('d', 103, struct disklabel)/* set, update disk */
-#define DIOCBSDBB _IOW('d', 110, void *) /* write bootblocks */
/*
* Functions for proper encoding/decoding of struct disklabel into/from
Modified: trunk/sys/sys/diskmbr.h
===================================================================
--- trunk/sys/sys/diskmbr.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/diskmbr.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1987, 1988, 1993
* The Regents of the University of California. All rights reserved.
@@ -27,7 +28,7 @@
* SUCH DAMAGE.
*
* @(#)disklabel.h 8.2 (Berkeley) 7/10/94
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/diskmbr.h 282861 2015-05-13 14:05:53Z ae $
*/
#ifndef _SYS_DISKMBR_H_
@@ -49,12 +50,15 @@
#define DOSPTYP_NTFS 0x07 /* NTFS partition */
#define DOSPTYP_FAT32 0x0b /* FAT32 partition */
#define DOSPTYP_EXTLBA 0x0f /* DOS extended partition */
+#define DOSPTYP_PPCBOOT 0x41 /* PReP/CHRP boot partition */
#define DOSPTYP_LDM 0x42 /* Win2k dynamic extended partition */
-#define DOSPTYP_386BSD 0xa5 /* 386BSD partition type */
-#define DOSPTYP_HFS 0xaf /* HFS/HFS+ partition type */
#define DOSPTYP_LINSWP 0x82 /* Linux swap partition */
#define DOSPTYP_LINUX 0x83 /* Linux partition */
#define DOSPTYP_LINLVM 0x8e /* Linux LVM partition */
+#define DOSPTYP_386BSD 0xa5 /* 386BSD partition type */
+#define DOSPTYP_APPLE_UFS 0xa8 /* Apple Mac OS X boot */
+#define DOSPTYP_APPLE_BOOT 0xab /* Apple Mac OS X UFS */
+#define DOSPTYP_HFS 0xaf /* HFS/HFS+ partition type */
#define DOSPTYP_PMBR 0xee /* GPT Protective MBR */
#define DOSPTYP_VMFS 0xfb /* VMware VMFS partition */
#define DOSPTYP_VMKDIAG 0xfc /* VMware vmkDiagnostic partition */
Modified: trunk/sys/sys/diskpc98.h
===================================================================
--- trunk/sys/sys/diskpc98.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/diskpc98.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1987, 1988, 1993
* The Regents of the University of California. All rights reserved.
@@ -27,7 +28,7 @@
* SUCH DAMAGE.
*
* @(#)disklabel.h 8.2 (Berkeley) 7/10/94
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/diskpc98.h 254015 2013-08-07 00:00:48Z marcel $
*/
#ifndef _SYS_DISKPC98_H_
@@ -35,15 +36,12 @@
#include <sys/ioccom.h>
-#define DOSBBSECTOR 0 /* DOS boot block relative sector number */
-#undef DOSPARTOFF
-#define DOSPARTOFF 0
-#undef DOSPARTSIZE
-#define DOSPARTSIZE 32
-#undef NDOSPART
-#define NDOSPART 16
-#define DOSMAGICOFFSET 510
-#define DOSMAGIC 0xAA55
+#define PC98_BBSECTOR 1 /* DOS boot block relative sector number */
+#define PC98_PARTOFF 0
+#define PC98_PARTSIZE 32
+#define PC98_NPARTS 16
+#define PC98_MAGICOFS 510
+#define PC98_MAGIC 0xAA55
#define PC98_MID_BOOTABLE 0x80
#define PC98_MID_MASK 0x7f
@@ -55,8 +53,7 @@
#define DOSMID_386BSD (PC98_MID_386BSD | PC98_MID_BOOTABLE)
#define DOSSID_386BSD (PC98_SID_386BSD | PC98_SID_ACTIVE)
-#undef DOSPTYP_386BSD
-#define DOSPTYP_386BSD (DOSSID_386BSD << 8 | DOSMID_386BSD)
+#define PC98_PTYP_386BSD (DOSSID_386BSD << 8 | DOSMID_386BSD)
struct pc98_partition {
unsigned char dp_mid;
@@ -75,7 +72,7 @@
unsigned char dp_name[16];
};
#ifdef CTASSERT
-CTASSERT(sizeof (struct pc98_partition) == DOSPARTSIZE);
+CTASSERT(sizeof (struct pc98_partition) == PC98_PARTSIZE);
#endif
void pc98_partition_dec(void const *pp, struct pc98_partition *d);
Added: trunk/sys/sys/dnv.h
===================================================================
--- trunk/sys/sys/dnv.h (rev 0)
+++ trunk/sys/sys/dnv.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -0,0 +1,117 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2013 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Pawel Jakub Dawidek under sponsorship from
+ * the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: stable/10/sys/sys/dnv.h 292973 2015-12-31 03:28:14Z ngie $
+ */
+
+#ifndef _DNV_H_
+#define _DNV_H_
+
+#include <sys/cdefs.h>
+
+#ifndef _KERNEL
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#endif
+
+#ifndef _NVLIST_T_DECLARED
+#define _NVLIST_T_DECLARED
+struct nvlist;
+
+typedef struct nvlist nvlist_t;
+#endif
+
+__BEGIN_DECLS
+
+/*
+ * The dnvlist_get functions returns value associated with the given name.
+ * If it returns a pointer, the pointer represents internal buffer and should
+ * not be freed by the caller.
+ * If no element of the given name and type exists, the function will return
+ * provided default value.
+ */
+
+bool dnvlist_get_bool(const nvlist_t *nvl, const char *name, bool defval);
+uint64_t dnvlist_get_number(const nvlist_t *nvl, const char *name, uint64_t defval);
+const char *dnvlist_get_string(const nvlist_t *nvl, const char *name, const char *defval);
+const nvlist_t *dnvlist_get_nvlist(const nvlist_t *nvl, const char *name, const nvlist_t *defval);
+int dnvlist_get_descriptor(const nvlist_t *nvl, const char *name, int defval);
+const void *dnvlist_get_binary(const nvlist_t *nvl, const char *name, size_t *sizep, const void *defval, size_t defsize);
+
+#ifndef _KERNEL
+bool dnvlist_getf_bool(const nvlist_t *nvl, bool defval, const char *namefmt, ...) __printflike(3, 4);
+uint64_t dnvlist_getf_number(const nvlist_t *nvl, uint64_t defval, const char *namefmt, ...) __printflike(3, 4);
+const char *dnvlist_getf_string(const nvlist_t *nvl, const char *defval, const char *namefmt, ...) __printflike(3, 4);
+const nvlist_t *dnvlist_getf_nvlist(const nvlist_t *nvl, const nvlist_t *defval, const char *namefmt, ...) __printflike(3, 4);
+int dnvlist_getf_descriptor(const nvlist_t *nvl, int defval, const char *namefmt, ...) __printflike(3, 4);
+const void *dnvlist_getf_binary(const nvlist_t *nvl, size_t *sizep, const void *defval, size_t defsize, const char *namefmt, ...) __printflike(5, 6);
+
+bool dnvlist_getv_bool(const nvlist_t *nvl, bool defval, const char *namefmt, va_list nameap) __printflike(3, 0);
+uint64_t dnvlist_getv_number(const nvlist_t *nvl, uint64_t defval, const char *namefmt, va_list nameap) __printflike(3, 0);
+const char *dnvlist_getv_string(const nvlist_t *nvl, const char *defval, const char *namefmt, va_list nameap) __printflike(3, 0);
+const nvlist_t *dnvlist_getv_nvlist(const nvlist_t *nvl, const nvlist_t *defval, const char *namefmt, va_list nameap) __printflike(3, 0);
+int dnvlist_getv_descriptor(const nvlist_t *nvl, int defval, const char *namefmt, va_list nameap) __printflike(3, 0);
+const void *dnvlist_getv_binary(const nvlist_t *nvl, size_t *sizep, const void *defval, size_t defsize, const char *namefmt, va_list nameap) __printflike(5, 0);
+#endif
+
+/*
+ * The dnvlist_take functions returns value associated with the given name and
+ * remove corresponding nvpair.
+ * If it returns a pointer, the caller has to free it.
+ * If no element of the given name and type exists, the function will return
+ * provided default value.
+ */
+
+bool dnvlist_take_bool(nvlist_t *nvl, const char *name, bool defval);
+uint64_t dnvlist_take_number(nvlist_t *nvl, const char *name, uint64_t defval);
+char *dnvlist_take_string(nvlist_t *nvl, const char *name, char *defval);
+nvlist_t *dnvlist_take_nvlist(nvlist_t *nvl, const char *name, nvlist_t *defval);
+int dnvlist_take_descriptor(nvlist_t *nvl, const char *name, int defval);
+void *dnvlist_take_binary(nvlist_t *nvl, const char *name, size_t *sizep, void *defval, size_t defsize);
+
+#ifndef _KERNEL
+bool dnvlist_takef_bool(nvlist_t *nvl, bool defval, const char *namefmt, ...) __printflike(3, 4);
+uint64_t dnvlist_takef_number(nvlist_t *nvl, uint64_t defval, const char *namefmt, ...) __printflike(3, 4);
+char *dnvlist_takef_string(nvlist_t *nvl, char *defval, const char *namefmt, ...) __printflike(3, 4);
+nvlist_t *dnvlist_takef_nvlist(nvlist_t *nvl, nvlist_t *defval, const char *namefmt, ...) __printflike(3, 4);
+int dnvlist_takef_descriptor(nvlist_t *nvl, int defval, const char *namefmt, ...) __printflike(3, 4);
+void *dnvlist_takef_binary(nvlist_t *nvl, size_t *sizep, void *defval, size_t defsize, const char *namefmt, ...) __printflike(5, 6);
+
+bool dnvlist_takev_bool(nvlist_t *nvl, bool defval, const char *namefmt, va_list nameap) __printflike(3, 0);
+uint64_t dnvlist_takev_number(nvlist_t *nvl, uint64_t defval, const char *namefmt, va_list nameap) __printflike(3, 0);
+char *dnvlist_takev_string(nvlist_t *nvl, char *defval, const char *namefmt, va_list nameap) __printflike(3, 0);
+nvlist_t *dnvlist_takev_nvlist(nvlist_t *nvl, nvlist_t *defval, const char *namefmt, va_list nameap) __printflike(3, 0);
+int dnvlist_takev_descriptor(nvlist_t *nvl, int defval, const char *namefmt, va_list nameap) __printflike(3, 0);
+void *dnvlist_takev_binary(nvlist_t *nvl, size_t *sizep, void *defval, size_t defsize, const char *namefmt, va_list nameap) __printflike(5, 0);
+#endif
+
+__END_DECLS
+
+#endif /* !_DNV_H_ */
Property changes on: trunk/sys/sys/dnv.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/sys/sys/domain.h
===================================================================
--- trunk/sys/sys/domain.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/domain.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
@@ -27,7 +28,7 @@
* SUCH DAMAGE.
*
* @(#)domain.h 8.1 (Berkeley) 6/2/93
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/domain.h 305261 2016-09-02 00:14:28Z markj $
*/
#ifndef _SYS_DOMAIN_H_
@@ -42,6 +43,7 @@
*/
struct mbuf;
struct ifnet;
+struct socket;
struct domain {
int dom_family; /* AF_xxx */
@@ -51,7 +53,7 @@
void (*dom_destroy) /* cleanup structures / state */
(void);
int (*dom_externalize) /* externalize access rights */
- (struct mbuf *, struct mbuf **);
+ (struct mbuf *, struct mbuf **, int);
void (*dom_dispose) /* dispose of internalized rights */
(struct mbuf *);
struct protosw *dom_protosw, *dom_protoswNPROTOSW;
@@ -78,6 +80,9 @@
extern struct domain *domains;
void domain_add(void *);
void domain_init(void *);
+
+/* Hack to fix dom_dispose for unix domain sockets. */
+void unp_dispose_so(struct socket *);
#ifdef VIMAGE
void vnet_domain_init(void *);
void vnet_domain_uninit(void *);
Modified: trunk/sys/sys/dtrace_bsd.h
===================================================================
--- trunk/sys/sys/dtrace_bsd.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/dtrace_bsd.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2007-2008 John Birrell (jb at freebsd.org)
* All rights reserved.
@@ -23,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/dtrace_bsd.h 282748 2015-05-11 07:54:39Z avg $
*
* This file contains BSD shims for Sun's DTrace code.
*/
@@ -42,15 +43,6 @@
struct bio;
/*
- * Cyclic clock function type definition used to hook the cyclic
- * subsystem into the appropriate timer interrupt.
- */
-typedef void (*cyclic_clock_func_t)(struct trapframe *);
-extern cyclic_clock_func_t cyclic_clock_func;
-
-void clocksource_cyc_set(const struct bintime *t);
-
-/*
* The dtrace module handles traps that occur during a DTrace probe.
* This type definition is used in the trap handler to provide a
* hook for the dtrace module to register it's handler with.
@@ -61,17 +53,17 @@
extern dtrace_trap_func_t dtrace_trap_func;
-/* Used by the machine dependent trap() code. */
+/*
+ * A hook which removes active FBT probes before executing the double fault
+ * handler. We want to ensure that DTrace doesn't trigger another trap, which
+ * would result in a reset.
+ */
typedef int (*dtrace_invop_func_t)(uintptr_t, uintptr_t *, uintptr_t);
typedef void (*dtrace_doubletrap_func_t)(void);
-
-/* Global variables in trap.c */
extern dtrace_invop_func_t dtrace_invop_func;
extern dtrace_doubletrap_func_t dtrace_doubletrap_func;
/* Pid provider hooks */
-typedef int (*dtrace_fasttrap_probe_ptr_t)(struct reg *);
-extern dtrace_fasttrap_probe_ptr_t dtrace_fasttrap_probe_ptr;
typedef int (*dtrace_pid_probe_ptr_t)(struct reg *);
extern dtrace_pid_probe_ptr_t dtrace_pid_probe_ptr;
typedef int (*dtrace_return_probe_ptr_t)(struct reg *);
Modified: trunk/sys/sys/dvdio.h
===================================================================
--- trunk/sys/sys/dvdio.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/dvdio.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,5 +1,6 @@
+/* $MidnightBSD$ */
/*-
- * Copyright (c) 1999,2000,2001,2002 S\xF8ren Schmidt <sos at FreeBSD.org>
+ * Copyright (c) 1999,2000,2001,2002 Søren Schmidt <sos at FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -25,7 +26,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/dvdio.h 230132 2012-01-15 13:23:18Z uqs $
*/
#ifndef _SYS_DVDIO_H_
Added: trunk/sys/sys/efi.h
===================================================================
--- trunk/sys/sys/efi.h (rev 0)
+++ trunk/sys/sys/efi.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -0,0 +1,178 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2004 Marcel Moolenaar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD: stable/10/sys/sys/efi.h 270296 2014-08-21 19:51:07Z emaste $
+ */
+
+#ifndef _SYS_EFI_H_
+#define _SYS_EFI_H_
+
+#include <sys/uuid.h>
+
+#define EFI_PAGE_SHIFT 12
+#define EFI_PAGE_SIZE (1 << EFI_PAGE_SHIFT)
+#define EFI_PAGE_MASK (EFI_PAGE_SIZE - 1)
+
+#define EFI_TABLE_ACPI20 \
+ {0x8868e871,0xe4f1,0x11d3,0xbc,0x22,{0x00,0x80,0xc7,0x3c,0x88,0x81}}
+#define EFI_TABLE_SAL \
+ {0xeb9d2d32,0x2d88,0x11d3,0x9a,0x16,{0x00,0x90,0x27,0x3f,0xc1,0x4d}}
+
+enum efi_reset {
+ EFI_RESET_COLD,
+ EFI_RESET_WARM
+};
+
+typedef uint16_t efi_char;
+typedef unsigned long efi_status;
+
+struct efi_cfgtbl {
+ struct uuid ct_uuid;
+ uint64_t ct_data;
+};
+
+struct efi_md {
+ uint32_t md_type;
+#define EFI_MD_TYPE_NULL 0
+#define EFI_MD_TYPE_CODE 1 /* Loader text. */
+#define EFI_MD_TYPE_DATA 2 /* Loader data. */
+#define EFI_MD_TYPE_BS_CODE 3 /* Boot services text. */
+#define EFI_MD_TYPE_BS_DATA 4 /* Boot services data. */
+#define EFI_MD_TYPE_RT_CODE 5 /* Runtime services text. */
+#define EFI_MD_TYPE_RT_DATA 6 /* Runtime services data. */
+#define EFI_MD_TYPE_FREE 7 /* Unused/free memory. */
+#define EFI_MD_TYPE_BAD 8 /* Bad memory */
+#define EFI_MD_TYPE_RECLAIM 9 /* ACPI reclaimable memory. */
+#define EFI_MD_TYPE_FIRMWARE 10 /* ACPI NV memory */
+#define EFI_MD_TYPE_IOMEM 11 /* Memory-mapped I/O. */
+#define EFI_MD_TYPE_IOPORT 12 /* I/O port space. */
+#define EFI_MD_TYPE_PALCODE 13 /* PAL */
+ uint32_t __pad;
+ uint64_t md_phys;
+ void *md_virt;
+ uint64_t md_pages;
+ uint64_t md_attr;
+#define EFI_MD_ATTR_UC 0x0000000000000001UL
+#define EFI_MD_ATTR_WC 0x0000000000000002UL
+#define EFI_MD_ATTR_WT 0x0000000000000004UL
+#define EFI_MD_ATTR_WB 0x0000000000000008UL
+#define EFI_MD_ATTR_UCE 0x0000000000000010UL
+#define EFI_MD_ATTR_WP 0x0000000000001000UL
+#define EFI_MD_ATTR_RP 0x0000000000002000UL
+#define EFI_MD_ATTR_XP 0x0000000000004000UL
+#define EFI_MD_ATTR_RT 0x8000000000000000UL
+};
+
+struct efi_tm {
+ uint16_t tm_year; /* 1998 - 20XX */
+ uint8_t tm_mon; /* 1 - 12 */
+ uint8_t tm_mday; /* 1 - 31 */
+ uint8_t tm_hour; /* 0 - 23 */
+ uint8_t tm_min; /* 0 - 59 */
+ uint8_t tm_sec; /* 0 - 59 */
+ uint8_t __pad1;
+ uint32_t tm_nsec; /* 0 - 999,999,999 */
+ int16_t tm_tz; /* -1440 to 1440 or 2047 */
+ uint8_t tm_dst;
+ uint8_t __pad2;
+};
+
+struct efi_tmcap {
+ uint32_t tc_res; /* 1e-6 parts per million */
+ uint32_t tc_prec; /* hertz */
+ uint8_t tc_stz; /* Set clears sub-second time */
+};
+
+struct efi_tblhdr {
+ uint64_t th_sig;
+ uint32_t th_rev;
+ uint32_t th_hdrsz;
+ uint32_t th_crc32;
+ uint32_t __res;
+};
+
+struct efi_rt {
+ struct efi_tblhdr rt_hdr;
+ efi_status (*rt_gettime)(struct efi_tm *, struct efi_tmcap *);
+ efi_status (*rt_settime)(struct efi_tm *);
+ efi_status (*rt_getwaketime)(uint8_t *, uint8_t *,
+ struct efi_tm *);
+ efi_status (*rt_setwaketime)(uint8_t, struct efi_tm *);
+ efi_status (*rt_setvirtual)(u_long, u_long, uint32_t,
+ struct efi_md *);
+ efi_status (*rt_cvtptr)(u_long, void **);
+ efi_status (*rt_getvar)(efi_char *, struct uuid *, uint32_t *,
+ u_long *, void *);
+ efi_status (*rt_scanvar)(u_long *, efi_char *, struct uuid *);
+ efi_status (*rt_setvar)(efi_char *, struct uuid *, uint32_t,
+ u_long, void *);
+ efi_status (*rt_gethicnt)(uint32_t *);
+ efi_status (*rt_reset)(enum efi_reset, efi_status, u_long,
+ efi_char *);
+};
+
+struct efi_systbl {
+ struct efi_tblhdr st_hdr;
+#define EFI_SYSTBL_SIG 0x5453595320494249UL
+ efi_char *st_fwvendor;
+ uint32_t st_fwrev;
+ uint32_t __pad;
+ void *st_cin;
+ void *st_cinif;
+ void *st_cout;
+ void *st_coutif;
+ void *st_cerr;
+ void *st_cerrif;
+ uint64_t st_rt;
+ void *st_bs;
+ u_long st_entries;
+ uint64_t st_cfgtbl;
+};
+
+#if defined(_KERNEL) && defined(__ia64__)
+
+typedef u_long (*ia64_efi_f)(u_long, u_long, u_long, u_long);
+
+u_long ia64_efi_physical(ia64_efi_f, u_long, u_long, u_long, u_long);
+
+void efi_boot_finish(void);
+int efi_boot_minimal(uint64_t);
+void *efi_get_table(struct uuid *);
+void efi_get_time(struct efi_tm *);
+struct efi_md *efi_md_find(vm_paddr_t);
+struct efi_md *efi_md_first(void);
+struct efi_md *efi_md_last(void);
+struct efi_md *efi_md_next(struct efi_md *);
+struct efi_md *efi_md_prev(struct efi_md *);
+void efi_reset_system(void);
+int efi_set_time(struct efi_tm *);
+int efi_var_get(efi_char *, struct uuid *, uint32_t *, size_t *, void *);
+int efi_var_nextname(size_t *, efi_char *, struct uuid *);
+int efi_var_set(efi_char *, struct uuid *, uint32_t, size_t, void *);
+
+#endif /* _KERNEL && __ia64__ */
+
+#endif /* _SYS_EFI_H_ */
Property changes on: trunk/sys/sys/efi.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/sys/sys/elf32.h
===================================================================
--- trunk/sys/sys/elf32.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/elf32.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -24,6 +24,7 @@
* SUCH DAMAGE.
*
* $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/elf32.h 294459 2016-01-20 21:06:24Z emaste $
*/
#ifndef _SYS_ELF32_H_
@@ -70,6 +71,18 @@
} Elf32_Ehdr;
/*
+ * Shared object information, found in SHT_MIPS_LIBLIST.
+ */
+
+typedef struct {
+ Elf32_Word l_name; /* The name of a shared object. */
+ Elf32_Word l_time_stamp; /* 32-bit timestamp. */
+ Elf32_Word l_checksum; /* Checksum of visible symbols, sizes. */
+ Elf32_Word l_version; /* Interface version string index. */
+ Elf32_Word l_flags; /* Flags (LL_*). */
+} Elf32_Lib;
+
+/*
* Section header.
*/
Modified: trunk/sys/sys/elf64.h
===================================================================
--- trunk/sys/sys/elf64.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/elf64.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1996-1998 John D. Polstra.
* All rights reserved.
@@ -23,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/elf64.h 294459 2016-01-20 21:06:24Z emaste $
*/
#ifndef _SYS_ELF64_H_
@@ -79,6 +80,18 @@
} Elf64_Ehdr;
/*
+ * Shared object information, found in SHT_MIPS_LIBLIST.
+ */
+
+typedef struct {
+ Elf64_Word l_name; /* The name of a shared object. */
+ Elf64_Word l_time_stamp; /* 64-bit timestamp. */
+ Elf64_Word l_checksum; /* Checksum of visible symbols, sizes. */
+ Elf64_Word l_version; /* Interface version string index. */
+ Elf64_Word l_flags; /* Flags (LL_*). */
+} Elf64_Lib;
+
+/*
* Section header.
*/
Modified: trunk/sys/sys/elf_common.h
===================================================================
--- trunk/sys/sys/elf_common.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/elf_common.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2000, 2001, 2008, 2011, David E. O'Brien
* Copyright (c) 1998 John D. Polstra.
@@ -24,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/elf_common.h 302002 2016-06-18 01:23:38Z emaste $
*/
#ifndef _SYS_ELF_COMMON_H_
@@ -50,6 +51,61 @@
} Elf_Note;
/*
+ * Option kinds.
+ */
+#define ODK_NULL 0 /* undefined */
+#define ODK_REGINFO 1 /* register usage info */
+#define ODK_EXCEPTIONS 2 /* exception processing info */
+#define ODK_PAD 3 /* section padding */
+#define ODK_HWPATCH 4 /* hardware patch applied */
+#define ODK_FILL 5 /* fill value used by the linker */
+#define ODK_TAGS 6 /* reserved space for tools */
+#define ODK_HWAND 7 /* hardware AND patch applied */
+#define ODK_HWOR 8 /* hardware OR patch applied */
+#define ODK_GP_GROUP 9 /* GP group for text/data sections */
+#define ODK_IDENT 10 /* ID information */
+#define ODK_PAGESIZE 11 /* page size information */
+
+/*
+ * ODK_EXCEPTIONS info field masks.
+ */
+#define OEX_FPU_MIN 0x0000001f /* min FPU exception required */
+#define OEX_FPU_MAX 0x00001f00 /* max FPU exception allowed */
+#define OEX_PAGE0 0x00010000 /* page zero must be mapped */
+#define OEX_SMM 0x00020000 /* run in sequential memory mode */
+#define OEX_PRECISEFP 0x00040000 /* run in precise FP exception mode */
+#define OEX_DISMISS 0x00080000 /* dismiss invalid address traps */
+
+/*
+ * ODK_PAD info field masks.
+ */
+#define OPAD_PREFIX 0x0001
+#define OPAD_POSTFIX 0x0002
+#define OPAD_SYMBOL 0x0004
+
+/*
+ * ODK_HWPATCH info field masks.
+ */
+#define OHW_R4KEOP 0x00000001 /* patch for R4000 branch at end-of-page bug */
+#define OHW_R8KPFETCH 0x00000002 /* R8000 prefetch bug may occur */
+#define OHW_R5KEOP 0x00000004 /* patch for R5000 branch at end-of-page bug */
+#define OHW_R5KCVTL 0x00000008 /* R5000 cvt.[ds].l bug: clean == 1 */
+#define OHW_R10KLDL 0x00000010UL /* need patch for R10000 misaligned load */
+
+/*
+ * ODK_HWAND/ODK_HWOR info field and hwp_flags[12] masks.
+ */
+#define OHWA0_R4KEOP_CHECKED 0x00000001 /* object checked for R4000 end-of-page bug */
+#define OHWA0_R4KEOP_CLEAN 0x00000002 /* object verified clean for R4000 end-of-page bug */
+#define OHWO0_FIXADE 0x00000001 /* object requires call to fixade */
+
+/*
+ * ODK_IDENT/ODK_GP_GROUP info field masks.
+ */
+#define OGP_GROUP 0x0000ffff /* GP group number */
+#define OGP_SELF 0x00010000 /* GP group is self-contained */
+
+/*
* The header for GNU-style hash sections.
*/
@@ -114,11 +170,14 @@
#define ELFOSABI_OPENVMS 13 /* Open VMS */
#define ELFOSABI_NSK 14 /* HP Non-Stop Kernel */
#define ELFOSABI_AROS 15 /* Amiga Research OS */
+#define ELFOSABI_FENIXOS 16 /* FenixOS */
+#define ELFOSABI_CLOUDABI 17 /* Nuxi CloudABI */
#define ELFOSABI_ARM 97 /* ARM */
#define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */
#define ELFOSABI_SYSV ELFOSABI_NONE /* symbol used in old spec */
#define ELFOSABI_MONTEREY ELFOSABI_AIX /* Monterey */
+#define ELFOSABI_GNU ELFOSABI_LINUX
/* e_ident */
#define IS_ELF(ehdr) ((ehdr).e_ident[EI_MAG0] == ELFMAG0 && \
@@ -144,6 +203,7 @@
#define EM_386 3 /* Intel i386. */
#define EM_68K 4 /* Motorola 68000. */
#define EM_88K 5 /* Motorola 88000. */
+#define EM_IAMCU 6 /* Intel MCU. */
#define EM_860 7 /* Intel i860. */
#define EM_MIPS 8 /* MIPS R3000 Big-Endian only. */
#define EM_S370 9 /* IBM System/370. */
@@ -237,6 +297,8 @@
#define EM_ARCA 109 /* Arca RISC Microprocessor. */
#define EM_UNICORE 110 /* Microprocessor series from PKU-Unity Ltd.
and MPRC of Peking University */
+#define EM_AARCH64 183 /* AArch64 (64-bit ARM) */
+#define EM_RISCV 243 /* RISC-V */
/* Non-standard or deprecated. */
#define EM_486 6 /* Intel i486. */
@@ -244,6 +306,60 @@
#define EM_ALPHA_STD 41 /* Digital Alpha (standard value). */
#define EM_ALPHA 0x9026 /* Alpha (written in the absence of an ABI) */
+/**
+ * e_flags
+ */
+#define EF_ARM_RELEXEC 0x1
+#define EF_ARM_HASENTRY 0x2
+#define EF_ARM_SYMSARESORTED 0x4
+#define EF_ARM_DYNSYMSUSESEGIDX 0x8
+#define EF_ARM_MAPSYMSFIRST 0x10
+#define EF_ARM_LE8 0x00400000
+#define EF_ARM_BE8 0x00800000
+#define EF_ARM_EABIMASK 0xFF000000
+#define EF_ARM_EABI_UNKNOWN 0x00000000
+#define EF_ARM_EABI_VER1 0x01000000
+#define EF_ARM_EABI_VER2 0x02000000
+#define EF_ARM_EABI_VER3 0x03000000
+#define EF_ARM_EABI_VER4 0x04000000
+#define EF_ARM_EABI_VER5 0x05000000
+#define EF_ARM_INTERWORK 0x00000004
+#define EF_ARM_APCS_26 0x00000008
+#define EF_ARM_APCS_FLOAT 0x00000010
+#define EF_ARM_PIC 0x00000020
+#define EF_ARM_ALIGN8 0x00000040
+#define EF_ARM_NEW_ABI 0x00000080
+#define EF_ARM_OLD_ABI 0x00000100
+#define EF_ARM_SOFT_FLOAT 0x00000200
+#define EF_ARM_VFP_FLOAT 0x00000400
+#define EF_ARM_MAVERICK_FLOAT 0x00000800
+
+#define EF_MIPS_NOREORDER 0x00000001
+#define EF_MIPS_PIC 0x00000002 /* Contains PIC code */
+#define EF_MIPS_CPIC 0x00000004 /* STD PIC calling sequence */
+#define EF_MIPS_UCODE 0x00000010
+#define EF_MIPS_ABI2 0x00000020 /* N32 */
+#define EF_MIPS_OPTIONS_FIRST 0x00000080
+#define EF_MIPS_ARCH_ASE 0x0F000000 /* Architectural extensions */
+#define EF_MIPS_ARCH_ASE_MDMX 0x08000000 /* MDMX multimedia extension */
+#define EF_MIPS_ARCH_ASE_M16 0x04000000 /* MIPS-16 ISA extensions */
+#define EF_MIPS_ARCH 0xF0000000 /* Architecture field */
+
+#define EF_PPC_EMB 0x80000000
+#define EF_PPC_RELOCATABLE 0x00010000
+#define EF_PPC_RELOCATABLE_LIB 0x00008000
+
+#define EF_SPARC_EXT_MASK 0x00ffff00
+#define EF_SPARC_32PLUS 0x00000100
+#define EF_SPARC_SUN_US1 0x00000200
+#define EF_SPARC_HAL_R1 0x00000200
+#define EF_SPARC_SUN_US3 0x00000800
+
+#define EF_SPARCV9_MM 0x00000003
+#define EF_SPARCV9_TSO 0x00000000
+#define EF_SPARCV9_PSO 0x00000001
+#define EF_SPARCV9_RMO 0x00000002
+
/* Special section indexes. */
#define SHN_UNDEF 0 /* Undefined, missing, irrelevant. */
#define SHN_LORESERVE 0xff00 /* First of reserved range. */
@@ -250,6 +366,9 @@
#define SHN_LOPROC 0xff00 /* First processor-specific. */
#define SHN_HIPROC 0xff1f /* Last processor-specific. */
#define SHN_LOOS 0xff20 /* First operating system-specific. */
+#define SHN_FBSD_CACHED SHN_LOOS /* Transient, for sys/kern/link_elf_obj
+ linker only: Cached global in local
+ symtab. */
#define SHN_HIOS 0xff3f /* Last operating system-specific. */
#define SHN_ABS 0xfff1 /* Absolute values. */
#define SHN_COMMON 0xfff2 /* Common data. */
@@ -278,8 +397,10 @@
#define SHT_LOSUNW 0x6ffffff4
#define SHT_SUNW_dof 0x6ffffff4
#define SHT_SUNW_cap 0x6ffffff5
+#define SHT_GNU_ATTRIBUTES 0x6ffffff5
#define SHT_SUNW_SIGNATURE 0x6ffffff6
#define SHT_GNU_HASH 0x6ffffff6
+#define SHT_GNU_LIBLIST 0x6ffffff7
#define SHT_SUNW_ANNOTATE 0x6ffffff7
#define SHT_SUNW_DEBUGSTR 0x6ffffff8
#define SHT_SUNW_DEBUG 0x6ffffff9
@@ -296,7 +417,47 @@
#define SHT_HIOS 0x6fffffff /* Last of OS specific semantics */
#define SHT_LOPROC 0x70000000 /* reserved range for processor */
#define SHT_AMD64_UNWIND 0x70000001 /* unwind information */
+
+#define SHT_ARM_EXIDX 0x70000001 /* Exception index table. */
+#define SHT_ARM_PREEMPTMAP 0x70000002 /* BPABI DLL dynamic linking
+ pre-emption map. */
+#define SHT_ARM_ATTRIBUTES 0x70000003 /* Object file compatibility
+ attributes. */
+#define SHT_ARM_DEBUGOVERLAY 0x70000004 /* See DBGOVL for details. */
+#define SHT_ARM_OVERLAYSECTION 0x70000005 /* See DBGOVL for details. */
+#define SHT_MIPS_LIBLIST 0x70000000
+#define SHT_MIPS_MSYM 0x70000001
+#define SHT_MIPS_CONFLICT 0x70000002
+#define SHT_MIPS_GPTAB 0x70000003
+#define SHT_MIPS_UCODE 0x70000004
+#define SHT_MIPS_DEBUG 0x70000005
+#define SHT_MIPS_REGINFO 0x70000006
+#define SHT_MIPS_PACKAGE 0x70000007
+#define SHT_MIPS_PACKSYM 0x70000008
+#define SHT_MIPS_RELD 0x70000009
+#define SHT_MIPS_IFACE 0x7000000b
+#define SHT_MIPS_CONTENT 0x7000000c
+#define SHT_MIPS_OPTIONS 0x7000000d
+#define SHT_MIPS_DELTASYM 0x7000001b
+#define SHT_MIPS_DELTAINST 0x7000001c
+#define SHT_MIPS_DELTACLASS 0x7000001d
#define SHT_MIPS_DWARF 0x7000001e /* MIPS gcc uses MIPS_DWARF */
+#define SHT_MIPS_DELTADECL 0x7000001f
+#define SHT_MIPS_SYMBOL_LIB 0x70000020
+#define SHT_MIPS_EVENTS 0x70000021
+#define SHT_MIPS_TRANSLATE 0x70000022
+#define SHT_MIPS_PIXIE 0x70000023
+#define SHT_MIPS_XLATE 0x70000024
+#define SHT_MIPS_XLATE_DEBUG 0x70000025
+#define SHT_MIPS_WHIRL 0x70000026
+#define SHT_MIPS_EH_REGION 0x70000027
+#define SHT_MIPS_XLATE_OLD 0x70000028
+#define SHT_MIPS_PDR_EXCEPTION 0x70000029
+#define SHT_MIPS_ABIFLAGS 0x7000002a
+
+#define SHT_SPARC_GOTDATA 0x70000000
+
+#define SHTORDERED
#define SHT_HIPROC 0x7fffffff /* specific section header types */
#define SHT_LOUSER 0x80000000 /* reserved range for application */
#define SHT_HIUSER 0xffffffff /* specific indexes */
@@ -312,9 +473,19 @@
#define SHF_OS_NONCONFORMING 0x100 /* OS-specific processing required. */
#define SHF_GROUP 0x200 /* Member of section group. */
#define SHF_TLS 0x400 /* Section contains TLS data. */
+#define SHF_COMPRESSED 0x800 /* Section contains compressed data. */
#define SHF_MASKOS 0x0ff00000 /* OS-specific semantics. */
#define SHF_MASKPROC 0xf0000000 /* Processor-specific semantics. */
+/* Flags for section groups. */
+#define GRP_COMDAT 0x1 /* COMDAT semantics. */
+
+/*
+ * Flags / mask for .gnu.versym sections.
+ */
+#define VERSYM_VERSION 0x7fff
+#define VERSYM_HIDDEN 0x8000
+
/* Values for p_type. */
#define PT_NULL 0 /* Unused entry. */
#define PT_LOAD 1 /* Loadable segment. */
@@ -329,6 +500,8 @@
#define PT_GNU_EH_FRAME 0x6474e550
#define PT_GNU_STACK 0x6474e551
#define PT_GNU_RELRO 0x6474e552
+#define PT_DUMP_DELTA 0x6fb5d000 /* va->pa map for kernel dumps
+ (currently arm). */
#define PT_LOSUNW 0x6ffffffa
#define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */
#define PT_SUNWSTACK 0x6ffffffb /* describes the stack segment */
@@ -411,11 +584,15 @@
* Dyn.d_un.d_val field of the Elf*_Dyn structure.
*/
#define DT_VALRNGLO 0x6ffffd00
+#define DT_GNU_PRELINKED 0x6ffffdf5 /* prelinking timestamp */
+#define DT_GNU_CONFLICTSZ 0x6ffffdf6 /* size of conflict section */
+#define DT_GNU_LIBLISTSZ 0x6ffffdf7 /* size of library list */
#define DT_CHECKSUM 0x6ffffdf8 /* elf checksum */
#define DT_PLTPADSZ 0x6ffffdf9 /* pltpadding size */
#define DT_MOVEENT 0x6ffffdfa /* move table entry size */
#define DT_MOVESZ 0x6ffffdfb /* move table size */
-#define DT_FEATURE_1 0x6ffffdfc /* feature holder */
+#define DT_FEATURE 0x6ffffdfc /* feature holder */
+#define DT_FEATURE_1 DT_FEATURE
#define DT_POSFLAG_1 0x6ffffdfd /* flags for DT_* entries, effecting */
/* the following DT_* entry. */
/* See DF_P1_* definitions */
@@ -432,6 +609,10 @@
*/
#define DT_ADDRRNGLO 0x6ffffe00
#define DT_GNU_HASH 0x6ffffef5 /* GNU-style hash table */
+#define DT_TLSDESC_PLT 0x6ffffef6 /* loc. of PLT for tlsdesc resolver */
+#define DT_TLSDESC_GOT 0x6ffffef7 /* loc. of GOT for tlsdesc resolver */
+#define DT_GNU_CONFLICT 0x6ffffef8 /* address of conflict section */
+#define DT_GNU_LIBLIST 0x6ffffef9 /* address of library list */
#define DT_CONFIG 0x6ffffefa /* configuration information */
#define DT_DEPAUDIT 0x6ffffefb /* dependency auditing */
#define DT_AUDIT 0x6ffffefc /* object auditing */
@@ -450,7 +631,67 @@
#define DT_VERNEEDNUM 0x6fffffff /* Number of elems in verneed section */
#define DT_LOPROC 0x70000000 /* First processor-specific type. */
+
+#define DT_ARM_SYMTABSZ 0x70000001
+#define DT_ARM_PREEMPTMAP 0x70000002
+
+#define DT_SPARC_REGISTER 0x70000001
#define DT_DEPRECATED_SPARC_REGISTER 0x7000001
+
+#define DT_MIPS_RLD_VERSION 0x70000001
+#define DT_MIPS_TIME_STAMP 0x70000002
+#define DT_MIPS_ICHECKSUM 0x70000003
+#define DT_MIPS_IVERSION 0x70000004
+#define DT_MIPS_FLAGS 0x70000005
+#define DT_MIPS_BASE_ADDRESS 0x70000006
+#define DT_MIPS_CONFLICT 0x70000008
+#define DT_MIPS_LIBLIST 0x70000009
+#define DT_MIPS_LOCAL_GOTNO 0x7000000a
+#define DT_MIPS_CONFLICTNO 0x7000000b
+#define DT_MIPS_LIBLISTNO 0x70000010
+#define DT_MIPS_SYMTABNO 0x70000011
+#define DT_MIPS_UNREFEXTNO 0x70000012
+#define DT_MIPS_GOTSYM 0x70000013
+#define DT_MIPS_HIPAGENO 0x70000014
+#define DT_MIPS_RLD_MAP 0x70000016
+#define DT_MIPS_DELTA_CLASS 0x70000017
+#define DT_MIPS_DELTA_CLASS_NO 0x70000018
+#define DT_MIPS_DELTA_INSTANCE 0x70000019
+#define DT_MIPS_DELTA_INSTANCE_NO 0x7000001A
+#define DT_MIPS_DELTA_RELOC 0x7000001B
+#define DT_MIPS_DELTA_RELOC_NO 0x7000001C
+#define DT_MIPS_DELTA_SYM 0x7000001D
+#define DT_MIPS_DELTA_SYM_NO 0x7000001E
+#define DT_MIPS_DELTA_CLASSSYM 0x70000020
+#define DT_MIPS_DELTA_CLASSSYM_NO 0x70000021
+#define DT_MIPS_CXX_FLAGS 0x70000022
+#define DT_MIPS_PIXIE_INIT 0x70000023
+#define DT_MIPS_SYMBOL_LIB 0x70000024
+#define DT_MIPS_LOCALPAGE_GOTIDX 0x70000025
+#define DT_MIPS_LOCAL_GOTIDX 0x70000026
+#define DT_MIPS_HIDDEN_GOTIDX 0x70000027
+#define DT_MIPS_PROTECTED_GOTIDX 0x70000028
+#define DT_MIPS_OPTIONS 0x70000029
+#define DT_MIPS_INTERFACE 0x7000002A
+#define DT_MIPS_DYNSTR_ALIGN 0x7000002B
+#define DT_MIPS_INTERFACE_SIZE 0x7000002C
+#define DT_MIPS_RLD_TEXT_RESOLVE_ADDR 0x7000002D
+#define DT_MIPS_PERF_SUFFIX 0x7000002E
+#define DT_MIPS_COMPACT_SIZE 0x7000002F
+#define DT_MIPS_GP_VALUE 0x70000030
+#define DT_MIPS_AUX_DYNAMIC 0x70000031
+#define DT_MIPS_PLTGOT 0x70000032
+#define DT_MIPS_RLD_OBJ_UPDATE 0x70000033
+#define DT_MIPS_RWPLT 0x70000034
+
+#define DT_PPC_GOT 0x70000000
+#define DT_PPC_TLSOPT 0x70000001
+
+#define DT_PPC64_GLINK 0x70000000
+#define DT_PPC64_OPD 0x70000001
+#define DT_PPC64_OPDSZ 0x70000002
+#define DT_PPC64_TLSOPT 0x70000003
+
#define DT_AUXILIARY 0x7ffffffd /* shared library auxiliary name */
#define DT_USED 0x7ffffffe /* ignored - same as needed */
#define DT_FILTER 0x7fffffff /* shared library filter name */
@@ -478,8 +719,18 @@
#define DF_1_LOADFLTR 0x00000010 /* Immediate loading of filtees */
#define DF_1_NOOPEN 0x00000040 /* Do not allow loading on dlopen() */
#define DF_1_ORIGIN 0x00000080 /* Process $ORIGIN */
+#define DF_1_INTERPOSE 0x00000400 /* Interpose all objects but main */
#define DF_1_NODEFLIB 0x00000800 /* Do not search default paths */
+/* Values for l_flags. */
+#define LL_NONE 0x0 /* no flags */
+#define LL_EXACT_MATCH 0x1 /* require an exact match */
+#define LL_IGNORE_INT_VER 0x2 /* ignore version incompatibilities */
+#define LL_REQUIRE_MINOR 0x4
+#define LL_EXPORTS 0x8
+#define LL_DELAY_LOAD 0x10
+#define LL_DELTA 0x20
+
/* Values for n_type. Used in core files. */
#define NT_PRSTATUS 1 /* Process status. */
#define NT_FPREGSET 2 /* Floating point registers. */
@@ -494,13 +745,16 @@
#define NT_PROCSTAT_OSREL 14 /* Procstat osreldate data. */
#define NT_PROCSTAT_PSSTRINGS 15 /* Procstat ps_strings data. */
#define NT_PROCSTAT_AUXV 16 /* Procstat auxv data. */
+#define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */
+#define NT_X86_XSTATE 0x202 /* x86 XSAVE extended state. */
/* Symbol Binding - ELFNN_ST_BIND - st_info */
#define STB_LOCAL 0 /* Local symbol */
#define STB_GLOBAL 1 /* Global symbol */
#define STB_WEAK 2 /* like global - lower precedence */
-#define STB_LOOS 10 /* Reserved range for operating system */
-#define STB_HIOS 12 /* specific semantics. */
+#define STB_LOOS 10 /* Start of operating system reserved range. */
+#define STB_GNU_UNIQUE 10 /* Unique symbol (GNU) */
+#define STB_HIOS 12 /* End of operating system reserved range. */
#define STB_LOPROC 13 /* reserved range for processor */
#define STB_HIPROC 15 /* specific semantics. */
@@ -626,6 +880,23 @@
#define R_386_TLS_TPOFF32 37 /* GOT entry of -ve static TLS offset */
#define R_386_IRELATIVE 42 /* PLT entry resolved indirectly at runtime */
+#define R_AARCH64_NONE 0 /* No relocation */
+#define R_AARCH64_ABS64 257 /* Absolute offset */
+#define R_AARCH64_ABS32 258 /* Absolute, 32-bit overflow check */
+#define R_AARCH64_ABS16 259 /* Absolute, 16-bit overflow check */
+#define R_AARCH64_PREL64 260 /* PC relative */
+#define R_AARCH64_PREL32 261 /* PC relative, 32-bit overflow check */
+#define R_AARCH64_PREL16 262 /* PC relative, 16-bit overflow check */
+#define R_AARCH64_COPY 1024 /* Copy data from shared object */
+#define R_AARCH64_GLOB_DAT 1025 /* Set GOT entry to data address */
+#define R_AARCH64_JUMP_SLOT 1026 /* Set GOT entry to code address */
+#define R_AARCH64_RELATIVE 1027 /* Add load address of shared object */
+#define R_AARCH64_TLS_DTPREL64 1028
+#define R_AARCH64_TLS_DTPMOD64 1029
+#define R_AARCH64_TLS_TPREL64 1030
+#define R_AARCH64_TLSDESC 1031 /* Identify the TLS descriptor */
+#define R_AARCH64_IRELATIVE 1032
+
#define R_ARM_NONE 0 /* No relocation. */
#define R_ARM_PC24 1
#define R_ARM_ABS32 2
@@ -759,6 +1030,7 @@
#define R_MIPS_PC16 10 /* PC relative 16 bit */
#define R_MIPS_CALL16 11 /* 16 bit GOT entry for function */
#define R_MIPS_GPREL32 12 /* GP relative 32 bit */
+#define R_MIPS_64 18 /* Direct 64 bit */
#define R_MIPS_GOTHI16 21 /* GOT HI 16 bit */
#define R_MIPS_GOTLO16 22 /* GOT LO 16 bit */
#define R_MIPS_CALLHI16 30 /* upper 16 bit GOT entry for function */
@@ -978,6 +1250,19 @@
#define R_X86_64_DTPOFF32 21 /* Offset in TLS block */
#define R_X86_64_GOTTPOFF 22 /* PC relative offset to IE GOT entry */
#define R_X86_64_TPOFF32 23 /* Offset in static TLS block */
+#define R_X86_64_PC64 24 /* PC-relative 64 bit signed sym value. */
+#define R_X86_64_GOTOFF64 25
+#define R_X86_64_GOTPC32 26
+#define R_X86_64_GOT64 27
+#define R_X86_64_GOTPCREL64 28
+#define R_X86_64_GOTPC64 29
+#define R_X86_64_GOTPLT64 30
+#define R_X86_64_PLTOFF64 31
+#define R_X86_64_SIZE32 32
+#define R_X86_64_SIZE64 33
+#define R_X86_64_GOTPC32_TLSDESC 34
+#define R_X86_64_TLSDESC_CALL 35
+#define R_X86_64_TLSDESC 36
#define R_X86_64_IRELATIVE 37
Modified: trunk/sys/sys/elf_generic.h
===================================================================
--- trunk/sys/sys/elf_generic.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/elf_generic.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1998 John D. Polstra.
* All rights reserved.
@@ -23,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/elf_generic.h 314197 2017-02-24 09:30:51Z kib $
*/
#ifndef _SYS_ELF_GENERIC_H_
@@ -84,5 +85,6 @@
#define ELF_ST_BIND __ELFN(ST_BIND)
#define ELF_ST_TYPE __ELFN(ST_TYPE)
#define ELF_ST_INFO __ELFN(ST_INFO)
+#define ELF_ST_VISIBILITY __ELFN(ST_VISIBILITY)
#endif /* !_SYS_ELF_GENERIC_H_ */
Modified: trunk/sys/sys/endian.h
===================================================================
--- trunk/sys/sys/endian.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/endian.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2002 Thomas Moestl <tmm at FreeBSD.org>
* All rights reserved.
@@ -23,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/endian.h 208331 2010-05-20 06:16:13Z phk $
*/
#ifndef _SYS_ENDIAN_H_
Modified: trunk/sys/sys/errno.h
===================================================================
--- trunk/sys/sys/errno.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/errno.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1982, 1986, 1989, 1993
* The Regents of the University of California. All rights reserved.
@@ -32,7 +33,7 @@
* SUCH DAMAGE.
*
* @(#)errno.h 8.5 (Berkeley) 1/21/94
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/errno.h 311708 2017-01-09 00:09:19Z jhb $
*/
#ifndef _SYS_ERRNO_H_
@@ -176,13 +177,15 @@
#ifndef _POSIX_SOURCE
#define ENOTCAPABLE 93 /* Capabilities insufficient */
#define ECAPMODE 94 /* Not permitted in capability mode */
+#define ENOTRECOVERABLE 95 /* State not recoverable */
+#define EOWNERDEAD 96 /* Previous owner died */
#endif /* _POSIX_SOURCE */
#ifndef _POSIX_SOURCE
-#define ELAST 94 /* Must be equal largest errno */
+#define ELAST 96 /* Must be equal largest errno */
#endif /* _POSIX_SOURCE */
-#ifdef _KERNEL
+#if defined(_KERNEL) || defined(_WANT_KERNEL_ERRNO)
/* pseudo-errors returned inside kernel to modify return to process */
#define ERESTART (-1) /* restart syscall */
#define EJUSTRETURN (-2) /* don't modify regs, just return */
Modified: trunk/sys/sys/eui64.h
===================================================================
--- trunk/sys/sys/eui64.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/eui64.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright 2004 The Aerospace Corporation. All rights reserved.
*
@@ -25,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/eui64.h 139825 2005-01-07 02:29:27Z imp $
*/
#ifndef _SYS_EUI64_H
#define _SYS_EUI64_H
Modified: trunk/sys/sys/event.h
===================================================================
--- trunk/sys/sys/event.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/event.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon at FreeBSD.org>
* All rights reserved.
@@ -23,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/event.h 311772 2017-01-09 10:13:53Z kib $
*/
#ifndef _SYS_EVENT_H_
@@ -42,9 +43,7 @@
#define EVFILT_FS (-9) /* filesystem events */
#define EVFILT_LIO (-10) /* attached to lio requests */
#define EVFILT_USER (-11) /* User events */
-#define EVFILT_SENDFILE (-12) /* not available yet */
-#define EVFILT_MACHPORT (-13) /* Mach portsets */
-#define EVFILT_SYSCOUNT 13
+#define EVFILT_SYSCOUNT 11
#define EV_SET(kevp_, a, b, c, d, e, f) do { \
struct kevent *kevp = (kevp_); \
@@ -78,7 +77,9 @@
#define EV_DISPATCH 0x0080 /* disable event after reporting */
#define EV_SYSFLAGS 0xF000 /* reserved by system */
+#define EV_DROP 0x1000 /* note should be dropped */
#define EV_FLAG1 0x2000 /* filter-specific flag */
+#define EV_FLAG2 0x4000 /* filter-specific flag */
/* returned values */
#define EV_EOF 0x8000 /* EOF detected */
@@ -118,6 +119,12 @@
#define NOTE_LINK 0x0010 /* link count changed */
#define NOTE_RENAME 0x0020 /* vnode was renamed */
#define NOTE_REVOKE 0x0040 /* vnode access was revoked */
+#define NOTE_OPEN 0x0080 /* vnode was opened */
+#define NOTE_CLOSE 0x0100 /* file closed, fd did not
+ allowed write */
+#define NOTE_CLOSE_WRITE 0x0200 /* file closed, fd did allowed
+ write */
+#define NOTE_READ 0x0400 /* file was read */
/*
* data/hint flags for EVFILT_PROC, shared with userspace
@@ -133,10 +140,16 @@
#define NOTE_TRACKERR 0x00000002 /* could not track child */
#define NOTE_CHILD 0x00000004 /* am a child process */
+/* additional flags for EVFILE_TIMER */
+#define NOTE_SECONDS 0x00000001 /* data is seconds */
+#define NOTE_MSECONDS 0x00000002 /* data is milliseconds */
+#define NOTE_USECONDS 0x00000004 /* data is microseconds */
+#define NOTE_NSECONDS 0x00000008 /* data is nanoseconds */
+
struct knote;
SLIST_HEAD(klist, knote);
struct kqueue;
-SLIST_HEAD(kqlist, kqueue);
+TAILQ_HEAD(kqlist, kqueue);
struct knlist {
struct klist kl_list;
void (*kl_lock)(void *); /* lock function */
@@ -149,10 +162,6 @@
#ifdef _KERNEL
-#ifdef MALLOC_DECLARE
-MALLOC_DECLARE(M_KQUEUE);
-#endif
-
/*
* Flags for knote call
*/
@@ -211,6 +220,7 @@
#define KN_MARKER 0x20 /* ignore this knote */
#define KN_KQUEUE 0x40 /* this knote belongs to a kq */
#define KN_HASKQLOCK 0x80 /* for _inevent */
+#define KN_SCAN 0x100 /* flux set in kqueue_scan() */
int kn_sfflags; /* saved filter flags */
intptr_t kn_sdata; /* saved data field */
union {
@@ -218,6 +228,8 @@
struct proc *p_proc; /* proc pointer */
struct aiocblist *p_aio; /* AIO job pointer */
struct aioliojob *p_lio; /* LIO job pointer */
+ sbintime_t *p_nexttime; /* next timer event fires at */
+ void *p_v; /* generic other pointer */
} kn_ptr;
struct filterops *kn_fop;
void *kn_hook;
@@ -240,29 +252,31 @@
struct proc;
struct knlist;
struct mtx;
+struct rwlock;
-extern void knote(struct knlist *list, long hint, int lockflags);
-extern void knote_fork(struct knlist *list, int pid);
-extern void knlist_add(struct knlist *knl, struct knote *kn, int islocked);
-extern void knlist_remove(struct knlist *knl, struct knote *kn, int islocked);
-extern void knlist_remove_inevent(struct knlist *knl, struct knote *kn);
-extern int knlist_empty(struct knlist *knl);
-extern void knlist_init(struct knlist *knl, void *lock,
- void (*kl_lock)(void *), void (*kl_unlock)(void *),
- void (*kl_assert_locked)(void *), void (*kl_assert_unlocked)(void *));
-extern void knlist_init_mtx(struct knlist *knl, struct mtx *lock);
-extern void knlist_destroy(struct knlist *knl);
-extern void knlist_cleardel(struct knlist *knl, struct thread *td,
+void knote(struct knlist *list, long hint, int lockflags);
+void knote_fork(struct knlist *list, int pid);
+void knlist_add(struct knlist *knl, struct knote *kn, int islocked);
+void knlist_remove(struct knlist *knl, struct knote *kn, int islocked);
+void knlist_remove_inevent(struct knlist *knl, struct knote *kn);
+int knlist_empty(struct knlist *knl);
+void knlist_init(struct knlist *knl, void *lock, void (*kl_lock)(void *),
+ void (*kl_unlock)(void *), void (*kl_assert_locked)(void *),
+ void (*kl_assert_unlocked)(void *));
+void knlist_init_mtx(struct knlist *knl, struct mtx *lock);
+void knlist_init_rw_reader(struct knlist *knl, struct rwlock *lock);
+void knlist_destroy(struct knlist *knl);
+void knlist_cleardel(struct knlist *knl, struct thread *td,
int islocked, int killkn);
#define knlist_clear(knl, islocked) \
- knlist_cleardel((knl), NULL, (islocked), 0)
+ knlist_cleardel((knl), NULL, (islocked), 0)
#define knlist_delete(knl, td, islocked) \
- knlist_cleardel((knl), (td), (islocked), 1)
-extern void knote_fdclose(struct thread *p, int fd);
-extern int kqfd_register(int fd, struct kevent *kev, struct thread *p,
- int waitok);
-extern int kqueue_add_filteropts(int filt, struct filterops *filtops);
-extern int kqueue_del_filteropts(int filt);
+ knlist_cleardel((knl), (td), (islocked), 1)
+void knote_fdclose(struct thread *p, int fd);
+int kqfd_register(int fd, struct kevent *kev, struct thread *p,
+ int waitok);
+int kqueue_add_filteropts(int filt, struct filterops *filtops);
+int kqueue_del_filteropts(int filt);
#else /* !_KERNEL */
Modified: trunk/sys/sys/eventhandler.h
===================================================================
--- trunk/sys/sys/eventhandler.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/eventhandler.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1999 Michael Smith <msmith at freebsd.org>
* All rights reserved.
@@ -23,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/eventhandler.h 307253 2016-10-14 03:11:31Z sephe $
*/
#ifndef SYS_EVENTHANDLER_H
@@ -182,6 +183,7 @@
typedef void (*power_change_fn)(void *);
EVENTHANDLER_DECLARE(power_resume, power_change_fn);
EVENTHANDLER_DECLARE(power_suspend, power_change_fn);
+EVENTHANDLER_DECLARE(power_suspend_early, power_change_fn);
/* Low memory event */
typedef void (*vm_lowmem_handler_t)(void *, int);
@@ -192,6 +194,17 @@
typedef void (*mountroot_handler_t)(void *);
EVENTHANDLER_DECLARE(mountroot, mountroot_handler_t);
+/* File system mount events */
+struct mount;
+struct vnode;
+struct thread;
+typedef void (*vfs_mounted_notify_fn)(void *, struct mount *, struct vnode *,
+ struct thread *);
+typedef void (*vfs_unmounted_notify_fn)(void *, struct mount *,
+ struct thread *);
+EVENTHANDLER_DECLARE(vfs_mounted, vfs_mounted_notify_fn);
+EVENTHANDLER_DECLARE(vfs_unmounted, vfs_unmounted_notify_fn);
+
/* VLAN state change events */
struct ifnet;
typedef void (*vlan_config_fn)(void *, struct ifnet *, uint16_t);
@@ -231,7 +244,6 @@
/*
* application dump event
*/
-struct thread;
typedef void (*app_coredump_start_fn)(void *, struct thread *, char *name);
typedef void (*app_coredump_progress_fn)(void *, struct thread *td, int byte_count);
typedef void (*app_coredump_finish_fn)(void *, struct thread *td);
@@ -253,6 +265,30 @@
typedef void (*uma_zone_chfn)(void *);
EVENTHANDLER_DECLARE(nmbclusters_change, uma_zone_chfn);
+EVENTHANDLER_DECLARE(nmbufs_change, uma_zone_chfn);
EVENTHANDLER_DECLARE(maxsockets_change, uma_zone_chfn);
+/* Kernel linker file load and unload events */
+struct linker_file;
+typedef void (*kld_load_fn)(void *, struct linker_file *);
+typedef void (*kld_unload_fn)(void *, const char *, caddr_t, size_t);
+typedef void (*kld_unload_try_fn)(void *, struct linker_file *, int *);
+EVENTHANDLER_DECLARE(kld_load, kld_load_fn);
+EVENTHANDLER_DECLARE(kld_unload, kld_unload_fn);
+EVENTHANDLER_DECLARE(kld_unload_try, kld_unload_try_fn);
+
+/* Generic graphics framebuffer interface */
+struct fb_info;
+typedef void (*register_framebuffer_fn)(void *, struct fb_info *);
+typedef void (*unregister_framebuffer_fn)(void *, struct fb_info *);
+EVENTHANDLER_DECLARE(register_framebuffer, register_framebuffer_fn);
+EVENTHANDLER_DECLARE(unregister_framebuffer, unregister_framebuffer_fn);
+
+/* Veto ada attachment */
+struct cam_path;
+struct ata_params;
+typedef void (*ada_probe_veto_fn)(void *, struct cam_path *,
+ struct ata_params *, int *);
+EVENTHANDLER_DECLARE(ada_probe_veto, ada_probe_veto_fn);
+
#endif /* SYS_EVENTHANDLER_H */
Modified: trunk/sys/sys/eventvar.h
===================================================================
--- trunk/sys/sys/eventvar.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/eventvar.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1999,2000 Jonathan Lemon <jlemon at FreeBSD.org>
* All rights reserved.
@@ -23,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/eventvar.h 255527 2013-09-13 19:50:50Z kib $
*/
#ifndef _SYS_EVENTVAR_H_
@@ -41,7 +42,7 @@
struct kqueue {
struct mtx kq_lock;
int kq_refcnt;
- SLIST_ENTRY(kqueue) kq_list;
+ TAILQ_ENTRY(kqueue) kq_list;
TAILQ_HEAD(, knote) kq_head; /* list of pending event */
int kq_count; /* number of pending events */
struct selinfo kq_sel;
@@ -60,7 +61,6 @@
u_long kq_knhashmask; /* size of knhash */
struct klist *kq_knhash; /* hash table for knotes */
struct task kq_task;
- struct ucred *kq_cred;
};
#endif /* !_SYS_EVENTVAR_H_ */
Modified: trunk/sys/sys/exec.h
===================================================================
--- trunk/sys/sys/exec.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/exec.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -32,7 +33,7 @@
* SUCH DAMAGE.
*
* @(#)exec.h 8.3 (Berkeley) 1/21/94
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/exec.h 295454 2016-02-10 00:08:51Z jhb $
*/
#ifndef _SYS_EXEC_H_
@@ -39,12 +40,17 @@
#define _SYS_EXEC_H_
/*
- * The following structure is found at the top of the user stack of each
- * user process. The ps program uses it to locate argv and environment
- * strings. Programs that wish ps to display other information may modify
- * it; normally ps_argvstr points to the argv vector, and ps_nargvstr
- * is the same as the program's argc. The fields ps_envstr and ps_nenvstr
- * are the equivalent for the environment.
+ * Before ps_args existed, the following structure, found at the top of
+ * the user stack of each user process, was used by ps(1) to locate
+ * environment and argv strings. Normally ps_argvstr points to the
+ * argv vector, and ps_nargvstr is the same as the program's argc. The
+ * fields ps_envstr and ps_nenvstr are the equivalent for the environment.
+ *
+ * Programs should now use setproctitle(3) to change ps output.
+ * setproctitle() always informs the kernel with sysctl and sets the
+ * pointers in ps_strings. The kern.proc.args sysctl first tries p_args.
+ * If p_args is NULL, it then falls back to reading ps_strings and following
+ * the pointers.
*/
struct ps_strings {
char **ps_argvstr; /* first of 0 or more argument strings */
@@ -55,6 +61,7 @@
/*
* Address of ps_strings structure (in user space).
+ * Prefer the kern.ps_strings or kern.proc.ps_strings sysctls to this constant.
*/
#define PS_STRINGS (USRSTACK - sizeof(struct ps_strings))
#define SPARE_USRSPACE 4096
@@ -77,6 +84,9 @@
int exec_register(const struct execsw *);
int exec_unregister(const struct execsw *);
+extern int coredump_pack_fileinfo;
+extern int coredump_pack_vmmapinfo;
+
/*
* note: name##_mod cannot be const storage because the
* linker_file_sysinit() function modifies _file in the
Modified: trunk/sys/sys/extattr.h
===================================================================
--- trunk/sys/sys/extattr.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/extattr.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1999-2001 Robert N. M. Watson
* All rights reserved.
@@ -25,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/extattr.h 248995 2013-04-02 05:30:41Z mdf $
*/
/*
* Developed by the TrustedBSD Project.
@@ -92,11 +93,11 @@
size_t _nbytes);
ssize_t extattr_list_link(const char *_path, int _attrnamespace, void *_data,
size_t _nbytes);
-int extattr_set_fd(int _fd, int _attrnamespace, const char *_attrname,
+ssize_t extattr_set_fd(int _fd, int _attrnamespace, const char *_attrname,
const void *_data, size_t _nbytes);
-int extattr_set_file(const char *_path, int _attrnamespace,
+ssize_t extattr_set_file(const char *_path, int _attrnamespace,
const char *_attrname, const void *_data, size_t _nbytes);
-int extattr_set_link(const char *_path, int _attrnamespace,
+ssize_t extattr_set_link(const char *_path, int _attrnamespace,
const char *_attrname, const void *_data, size_t _nbytes);
__END_DECLS
Modified: trunk/sys/sys/fail.h
===================================================================
--- trunk/sys/sys/fail.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/fail.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2009 Isilon Inc http://www.isilon.com/
*
@@ -22,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/fail.h 216620 2010-12-21 18:23:03Z mdf $
*/
/**
* @file
Modified: trunk/sys/sys/fbio.h
===================================================================
--- trunk/sys/sys/fbio.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/fbio.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -32,7 +33,7 @@
*
* @(#)fbio.h 8.2 (Berkeley) 10/30/93
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/fbio.h 271117 2014-09-04 18:43:40Z emaste $
*/
#ifndef _SYS_FBIO_H_
@@ -40,6 +41,10 @@
#ifndef _KERNEL
#include <sys/types.h>
+#else
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/eventhandler.h>
#endif
#include <sys/ioccom.h>
@@ -101,6 +106,63 @@
};
#define FBIOGTYPE _IOR('F', 0, struct fbtype)
+#define FBTYPE_GET_STRIDE(_fb) ((_fb)->fb_size / (_fb)->fb_height)
+#define FBTYPE_GET_BPP(_fb) ((_fb)->fb_bpp)
+#define FBTYPE_GET_BYTESPP(_fb) ((_fb)->fb_bpp / 8)
+
+#ifdef _KERNEL
+
+struct fb_info;
+
+typedef int fb_enter_t(void *priv);
+typedef int fb_leave_t(void *priv);
+
+struct fb_info {
+ /* Raw copy of fbtype. Do not change. */
+ int fb_type; /* as defined above */
+ int fb_height; /* in pixels */
+ int fb_width; /* in pixels */
+ int fb_depth; /* bits to define color */
+ int fb_cmsize; /* size of color map (entries) */
+ int fb_size; /* total size in bytes */
+
+ struct cdev *fb_cdev;
+
+ fb_enter_t *enter;
+ fb_leave_t *leave;
+
+ intptr_t fb_pbase; /* For FB mmap. */
+ intptr_t fb_vbase; /* if NULL, use fb_write/fb_read. */
+ void *fb_priv; /* First argument for read/write. */
+ const char *fb_name;
+ uint32_t fb_flags;
+ int fb_stride;
+ int fb_bpp; /* bits per pixel */
+#define FB_FLAG_NOMMAP 1 /* mmap unsupported. */
+ uint32_t fb_cmap[16];
+};
+
+int fbd_list(void);
+int fbd_register(struct fb_info *);
+int fbd_unregister(struct fb_info *);
+
+static inline int
+register_framebuffer(struct fb_info *info)
+{
+
+ EVENTHANDLER_INVOKE(register_framebuffer, info);
+ return (0);
+}
+
+static inline int
+unregister_framebuffer(struct fb_info *info)
+{
+
+ EVENTHANDLER_INVOKE(unregister_framebuffer, info);
+ return (0);
+}
+#endif
+
#ifdef notdef
/*
* General purpose structure for passing info in and out of frame buffers
Modified: trunk/sys/sys/fcntl.h
===================================================================
--- trunk/sys/sys/fcntl.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/fcntl.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1983, 1990, 1993
* The Regents of the University of California. All rights reserved.
@@ -32,7 +33,7 @@
* SUCH DAMAGE.
*
* @(#)fcntl.h 8.3 (Berkeley) 1/21/94
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/fcntl.h 273840 2014-10-29 22:55:16Z jilles $
*/
#ifndef _SYS_FCNTL_H_
@@ -96,7 +97,7 @@
#define O_FSYNC 0x0080 /* synchronous writes */
#endif
#define O_SYNC 0x0080 /* POSIX synonym for O_FSYNC */
-#if __BSD_VISIBLE
+#if __POSIX_VISIBLE >= 200809
#define O_NOFOLLOW 0x0100 /* don't follow symlinks */
#endif
#define O_CREAT 0x0200 /* create if nonexistent */
@@ -114,8 +115,7 @@
#define O_DIRECT 0x00010000
#endif
-/* Defined by POSIX Extended API Set Part 2 */
-#if __BSD_VISIBLE
+#if __POSIX_VISIBLE >= 200809
#define O_DIRECTORY 0x00020000 /* Fail if not directory */
#define O_EXEC 0x00040000 /* Open for execute only */
#endif
@@ -136,8 +136,8 @@
#ifdef _KERNEL
/* convert from open() flags to/from fflags; convert O_RD/WR to FREAD/FWRITE */
-#define FFLAGS(oflags) ((oflags) + 1)
-#define OFLAGS(fflags) ((fflags) - 1)
+#define FFLAGS(oflags) ((oflags) & O_EXEC ? (oflags) : (oflags) + 1)
+#define OFLAGS(fflags) ((fflags) & O_EXEC ? (fflags) : (fflags) - 1)
/* bits to save after open */
#define FMASK (FREAD|FWRITE|FAPPEND|FASYNC|FFSYNC|FNONBLOCK|O_DIRECT|FEXEC)
@@ -183,8 +183,7 @@
#define FRDAHEAD O_CREAT
#endif
-/* Defined by POSIX Extended API Set Part 2 */
-#if __BSD_VISIBLE
+#if __POSIX_VISIBLE >= 200809
/*
* Magic value that specify the use of the current working directory
* to determine the target of relative file paths in the openat() and
@@ -211,7 +210,7 @@
#define F_SETFD 2 /* set file descriptor flags */
#define F_GETFL 3 /* get file status flags */
#define F_SETFL 4 /* set file status flags */
-#if __BSD_VISIBLE || __XSI_VISIBLE || __POSIX_VISIBLE >= 200112
+#if __XSI_VISIBLE || __POSIX_VISIBLE >= 200112
#define F_GETOWN 5 /* get SIGIO/SIGURG proc/pgrp */
#define F_SETOWN 6 /* set SIGIO/SIGURG proc/pgrp */
#endif
@@ -229,7 +228,7 @@
#define F_READAHEAD 15 /* read ahead */
#define F_RDAHEAD 16 /* Darwin compatible read ahead */
#endif
-#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809
+#if __POSIX_VISIBLE >= 200809
#define F_DUPFD_CLOEXEC 17 /* Like F_DUPFD, but FD_CLOEXEC is set */
#endif
#if __BSD_VISIBLE
@@ -307,16 +306,16 @@
int open(const char *, int, ...);
int creat(const char *, mode_t);
int fcntl(int, int, ...);
-#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809
+#if __BSD_VISIBLE
+int flock(int, int);
+#endif
+#if __POSIX_VISIBLE >= 200809
int openat(int, const char *, int, ...);
#endif
-#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112
+#if __POSIX_VISIBLE >= 200112
int posix_fadvise(int, off_t, off_t, int);
int posix_fallocate(int, off_t, off_t);
#endif
-#if __BSD_VISIBLE
-int flock(int, int);
-#endif
__END_DECLS
#endif
Modified: trunk/sys/sys/fdcio.h
===================================================================
--- trunk/sys/sys/fdcio.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/fdcio.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (C) 1992-1994,2001 by Joerg Wunsch, Dresden
* All rights reserved.
@@ -24,7 +25,7 @@
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/fdcio.h 274024 2014-11-03 10:26:29Z nyan $
*/
#ifndef _MACHINE_IOCTL_FD_H_
@@ -181,27 +182,17 @@
* XXX: should have been done 20 years ago to make sense.
*/
#ifdef PC98
-#define FDF_3_1722 21,2,0xFF,0x04,82,0,2,2,0x0C,2,0,FL_MFM
-#define FDF_3_1476 18,2,0xFF,0x1B,82,0,2,2,0x54,1,0,FL_MFM
#define FDF_3_1440 18,2,0xFF,0x1B,80,0,2,2,0x54,1,0,FL_MFM
#define FDF_3_1200 15,2,0xFF,0x1B,80,0,0,2,0x54,1,0,FL_MFM
-#define FDF_3_820 10,2,0xFF,0x10,82,0,1,2,0x30,1,0,FL_MFM
-#define FDF_3_800 10,2,0xFF,0x10,80,0,1,2,0x30,1,0,FL_MFM
#define FDF_3_720 9,2,0xFF,0x20,80,0,1,2,0x50,1,0,FL_MFM
#define FDF_3_360 9,2,0xFF,0x20,40,0,1,2,0x50,1,0,FL_MFM|FL_2STEP
#define FDF_3_640 8,2,0xFF,0x2A,80,0,1,2,0x50,1,0,FL_MFM
#define FDF_3_1230 8,3,0xFF,0x35,77,0,0,2,0x74,1,0,FL_MFM
-#define FDF_3_1280 8,3,0xFF,0x35,80,0,0,2,0x74,1,0,FL_MFM
-#define FDF_3_1480 9,3,0xFF,0x35,82,0,0,2,0x47,1,0,FL_MFM
-#define FDF_3_1640 10,3,0xFF,0x1B,82,0,2,2,0x54,1,0,FL_MFM
#define FDF_5_1200 15,2,0xFF,0x1B,80,0,0,2,0x54,1,0,FL_MFM
-#define FDF_5_820 10,2,0xFF,0x10,82,0,1,2,0x30,1,0,FL_MFM
-#define FDF_5_800 10,2,0xFF,0x10,80,0,1,2,0x30,1,0,FL_MFM
#define FDF_5_720 9,2,0xFF,0x20,80,0,1,2,0x50,1,0,FL_MFM
#define FDF_5_360 9,2,0xFF,0x20,40,0,1,2,0x50,1,0,FL_MFM|FL_2STEP
#define FDF_5_640 8,2,0xFF,0x2A,80,0,1,2,0x50,1,0,FL_MFM
#define FDF_5_1230 8,3,0xFF,0x35,77,0,0,2,0x74,1,0,FL_MFM
-#define FDF_5_1280 8,3,0xFF,0x35,80,0,0,2,0x74,1,0,FL_MFM
#else /* PC98 */
#define FDF_3_2880 36,2,0xFF,0x1B,80,0,FDC_1MBPS,002,0x4C,1,1,FL_MFM|FL_PERPND
#define FDF_3_1722 21,2,0xFF,0x04,82,0,FDC_500KBPS,2,0x0C,2,0,FL_MFM
Modified: trunk/sys/sys/file.h
===================================================================
--- trunk/sys/sys/file.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/file.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1982, 1986, 1989, 1993
* The Regents of the University of California. All rights reserved.
@@ -27,7 +28,7 @@
* SUCH DAMAGE.
*
* @(#)file.h 8.3 (Berkeley) 1/9/95
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/file.h 293549 2016-01-09 16:48:50Z dchagin $
*/
#ifndef _SYS_FILE_H_
@@ -64,12 +65,13 @@
#define DTYPE_SEM 9 /* posix semaphore */
#define DTYPE_PTS 10 /* pseudo teletype master device */
#define DTYPE_DEV 11 /* Device specific fd type */
-#define DTYPE_CAPABILITY 12 /* capability */
-#define DTYPE_PROCDESC 13 /* process descriptor */
+#define DTYPE_PROCDESC 12 /* process descriptor */
+#define DTYPE_LINUXEFD 13 /* emulation eventfd type */
#ifdef _KERNEL
struct file;
+struct filecaps;
struct ucred;
#define FOF_OFFSET 0x01 /* Use the offset in uio argument */
@@ -105,6 +107,11 @@
struct ucred *active_cred, struct thread *td);
typedef int fo_chown_t(struct file *fp, uid_t uid, gid_t gid,
struct ucred *active_cred, struct thread *td);
+typedef int fo_sendfile_t(struct file *fp, int sockfd, struct uio *hdr_uio,
+ struct uio *trl_uio, off_t offset, size_t nbytes,
+ off_t *sent, int flags, int kflags, struct thread *td);
+typedef int fo_seek_t(struct file *fp, off_t offset, int whence,
+ struct thread *td);
typedef int fo_flags_t;
struct fileops {
@@ -118,6 +125,8 @@
fo_close_t *fo_close;
fo_chmod_t *fo_chmod;
fo_chown_t *fo_chown;
+ fo_sendfile_t *fo_sendfile;
+ fo_seek_t *fo_seek;
fo_flags_t fo_flags; /* DFLAG_* below */
};
@@ -132,6 +141,7 @@
*
* Below is the list of locks that protects members in struct file.
*
+ * (a) f_vnode lock required (shared allows both reads and writes)
* (f) protected with mtx_lock(mtx_pool_find(fp))
* (d) cdevpriv_mtx
* none not locked
@@ -157,7 +167,7 @@
/*
* DTYPE_VNODE specific fields.
*/
- int f_seqcount; /* Count of sequential accesses. */
+ int f_seqcount; /* (a) Count of sequential accesses. */
off_t f_nextoff; /* next expected read/write offset. */
union {
struct cdev_privdata *fvn_cdevpriv;
@@ -203,10 +213,6 @@
#ifdef _KERNEL
-#ifdef MALLOC_DECLARE
-MALLOC_DECLARE(M_FILE);
-#endif
-
extern struct fileops vnops;
extern struct fileops badfileops;
extern struct fileops socketops;
@@ -214,14 +220,13 @@
extern int maxfilesperproc; /* per process limit on number of open files */
extern volatile int openfiles; /* actual number of open files */
-int fget(struct thread *td, int fd, cap_rights_t rights, struct file **fpp);
-int fget_mmap(struct thread *td, int fd, cap_rights_t rights,
+int fget(struct thread *td, int fd, cap_rights_t *rightsp, struct file **fpp);
+int fget_mmap(struct thread *td, int fd, cap_rights_t *rightsp,
u_char *maxprotp, struct file **fpp);
-int fget_read(struct thread *td, int fd, cap_rights_t rights,
+int fget_read(struct thread *td, int fd, cap_rights_t *rightsp,
struct file **fpp);
-int fget_write(struct thread *td, int fd, cap_rights_t rights,
+int fget_write(struct thread *td, int fd, cap_rights_t *rightsp,
struct file **fpp);
-int fgetcap(struct thread *td, int fd, struct file **fpp);
int _fdrop(struct file *fp, struct thread *td);
/*
@@ -240,19 +245,24 @@
fo_chmod_t invfo_chmod;
fo_chown_t invfo_chown;
+fo_sendfile_t invfo_sendfile;
+fo_sendfile_t vn_sendfile;
+fo_seek_t vn_seek;
+
void finit(struct file *, u_int, short, void *, struct fileops *);
-int fgetvp(struct thread *td, int fd, cap_rights_t rights, struct vnode **vpp);
-int fgetvp_exec(struct thread *td, int fd, cap_rights_t rights,
+int fgetvp(struct thread *td, int fd, cap_rights_t *rightsp,
struct vnode **vpp);
-int fgetvp_rights(struct thread *td, int fd, cap_rights_t need,
- cap_rights_t *have, struct vnode **vpp);
-int fgetvp_read(struct thread *td, int fd, cap_rights_t rights,
+int fgetvp_exec(struct thread *td, int fd, cap_rights_t *rightsp,
struct vnode **vpp);
-int fgetvp_write(struct thread *td, int fd, cap_rights_t rights,
+int fgetvp_rights(struct thread *td, int fd, cap_rights_t *needrightsp,
+ struct filecaps *havecaps, struct vnode **vpp);
+int fgetvp_read(struct thread *td, int fd, cap_rights_t *rightsp,
struct vnode **vpp);
+int fgetvp_write(struct thread *td, int fd, cap_rights_t *rightsp,
+ struct vnode **vpp);
-int fgetsock(struct thread *td, int fd, cap_rights_t rights,
+int fgetsock(struct thread *td, int fd, cap_rights_t *rightsp,
struct socket **spp, u_int *fflagp);
void fputsock(struct socket *sp);
@@ -278,6 +288,7 @@
static __inline fo_close_t fo_close;
static __inline fo_chmod_t fo_chmod;
static __inline fo_chown_t fo_chown;
+static __inline fo_sendfile_t fo_sendfile;
static __inline int
fo_read(struct file *fp, struct uio *uio, struct ucred *active_cred,
@@ -357,6 +368,23 @@
return ((*fp->f_ops->fo_chown)(fp, uid, gid, active_cred, td));
}
+static __inline int
+fo_sendfile(struct file *fp, int sockfd, struct uio *hdr_uio,
+ struct uio *trl_uio, off_t offset, size_t nbytes, off_t *sent, int flags,
+ int kflags, struct thread *td)
+{
+
+ return ((*fp->f_ops->fo_sendfile)(fp, sockfd, hdr_uio, trl_uio, offset,
+ nbytes, sent, flags, kflags, td));
+}
+
+static __inline int
+fo_seek(struct file *fp, off_t offset, int whence, struct thread *td)
+{
+
+ return ((*fp->f_ops->fo_seek)(fp, offset, whence, td));
+}
+
#endif /* _KERNEL */
#endif /* !SYS_FILE_H */
Modified: trunk/sys/sys/filedesc.h
===================================================================
--- trunk/sys/sys/filedesc.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/filedesc.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
@@ -27,20 +28,41 @@
* SUCH DAMAGE.
*
* @(#)filedesc.h 8.1 (Berkeley) 6/2/93
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/filedesc.h 321020 2017-07-15 17:25:40Z dchagin $
*/
#ifndef _SYS_FILEDESC_H_
#define _SYS_FILEDESC_H_
+#include <sys/caprights.h>
#include <sys/queue.h>
#include <sys/event.h>
#include <sys/lock.h>
#include <sys/priority.h>
+#include <sys/seq.h>
#include <sys/sx.h>
#include <machine/_limits.h>
+struct filecaps {
+ cap_rights_t fc_rights; /* per-descriptor capability rights */
+ u_long *fc_ioctls; /* per-descriptor allowed ioctls */
+ int16_t fc_nioctls; /* fc_ioctls array size */
+ uint32_t fc_fcntls; /* per-descriptor allowed fcntls */
+};
+
+struct filedescent {
+ struct file *fde_file; /* file structure for open file */
+ struct filecaps fde_caps; /* per-descriptor rights */
+ uint8_t fde_flags; /* per-process open file flags */
+ seq_t fde_seq; /* keep file and caps in sync */
+};
+#define fde_rights fde_caps.fc_rights
+#define fde_fcntls fde_caps.fc_fcntls
+#define fde_ioctls fde_caps.fc_ioctls
+#define fde_nioctls fde_caps.fc_nioctls
+#define fde_change_size (offsetof(struct filedescent, fde_seq))
+
/*
* This structure is used for the management of descriptors. It may be
* shared by multiple processes.
@@ -48,8 +70,7 @@
#define NDSLOTTYPE u_long
struct filedesc {
- struct file **fd_ofiles; /* file structures for open files */
- char *fd_ofileflags; /* per-process open file flags */
+ struct filedescent *fd_ofiles; /* open files */
struct vnode *fd_cdir; /* current directory */
struct vnode *fd_rdir; /* root directory */
struct vnode *fd_jdir; /* jail root directory */
@@ -65,6 +86,7 @@
int fd_holdleaderscount; /* block fdfree() for shared close() */
int fd_holdleaderswakeup; /* fdfree() needs wakeup */
};
+#define fd_seq(fdp, fd) (&(fdp)->fd_ofiles[(fd)].fde_seq)
/*
* Structure to keep track of (process leader, struct fildedesc) tuples.
@@ -88,10 +110,15 @@
/*
* Per-process open flags.
*/
-#define UF_EXCLOSE 0x01 /* auto-close on exec */
+#define UF_EXCLOSE 0x01 /* auto-close on exec */
#ifdef _KERNEL
+/* Flags for do_dup() */
+#define DUP_FIXED 0x1 /* Force fixed allocation. */
+#define DUP_FCNTL 0x2 /* fcntl()-style errors. */
+#define DUP_CLOEXEC 0x4 /* Atomically set FD_CLOEXEC. */
+
/* Lock a file descriptor table. */
#define FILEDESC_LOCK_INIT(fdp) sx_init(&(fdp)->fd_sx, "filedesc structure")
#define FILEDESC_LOCK_DESTROY(fdp) sx_destroy(&(fdp)->fd_sx)
@@ -105,36 +132,47 @@
SX_NOTRECURSED)
#define FILEDESC_XLOCK_ASSERT(fdp) sx_assert(&(fdp)->fd_sx, SX_XLOCKED | \
SX_NOTRECURSED)
+#define FILEDESC_UNLOCK_ASSERT(fdp) sx_assert(&(fdp)->fd_sx, SX_UNLOCKED)
struct thread;
+void filecaps_init(struct filecaps *fcaps);
+void filecaps_copy(const struct filecaps *src, struct filecaps *dst);
+void filecaps_move(struct filecaps *src, struct filecaps *dst);
+void filecaps_free(struct filecaps *fcaps);
+
int closef(struct file *fp, struct thread *td);
-int dupfdopen(struct thread *td, struct filedesc *fdp, int indx, int dfd,
- int mode, int error);
+int do_dup(struct thread *td, int flags, int old, int new,
+ register_t *retval);
+int dupfdopen(struct thread *td, struct filedesc *fdp, int dfd, int mode,
+ int openerror, int *indxp);
int falloc(struct thread *td, struct file **resultfp, int *resultfd,
int flags);
int falloc_noinstall(struct thread *td, struct file **resultfp);
-int finstall(struct thread *td, struct file *fp, int *resultfp, int flags);
+int finstall(struct thread *td, struct file *fp, int *resultfp, int flags,
+ struct filecaps *fcaps);
int fdalloc(struct thread *td, int minfd, int *result);
+int fdallocn(struct thread *td, int minfd, int *fds, int n);
int fdavail(struct thread *td, int n);
int fdcheckstd(struct thread *td);
-void fdclose(struct filedesc *fdp, struct file *fp, int idx, struct thread *td);
+void fdclose(struct thread *td, struct file *fp, int idx);
void fdcloseexec(struct thread *td);
struct filedesc *fdcopy(struct filedesc *fdp);
-void fdunshare(struct proc *p, struct thread *td);
-void fdfree(struct thread *td);
+void fdunshare(struct thread *td);
+void fdescfree(struct thread *td);
struct filedesc *fdinit(struct filedesc *fdp);
struct filedesc *fdshare(struct filedesc *fdp);
struct filedesc_to_leader *
filedesc_to_leader_alloc(struct filedesc_to_leader *old,
struct filedesc *fdp, struct proc *leader);
-int getvnode(struct filedesc *fdp, int fd, cap_rights_t rights,
+int getvnode(struct filedesc *fdp, int fd, cap_rights_t *rightsp,
struct file **fpp);
void mountcheckdirs(struct vnode *olddp, struct vnode *newdp);
void setugidsafety(struct thread *td);
/* Return a referenced file from an unlocked descriptor. */
-struct file *fget_unlocked(struct filedesc *fdp, int fd);
+int fget_unlocked(struct filedesc *fdp, int fd, cap_rights_t *needrightsp,
+ int needfcntl, struct file **fpp, cap_rights_t *haverightsp);
/* Requires a FILEDESC_{S,X}LOCK held and returns without a ref. */
static __inline struct file *
@@ -141,7 +179,12 @@
fget_locked(struct filedesc *fdp, int fd)
{
- return (fd < 0 || fd >= fdp->fd_nfiles ? NULL : fdp->fd_ofiles[fd]);
+ FILEDESC_LOCK_ASSERT(fdp);
+
+ if (fd < 0 || fd > fdp->fd_lastfile)
+ return (NULL);
+
+ return (fdp->fd_ofiles[fd].fde_file);
}
#endif /* _KERNEL */
Modified: trunk/sys/sys/filio.h
===================================================================
--- trunk/sys/sys/filio.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/filio.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1982, 1986, 1990, 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -32,7 +33,7 @@
* SUCH DAMAGE.
*
* @(#)filio.h 8.1 (Berkeley) 3/28/94
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/filio.h 195191 2009-06-30 13:38:49Z emaste $
*/
#ifndef _SYS_FILIO_H_
Modified: trunk/sys/sys/firmware.h
===================================================================
--- trunk/sys/sys/firmware.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/firmware.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2005, Sam Leffler <sam at errno.com>
* All rights reserved.
@@ -23,7 +24,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/firmware.h 166756 2007-02-15 17:21:31Z luigi $
*/
#ifndef _SYS_FIRMWARE_H_
#define _SYS_FIRMWARE_H_
Modified: trunk/sys/sys/fnv_hash.h
===================================================================
--- trunk/sys/sys/fnv_hash.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/fnv_hash.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Fowler / Noll / Vo Hash (FNV Hash)
* http://www.isthe.com/chongo/tech/comp/fnv/
@@ -5,7 +6,7 @@
* This is an implementation of the algorithms posted above.
* This file is placed in the public domain by Peter Wemm.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/fnv_hash.h 244209 2012-12-14 12:37:35Z ae $
*/
#ifndef _SYS_FNV_HASH_H_
#define _SYS_FNV_HASH_H_
Modified: trunk/sys/sys/gmon.h
===================================================================
--- trunk/sys/sys/gmon.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/gmon.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1982, 1986, 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -27,7 +28,7 @@
* SUCH DAMAGE.
*
* @(#)gmon.h 8.2 (Berkeley) 1/4/94
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/gmon.h 157268 2006-03-29 18:17:03Z jhb $
*/
#ifndef _SYS_GMON_H_
Modified: trunk/sys/sys/gpio.h
===================================================================
--- trunk/sys/sys/gpio.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/gpio.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/* $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 $ */
/*-
@@ -26,7 +27,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/gpio.h 213237 2010-09-28 03:24:53Z gonzo $
*
*/
Modified: trunk/sys/sys/hash.h
===================================================================
--- trunk/sys/sys/hash.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/hash.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2001 Tobias Weingartner
* All rights reserved.
@@ -23,7 +24,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $OpenBSD: hash.h,v 1.4 2004/05/25 18:37:23 jmc Exp $
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/hash.h 274486 2014-11-13 21:58:42Z gnn $
*/
#ifndef _SYS_HASH_H_
@@ -118,4 +119,16 @@
return hash;
}
+
+#ifdef _KERNEL
+/*
+ * Hashing function from Bob Jenkins. Implementation in libkern/jenkins_hash.c.
+ */
+uint32_t jenkins_hash(const void *, size_t, uint32_t);
+uint32_t jenkins_hash32(const uint32_t *, size_t, uint32_t);
+
+uint32_t murmur3_aligned_32(const void *data, size_t len, uint32_t seed);
+
+#endif /* _KERNEL */
+
#endif /* !_SYS_HASH_H_ */
Modified: trunk/sys/sys/hhook.h
===================================================================
--- trunk/sys/sys/hhook.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/hhook.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,5 +1,6 @@
+/* $MidnightBSD$ */
/*-
- * Copyright (c) 2010 Lawrence Stewart <lstewart at freebsd.org>
+ * Copyright (c) 2010,2013 Lawrence Stewart <lstewart at freebsd.org>
* Copyright (c) 2010 The FreeBSD Foundation
* All rights reserved.
*
@@ -33,7 +34,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/hhook.h 251770 2013-06-15 04:03:40Z lstewart $
*/
/*
@@ -91,6 +92,7 @@
struct hhook_head {
STAILQ_HEAD(hhook_list, hhook) hhh_hooks;
struct rmlock hhh_lock;
+ uintptr_t hhh_vid;
int32_t hhh_id;
int32_t hhh_nhooks;
int32_t hhh_type;
@@ -97,6 +99,7 @@
uint32_t hhh_flags;
volatile uint32_t hhh_refcount;
LIST_ENTRY(hhook_head) hhh_next;
+ LIST_ENTRY(hhook_head) hhh_vnext;
};
/* Public KPI functions. */
Modified: trunk/sys/sys/iconv.h
===================================================================
--- trunk/sys/sys/iconv.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/iconv.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2000-2001 Boris Popov
* All rights reserved.
@@ -23,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/iconv.h 300060 2016-05-17 15:18:01Z pfg $
*/
#ifndef _SYS_ICONV_H_
#define _SYS_ICONV_H_
@@ -65,7 +66,7 @@
};
/*
- * Paramters for 'add' sysctl
+ * Parameters for 'add' sysctl
*/
#define ICONV_ADD_VER 1
@@ -240,7 +241,7 @@
int iconv_converter_handler(module_t mod, int type, void *data);
#ifdef ICONV_DEBUG
-#define ICDEBUG(format, ...) printf("%s: "format, __func__ , __VA_ARGS__)
+#define ICDEBUG(format, ...) printf("%s: "format, __func__ , ## __VA_ARGS__)
#else
#define ICDEBUG(format, ...)
#endif
Modified: trunk/sys/sys/imgact.h
===================================================================
--- trunk/sys/sys/imgact.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/imgact.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1993, David Greenman
* All rights reserved.
@@ -26,7 +27,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/imgact.h 302238 2016-06-27 22:12:11Z bdrewery $
*/
#ifndef _SYS_IMGACT_H_
@@ -38,6 +39,8 @@
#define MAXSHELLCMDLEN PAGE_SIZE
+struct ucred;
+
struct image_args {
char *buf; /* pointer to string buffer */
char *begin_argv; /* beginning of argv in buf */
@@ -61,7 +64,9 @@
unsigned long entry_addr; /* entry address of target executable */
unsigned long reloc_base; /* load address of image */
char vmspace_destroyed; /* flag - we've blown away original vm space */
- char interpreted; /* flag - this executable is interpreted */
+#define IMGACT_SHELL 0x1
+#define IMGACT_BINMISC 0x2
+ unsigned char interpreted; /* mask of interpreters that have run */
char opened; /* flag - we have opened executable vnode */
char *interpreter_name; /* name of the interpreter */
void *auxargs; /* ELF Auxinfo structure pointer */
@@ -78,11 +83,15 @@
unsigned long pagesizes;
int pagesizeslen;
vm_prot_t stack_prot;
+ u_long stack_sz;
+ struct ucred *newcred; /* new credentials if changing */
+ bool credential_setid; /* true if becoming setid */
};
#ifdef _KERNEL
struct sysentvec;
struct thread;
+struct vmspace;
#define IMGACT_CORE_COMPRESS 0x01
@@ -95,6 +104,8 @@
int exec_shell_imgact(struct image_params *);
int exec_copyin_args(struct image_args *, char *, enum uio_seg,
char **, char **);
+int pre_execve(struct thread *td, struct vmspace **oldvmspace);
+void post_execve(struct thread *td, int error, struct vmspace *oldvmspace);
#endif
#endif /* !_SYS_IMGACT_H_ */
Modified: trunk/sys/sys/imgact_aout.h
===================================================================
--- trunk/sys/sys/imgact_aout.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/imgact_aout.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -27,7 +28,7 @@
* SUCH DAMAGE.
*
* from: @(#)exec.h 8.1 (Berkeley) 6/11/93
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/imgact_aout.h 237695 2012-06-28 07:37:46Z imp $
*/
#ifndef _IMGACT_AOUT_H_
@@ -119,7 +120,7 @@
uint32_t a_trsize; /* text relocation size */
uint32_t a_drsize; /* data relocation size */
};
-#define a_magic a_midmag /* XXX Hack to work with imgact_{aout,gzip}.c */
+#define a_magic a_midmag /* Hack for emulators */
/* a_magic */
#define OMAGIC 0407 /* old impure format */
Added: trunk/sys/sys/imgact_binmisc.h
===================================================================
--- trunk/sys/sys/imgact_binmisc.h (rev 0)
+++ trunk/sys/sys/imgact_binmisc.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -0,0 +1,173 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2013 Stacey D. Son
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: stable/10/sys/sys/imgact_binmisc.h 300060 2016-05-17 15:18:01Z pfg $
+ */
+
+#ifndef _IMGACT_BINMISC_H_
+#define _IMGACT_BINMISC_H_
+
+/**
+ * Miscellaneous binary interpreter image activator.
+ */
+
+#include <sys/param.h> /* for MAXPATHLEN */
+
+/*
+ * Imgact bin misc parameters.
+ */
+#define IBE_VERSION 1 /* struct ximgact_binmisc_entry version. */
+#define IBE_NAME_MAX 32 /* Max size for entry name. */
+#define IBE_MAGIC_MAX 256 /* Max size for header magic and mask. */
+#define IBE_ARG_LEN_MAX 256 /* Max space for optional interpreter command-
+ line argruments separated by white space */
+#define IBE_INTERP_LEN_MAX (MAXPATHLEN + IBE_ARG_LEN_MAX)
+#define IBE_MAX_ENTRIES 64 /* Max number of interpreter entries. */
+
+/*
+ * Imgact bin misc interpreter entry flags.
+ */
+#define IBF_ENABLED 0x0001 /* Entry is active. */
+#define IBF_USE_MASK 0x0002 /* Use mask on header magic field. */
+
+/*
+ * Used with sysctlbyname() to pass imgact bin misc entries in and out of the
+ * kernel.
+ */
+typedef struct ximgact_binmisc_entry {
+ uint32_t xbe_version; /* Struct version(IBE_VERSION) */
+ uint32_t xbe_flags; /* Entry flags (IBF_*) */
+ uint32_t xbe_moffset; /* Magic offset in header */
+ uint32_t xbe_msize; /* Magic size */
+ uint32_t spare[3]; /* Spare fields for future use */
+ char xbe_name[IBE_NAME_MAX]; /* Unique interpreter name */
+ char xbe_interpreter[IBE_INTERP_LEN_MAX]; /* Interpreter path + args */
+ uint8_t xbe_magic[IBE_MAGIC_MAX]; /* Header Magic */
+ uint8_t xbe_mask[IBE_MAGIC_MAX]; /* Magic Mask */
+} ximgact_binmisc_entry_t;
+
+/*
+ * sysctl() command names.
+ */
+#define IBE_SYSCTL_NAME "kern.binmisc"
+
+#define IBE_SYSCTL_NAME_ADD IBE_SYSCTL_NAME ".add"
+#define IBE_SYSCTL_NAME_REMOVE IBE_SYSCTL_NAME ".remove"
+#define IBE_SYSCTL_NAME_DISABLE IBE_SYSCTL_NAME ".disable"
+#define IBE_SYSCTL_NAME_ENABLE IBE_SYSCTL_NAME ".enable"
+#define IBE_SYSCTL_NAME_LOOKUP IBE_SYSCTL_NAME ".lookup"
+#define IBE_SYSCTL_NAME_LIST IBE_SYSCTL_NAME ".list"
+
+#define KMOD_NAME "imgact_binmisc"
+
+/*
+ * Examples of manipulating the interpreter table using sysctlbyname(3):
+ *
+ * #include <sys/imgact_binmisc.h>
+ *
+ * #define LLVM_MAGIC "BC\xc0\xde"
+ *
+ * #define MIPS64_ELF_MAGIC "\x7f\x45\x4c\x46\x02\x02\x01\x00\x00\x00" \
+ * "\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08"
+ * #define MIPS64_ELF_MASK "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff" \
+ * "\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff"
+ *
+ * ximgact_binmisc_entry_t xbe, *xbep, out_xbe;
+ * size_t size = 0, osize;
+ * int error, i;
+ *
+ * // Add image activator for LLVM byte code
+ * bzero(&xbe, sizeof(xbe));
+ * xbe.xbe_version = IBE_VERSION;
+ * xbe.xbe_flags = IBF_ENABLED;
+ * strlcpy(xbe.xbe_name, "llvm_bc", IBE_NAME_MAX);
+ * strlcpy(xbe.xbe_interpreter, "/usr/bin/lli --fake-arg0=#a",
+ * IBE_INTERP_LEN_MAX);
+ * xbe.xbe_moffset = 0;
+ * xbe.xbe_msize = 4;
+ * memcpy(xbe.xbe_magic, LLVM_MAGIC, xbe.xbe_msize);
+ * error = sysctlbyname(IBE_SYSCTL_NAME_ADD, NULL, NULL, &xbe, sizeof(xbe));
+ *
+ * // Add image activator for mips64 ELF binaries to use qemu user mode
+ * bzero(&xbe, sizeof(xbe));
+ * xbe.xbe_version = IBE_VERSION;
+ * xbe.xbe_flags = IBF_ENABLED | IBF_USE_MASK;
+ * strlcpy(xbe.xbe_name, "mips64elf", IBE_NAME_MAX);
+ * strlcpy(xbe.xbe_interpreter, "/usr/local/bin/qemu-mips64",
+ * IBE_INTERP_LEN_MAX);
+ * xbe.xbe_moffset = 0;
+ * xbe.xbe_msize = 20;
+ * memcpy(xbe.xbe_magic, MIPS64_ELF_MAGIC, xbe.xbe_msize);
+ * memcpy(xbe.xbe_mask, MIPS64_ELF_MASK, xbe.xbe_msize);
+ * sysctlbyname(IBE_SYSCTL_NAME_ADD, NULL, NULL, &xbe, sizeof(xbe));
+ *
+ * // Disable (OR Enable OR Remove) image activator for LLVM byte code
+ * bzero(&xbe, sizeof(xbe));
+ * xbe.xbe_version = IBE_VERSION;
+ * strlcpy(xbe.xbe_name, "llvm_bc", IBE_NAME_MAX);
+ * error = sysctlbyname(IBE_SYSCTL_NAME_DISABLE, NULL, NULL, &xbe, sizeof(xbe));
+ * // OR sysctlbyname(IBE_SYSCTL_NAME_ENABLE, NULL, NULL, &xbe, sizeof(xbe));
+ * // OR sysctlbyname(IBE_SYSCTL_NAME_REMOVE, NULL, NULL, &xbe, sizeof(xbe));
+ *
+ * // Lookup image activator "llvm_bc"
+ * bzero(&xbe, sizeof(xbe));
+ * xbe.xbe_version = IBE_VERSION;
+ * strlcpy(xbe.xbe_name, "llvm_bc", IBE_NAME_MAX);
+ * size = sizeof(out_xbe);
+ * error = sysctlbyname(IBE_SYSCTL_NAME_LOOKUP, &out_xbe, &size, &xbe,
+ * sizeof(xbe));
+ *
+ * // Get all the currently configured image activators and report
+ * error = sysctlbyname(IBE_SYSCTL_NAME_LIST, NULL, &size, NULL, 0);
+ * if (0 == error && size > 0) {
+ * xbep = malloc(size);
+ * while(1) {
+ * osize = size;
+ * error = sysctlbyname("kern.binmisc.list", xbep, &size, NULL, 0);
+ * if (-1 == error && ENOMEM == errno && size == osize) {
+ * // The buffer too small and needs to grow
+ * size += sizeof(xbe);
+ * xbep = realloc(xbep, size);
+ * } else
+ * break;
+ * }
+ * }
+ * for(i = 0; i < (size / sizeof(xbe)); i++, xbep++)
+ * printf("name: %s interpreter: %s flags: %s %s\n", xbep->xbe_name,
+ * xbep->xbe_interpreter, (xbep->xbe_flags & IBF_ENABLED) ?
+ * "ENABLED" : "", (xbep->xbe_flags & IBF_ENABLED) ? "USE_MASK" : "");
+ *
+ * The sysctlbyname() calls above may return the following errors in addition
+ * to the standard ones:
+ *
+ * [EINVAL] Invalid argument in the input ximgact_binmisc_entry_t structure.
+ * [EEXIST] Interpreter entry for given name already exist in kernel list.
+ * [ENOMEM] Allocating memory in the kernel failed or, in the case of
+ * kern.binmisc.list, the user buffer is too small.
+ * [ENOENT] Interpreter entry for given name is not found.
+ * [ENOSPC] Attempted to exceed maximum number of entries (IBE_MAX_ENTRIES).
+ */
+
+#endif /* !_IMGACT_BINMISC_H_ */
Property changes on: trunk/sys/sys/imgact_binmisc.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/sys/sys/imgact_elf.h
===================================================================
--- trunk/sys/sys/imgact_elf.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/imgact_elf.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,5 +1,6 @@
+/* $MidnightBSD$ */
/*-
- * Copyright (c) 1995-1996 S\xF8ren Schmidt
+ * Copyright (c) 1995-1996 Søren Schmidt
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -25,7 +26,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $MidnightBSD: src/sys/sys/imgact_elf.h,v 1.5 2012/10/09 04:05:36 laffer1 Exp $
+ * $FreeBSD: stable/10/sys/sys/imgact_elf.h 316277 2017-03-30 15:05:58Z ed $
*/
#ifndef _SYS_IMGACT_ELF_H_
@@ -38,9 +39,10 @@
#define AUXARGS_ENTRY(pos, id, val) {suword(pos++, id); suword(pos++, val);}
struct thread;
+struct vnode;
/*
- * Structure used to pass infomation from the loader to the
+ * Structure used to pass information from the loader to the
* stack fixup routine.
*/
typedef struct {
@@ -89,6 +91,7 @@
int __elfN(remove_brand_entry)(Elf_Brandinfo *entry);
int __elfN(freebsd_fixup)(register_t **, struct image_params *);
int __elfN(coredump)(struct thread *, struct vnode *, off_t, int);
+size_t __elfN(populate_note)(int, void *, void *, size_t, void **);
/* Machine specific function to dump per-thread information. */
void __elfN(dump_thread)(struct thread *, void *, size_t *);
@@ -95,6 +98,7 @@
extern int __elfN(fallback_brand);
extern Elf_Brandnote __elfN(freebsd_brandnote);
+extern Elf_Brandnote __elfN(kfreebsd_brandnote);
#endif /* _KERNEL */
#endif /* !_SYS_IMGACT_ELF_H_ */
Modified: trunk/sys/sys/ioctl.h
===================================================================
--- trunk/sys/sys/ioctl.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/ioctl.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1982, 1986, 1990, 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -32,7 +33,7 @@
* SUCH DAMAGE.
*
* @(#)ioctl.h 8.6 (Berkeley) 3/28/94
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/ioctl.h 191947 2009-05-09 19:01:24Z ed $
*/
#ifndef _SYS_IOCTL_H_
Modified: trunk/sys/sys/ioctl_compat.h
===================================================================
--- trunk/sys/sys/ioctl_compat.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/ioctl_compat.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
@@ -32,7 +33,7 @@
* SUCH DAMAGE.
*
* @(#)ioctl_compat.h 8.4 (Berkeley) 1/21/94
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/ioctl_compat.h 196884 2009-09-06 09:39:40Z ed $
*/
#ifndef _SYS_IOCTL_COMPAT_H_
Modified: trunk/sys/sys/ipc.h
===================================================================
--- trunk/sys/sys/ipc.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/ipc.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1988 University of Utah.
* Copyright (c) 1990, 1993
@@ -37,7 +38,7 @@
* SUCH DAMAGE.
*
* @(#)ipc.h 8.4 (Berkeley) 2/19/95
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/ipc.h 300060 2016-05-17 15:18:01Z pfg $
*/
/*
@@ -112,7 +113,7 @@
#define IPC_STAT 2 /* get options */
#if __BSD_VISIBLE
/*
- * For Linux compatability.
+ * For Linux compatibility.
*/
#define IPC_INFO 3 /* get info */
#endif
Modified: trunk/sys/sys/ipmi.h
===================================================================
--- trunk/sys/sys/ipmi.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/ipmi.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2006 IronPort Systems Inc. <ambrisko at ironport.com>
* All rights reserved.
@@ -23,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/ipmi.h 300060 2016-05-17 15:18:01Z pfg $
*/
#ifndef __SYS_IPMI_H__
@@ -122,7 +123,7 @@
};
#if defined(__amd64__)
-/* Compatiblity with 32-bit binaries. */
+/* Compatibility with 32-bit binaries. */
#define IPMICTL_RECEIVE_MSG_TRUNC_32 _IOWR(IPMI_IOC_MAGIC, 11, struct ipmi_recv32)
#define IPMICTL_RECEIVE_MSG_32 _IOWR(IPMI_IOC_MAGIC, 12, struct ipmi_recv32)
Modified: trunk/sys/sys/jail.h
===================================================================
--- trunk/sys/sys/jail.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/jail.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1999 Poul-Henning Kamp.
* Copyright (c) 2009 James Gritton.
@@ -24,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/jail.h 298833 2016-04-30 03:19:07Z jamie $
*/
#ifndef _SYS_JAIL_H_
@@ -134,6 +135,7 @@
#include <sys/osd.h>
#define HOSTUUIDLEN 64
+#define OSRELEASELEN 32
struct racct;
struct prison_racct;
@@ -148,7 +150,6 @@
* (p) locked by pr_mtx
* (c) set only during creation before the structure is shared, no mutex
* required to read
- * (d) set only during destruction of jail, no mutex needed
*/
struct prison {
TAILQ_ENTRY(prison) pr_list; /* (a) all prisons */
@@ -160,7 +161,7 @@
LIST_ENTRY(prison) pr_sibling; /* (a) next in parent's list */
struct prison *pr_parent; /* (c) containing jail */
struct mtx pr_mtx;
- struct task pr_task; /* (d) destroy task */
+ struct task pr_task; /* (c) destroy task */
struct osd pr_osd; /* (p) additional data */
struct cpuset *pr_cpuset; /* (p) cpuset */
struct vnet *pr_vnet; /* (c) network stack */
@@ -177,7 +178,8 @@
int pr_securelevel; /* (p) securelevel */
int pr_enforce_statfs; /* (p) statfs permission */
int pr_devfs_rsnum; /* (p) devfs ruleset */
- int pr_spare[4];
+ int pr_spare[3];
+ int pr_osreldate; /* (c) kern.osreldate value */
unsigned long pr_hostid; /* (p) jail hostid */
char pr_name[MAXHOSTNAMELEN]; /* (p) admin jail name */
char pr_path[MAXPATHLEN]; /* (c) chroot path */
@@ -184,6 +186,7 @@
char pr_hostname[MAXHOSTNAMELEN]; /* (p) jail hostname */
char pr_domainname[MAXHOSTNAMELEN]; /* (p) jail domainname */
char pr_hostuuid[HOSTUUIDLEN]; /* (p) jail hostuuid */
+ char pr_osrelease[OSRELEASELEN]; /* (c) kern.osrelease value */
};
struct prison_racct {
@@ -209,7 +212,6 @@
/* primary jail address. */
/* Internal flag bits */
-#define PR_REMOVE 0x01000000 /* In process of being removed */
#define PR_IP4 0x02000000 /* IPv4 restricted or disabled */
/* by this jail or an ancestor */
#define PR_IP6 0x04000000 /* IPv6 restricted or disabled */
@@ -227,7 +229,11 @@
#define PR_ALLOW_MOUNT_NULLFS 0x0100
#define PR_ALLOW_MOUNT_ZFS 0x0200
#define PR_ALLOW_MOUNT_PROCFS 0x0400
-#define PR_ALLOW_ALL 0x07ff
+#define PR_ALLOW_MOUNT_TMPFS 0x0800
+#define PR_ALLOW_MOUNT_FDESCFS 0x1000
+#define PR_ALLOW_MOUNT_LINPROCFS 0x2000
+#define PR_ALLOW_MOUNT_LINSYSFS 0x4000
+#define PR_ALLOW_ALL 0x7fff
/*
* OSD methods
@@ -237,7 +243,8 @@
#define PR_METHOD_SET 2
#define PR_METHOD_CHECK 3
#define PR_METHOD_ATTACH 4
-#define PR_MAXMETHOD 5
+#define PR_METHOD_REMOVE 5
+#define PR_MAXMETHOD 6
/*
* Lock/unlock a prison.
@@ -362,6 +369,7 @@
void getcreddomainname(struct ucred *, char *, size_t);
void getcredhostuuid(struct ucred *, char *, size_t);
void getcredhostid(struct ucred *, unsigned long *);
+void prison0_init(void);
int prison_allow(struct ucred *, unsigned);
int prison_check(struct ucred *cred1, struct ucred *cred2);
int prison_owns_vnet(struct ucred *);
Modified: trunk/sys/sys/kbio.h
===================================================================
--- trunk/sys/sys/kbio.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/kbio.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,5 +1,6 @@
+/* $MidnightBSD$ */
/*-
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/kbio.h 224126 2011-07-17 08:19:19Z ed $
*/
#ifndef _SYS_KBIO_H_
Modified: trunk/sys/sys/kdb.h
===================================================================
--- trunk/sys/sys/kdb.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/kdb.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2004 Marcel Moolenaar
* All rights reserved.
@@ -23,7 +24,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/kdb.h 333205 2018-05-03 07:57:08Z avg $
*/
#ifndef _SYS_KDB_H_
@@ -97,6 +98,8 @@
extern const char * volatile kdb_why;
#define KDB_WHY_UNSET NULL /* No reason set. */
#define KDB_WHY_PANIC "panic" /* panic() was called. */
+#define KDB_WHY_KASSERT "kassert" /* kassert failed. */
+#define KDB_WHY_TRAP "trap" /* Fatal trap. */
#define KDB_WHY_SYSCTL "sysctl" /* Sysctl entered debugger. */
#define KDB_WHY_BOOTFLAGS "bootflags" /* Boot flags were set. */
#define KDB_WHY_WITNESS "witness" /* Witness entered debugger. */
Modified: trunk/sys/sys/kernel.h
===================================================================
--- trunk/sys/sys/kernel.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/kernel.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1995 Terrence R. Lambert
* All rights reserved.
@@ -39,7 +40,7 @@
* SUCH DAMAGE.
*
* @(#)kernel.h 8.3 (Berkeley) 1/21/94
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/kernel.h 255040 2013-08-29 19:52:18Z gibbs $
*/
#ifndef _SYS_KERNEL_H_
@@ -79,17 +80,11 @@
* enumeration values are explicit rather than implicit to provide
* for binary compatibility with inserted elements.
*
- * The SI_SUB_RUN_SCHEDULER value must have the highest lexical value.
+ * The SI_SUB_LAST value must have the highest lexical value.
*
* The SI_SUB_SWAP values represent a value used by
* the BSD 4.4Lite but not by FreeBSD; it is maintained in dependent
* order to support porting.
- *
- * The SI_SUB_PROTO_BEGIN and SI_SUB_PROTO_END bracket a range of
- * initializations to take place at splimp(). This is a historical
- * wart that should be removed -- probably running everything at
- * splimp() until the first init that doesn't want it is the correct
- * fix. They are currently present to ensure historical behavior.
*/
enum sysinit_sub_id {
SI_SUB_DUMMY = 0x0000000, /* not executed; for linker*/
@@ -102,6 +97,11 @@
SI_SUB_VM = 0x1000000, /* virtual memory system init*/
SI_SUB_KMEM = 0x1800000, /* kernel memory*/
SI_SUB_KVM_RSRC = 0x1A00000, /* kvm operational limits*/
+ SI_SUB_HYPERVISOR = 0x1A40000, /*
+ * Hypervisor detection and
+ * virtualization support
+ * setup.
+ */
SI_SUB_WITNESS = 0x1A80000, /* witness initialization */
SI_SUB_MTX_POOL_DYNAMIC = 0x1AC0000, /* dynamic mutex pool */
SI_SUB_LOCK = 0x1B00000, /* various locks */
@@ -147,12 +147,12 @@
SI_SUB_P1003_1B = 0x6E00000, /* P1003.1B realtime */
SI_SUB_PSEUDO = 0x7000000, /* pseudo devices*/
SI_SUB_EXEC = 0x7400000, /* execve() handlers */
- SI_SUB_PROTO_BEGIN = 0x8000000, /* XXX: set splimp (kludge)*/
+ SI_SUB_PROTO_BEGIN = 0x8000000, /* VNET initialization */
SI_SUB_PROTO_IF = 0x8400000, /* interfaces*/
SI_SUB_PROTO_DOMAININIT = 0x8600000, /* domain registration system */
SI_SUB_PROTO_DOMAIN = 0x8800000, /* domains (address families?)*/
SI_SUB_PROTO_IFATTACHDOMAIN = 0x8800001, /* domain dependent data init*/
- SI_SUB_PROTO_END = 0x8ffffff, /* XXX: set splx (kludge)*/
+ SI_SUB_PROTO_END = 0x8ffffff, /* VNET helper functions */
SI_SUB_KPROF = 0x9000000, /* kernel profiling*/
SI_SUB_KICK_SCHEDULER = 0xa000000, /* start the timeout events*/
SI_SUB_INT_CONFIG_HOOKS = 0xa800000, /* Interrupts enabled config */
@@ -171,7 +171,7 @@
SI_SUB_KTHREAD_IDLE = 0xee00000, /* idle procs*/
SI_SUB_SMP = 0xf000000, /* start the APs*/
SI_SUB_RACCTD = 0xf100000, /* start raccd*/
- SI_SUB_RUN_SCHEDULER = 0xfffffff /* scheduler*/
+ SI_SUB_LAST = 0xfffffff /* final initialization */
};
@@ -267,7 +267,7 @@
/*
* Infrastructure for tunable 'constants'. Value may be specified at compile
* time or kernel load time. Rules relating tunables together can be placed
- * in a SYSINIT function at SI_SUB_TUNABLES with SI_ORDER_LAST.
+ * in a SYSINIT function at SI_SUB_TUNABLES with SI_ORDER_ANY.
*
* WARNING: developers should never use the reserved suffixes specified in
* loader.conf(5) for any tunables or conflicts will result.
Modified: trunk/sys/sys/kerneldump.h
===================================================================
--- trunk/sys/sys/kerneldump.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/kerneldump.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2002 Poul-Henning Kamp
* Copyright (c) 2002 Networks Associates Technology, Inc.
@@ -32,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/kerneldump.h 214903 2010-11-07 03:09:02Z gonzo $
*/
#ifndef _SYS_KERNELDUMP_H
Modified: trunk/sys/sys/kobj.h
===================================================================
--- trunk/sys/sys/kobj.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/kobj.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2000,2003 Doug Rabson
* All rights reserved.
@@ -23,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/kobj.h 318275 2017-05-14 14:21:11Z marius $
*/
#ifndef _SYS_KOBJ_H_
@@ -34,7 +35,7 @@
*/
typedef struct kobj *kobj_t;
typedef struct kobj_class *kobj_class_t;
-typedef struct kobj_method kobj_method_t;
+typedef const struct kobj_method kobj_method_t;
typedef int (*kobjop_t)(void);
typedef struct kobj_ops *kobj_ops_t;
typedef struct kobjop_desc *kobjop_desc_t;
@@ -86,7 +87,7 @@
struct kobjop_desc {
unsigned int id; /* unique ID */
- kobj_method_t *deflt; /* default implementation */
+ kobj_method_t deflt; /* default implementation */
};
/*
@@ -226,10 +227,12 @@
kobj_method_t **_cep = \
&OPS->cache[_desc->id & (KOBJ_CACHE_SIZE-1)]; \
kobj_method_t *_ce = *_cep; \
- kobj_lookup_hits++; /* assume hit */ \
- if (_ce->desc != _desc) \
+ if (_ce->desc != _desc) { \
_ce = kobj_lookup_method(OPS->cls, \
_cep, _desc); \
+ kobj_lookup_misses++; \
+ } else \
+ kobj_lookup_hits++; \
_m = _ce->func; \
} while(0)
#else
Modified: trunk/sys/sys/ksem.h
===================================================================
--- trunk/sys/sys/ksem.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/ksem.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2002 Alfred Perlstein <alfred at FreeBSD.org>
* All rights reserved.
@@ -23,13 +24,13 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/ksem.h 250223 2013-05-03 21:11:57Z jhb $
*/
#ifndef _POSIX4_KSEM_H_
#define _POSIX4_KSEM_H_
-#ifndef _KERNEL
+#if !defined(_KERNEL) && !defined(_WANT_FILE)
#error "no user-servicable parts inside"
#endif
@@ -57,9 +58,15 @@
struct timespec ks_birthtime;
struct label *ks_label; /* MAC label */
+ const char *ks_path;
};
#define KS_ANONYMOUS 0x0001 /* Anonymous (unnamed) semaphore. */
#define KS_DEAD 0x0002 /* No new waiters allowed. */
+#ifdef _KERNEL
+extern void (*ksem_info)(struct ksem *ks, char *path, size_t size,
+ uint32_t *value);
+#endif
+
#endif /* !_POSIX4_KSEM_H_ */
Modified: trunk/sys/sys/ksyms.h
===================================================================
--- trunk/sys/sys/ksyms.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/ksyms.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2008-2009, Stacey Son <sson at freebsd.org>
* All rights reserved.
@@ -23,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/ksyms.h 192859 2009-05-26 21:39:09Z sson $
*/
#ifndef _SYS_KSYMS_H_
Modified: trunk/sys/sys/ktr.h
===================================================================
--- trunk/sys/sys/ktr.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/ktr.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1996 Berkeley Software Design, Inc. All rights reserved.
*
@@ -25,8 +26,8 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * from BSDI $Id: ktr.h,v 1.5 2012-10-09 04:05:36 laffer1 Exp $
- * $MidnightBSD$
+ * from BSDI $Id: ktr.h,v 1.10.2.7 2000/03/16 21:44:42 cp Exp $
+ * $FreeBSD: stable/10/sys/sys/ktr.h 284343 2015-06-13 16:15:43Z jhb $
*/
/*
@@ -75,7 +76,8 @@
#define KTR_INET6 0x10000000 /* IPv6 stack */
#define KTR_SCHED 0x20000000 /* Machine parsed sched info. */
#define KTR_BUF 0x40000000 /* Buffer cache */
-#define KTR_ALL 0x7fffffff
+#define KTR_PTRACE 0x80000000 /* Process debugging. */
+#define KTR_ALL 0xffffffff
/* Trace classes to compile in */
#ifdef KTR
@@ -116,7 +118,7 @@
extern int ktr_verbose;
extern volatile int ktr_idx;
-extern struct ktr_entry ktr_buf[];
+extern struct ktr_entry *ktr_buf;
#ifdef KTR
@@ -244,6 +246,50 @@
point, a0, (v0), a1, (v1), a2, (v2), a3, (v3))
/*
+ * Start functions denote the start of a region of code or operation
+ * and should be paired with stop functions for timing of nested
+ * sequences.
+ *
+ * Specifying extra attributes with the name "key" will result in
+ * multi-part keys. For example a block device and offset pair
+ * might be used to describe a buf undergoing I/O.
+ */
+#define KTR_START0(m, egroup, ident, key) \
+ KTR_EVENT0(m, egroup, ident, "start:0x%jX", (uintmax_t)key)
+#define KTR_START1(m, egroup, ident, key, a0, v0) \
+ KTR_EVENT1(m, egroup, ident, "start:0x%jX", (uintmax_t)key, a0, (v0))
+#define KTR_START2(m, egroup, ident, key, a0, v0, a1, v1) \
+ KTR_EVENT2(m, egroup, ident, "start:0x%jX", (uintmax_t)key, \
+ a0, (v0), a1, (v1))
+#define KTR_START3(m, egroup, ident, key, a0, v0, a1, v1, a2, v2)\
+ KTR_EVENT3(m, egroup, ident, "start:0x%jX", (uintmax_t)key, \
+ a0, (v0), a1, (v1), a2, (v2))
+#define KTR_START4(m, egroup, ident, key, \
+ a0, v0, a1, v1, a2, v2, a3, v3) \
+ KTR_EVENT4(m, egroup, ident, "start:0x%jX", (uintmax_t)key, \
+ a0, (v0), a1, (v1), a2, (v2), a3, (v3))
+
+/*
+ * Stop functions denote the end of a region of code or operation
+ * and should be paired with start functions for timing of nested
+ * sequences.
+ */
+#define KTR_STOP0(m, egroup, ident, key) \
+ KTR_EVENT0(m, egroup, ident, "stop:0x%jX", (uintmax_t)key)
+#define KTR_STOP1(m, egroup, ident, key, a0, v0) \
+ KTR_EVENT1(m, egroup, ident, "stop:0x%jX", (uintmax_t)key, a0, (v0))
+#define KTR_STOP2(m, egroup, ident, key, a0, v0, a1, v1) \
+ KTR_EVENT2(m, egroup, ident, "stop:0x%jX", (uintmax_t)key, \
+ a0, (v0), a1, (v1))
+#define KTR_STOP3(m, egroup, ident, key, a0, v0, a1, v1, a2, v2)\
+ KTR_EVENT3(m, egroup, ident, "stop:0x%jX", (uintmax_t)key, \
+ a0, (v0), a1, (v1), a2, (v2))
+#define KTR_STOP4(m, egroup, ident, \
+ key, a0, v0, a1, v1, a2, v2, a3, v3) \
+ KTR_EVENT4(m, egroup, ident, "stop:0x%jX", (uintmax_t)key, \
+ a0, (v0), a1, (v1), a2, (v2), a3, (v3))
+
+/*
* Trace initialization events, similar to CTR with KTR_INIT, but
* completely ifdef'ed out if KTR_INIT isn't in KTR_COMPILE (to
* save string space, the compiler doesn't optimize out strings
Modified: trunk/sys/sys/ktrace.h
===================================================================
--- trunk/sys/sys/ktrace.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/ktrace.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
@@ -27,12 +28,14 @@
* SUCH DAMAGE.
*
* @(#)ktrace.h 8.1 (Berkeley) 6/2/93
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/ktrace.h 315562 2017-03-19 15:56:06Z kib $
*/
#ifndef _SYS_KTRACE_H_
#define _SYS_KTRACE_H_
+#include <sys/caprights.h>
+
/*
* operations to ktrace system call (KTROP(op))
*/
@@ -184,6 +187,22 @@
#define KTR_PROCDTOR 11
/*
+ * KTR_CAPFAIL - trace capability check failures
+ */
+#define KTR_CAPFAIL 12
+enum ktr_cap_fail_type {
+ CAPFAIL_NOTCAPABLE, /* insufficient capabilities in cap_check() */
+ CAPFAIL_INCREASE, /* attempt to increase capabilities */
+ CAPFAIL_SYSCALL, /* disallowed system call */
+ CAPFAIL_LOOKUP, /* disallowed VFS lookup */
+};
+struct ktr_cap_fail {
+ enum ktr_cap_fail_type cap_type;
+ cap_rights_t cap_needed;
+ cap_rights_t cap_held;
+};
+
+/*
* KTR_FAULT - page fault record
*/
#define KTR_FAULT 13
@@ -221,6 +240,7 @@
#define KTRFAC_SYSCTL (1<<KTR_SYSCTL)
#define KTRFAC_PROCCTOR (1<<KTR_PROCCTOR)
#define KTRFAC_PROCDTOR (1<<KTR_PROCDTOR)
+#define KTRFAC_CAPFAIL (1<<KTR_CAPFAIL)
#define KTRFAC_FAULT (1<<KTR_FAULT)
#define KTRFAC_FAULTEND (1<<KTR_FAULTEND)
@@ -247,11 +267,17 @@
void ktrprocfork(struct proc *, struct proc *);
void ktruserret(struct thread *);
void ktrstruct(const char *, void *, size_t);
+void ktrcapfail(enum ktr_cap_fail_type, const cap_rights_t *,
+ const cap_rights_t *);
+#define ktrcaprights(s) \
+ ktrstruct("caprights", (s), sizeof(cap_rights_t))
+#define ktritimerval(s) \
+ ktrstruct("itimerval", (s), sizeof(struct itimerval))
#define ktrsockaddr(s) \
ktrstruct("sockaddr", (s), ((struct sockaddr *)(s))->sa_len)
#define ktrstat(s) \
ktrstruct("stat", (s), sizeof(struct stat))
-
+extern u_int ktr_geniosize;
#else
#include <sys/cdefs.h>
Modified: trunk/sys/sys/libkern.h
===================================================================
--- trunk/sys/sys/libkern.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/libkern.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -27,7 +28,7 @@
* SUCH DAMAGE.
*
* @(#)libkern.h 8.1 (Berkeley) 6/10/93
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/libkern.h 306536 2016-09-30 22:40:58Z jkim $
*/
#ifndef _SYS_LIBKERN_H_
@@ -94,9 +95,19 @@
#ifndef HAVE_INLINE_FLSL
int flsl(long);
#endif
+#ifndef HAVE_INLINE_FLSLL
+int flsll(long long);
+#endif
+#define bitcount64(x) __bitcount64((uint64_t)(x))
+#define bitcount32(x) __bitcount32((uint32_t)(x))
+#define bitcount16(x) __bitcount16((uint16_t)(x))
+#define bitcountl(x) __bitcountl((u_long)(x))
+#define bitcount(x) __bitcount((u_int)(x))
+
int fnmatch(const char *, const char *, int);
int locc(int, char *, u_int);
void *memchr(const void *s, int c, size_t n);
+void *memcchr(const void *s, int c, size_t n);
int memcmp(const void *b1, const void *b2, size_t len);
void qsort(void *base, size_t nmemb, size_t size,
int (*compar)(const void *, const void *));
@@ -103,17 +114,17 @@
void qsort_r(void *base, size_t nmemb, size_t size, void *thunk,
int (*compar)(void *, const void *, const void *));
u_long random(void);
-char *index(const char *, int);
-char *rindex(const char *, int);
int scanc(u_int, const u_char *, const u_char *, int);
-int skpc(int, int, char *);
void srandom(u_long);
int strcasecmp(const char *, const char *);
char *strcat(char * __restrict, const char * __restrict);
+char *strchr(const char *, int);
int strcmp(const char *, const char *);
char *strcpy(char * __restrict, const char * __restrict);
size_t strcspn(const char * __restrict, const char * __restrict) __pure;
char *strdup(const char *__restrict, struct malloc_type *);
+char *strncat(char *, const char *, size_t);
+char *strndup(const char *__restrict, size_t, struct malloc_type *);
size_t strlcat(char *, const char *, size_t);
size_t strlcpy(char *, const char *, size_t);
size_t strlen(const char *);
@@ -121,12 +132,13 @@
int strncmp(const char *, const char *, size_t);
char *strncpy(char * __restrict, const char * __restrict, size_t);
size_t strnlen(const char *, size_t);
+char *strrchr(const char *, int);
char *strsep(char **, const char *delim);
size_t strspn(const char *, const char *);
char *strstr(const char *, const char *);
int strvalid(const char *, size_t);
-extern uint32_t crc32_tab[];
+extern const uint32_t crc32_tab[];
static __inline uint32_t
crc32_raw(const void *buf, size_t size, uint32_t crc)
@@ -148,8 +160,8 @@
}
uint32_t
-calculate_crc32c(uint32_t crc32c, const unsigned char *buffer,
- unsigned int length);
+calculate_crc32c(uint32_t crc32c, const unsigned char *buffer,
+ unsigned int length);
LIBKERN_INLINE void *memset(void *, int, size_t);
@@ -169,15 +181,17 @@
#endif
static __inline char *
-strchr(const char *p, int ch)
+index(const char *p, int ch)
{
- return (index(p, ch));
+
+ return (strchr(p, ch));
}
static __inline char *
-strrchr(const char *p, int ch)
+rindex(const char *p, int ch)
{
- return (rindex(p, ch));
+
+ return (strrchr(p, ch));
}
/* fnmatch() return values. */
Modified: trunk/sys/sys/link_elf.h
===================================================================
--- trunk/sys/sys/link_elf.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/link_elf.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1993 Paul Kranenburg
* All rights reserved.
@@ -27,7 +28,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/link_elf.h 276908 2015-01-10 09:22:17Z kib $
*/
/*
@@ -94,7 +95,12 @@
extern int dl_iterate_phdr(__dl_iterate_hdr_callback, void *);
int _rtld_addr_phdr(const void *, struct dl_phdr_info *);
int _rtld_get_stack_prot(void);
+int _rtld_is_dlopened(void *);
+#ifdef __ARM_EABI__
+void * dl_unwind_find_exidx(const void *, int *);
+#endif
+
__END_DECLS
#endif /* _SYS_LINK_ELF_H_ */
Modified: trunk/sys/sys/linker.h
===================================================================
--- trunk/sys/sys/linker.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/linker.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1997-2000 Doug Rabson
* All rights reserved.
@@ -23,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/linker.h 300060 2016-05-17 15:18:01Z pfg $
*/
#ifndef _SYS_LINKER_H_
@@ -92,10 +93,6 @@
*/
int nenabled; /* number of enabled probes. */
int fbt_nentries; /* number of fbt entries created. */
- void *sdt_probes;
- int sdt_nentries;
- size_t sdt_nprobes;
- size_t sdt_size;
};
/*
@@ -162,7 +159,7 @@
linker_function_nameval_callback_t, void *);
/*
- * Functions soley for use by the linker class handlers.
+ * Functions solely for use by the linker class handlers.
*/
int linker_add_class(linker_class_t _cls);
int linker_file_unload(linker_file_t _file, int flags);
@@ -263,7 +260,7 @@
#endif
-typedef Elf_Addr elf_lookup_fn(linker_file_t, Elf_Size, int);
+typedef int elf_lookup_fn(linker_file_t, Elf_Size, int, Elf_Addr *);
/* Support functions */
int elf_reloc(linker_file_t _lf, Elf_Addr base, const void *_rel, int _type, elf_lookup_fn _lu);
Modified: trunk/sys/sys/linker_set.h
===================================================================
--- trunk/sys/sys/linker_set.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/linker_set.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1999 John D. Polstra
* Copyright (c) 1999,2001 Peter Wemm <peter at FreeBSD.org>
@@ -24,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/linker_set.h 284880 2015-06-26 21:35:36Z hselasky $
*/
#ifndef _SYS_LINKER_SET_H_
@@ -68,9 +69,9 @@
/*
* Initialize before referring to a given linker set.
*/
-#define SET_DECLARE(set, ptype) \
- extern ptype *__CONCAT(__start_set_,set); \
- extern ptype *__CONCAT(__stop_set_,set)
+#define SET_DECLARE(set, ptype) \
+ extern ptype __weak_symbol *__CONCAT(__start_set_,set); \
+ extern ptype __weak_symbol *__CONCAT(__stop_set_,set)
#define SET_BEGIN(set) \
(&__CONCAT(__start_set_,set))
Modified: trunk/sys/sys/lock.h
===================================================================
--- trunk/sys/sys/lock.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/lock.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1997 Berkeley Software Design, Inc. All rights reserved.
*
@@ -26,7 +27,7 @@
* SUCH DAMAGE.
*
* from BSDI Id: mutex.h,v 2.7.2.35 2000/04/27 03:10:26 cp
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/lock.h 323870 2017-09-21 19:24:11Z marius $
*/
#ifndef _SYS_LOCK_H_
@@ -56,13 +57,14 @@
*/
struct lock_class {
- const char *lc_name;
- u_int lc_flags;
- void (*lc_assert)(struct lock_object *lock, int what);
- void (*lc_ddb_show)(struct lock_object *lock);
- void (*lc_lock)(struct lock_object *lock, int how);
- int (*lc_owner)(struct lock_object *lock, struct thread **owner);
- int (*lc_unlock)(struct lock_object *lock);
+ const char *lc_name;
+ u_int lc_flags;
+ void (*lc_assert)(const struct lock_object *lock, int what);
+ void (*lc_ddb_show)(const struct lock_object *lock);
+ void (*lc_lock)(struct lock_object *lock, uintptr_t how);
+ int (*lc_owner)(const struct lock_object *lock,
+ struct thread **owner);
+ uintptr_t (*lc_unlock)(struct lock_object *lock);
};
#define LC_SLEEPLOCK 0x00000001 /* Sleep lock. */
@@ -79,8 +81,10 @@
#define LO_SLEEPABLE 0x00100000 /* Lock may be held while sleeping. */
#define LO_UPGRADABLE 0x00200000 /* Lock may be upgraded/downgraded. */
#define LO_DUPOK 0x00400000 /* Don't check for duplicate acquires */
+#define LO_IS_VNODE 0x00800000 /* Tell WITNESS about a VNODE lock */
#define LO_CLASSMASK 0x0f000000 /* Class index bitmask. */
#define LO_NOPROFILE 0x10000000 /* Don't profile this lock */
+#define LO_NEW 0x20000000 /* Don't check for double-init */
/*
* Lock classes are statically assigned an index into the gobal lock_classes
@@ -192,13 +196,38 @@
extern struct lock_class lock_class_sx;
extern struct lock_class lock_class_rw;
extern struct lock_class lock_class_rm;
+extern struct lock_class lock_class_rm_sleepable;
extern struct lock_class lock_class_lockmgr;
extern struct lock_class *lock_classes[];
+struct lock_delay_config {
+ u_int initial;
+ u_int step;
+ u_int min;
+ u_int max;
+};
+
+struct lock_delay_arg {
+ struct lock_delay_config *config;
+ u_int delay;
+ u_int spin_cnt;
+};
+
+static inline void
+lock_delay_arg_init(struct lock_delay_arg *la, struct lock_delay_config *lc) {
+ la->config = lc;
+ la->delay = 0;
+ la->spin_cnt = 0;
+}
+
+#define LOCK_DELAY_SYSINIT(func) \
+ SYSINIT(func##_ld, SI_SUB_LOCK, SI_ORDER_ANY, func, NULL)
+
void lock_init(struct lock_object *, struct lock_class *,
const char *, const char *, int);
void lock_destroy(struct lock_object *);
+void lock_delay(struct lock_delay_arg *);
void spinlock_enter(void);
void spinlock_exit(void);
void witness_init(struct lock_object *, const char *);
@@ -215,7 +244,7 @@
int witness_list_locks(struct lock_list_entry **,
int (*)(const char *, ...));
int witness_warn(int, struct lock_object *, const char *, ...);
-void witness_assert(struct lock_object *, int, const char *, int);
+void witness_assert(const struct lock_object *, int, const char *, int);
void witness_display_spinlock(struct lock_object *, struct thread *,
int (*)(const char *, ...));
int witness_line(struct lock_object *);
@@ -304,16 +333,5 @@
#define WITNESS_LINE(lock) (0)
#endif /* WITNESS */
-/*
- * Helper macros to allow developers to add explicit lock order checks
- * wherever they please without having to actually grab a lock to do so.
- */
-#define witness_check(l) \
- WITNESS_CHECKORDER(&(l)->lock_object, LOP_EXCLUSIVE, LOCK_FILE, \
- LOCK_LINE, NULL)
-
-#define witness_check_shared(l) \
- WITNESS_CHECKORDER(&(l)->lock_object, 0, LOCK_FILE, LOCK_LINE, NULL)
-
#endif /* _KERNEL */
#endif /* _SYS_LOCK_H_ */
Modified: trunk/sys/sys/lock_profile.h
===================================================================
--- trunk/sys/sys/lock_profile.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/lock_profile.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2006 Kip Macy kmacy at FreeBSD.org
* Copyright (c) 2006 Kris Kennaway kris at FreeBSD.org
@@ -24,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/lock_profile.h 194578 2009-06-21 09:01:12Z rdivacky $
*/
Modified: trunk/sys/sys/lockmgr.h
===================================================================
--- trunk/sys/sys/lockmgr.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/lockmgr.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2008 Attilio Rao <attilio at FreeBSD.org>
* All rights reserved.
@@ -25,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/lockmgr.h 274606 2014-11-16 23:02:32Z kib $
*/
#ifndef _SYS_LOCKMGR_H_
@@ -69,7 +70,7 @@
int __lockmgr_args(struct lock *lk, u_int flags, struct lock_object *ilk,
const char *wmesg, int prio, int timo, const char *file, int line);
#if defined(INVARIANTS) || defined(INVARIANT_SUPPORT)
-void _lockmgr_assert(struct lock *lk, int what, const char *file, int line);
+void _lockmgr_assert(const struct lock *lk, int what, const char *file, int line);
#endif
void _lockmgr_disown(struct lock *lk, const char *file, int line);
@@ -77,13 +78,14 @@
void lockallowshare(struct lock *lk);
void lockdestroy(struct lock *lk);
void lockdisablerecurse(struct lock *lk);
+void lockdisableshare(struct lock *lk);
void lockinit(struct lock *lk, int prio, const char *wmesg, int timo,
int flags);
#ifdef DDB
int lockmgr_chain(struct thread *td, struct thread **ownerp);
#endif
-void lockmgr_printinfo(struct lock *lk);
-int lockstatus(struct lock *lk);
+void lockmgr_printinfo(const struct lock *lk);
+int lockstatus(const struct lock *lk);
/*
* As far as the ilk can be a static NULL pointer these functions need a
@@ -146,6 +148,7 @@
#define LK_NOWITNESS 0x000010
#define LK_QUIET 0x000020
#define LK_ADAPTIVE 0x000040
+#define LK_IS_VNODE 0x000080 /* Tell WITNESS about a VNODE lock */
/*
* Additional attributes to be used in lockmgr().
@@ -156,6 +159,7 @@
#define LK_RETRY 0x000400
#define LK_SLEEPFAIL 0x000800
#define LK_TIMELOCK 0x001000
+#define LK_NODDLKTREAT 0x002000
/*
* Operations for lockmgr().
@@ -168,6 +172,7 @@
#define LK_RELEASE 0x100000
#define LK_SHARED 0x200000
#define LK_UPGRADE 0x400000
+#define LK_TRYUPGRADE 0x800000
#define LK_TOTAL_MASK (LK_INIT_MASK | LK_EATTR_MASK | LK_TYPE_MASK)
Modified: trunk/sys/sys/lockstat.h
===================================================================
--- trunk/sys/sys/lockstat.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/lockstat.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2008-2009 Stacey Son <sson at FreeBSD.org>
*
@@ -22,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/lockstat.h 285759 2015-07-21 17:16:37Z markj $
*/
/*
@@ -149,11 +150,13 @@
* The following must match the type definition of dtrace_probe. It is
* defined this way to avoid having to rely on CDDL code.
*/
+struct lock_object;
extern uint32_t lockstat_probemap[LS_NPROBES];
typedef void (*lockstat_probe_func_t)(uint32_t, uintptr_t arg0, uintptr_t arg1,
uintptr_t arg2, uintptr_t arg3, uintptr_t arg4);
extern lockstat_probe_func_t lockstat_probe_func;
-extern uint64_t lockstat_nsecs(void);
+extern uint64_t lockstat_nsecs(struct lock_object *);
+extern int lockstat_enabled;
#ifdef KDTRACE_HOOKS
/*
@@ -198,6 +201,9 @@
(*lockstat_probe_func)(id, (uintptr_t)(lp), 0, 0, 0, 0); \
} while (0)
+#define LOCKSTAT_WRITER 0
+#define LOCKSTAT_READER 1
+
#else /* !KDTRACE_HOOKS */
#define LOCKSTAT_RECORD(probe, lp, arg1)
Modified: trunk/sys/sys/malloc.h
===================================================================
--- trunk/sys/sys/malloc.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/malloc.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1987, 1993
* The Regents of the University of California.
@@ -29,7 +30,7 @@
* SUCH DAMAGE.
*
* @(#)malloc.h 8.5 (Berkeley) 5/3/95
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/malloc.h 328276 2018-01-23 04:37:31Z kp $
*/
#ifndef _SYS_MALLOC_H_
@@ -39,6 +40,7 @@
#include <sys/queue.h>
#include <sys/_lock.h>
#include <sys/_mutex.h>
+#include <machine/_limits.h>
#define MINALLOCSIZE UMA_SMALLEST_UNIT
@@ -51,6 +53,8 @@
#define M_NOVM 0x0200 /* don't ask VM for pages */
#define M_USE_RESERVE 0x0400 /* can alloc out of reserve memory */
#define M_NODUMP 0x0800 /* don't dump pages in this allocation */
+#define M_FIRSTFIT 0x1000 /* Only for vmem, fast fit. */
+#define M_BESTFIT 0x2000 /* Only for vmem, low fragmentation. */
#define M_MAGIC 877983977 /* time when first defined :-) */
@@ -171,9 +175,11 @@
void contigfree(void *addr, unsigned long size, struct malloc_type *type);
void *contigmalloc(unsigned long size, struct malloc_type *type, int flags,
vm_paddr_t low, vm_paddr_t high, unsigned long alignment,
- unsigned long boundary) __malloc_like;
+ vm_paddr_t boundary) __malloc_like;
void free(void *addr, struct malloc_type *type);
void *malloc(unsigned long size, struct malloc_type *type, int flags) __malloc_like;
+void *mallocarray(size_t nmemb, size_t size, struct malloc_type *type,
+ int flags) __malloc_like __result_use_check;
void malloc_init(void *);
int malloc_last_fail(void);
void malloc_type_allocated(struct malloc_type *type, unsigned long size);
@@ -186,6 +192,20 @@
int flags);
struct malloc_type *malloc_desc2type(const char *desc);
+
+/*
+ * This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX
+ * if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW
+ */
+#define MUL_NO_OVERFLOW (1UL << (sizeof(size_t) * 8 / 2))
+static inline bool
+WOULD_OVERFLOW(size_t nmemb, size_t size)
+{
+
+ return ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) &&
+ nmemb > 0 && __SIZE_T_MAX / nmemb < size);
+}
+#undef MUL_NO_OVERFLOW
#endif /* _KERNEL */
#endif /* !_SYS_MALLOC_H_ */
Modified: trunk/sys/sys/mbpool.h
===================================================================
--- trunk/sys/sys/mbpool.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/mbpool.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2003
* Fraunhofer Institute for Open Communication Systems (FhG Fokus).
@@ -34,7 +35,7 @@
* interfaces on 64bit machines). This assists network interfaces that may need
* huge numbers of mbufs.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/mbpool.h 254842 2013-08-25 10:57:09Z andre $
*/
#ifndef _SYS_MBPOOL_H_
#define _SYS_MBPOOL_H_
@@ -69,7 +70,7 @@
void mbp_free(struct mbpool *, void *);
/* free a chunk that is an external mbuf */
-void mbp_ext_free(void *, void *);
+int mbp_ext_free(struct mbuf *, void *, void *);
/* free all buffers that are marked to be on the card */
void mbp_card_free(struct mbpool *);
Modified: trunk/sys/sys/mbuf.h
===================================================================
--- trunk/sys/sys/mbuf.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/mbuf.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1982, 1986, 1988, 1993
* The Regents of the University of California.
@@ -28,7 +29,7 @@
* SUCH DAMAGE.
*
* @(#)mbuf.h 8.5 (Berkeley) 2/19/95
- * $MidnightBSD: src/sys/sys/mbuf.h,v 1.8 2012/10/09 04:05:36 laffer1 Exp $
+ * $FreeBSD: stable/10/sys/sys/mbuf.h 282786 2015-05-12 00:27:20Z hiren $
*/
#ifndef _SYS_MBUF_H_
@@ -52,11 +53,18 @@
* stored. Additionally, it is possible to allocate a separate buffer
* externally and attach it to the mbuf in a way similar to that of mbuf
* clusters.
+ *
+ * NB: These calculation do not take actual compiler-induced alignment and
+ * padding inside the complete struct mbuf into account. Appropriate
+ * attention is required when changing members of struct mbuf.
+ *
+ * MLEN is data length in a normal mbuf.
+ * MHLEN is data length in an mbuf with pktheader.
+ * MINCLSIZE is a smallest amount of data that should be put into cluster.
*/
-#define MLEN (MSIZE - sizeof(struct m_hdr)) /* normal data len */
-#define MHLEN (MLEN - sizeof(struct pkthdr)) /* data len w/pkthdr */
-#define MINCLSIZE (MHLEN + 1) /* smallest amount to put in cluster */
-#define M_MAXCOMPRESS (MHLEN / 2) /* max amount to copy for compression */
+#define MLEN ((int)(MSIZE - sizeof(struct m_hdr)))
+#define MHLEN ((int)(MLEN - sizeof(struct pkthdr)))
+#define MINCLSIZE (MHLEN + 1)
#ifdef _KERNEL
/*-
@@ -64,8 +72,10 @@
* type:
*
* mtod(m, t) -- Convert mbuf pointer to data pointer of correct type.
+ * mtodo(m, o) -- Same as above but with offset 'o' into data.
*/
#define mtod(m, t) ((t)((m)->m_data))
+#define mtodo(m, o) ((void *)(((m)->m_data) + (o)))
/*
* Argument structure passed to UMA routines during mbuf and packet
@@ -77,23 +87,21 @@
};
#endif /* _KERNEL */
-#if defined(__LP64__)
-#define M_HDR_PAD 6
-#else
-#define M_HDR_PAD 2
-#endif
-
/*
* Header present at the beginning of every mbuf.
+ * Size ILP32: 24
+ * LP64: 32
*/
struct m_hdr {
struct mbuf *mh_next; /* next buffer in chain */
struct mbuf *mh_nextpkt; /* next chain in queue/record */
caddr_t mh_data; /* location of data */
- int mh_len; /* amount of data in this mbuf */
- int mh_flags; /* flags; see below */
- short mh_type; /* type of data in this mbuf */
- uint8_t pad[M_HDR_PAD];/* word align */
+ int32_t mh_len; /* amount of data in this mbuf */
+ uint32_t mh_type:8, /* type of data in this mbuf */
+ mh_flags:24; /* flags; see below */
+#if !defined(__LP64__)
+ uint32_t mh_pad; /* pad for 64bit alignment */
+#endif
};
/*
@@ -109,42 +117,66 @@
/*
* Record/packet header in first mbuf of chain; valid only if M_PKTHDR is set.
+ * Size ILP32: 48
+ * LP64: 56
*/
struct pkthdr {
struct ifnet *rcvif; /* rcv interface */
- /* variables for ip and tcp reassembly */
- void *header; /* pointer to packet header */
- int len; /* total packet length */
- uint32_t flowid; /* packet's 4-tuple system
- * flow identifier
- */
- /* variables for hardware checksum */
- int csum_flags; /* flags regarding checksum */
- int csum_data; /* data field used by csum routines */
- u_int16_t tso_segsz; /* TSO segment size */
+ SLIST_HEAD(packet_tags, m_tag) tags; /* list of packet tags */
+ int32_t len; /* total packet length */
+
+ /* Layer crossing persistent information. */
+ uint32_t flowid; /* packet's 4-tuple system */
+ uint64_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 {
- u_int16_t vt_vtag; /* Ethernet 802.1p+q vlan tag */
- u_int16_t vt_nrecs; /* # of IGMPv3 records in this chain */
- } PH_vt;
- u_int16_t fibnum; /* this packet should use this fib */
- u_int16_t pad2; /* align to 32 bits */
- SLIST_HEAD(packet_tags, m_tag) tags; /* list of packet tags */
+ uint8_t eigth[8];
+ uint16_t sixteen[4];
+ uint32_t thirtytwo[2];
+ uint64_t sixtyfour[1];
+ uintptr_t unintptr[1];
+ void *ptr;
+ } PH_per;
+
+ /* Layer specific non-persistent local storage for reassembly, etc. */
+ union {
+ uint8_t eigth[8];
+ uint16_t sixteen[4];
+ uint32_t thirtytwo[2];
+ uint64_t sixtyfour[1];
+ uintptr_t unintptr[1];
+ void *ptr;
+ } PH_loc;
};
-#define ether_vtag PH_vt.vt_vtag
+#define ether_vtag PH_per.sixteen[0]
+#define PH_vt PH_per
+#define vt_nrecs sixteen[0]
+#define tso_segsz PH_per.sixteen[1]
+#define csum_phsum PH_per.sixteen[2]
+#define csum_data PH_per.thirtytwo[1]
/*
* Description of external storage mapped into mbuf; valid only if M_EXT is
* set.
+ * Size ILP32: 28
+ * LP64: 48
*/
struct m_ext {
+ volatile u_int *ref_cnt; /* pointer to ref count info */
caddr_t ext_buf; /* start of buffer */
- void (*ext_free) /* free routine if not the usual */
- (void *, void *);
+ 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 */
+ int (*ext_free) /* free routine if not the usual */
+ (struct mbuf *, void *, void *);
void *ext_arg1; /* optional argument pointer */
void *ext_arg2; /* optional argument pointer */
- u_int ext_size; /* size of buffer, for ext_free */
- volatile u_int *ref_cnt; /* pointer to ref count info */
- int ext_type; /* type of external storage */
};
/*
@@ -170,50 +202,78 @@
#define m_type m_hdr.mh_type
#define m_flags m_hdr.mh_flags
#define m_nextpkt m_hdr.mh_nextpkt
-#define m_fibnum m_hdr.mh_nextpkt
-#define m_act m_nextpkt
#define m_pkthdr M_dat.MH.MH_pkthdr
#define m_ext M_dat.MH.MH_dat.MH_ext
#define m_pktdat M_dat.MH.MH_dat.MH_databuf
#define m_dat M_dat.M_databuf
+/*
+ * NOTE: forwards compatibility definitions for mbuf(9)
+ *
+ * These aren't 1:1 with the macros in r277203; in particular they're exposed
+ * to both userland and kernel, whereas this is exposed to just _KERNEL -- to
+ * avoid disruption with existing KBI/KPIs
+ */
+#define MHSIZE offsetof(struct mbuf, m_dat)
+#define MPKTHSIZE offsetof(struct mbuf, m_pktdat)
+
/*
- * mbuf flags.
+ * mbuf flags of global significance and layer crossing.
+ * Those of only protocol/layer specific significance are to be mapped
+ * to M_PROTO[1-12] and cleared at layer handoff boundaries.
+ * NB: Limited to the lower 24 bits.
*/
#define M_EXT 0x00000001 /* has associated external storage */
#define M_PKTHDR 0x00000002 /* start of record */
#define M_EOR 0x00000004 /* end of record */
#define M_RDONLY 0x00000008 /* associated data is marked read-only */
-#define M_PROTO1 0x00000010 /* protocol-specific */
-#define M_PROTO2 0x00000020 /* protocol-specific */
-#define M_PROTO3 0x00000040 /* protocol-specific */
-#define M_PROTO4 0x00000080 /* protocol-specific */
-#define M_PROTO5 0x00000100 /* protocol-specific */
-#define M_BCAST 0x00000200 /* send/received as link-level broadcast */
-#define M_MCAST 0x00000400 /* send/received as link-level multicast */
-#define M_FRAG 0x00000800 /* packet is a fragment of a larger packet */
-#define M_FIRSTFRAG 0x00001000 /* packet is first fragment */
-#define M_LASTFRAG 0x00002000 /* packet is last fragment */
-#define M_SKIP_FIREWALL 0x00004000 /* skip firewall processing */
-#define M_FREELIST 0x00008000 /* mbuf is on the free list */
-#define M_VLANTAG 0x00010000 /* ether_vtag is valid */
-#define M_PROMISC 0x00020000 /* packet was not for us */
-#define M_NOFREE 0x00040000 /* do not free mbuf, embedded in cluster */
-#define M_PROTO6 0x00080000 /* protocol-specific */
-#define M_PROTO7 0x00100000 /* protocol-specific */
-#define M_PROTO8 0x00200000 /* protocol-specific */
-#define M_FLOWID 0x00400000 /* deprecated: flowid is valid */
-#define M_HASHTYPEBITS 0x0F000000 /* mask of bits holding flowid hash type */
+#define M_BCAST 0x00000010 /* send/received as link-level broadcast */
+#define M_MCAST 0x00000020 /* send/received as link-level multicast */
+#define M_PROMISC 0x00000040 /* packet was not for us */
+#define M_VLANTAG 0x00000080 /* ether_vtag is valid */
+#define M_FLOWID 0x00000100 /* deprecated: flowid is valid */
+#define M_NOFREE 0x00000200 /* do not free mbuf, embedded in cluster */
-#define M_NOTIFICATION M_PROTO5 /* SCTP notification */
+#define M_PROTO1 0x00001000 /* protocol-specific */
+#define M_PROTO2 0x00002000 /* protocol-specific */
+#define M_PROTO3 0x00004000 /* protocol-specific */
+#define M_PROTO4 0x00008000 /* protocol-specific */
+#define M_PROTO5 0x00010000 /* protocol-specific */
+#define M_PROTO6 0x00020000 /* protocol-specific */
+#define M_PROTO7 0x00040000 /* protocol-specific */
+#define M_PROTO8 0x00080000 /* protocol-specific */
+#define M_PROTO9 0x00100000 /* protocol-specific */
+#define M_PROTO10 0x00200000 /* protocol-specific */
+#define M_PROTO11 0x00400000 /* protocol-specific */
+#define M_PROTO12 0x00800000 /* protocol-specific */
/*
* Flags to purge when crossing layers.
*/
#define M_PROTOFLAGS \
- (M_PROTO1|M_PROTO2|M_PROTO3|M_PROTO4|M_PROTO5|M_PROTO6|M_PROTO7|M_PROTO8)
+ (M_PROTO1|M_PROTO2|M_PROTO3|M_PROTO4|M_PROTO5|M_PROTO6|M_PROTO7|M_PROTO8|\
+ M_PROTO9|M_PROTO10|M_PROTO11|M_PROTO12)
/*
+ * Flags preserved when copying m_pkthdr.
+ */
+#define M_COPYFLAGS \
+ (M_PKTHDR|M_EOR|M_RDONLY|M_BCAST|M_MCAST|M_PROMISC|M_VLANTAG|M_FLOWID| \
+ 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\11M_FLOWID"
+#define M_FLAG_PROTOBITS \
+ "\15M_PROTO1\16M_PROTO2\17M_PROTO3\20M_PROTO4\21M_PROTO5" \
+ "\22M_PROTO6\23M_PROTO7\24M_PROTO8\25M_PROTO9\26M_PROTO10" \
+ "\27M_PROTO11\30M_PROTO12"
+#define M_FLAG_PRINTF (M_FLAG_BITS M_FLAG_PROTOBITS)
+
+/*
* Network interface cards are able to hash protocol fields (such as IPv4
* addresses and TCP port numbers) classify packets into flows. These flows
* can then be used to maintain ordering while delivering packets to the OS
@@ -228,34 +288,58 @@
* that provide an opaque flow identifier, allowing for ordering and
* distribution without explicit affinity.
*/
-#define M_HASHTYPE_SHIFT 24
-#define M_HASHTYPE_NONE 0x0
-#define M_HASHTYPE_RSS_IPV4 0x1 /* IPv4 2-tuple */
-#define M_HASHTYPE_RSS_TCP_IPV4 0x2 /* TCPv4 4-tuple */
-#define M_HASHTYPE_RSS_IPV6 0x3 /* IPv6 2-tuple */
-#define M_HASHTYPE_RSS_TCP_IPV6 0x4 /* TCPv6 4-tuple */
-#define M_HASHTYPE_RSS_IPV6_EX 0x5 /* IPv6 2-tuple + ext hdrs */
-#define M_HASHTYPE_RSS_TCP_IPV6_EX 0x6 /* TCPv6 4-tiple + ext hdrs */
-#define M_HASHTYPE_OPAQUE 0xf /* ordering, not affinity */
+#define M_HASHTYPE_NONE 0
+#define M_HASHTYPE_RSS_IPV4 1 /* IPv4 2-tuple */
+#define M_HASHTYPE_RSS_TCP_IPV4 2 /* TCPv4 4-tuple */
+#define M_HASHTYPE_RSS_IPV6 3 /* IPv6 2-tuple */
+#define M_HASHTYPE_RSS_TCP_IPV6 4 /* TCPv6 4-tuple */
+#define M_HASHTYPE_RSS_IPV6_EX 5 /* IPv6 2-tuple + ext hdrs */
+#define M_HASHTYPE_RSS_TCP_IPV6_EX 6 /* TCPv6 4-tiple + ext hdrs */
+#define M_HASHTYPE_OPAQUE 255 /* ordering, not affinity */
-#define M_HASHTYPE_CLEAR(m) (m)->m_flags &= ~(M_HASHTYPEBITS)
-#define M_HASHTYPE_GET(m) (((m)->m_flags & M_HASHTYPEBITS) >> \
- M_HASHTYPE_SHIFT)
-#define M_HASHTYPE_SET(m, v) do { \
- (m)->m_flags &= ~M_HASHTYPEBITS; \
- (m)->m_flags |= ((v) << M_HASHTYPE_SHIFT); \
+#define M_HASHTYPE_CLEAR(m) ((m)->m_pkthdr.rsstype = 0)
+/*
+ * Handle M_FLOWID for legacy drivers still using them.
+ */
+#define M_HASHTYPE_GET(m) (((m->m_flags & M_FLOWID) && \
+ (m)->m_pkthdr.rsstype == M_HASHTYPE_NONE) ? M_HASHTYPE_OPAQUE : \
+ (m)->m_pkthdr.rsstype)
+#define M_HASHTYPE_SET(m, v) do { \
+ if ((v) != M_HASHTYPE_NONE) \
+ m->m_flags |= M_FLOWID; \
+ (m)->m_pkthdr.rsstype = (v); \
} while (0)
#define M_HASHTYPE_TEST(m, v) (M_HASHTYPE_GET(m) == (v))
/*
- * Flags preserved when copying m_pkthdr.
+ * COS/QOS class and quality of service tags.
+ * It uses DSCP code points as base.
*/
-#define M_COPYFLAGS \
- (M_PKTHDR|M_EOR|M_RDONLY|M_PROTOFLAGS|M_SKIP_FIREWALL|M_BCAST|M_MCAST|\
- M_FRAG|M_FIRSTFRAG|M_LASTFRAG|M_VLANTAG|M_PROMISC|M_HASHTYPEBITS)
+#define QOS_DSCP_CS0 0x00
+#define QOS_DSCP_DEF QOS_DSCP_CS0
+#define QOS_DSCP_CS1 0x20
+#define QOS_DSCP_AF11 0x28
+#define QOS_DSCP_AF12 0x30
+#define QOS_DSCP_AF13 0x38
+#define QOS_DSCP_CS2 0x40
+#define QOS_DSCP_AF21 0x48
+#define QOS_DSCP_AF22 0x50
+#define QOS_DSCP_AF23 0x58
+#define QOS_DSCP_CS3 0x60
+#define QOS_DSCP_AF31 0x68
+#define QOS_DSCP_AF32 0x70
+#define QOS_DSCP_AF33 0x78
+#define QOS_DSCP_CS4 0x80
+#define QOS_DSCP_AF41 0x88
+#define QOS_DSCP_AF42 0x90
+#define QOS_DSCP_AF43 0x98
+#define QOS_DSCP_CS5 0xa0
+#define QOS_DSCP_EF 0xb8
+#define QOS_DSCP_CS6 0xc0
+#define QOS_DSCP_CS7 0xe0
/*
- * External buffer types: identify ext_buf type.
+ * External mbuf storage buffer types.
*/
#define EXT_CLUSTER 1 /* mbuf cluster */
#define EXT_SFBUF 2 /* sendfile(2)'s sf_bufs */
@@ -264,48 +348,135 @@
#define EXT_JUMBO16 5 /* jumbo cluster 16184 bytes */
#define EXT_PACKET 6 /* mbuf+cluster from packet zone */
#define EXT_MBUF 7 /* external mbuf reference (M_IOVEC) */
-#define EXT_NET_DRV 100 /* custom ext_buf provided by net driver(s) */
-#define EXT_MOD_TYPE 200 /* custom module's ext_buf type */
-#define EXT_DISPOSABLE 300 /* can throw this buffer away w/page flipping */
-#define EXT_EXTREF 400 /* has externally maintained ref_cnt ptr */
+#define EXT_VENDOR1 224 /* for vendor-internal use */
+#define EXT_VENDOR2 225 /* for vendor-internal use */
+#define EXT_VENDOR3 226 /* for vendor-internal use */
+#define EXT_VENDOR4 227 /* for vendor-internal use */
+
+#define EXT_EXP1 244 /* for experimental use */
+#define EXT_EXP2 245 /* for experimental use */
+#define EXT_EXP3 246 /* for experimental use */
+#define EXT_EXP4 247 /* for experimental use */
+
+#define EXT_NET_DRV 252 /* custom ext_buf provided by net driver(s) */
+#define EXT_MOD_TYPE 253 /* custom module's ext_buf type */
+#define EXT_DISPOSABLE 254 /* can throw this buffer away w/page flipping */
+#define EXT_EXTREF 255 /* has externally maintained ref_cnt ptr */
+
/*
- * Flags indicating hw checksum support and sw checksum requirements. This
- * field can be directly tested against if_data.ifi_hwassist.
+ * Flags for external mbuf buffer types.
+ * NB: limited to the lower 24 bits.
*/
-#define CSUM_IP 0x0001 /* will csum IP */
-#define CSUM_TCP 0x0002 /* will csum TCP */
-#define CSUM_UDP 0x0004 /* will csum UDP */
-#define CSUM_IP_FRAGS 0x0008 /* will csum IP fragments */
-#define CSUM_FRAGMENT 0x0010 /* will do IP fragmentation */
-#define CSUM_TSO 0x0020 /* will do TSO */
-#define CSUM_SCTP 0x0040 /* will csum SCTP */
-#define CSUM_SCTP_IPV6 0x0080 /* will csum IPv6/SCTP */
+#define EXT_FLAG_EMBREF 0x000001 /* embedded ref_cnt, notyet */
+#define EXT_FLAG_EXTREF 0x000002 /* external ref_cnt, notyet */
+#define EXT_FLAG_NOFREE 0x000010 /* don't free mbuf to pool, notyet */
-#define CSUM_IP_CHECKED 0x0100 /* did csum IP */
-#define CSUM_IP_VALID 0x0200 /* ... the csum is valid */
-#define CSUM_DATA_VALID 0x0400 /* csum_data field is valid */
-#define CSUM_PSEUDO_HDR 0x0800 /* csum_data has pseudo hdr */
-#define CSUM_SCTP_VALID 0x1000 /* SCTP checksum is valid */
-#define CSUM_UDP_IPV6 0x2000 /* will csum IPv6/UDP */
-#define CSUM_TCP_IPV6 0x4000 /* will csum IPv6/TCP */
-/* CSUM_TSO_IPV6 0x8000 will do IPv6/TSO */
+#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 */
-/* CSUM_FRAGMENT_IPV6 0x10000 will do IPv6 fragementation */
+#define EXT_FLAG_EXP1 0x100000 /* for experimental use */
+#define EXT_FLAG_EXP2 0x200000 /* for experimental use */
+#define EXT_FLAG_EXP3 0x400000 /* for experimental use */
+#define EXT_FLAG_EXP4 0x800000 /* for experimental use */
-#define CSUM_DELAY_DATA_IPV6 (CSUM_TCP_IPV6 | CSUM_UDP_IPV6)
-#define CSUM_DATA_VALID_IPV6 CSUM_DATA_VALID
+/*
+ * EXT flag description for use with printf(9) %b identifier.
+ */
+#define EXT_FLAG_BITS \
+ "\20\1EXT_FLAG_EMBREF\2EXT_FLAG_EXTREF\5EXT_FLAG_NOFREE" \
+ "\21EXT_FLAG_VENDOR1\22EXT_FLAG_VENDOR2\23EXT_FLAG_VENDOR3" \
+ "\24EXT_FLAG_VENDOR4\25EXT_FLAG_EXP1\26EXT_FLAG_EXP2\27EXT_FLAG_EXP3" \
+ "\30EXT_FLAG_EXP4"
-#define CSUM_DELAY_DATA (CSUM_TCP | CSUM_UDP)
-#define CSUM_DELAY_IP (CSUM_IP) /* Only v4, no v6 IP hdr csum */
+/*
+ * Return values for (*ext_free).
+ */
+#define EXT_FREE_OK 0 /* Normal return */
/*
- * mbuf types.
+ * 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.
+ *
+ * Outbound flags that are set by upper protocol layers requesting lower
+ * layers, or ideally the hardware, to perform these offloading tasks.
+ * For outbound packets this field and its flags can be directly tested
+ * against if_data.ifi_hwassist.
*/
+#define CSUM_IP 0x00000001 /* IP header checksum offload */
+#define CSUM_IP_UDP 0x00000002 /* UDP checksum offload */
+#define CSUM_IP_TCP 0x00000004 /* TCP checksum offload */
+#define CSUM_IP_SCTP 0x00000008 /* SCTP checksum offload */
+#define CSUM_IP_TSO 0x00000010 /* TCP segmentation offload */
+#define CSUM_IP_ISCSI 0x00000020 /* iSCSI checksum offload */
+
+#define CSUM_IP6_UDP 0x00000200 /* UDP checksum offload */
+#define CSUM_IP6_TCP 0x00000400 /* TCP checksum offload */
+#define CSUM_IP6_SCTP 0x00000800 /* SCTP checksum offload */
+#define CSUM_IP6_TSO 0x00001000 /* TCP segmentation offload */
+#define CSUM_IP6_ISCSI 0x00002000 /* iSCSI checksum offload */
+
+/* Inbound checksum support where the checksum was verified by hardware. */
+#define CSUM_L3_CALC 0x01000000 /* calculated layer 3 csum */
+#define CSUM_L3_VALID 0x02000000 /* checksum is correct */
+#define CSUM_L4_CALC 0x04000000 /* calculated layer 4 csum */
+#define CSUM_L4_VALID 0x08000000 /* checksum is correct */
+#define CSUM_L5_CALC 0x10000000 /* calculated layer 5 csum */
+#define CSUM_L5_VALID 0x20000000 /* checksum is correct */
+#define CSUM_COALESED 0x40000000 /* contains merged segments */
+
+/*
+ * CSUM flag description for use with printf(9) %b identifier.
+ */
+#define CSUM_BITS \
+ "\20\1CSUM_IP\2CSUM_IP_UDP\3CSUM_IP_TCP\4CSUM_IP_SCTP\5CSUM_IP_TSO" \
+ "\6CSUM_IP_ISCSI" \
+ "\12CSUM_IP6_UDP\13CSUM_IP6_TCP\14CSUM_IP6_SCTP\15CSUM_IP6_TSO" \
+ "\16CSUM_IP6_ISCSI" \
+ "\31CSUM_L3_CALC\32CSUM_L3_VALID\33CSUM_L4_CALC\34CSUM_L4_VALID" \
+ "\35CSUM_L5_CALC\36CSUM_L5_VALID\37CSUM_COALESED"
+
+/* CSUM flags compatibility mappings. */
+#define CSUM_IP_CHECKED CSUM_L3_CALC
+#define CSUM_IP_VALID CSUM_L3_VALID
+#define CSUM_DATA_VALID CSUM_L4_VALID
+#define CSUM_PSEUDO_HDR CSUM_L4_CALC
+#define CSUM_SCTP_VALID CSUM_L4_VALID
+#define CSUM_DELAY_DATA (CSUM_TCP|CSUM_UDP)
+#define CSUM_DELAY_IP CSUM_IP /* Only v4, no v6 IP hdr csum */
+#define CSUM_DELAY_DATA_IPV6 (CSUM_TCP_IPV6|CSUM_UDP_IPV6)
+#define CSUM_DATA_VALID_IPV6 CSUM_DATA_VALID
+#define CSUM_TCP CSUM_IP_TCP
+#define CSUM_UDP CSUM_IP_UDP
+#define CSUM_SCTP CSUM_IP_SCTP
+#define CSUM_TSO (CSUM_IP_TSO|CSUM_IP6_TSO)
+#define CSUM_UDP_IPV6 CSUM_IP6_UDP
+#define CSUM_TCP_IPV6 CSUM_IP6_TCP
+#define CSUM_SCTP_IPV6 CSUM_IP6_SCTP
+#define CSUM_FRAGMENT 0x0 /* Unused */
+
+/*
+ * mbuf types describing the content of the mbuf (including external storage).
+ */
#define MT_NOTMBUF 0 /* USED INTERNALLY ONLY! Object is not mbuf */
#define MT_DATA 1 /* dynamic (data) allocation */
#define MT_HEADER MT_DATA /* packet header, use M_PKTHDR instead */
+
+#define MT_VENDOR1 4 /* for vendor-internal use */
+#define MT_VENDOR2 5 /* for vendor-internal use */
+#define MT_VENDOR3 6 /* for vendor-internal use */
+#define MT_VENDOR4 7 /* for vendor-internal use */
+
#define MT_SONAME 8 /* socket name */
+
+#define MT_EXP1 9 /* for experimental use */
+#define MT_EXP2 10 /* for experimental use */
+#define MT_EXP3 11 /* for experimental use */
+#define MT_EXP4 12 /* for experimental use */
+
#define MT_CONTROL 14 /* extra-data protocol message */
#define MT_OOBDATA 15 /* expedited data */
#define MT_NTYPES 16 /* number of mbuf types for mbtypes[] */
@@ -313,50 +484,9 @@
#define MT_NOINIT 255 /* Not a type but a flag to allocate
a non-initialized mbuf */
-#define MB_NOTAGS 0x1UL /* no tags attached to mbuf */
-
/*
- * General mbuf allocator statistics structure.
- *
- * Many of these statistics are no longer used; we instead track many
- * allocator statistics through UMA's built in statistics mechanism.
+ * Compatibility with historic mbuf allocator.
*/
-struct mbstat {
- u_long m_mbufs; /* XXX */
- u_long m_mclusts; /* XXX */
-
- u_long m_drain; /* times drained protocols for space */
- u_long m_mcfail; /* XXX: times m_copym failed */
- u_long m_mpfail; /* XXX: times m_pullup failed */
- u_long m_msize; /* length of an mbuf */
- u_long m_mclbytes; /* length of an mbuf cluster */
- u_long m_minclsize; /* min length of data to allocate a cluster */
- u_long m_mlen; /* length of data in an mbuf */
- u_long m_mhlen; /* length of data in a header mbuf */
-
- /* Number of mbtypes (gives # elems in mbtypes[] array) */
- short m_numtypes;
-
- /* XXX: Sendfile stats should eventually move to their own struct */
- u_long sf_iocnt; /* times sendfile had to do disk I/O */
- u_long sf_allocfail; /* times sfbuf allocation failed */
- u_long sf_allocwait; /* times sfbuf allocation had to wait */
-};
-
-/*
- * Flags specifying how an allocation should be made.
- *
- * The flag to use is as follows:
- * - M_DONTWAIT or M_NOWAIT from an interrupt handler to not block allocation.
- * - M_WAIT or M_WAITOK from wherever it is safe to block.
- *
- * M_DONTWAIT/M_NOWAIT means that we will not block the thread explicitly and
- * if we cannot allocate immediately we may return NULL, whereas
- * M_WAIT/M_WAITOK means that if we cannot allocate resources we
- * will block until they are available, and thus never return NULL.
- *
- * XXX Eventually just phase this out to use M_WAITOK/M_NOWAIT.
- */
#define MBTOM(how) (how)
#define M_DONTWAIT M_NOWAIT
#define M_TRYWAIT M_WAITOK
@@ -393,7 +523,6 @@
*
* The rest of it is defined in kern/kern_mbuf.c
*/
-
extern uma_zone_t zone_mbuf;
extern uma_zone_t zone_clust;
extern uma_zone_t zone_pack;
@@ -402,21 +531,8 @@
extern uma_zone_t zone_jumbo16;
extern uma_zone_t zone_ext_refcnt;
-static __inline struct mbuf *m_getcl(int how, short type, int flags);
-static __inline struct mbuf *m_get(int how, short type);
-static __inline struct mbuf *m_gethdr(int how, short type);
-static __inline struct mbuf *m_getjcl(int how, short type, int flags,
- int size);
-static __inline struct mbuf *m_getclr(int how, short type); /* XXX */
-static __inline int m_init(struct mbuf *m, uma_zone_t zone,
- int size, int how, short type, int flags);
-static __inline struct mbuf *m_free(struct mbuf *m);
-static __inline void m_clget(struct mbuf *m, int how);
-static __inline void *m_cljget(struct mbuf *m, int how, int size);
-static __inline void m_chtype(struct mbuf *m, short new_type);
-void mb_free_ext(struct mbuf *);
-static __inline struct mbuf *m_last(struct mbuf *m);
-int m_pkthdr_init(struct mbuf *m, int how);
+void mb_free_ext(struct mbuf *);
+int m_pkthdr_init(struct mbuf *, int);
static __inline int
m_gettype(int size)
@@ -442,12 +558,35 @@
type = EXT_JUMBO16;
break;
default:
- panic("%s: m_getjcl: invalid cluster size", __func__);
+ panic("%s: invalid cluster size %d", __func__, size);
}
return (type);
}
+/*
+ * 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,
+ int (*freef)(struct mbuf *, void *, void *), void *arg1, void *arg2)
+{
+
+ KASSERT(ref_cnt != NULL, ("%s: ref_cnt not provided", __func__));
+
+ atomic_add_int(ref_cnt, 1);
+ m->m_flags |= M_EXT;
+ m->m_ext.ext_buf = buf;
+ m->m_ext.ref_cnt = ref_cnt;
+ m->m_data = m->m_ext.ext_buf;
+ m->m_ext.ext_size = size;
+ m->m_ext.ext_free = freef;
+ m->m_ext.ext_arg1 = arg1;
+ m->m_ext.ext_arg2 = arg2;
+ m->m_ext.ext_type = EXT_EXTREF;
+ m->m_ext.ext_flags = 0;
+}
+
static __inline uma_zone_t
m_getzone(int size)
{
@@ -454,9 +593,6 @@
uma_zone_t zone;
switch (size) {
- case MSIZE:
- zone = zone_mbuf;
- break;
case MCLBYTES:
zone = zone_clust;
break;
@@ -472,7 +608,7 @@
zone = zone_jumbo16;
break;
default:
- panic("%s: m_getjcl: invalid cluster type", __func__);
+ panic("%s: invalid cluster size %d", __func__, size);
}
return (zone);
@@ -512,7 +648,7 @@
args.flags = 0;
args.type = type;
- return ((struct mbuf *)(uma_zalloc_arg(zone_mbuf, &args, how)));
+ return (uma_zalloc_arg(zone_mbuf, &args, how));
}
/*
@@ -539,7 +675,7 @@
args.flags = M_PKTHDR;
args.type = type;
- return ((struct mbuf *)(uma_zalloc_arg(zone_mbuf, &args, how)));
+ return (uma_zalloc_arg(zone_mbuf, &args, how));
}
static __inline struct mbuf *
@@ -549,65 +685,10 @@
args.flags = flags;
args.type = type;
- return ((struct mbuf *)(uma_zalloc_arg(zone_pack, &args, how)));
+ return (uma_zalloc_arg(zone_pack, &args, how));
}
-/*
- * m_getjcl() returns an mbuf with a cluster of the specified size attached.
- * For size it takes MCLBYTES, MJUMPAGESIZE, MJUM9BYTES, MJUM16BYTES.
- *
- * XXX: This is rather large, should be real function maybe.
- */
-static __inline struct mbuf *
-m_getjcl(int how, short type, int flags, int size)
-{
- struct mb_args args;
- struct mbuf *m, *n;
- uma_zone_t zone;
-
- if (size == MCLBYTES)
- return m_getcl(how, type, flags);
-
- args.flags = flags;
- args.type = type;
-
- m = uma_zalloc_arg(zone_mbuf, &args, how);
- if (m == NULL)
- return (NULL);
-
- zone = m_getzone(size);
- n = uma_zalloc_arg(zone, m, how);
- if (n == NULL) {
- uma_zfree(zone_mbuf, m);
- return (NULL);
- }
- return (m);
-}
-
static __inline void
-m_free_fast(struct mbuf *m)
-{
-#ifdef INVARIANTS
- if (m->m_flags & M_PKTHDR)
- KASSERT(SLIST_EMPTY(&m->m_pkthdr.tags), ("doing fast free of mbuf with tags"));
-#endif
-
- uma_zfree_arg(zone_mbuf, m, (void *)MB_NOTAGS);
-}
-
-static __inline struct mbuf *
-m_free(struct mbuf *m)
-{
- struct mbuf *n = m->m_next;
-
- if (m->m_flags & M_EXT)
- mb_free_ext(m);
- else if ((m->m_flags & M_NOFREE) == 0)
- uma_zfree(zone_mbuf, m);
- return (n);
-}
-
-static __inline void
m_clget(struct mbuf *m, int how)
{
@@ -672,7 +753,7 @@
zone = zone_jumbo16;
break;
default:
- panic("unknown cluster type");
+ panic("%s: unknown cluster type %d", __func__, type);
break;
}
@@ -680,6 +761,7 @@
m->m_ext.ext_free = m->m_ext.ext_arg1 = m->m_ext.ext_arg2 = NULL;
m->m_ext.ext_size = size;
m->m_ext.ext_type = type;
+ m->m_ext.ext_flags = 0;
m->m_ext.ref_cnt = uma_find_refcnt(zone, cl);
m->m_flags |= M_EXT;
@@ -692,6 +774,13 @@
m->m_type = new_type;
}
+static __inline void
+m_clrprotoflags(struct mbuf *m)
+{
+
+ m->m_flags &= ~M_PROTOFLAGS;
+}
+
static __inline struct mbuf *
m_last(struct mbuf *m)
{
@@ -701,16 +790,6 @@
return (m);
}
-extern void (*m_addr_chg_pf_p)(struct mbuf *m);
-
-static __inline void
-m_addr_changed(struct mbuf *m)
-{
-
- if (m_addr_chg_pf_p)
- m_addr_chg_pf_p(m);
-}
-
/*
* mbuf, cluster, and external object allocation macros (for compatibility
* purposes).
@@ -720,7 +799,8 @@
#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),(flags), (type))
+ (void )m_extadd((m), (caddr_t)(buf), (size), (free), (arg1), (arg2),\
+ (flags), (type), M_NOWAIT)
#define m_getm(m, len, how, type) \
m_getm2((m), (len), (how), (type), M_PKTHDR)
@@ -772,6 +852,18 @@
} while (0)
/*
+ * As above, for mbuf with external storage.
+ */
+#define MEXT_ALIGN(m, len) do { \
+ KASSERT((m)->m_flags & M_EXT, \
+ ("%s: MEXT_ALIGN not an M_EXT mbuf", __func__)); \
+ KASSERT((m)->m_data == (m)->m_ext.ext_buf, \
+ ("%s: MEXT_ALIGN not a virgin mbuf", __func__)); \
+ (m)->m_data += ((m)->m_ext.ext_size - (len)) & \
+ ~(sizeof(long) - 1); \
+} while (0)
+
+/*
* Compute the amount of space available before the current start of data in
* an mbuf.
*
@@ -828,13 +920,12 @@
#define M_COPYALL 1000000000
/* Compatibility with 4.3. */
-#define m_copy(m, o, l) m_copym((m), (o), (l), M_DONTWAIT)
+#define m_copy(m, o, l) m_copym((m), (o), (l), M_NOWAIT)
extern int max_datalen; /* MHLEN - max_hdr */
extern int max_hdr; /* Largest link + protocol header */
extern int max_linkhdr; /* Largest link-level header */
extern int max_protohdr; /* Largest protocol header */
-extern struct mbstat mbstat; /* General mbuf stats/infos */
extern int nmbclusters; /* Maximum number of clusters */
struct uio;
@@ -845,8 +936,9 @@
int (*)(void *, void *, u_int), void *);
int m_append(struct mbuf *, int, c_caddr_t);
void m_cat(struct mbuf *, struct mbuf *);
-void m_extadd(struct mbuf *, caddr_t, u_int,
- void (*)(void *, void *), void *, void *, int, int);
+int m_extadd(struct mbuf *, caddr_t, u_int,
+ int (*)(struct mbuf *, void *, void *), void *, void *,
+ int, int, int);
struct mbuf *m_collapse(struct mbuf *, int, int);
void m_copyback(struct mbuf *, int, int, c_caddr_t);
void m_copydata(const struct mbuf *, int, int, caddr_t);
@@ -855,7 +947,7 @@
int, int, int, int);
struct mbuf *m_copypacket(struct mbuf *, int);
void m_copy_pkthdr(struct mbuf *, struct mbuf *);
-struct mbuf *m_copyup(struct mbuf *n, int len, int dstoff);
+struct mbuf *m_copyup(struct mbuf *, int, int);
struct mbuf *m_defrag(struct mbuf *, int);
void m_demote(struct mbuf *, int);
struct mbuf *m_devget(char *, int, int, struct ifnet *,
@@ -865,6 +957,8 @@
u_int m_fixhdr(struct mbuf *);
struct mbuf *m_fragment(struct mbuf *, int, int);
void m_freem(struct mbuf *);
+struct mbuf *m_get2(int, int, short, int);
+struct mbuf *m_getjcl(int, short, int, int);
struct mbuf *m_getm2(struct mbuf *, int, int, short, int);
struct mbuf *m_getptr(struct mbuf *, int, int *);
u_int m_length(struct mbuf *, struct mbuf **);
@@ -874,10 +968,10 @@
void m_print(const struct mbuf *, int);
struct mbuf *m_pulldown(struct mbuf *, int, int, int *);
struct mbuf *m_pullup(struct mbuf *, int);
-int m_sanity(struct mbuf *, int);
+int m_sanity(struct mbuf *, int);
struct mbuf *m_split(struct mbuf *, int, int);
struct mbuf *m_uiotombuf(struct uio *, int, int, int, int);
-struct mbuf *m_unshare(struct mbuf *, int how);
+struct mbuf *m_unshare(struct mbuf *, int);
/*-
* Network packets may have annotations attached by affixing a list of
@@ -950,7 +1044,7 @@
#define PACKET_TAG_DIVERT 17 /* divert info */
#define PACKET_TAG_IPFORWARD 18 /* ipforward info */
#define PACKET_TAG_MACLABEL (19 | MTAG_PERSISTENT) /* MAC label */
-#define PACKET_TAG_PF 21 /* PF + ALTQ information */
+#define PACKET_TAG_PF (21 | MTAG_PERSISTENT) /* PF/ALTQ information */
#define PACKET_TAG_RTSOCKFAM 25 /* rtsock sa family */
#define PACKET_TAG_IPOPTIONS 27 /* Saved IP options */
#define PACKET_TAG_CARP 28 /* CARP info */
@@ -1060,10 +1154,24 @@
m_tag_locate(m, MTAG_ABI_COMPAT, type, start));
}
+static __inline struct mbuf *
+m_free(struct mbuf *m)
+{
+ struct mbuf *n = m->m_next;
+
+ if ((m->m_flags & (M_PKTHDR|M_NOFREE)) == (M_PKTHDR|M_NOFREE))
+ m_tag_delete_chain(m, NULL);
+ if (m->m_flags & M_EXT)
+ mb_free_ext(m);
+ else if ((m->m_flags & M_NOFREE) == 0)
+ uma_zfree(zone_mbuf, m);
+ return (n);
+}
+
static int inline
rt_m_getfib(struct mbuf *m)
{
- KASSERT(m->m_flags & M_EXT , ("attempt to set FIB on non header mbuf"));
+ KASSERT(m->m_flags & M_PKTHDR , ("Attempt to get FIB from non header mbuf."));
return (m->m_pkthdr.fibnum);
}
@@ -1070,7 +1178,7 @@
#define M_GETFIB(_m) rt_m_getfib(_m)
#define M_SETFIB(_m, _fib) do { \
- KASSERT((_m)->m_flags & M_EXT, ("No FIB on non header mbuf")); \
+ KASSERT((_m)->m_flags & M_PKTHDR, ("Attempt to set FIB on non header mbuf.")); \
((_m)->m_pkthdr.fibnum) = (_fib); \
} while (0)
Modified: trunk/sys/sys/mchain.h
===================================================================
--- trunk/sys/sys/mchain.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/mchain.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2000, 2001 Boris Popov
* All rights reserved.
@@ -23,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/mchain.h 227650 2011-11-18 03:05:20Z kevlo $
*/
#ifndef _SYS_MCHAIN_H_
#define _SYS_MCHAIN_H_
Modified: trunk/sys/sys/mdioctl.h
===================================================================
--- trunk/sys/sys/mdioctl.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/mdioctl.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1988 University of Utah.
* Copyright (c) 1990, 1993
@@ -37,13 +38,13 @@
*
* From: src/sys/sys/vnioctl.h,v 1.4
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/mdioctl.h 289516 2015-10-18 14:52:31Z trasz $
*/
#ifndef _SYS_MDIOCTL_H_
#define _SYS_MDIOCTL_H_
-enum md_types {MD_MALLOC, MD_PRELOAD, MD_VNODE, MD_SWAP};
+enum md_types {MD_MALLOC, MD_PRELOAD, MD_VNODE, MD_SWAP, MD_NULL};
/*
* Ioctl definitions for memory disk pseudo-device.
@@ -79,6 +80,7 @@
#define MDIOCDETACH _IOWR('m', 1, struct md_ioctl) /* detach disk */
#define MDIOCQUERY _IOWR('m', 2, struct md_ioctl) /* query status */
#define MDIOCLIST _IOWR('m', 3, struct md_ioctl) /* query status */
+#define MDIOCRESIZE _IOWR('m', 4, struct md_ioctl) /* resize disk */
#define MD_CLUSTER 0x01 /* Don't cluster */
#define MD_RESERVE 0x02 /* Pre-reserve swap */
@@ -86,6 +88,6 @@
#define MD_READONLY 0x08 /* Readonly mode */
#define MD_COMPRESS 0x10 /* Compression mode */
#define MD_FORCE 0x20 /* Don't try to prevent foot-shooting */
-#define MD_ASYNC 0x40 /* Don't try to prevent foot-shooting */
+#define MD_ASYNC 0x40 /* Asynchronous mode */
#endif /* _SYS_MDIOCTL_H_*/
Modified: trunk/sys/sys/memrange.h
===================================================================
--- trunk/sys/sys/memrange.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/memrange.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,7 +1,8 @@
+/* $MidnightBSD$ */
/*
- * Memory range attribute operations, peformed on /dev/mem
+ * Memory range attribute operations, performed on /dev/mem
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/memrange.h 300060 2016-05-17 15:18:01Z pfg $
*/
#ifndef _SYS_MEMRANGE_H_
Modified: trunk/sys/sys/mman.h
===================================================================
--- trunk/sys/sys/mman.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/mman.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
@@ -27,7 +28,7 @@
* SUCH DAMAGE.
*
* @(#)mman.h 8.2 (Berkeley) 1/9/95
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/mman.h 321717 2017-07-30 10:36:20Z kib $
*/
#ifndef _SYS_MMAN_H_
@@ -43,6 +44,7 @@
#define INHERIT_SHARE 0
#define INHERIT_COPY 1
#define INHERIT_NONE 2
+#define INHERIT_ZERO 3
#endif
/*
@@ -89,8 +91,24 @@
/*
* Extended flags
*/
+#define MAP_GUARD 0x00002000 /* reserve but don't map address range */
+#define MAP_EXCL 0x00004000 /* for MAP_FIXED, fail if address is used */
#define MAP_NOCORE 0x00020000 /* dont include these pages in a coredump */
#define MAP_PREFAULT_READ 0x00040000 /* prefault mapping for reading */
+#ifdef __LP64__
+#define MAP_32BIT 0x00080000 /* map in the low 2GB of address space */
+#endif
+
+/*
+ * Request specific alignment (n == log2 of the desired alignment).
+ *
+ * MAP_ALIGNED_SUPER requests optimal superpage alignment, but does
+ * not enforce a specific alignment.
+ */
+#define MAP_ALIGNED(n) ((n) << MAP_ALIGNMENT_SHIFT)
+#define MAP_ALIGNMENT_SHIFT 24
+#define MAP_ALIGNMENT_MASK MAP_ALIGNED(0xff)
+#define MAP_ALIGNED_SUPER MAP_ALIGNED(1) /* align on a superpage */
#endif /* __BSD_VISIBLE */
#if __POSIX_VISIBLE >= 199309
@@ -179,6 +197,10 @@
#endif
#if defined(_KERNEL) || defined(_WANT_FILE)
+#include <sys/lock.h>
+#include <sys/mutex.h>
+#include <sys/queue.h>
+#include <sys/rangelock.h>
#include <vm/vm.h>
struct file;
@@ -200,9 +222,13 @@
struct timespec shm_mtime;
struct timespec shm_ctime;
struct timespec shm_birthtime;
+ ino_t shm_ino;
struct label *shm_label; /* MAC label */
const char *shm_path;
+
+ struct rangelock shm_rl;
+ struct mtx shm_mtx;
};
#endif
Modified: trunk/sys/sys/module.h
===================================================================
--- trunk/sys/sys/module.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/module.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1997 Doug Rabson
* All rights reserved.
@@ -23,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/module.h 298493 2016-04-22 21:38:37Z emaste $
*/
#ifndef _SYS_MODULE_H_
@@ -35,6 +36,7 @@
#define MDT_DEPEND 1 /* argument is a module name */
#define MDT_MODULE 2 /* module declaration */
#define MDT_VERSION 3 /* module version(s) */
+#define MDT_PNP_INFO 4 /* Plug and play hints record */
#define MDT_STRUCT_VERSION 1 /* version of metadata structure */
#define MDT_SETNAME "modmetadata_set"
@@ -106,7 +108,8 @@
DATA_SET(modmetadata_set, _mod_metadata##uniquifier)
#define MODULE_DEPEND(module, mdepend, vmin, vpref, vmax) \
- static struct mod_depend _##module##_depend_on_##mdepend = { \
+ static struct mod_depend _##module##_depend_on_##mdepend \
+ __section(".data") = { \
vmin, \
vpref, \
vmax \
@@ -146,7 +149,8 @@
DECLARE_MODULE_WITH_MAXVER(name, data, sub, order, __FreeBSD_version)
#define MODULE_VERSION(module, version) \
- static struct mod_version _##module##_version = { \
+ static struct mod_version _##module##_version \
+ __section(".data") = { \
version \
}; \
MODULE_METADATA(_##module##_version, MDT_VERSION, \
Modified: trunk/sys/sys/module_khelp.h
===================================================================
--- trunk/sys/sys/module_khelp.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/module_khelp.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2010 Lawrence Stewart <lstewart at freebsd.org>
* Copyright (c) 2010 The FreeBSD Foundation
@@ -33,7 +34,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/module_khelp.h 251789 2013-06-15 10:38:31Z lstewart $
*/
#ifndef _SYS_MODULE_KHELP_H_
@@ -70,22 +71,6 @@
uma_dtor umadtor;
};
-#define KHELP_DECLARE_MOD(hname, hdata, hhooks, version) \
- static struct khelp_modevent_data kmd_##hname = { \
- .name = #hname, \
- .helper = hdata \
- .hooks = hhooks, \
- .nhooks = sizeof(hhooks) / sizeof(hhooks[0]), \
- }; \
- static moduledata_t h_##hname = { \
- .name = #hname, \
- .evhand = khelp_modevent, \
- .priv = &kmd_##hname \
- }; \
- DECLARE_MODULE(hname, h_##hname, SI_SUB_PROTO_IFATTACHDOMAIN, \
- SI_ORDER_ANY); \
- MODULE_VERSION(hname, version)
-
#define KHELP_DECLARE_MOD_UMA(hname, hdata, hhooks, version, size, ctor, dtor) \
static struct khelp_modevent_data kmd_##hname = { \
.name = #hname, \
@@ -101,10 +86,12 @@
.evhand = khelp_modevent, \
.priv = &kmd_##hname \
}; \
- DECLARE_MODULE(hname, h_##hname, SI_SUB_PROTO_IFATTACHDOMAIN, \
- SI_ORDER_ANY); \
+ DECLARE_MODULE(hname, h_##hname, SI_SUB_KLD, SI_ORDER_ANY); \
MODULE_VERSION(hname, version)
+#define KHELP_DECLARE_MOD(hname, hdata, hhooks, version) \
+ KHELP_DECLARE_MOD_UMA(hname, hdata, hhooks, version, 0, NULL, NULL)
+
int khelp_modevent(module_t mod, int type, void *data);
#endif /* _SYS_MODULE_KHELP_H_ */
Modified: trunk/sys/sys/mount.h
===================================================================
--- trunk/sys/sys/mount.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/mount.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1989, 1991, 1993
* The Regents of the University of California. All rights reserved.
@@ -27,7 +28,7 @@
* SUCH DAMAGE.
*
* @(#)mount.h 8.21 (Berkeley) 5/20/95
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/mount.h 309530 2016-12-04 13:56:15Z kib $
*/
#ifndef _SYS_MOUNT_H_
@@ -39,6 +40,7 @@
#include <sys/lock.h>
#include <sys/lockmgr.h>
#include <sys/_mutex.h>
+#include <sys/_sx.h>
#endif
/*
@@ -170,7 +172,6 @@
int mnt_writeopcount; /* (i) write syscalls pending */
int mnt_kern_flag; /* (i) kernel only flags */
uint64_t mnt_flag; /* (i) flags shared with user */
- u_int mnt_pad_noasync;
struct vfsoptlist *mnt_opt; /* current mount options */
struct vfsoptlist *mnt_optnew; /* new options passed to fs */
int mnt_maxsymlinklen; /* max size of short symlink */
@@ -226,29 +227,6 @@
#define MNT_VNODE_FOREACH_ACTIVE_ABORT(mp, mvp) \
__mnt_vnode_markerfree_active(&(mvp), (mp))
-/*
- * Definitions for MNT_VNODE_FOREACH.
- *
- * This interface has been deprecated in favor of MNT_VNODE_FOREACH_ALL.
- */
-struct vnode *__mnt_vnode_next(struct vnode **mvp, struct mount *mp);
-struct vnode *__mnt_vnode_first(struct vnode **mvp, struct mount *mp);
-void __mnt_vnode_markerfree(struct vnode **mvp, struct mount *mp);
-
-#define MNT_VNODE_FOREACH(vp, mp, mvp) \
- for (vp = __mnt_vnode_first(&(mvp), (mp)); \
- (vp) != NULL; vp = __mnt_vnode_next(&(mvp), (mp)))
-
-#define MNT_VNODE_FOREACH_ABORT_ILOCKED(mp, mvp) \
- __mnt_vnode_markerfree(&(mvp), (mp))
-
-#define MNT_VNODE_FOREACH_ABORT(mp, mvp) \
- do { \
- MNT_ILOCK(mp); \
- MNT_VNODE_FOREACH_ABORT_ILOCKED(mp, mvp); \
- MNT_IUNLOCK(mp); \
- } while (0)
-
#define MNT_ILOCK(mp) mtx_lock(&(mp)->mnt_mtx)
#define MNT_ITRYLOCK(mp) mtx_trylock(&(mp)->mnt_mtx)
#define MNT_IUNLOCK(mp) mtx_unlock(&(mp)->mnt_mtx)
@@ -283,6 +261,7 @@
#define MNT_NOCLUSTERR 0x0000000040000000ULL /* disable cluster read */
#define MNT_NOCLUSTERW 0x0000000080000000ULL /* disable cluster write */
#define MNT_SUJ 0x0000000100000000ULL /* using journaled soft updates */
+#define MNT_AUTOMOUNTED 0x0000000200000000ULL /* mounted by automountd(8) */
/*
* NFS export related mount flags.
@@ -319,7 +298,7 @@
MNT_NOCLUSTERW | MNT_SUIDDIR | MNT_SOFTDEP | \
MNT_IGNORE | MNT_EXPUBLIC | MNT_NOSYMFOLLOW | \
MNT_GJOURNAL | MNT_MULTILABEL | MNT_ACLS | \
- MNT_NFS4ACLS)
+ MNT_NFS4ACLS | MNT_AUTOMOUNTED)
/* Mask of flags that can be updated. */
#define MNT_UPDATEMASK (MNT_NOSUID | MNT_NOEXEC | \
@@ -327,7 +306,8 @@
MNT_NOATIME | \
MNT_NOSYMFOLLOW | MNT_IGNORE | \
MNT_NOCLUSTERR | MNT_NOCLUSTERW | MNT_SUIDDIR | \
- MNT_ACLS | MNT_USER | MNT_NFS4ACLS)
+ MNT_ACLS | MNT_USER | MNT_NFS4ACLS | \
+ MNT_AUTOMOUNTED)
/*
* External filesystem command modifier flags.
@@ -375,6 +355,8 @@
#define MNTK_VGONE_WAITER 0x00000400
#define MNTK_LOOKUP_EXCL_DOTDOT 0x00000800
#define MNTK_MARKER 0x00001000
+#define MNTK_UNMAPPED_BUFS 0x00002000
+#define MNTK_USES_BCACHE 0x00004000 /* FS uses the buffer cache. */
#define MNTK_NOASYNC 0x00800000 /* disable async */
#define MNTK_UNMOUNT 0x01000000 /* unmount in progress */
#define MNTK_MWAIT 0x02000000 /* waiting for unmount to finish */
@@ -381,13 +363,27 @@
#define MNTK_SUSPEND 0x08000000 /* request write suspension */
#define MNTK_SUSPEND2 0x04000000 /* block secondary writes */
#define MNTK_SUSPENDED 0x10000000 /* write operations are suspended */
-#define MNTK_MPSAFE 0x20000000 /* Filesystem is MPSAFE. */
+#define MNTK_NULL_NOCACHE 0x20000000 /* auto disable cache for nullfs
+ mounts over this fs */
#define MNTK_LOOKUP_SHARED 0x40000000 /* FS supports shared lock lookups */
#define MNTK_NOKNOTE 0x80000000 /* Don't send KNOTEs from VOP hooks */
-#define MNT_SHARED_WRITES(mp) (((mp) != NULL) && \
- ((mp)->mnt_kern_flag & MNTK_SHARED_WRITES))
+#ifdef _KERNEL
+static inline int
+MNT_SHARED_WRITES(struct mount *mp)
+{
+ return (mp != NULL && (mp->mnt_kern_flag & MNTK_SHARED_WRITES) != 0);
+}
+
+static inline int
+MNT_EXTENDED_SHARED(struct mount *mp)
+{
+
+ return (mp != NULL && (mp->mnt_kern_flag & MNTK_EXTENDED_SHARED) != 0);
+}
+#endif
+
/*
* Sysctl CTL_VFS definitions.
*
@@ -632,6 +628,7 @@
struct sysctl_req *req);
typedef void vfs_susp_clean_t(struct mount *mp);
typedef void vfs_notify_lowervp_t(struct mount *mp, struct vnode *lowervp);
+typedef void vfs_purge_t(struct mount *mp);
struct vfsops {
vfs_mount_t *vfs_mount;
@@ -651,50 +648,19 @@
vfs_susp_clean_t *vfs_susp_clean;
vfs_notify_lowervp_t *vfs_reclaim_lowervp;
vfs_notify_lowervp_t *vfs_unlink_lowervp;
+ vfs_purge_t *vfs_purge;
+ vfs_mount_t *vfs_spare[6]; /* spares for ABI compat */
};
vfs_statfs_t __vfs_statfs;
-#define VFS_NEEDSGIANT_(MP) \
- ((MP) != NULL && ((MP)->mnt_kern_flag & MNTK_MPSAFE) == 0)
-
-#define VFS_NEEDSGIANT(MP) __extension__ \
-({ \
- struct mount *_mp; \
- _mp = (MP); \
- VFS_NEEDSGIANT_(_mp); \
-})
-
-#define VFS_LOCK_GIANT(MP) __extension__ \
-({ \
- int _locked; \
- struct mount *_mp; \
- _mp = (MP); \
- if (VFS_NEEDSGIANT_(_mp)) { \
- mtx_lock(&Giant); \
- _locked = 1; \
- } else \
- _locked = 0; \
- _locked; \
-})
-#define VFS_UNLOCK_GIANT(locked) do \
-{ \
- if ((locked)) \
- mtx_unlock(&Giant); \
-} while (0)
-#define VFS_ASSERT_GIANT(MP) do \
-{ \
- struct mount *_mp; \
- _mp = (MP); \
- if (VFS_NEEDSGIANT_(_mp)) \
- mtx_assert(&Giant, MA_OWNED); \
-} while (0)
-
#define VFS_PROLOGUE(MP) do { \
+ struct mount *mp__; \
int _enable_stops; \
\
- _enable_stops = ((MP) != NULL && \
- ((MP)->mnt_vfc->vfc_flags & VFCF_SBDRY) && sigdeferstop())
+ mp__ = (MP); \
+ _enable_stops = (mp__ != NULL && \
+ (mp__->mnt_vfc->vfc_flags & VFCF_SBDRY) && sigdeferstop())
#define VFS_EPILOGUE(MP) \
if (_enable_stops) \
@@ -814,6 +780,14 @@
} \
} while (0)
+#define VFS_PURGE(MP) do { \
+ if (*(MP)->mnt_op->vfs_purge != NULL) { \
+ VFS_PROLOGUE(MP); \
+ (*(MP)->mnt_op->vfs_purge)(MP); \
+ VFS_EPILOGUE(MP); \
+ } \
+} while (0)
+
#define VFS_KNOTE_LOCKED(vp, hint) do \
{ \
if (((vp)->v_vflag & VV_NOKNOTE) == 0) \
@@ -835,7 +809,8 @@
* Version numbers.
*/
#define VFS_VERSION_00 0x19660120
-#define VFS_VERSION VFS_VERSION_00
+#define VFS_VERSION_01 0x20121030
+#define VFS_VERSION VFS_VERSION_01
#define VFS_SET(vfsops, fsname, flags) \
static struct vfsconf fsname ## _vfsconf = { \
@@ -878,6 +853,8 @@
uint64_t val);
int vfs_getopt(struct vfsoptlist *, const char *, void **, int *);
int vfs_getopt_pos(struct vfsoptlist *opts, const char *name);
+int vfs_getopt_size(struct vfsoptlist *opts, const char *name,
+ off_t *value);
char *vfs_getopts(struct vfsoptlist *, const char *, int *error);
int vfs_copyopt(struct vfsoptlist *, const char *, void *, int);
int vfs_filteropt(struct vfsoptlist *, const char **legal);
@@ -920,11 +897,17 @@
extern TAILQ_HEAD(mntlist, mount) mountlist; /* mounted filesystem list */
extern struct mtx mountlist_mtx;
extern struct nfs_public nfs_pub;
+extern struct sx vfsconf_sx;
+#define vfsconf_lock() sx_xlock(&vfsconf_sx)
+#define vfsconf_unlock() sx_xunlock(&vfsconf_sx)
+#define vfsconf_slock() sx_slock(&vfsconf_sx)
+#define vfsconf_sunlock() sx_sunlock(&vfsconf_sx)
/*
* Declarations for these vfs default operations are located in
- * kern/vfs_default.c, they should be used instead of making "dummy"
- * functions or casting entries in the VFS op table to "enopnotsupp()".
+ * kern/vfs_default.c. They will be automatically used to replace
+ * null entries in VFS ops tables when registering a new filesystem
+ * type in the global table.
*/
vfs_root_t vfs_stdroot;
vfs_quotactl_t vfs_stdquotactl;
@@ -939,6 +922,9 @@
vfs_extattrctl_t vfs_stdextattrctl;
vfs_sysctl_t vfs_stdsysctl;
+void syncer_suspend(void);
+void syncer_resume(void);
+
#else /* !_KERNEL */
#include <sys/cdefs.h>
Modified: trunk/sys/sys/mouse.h
===================================================================
--- trunk/sys/sys/mouse.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/mouse.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1992, 1993 Erik Forsberg.
* Copyright (c) 1996, 1997 Kazutaka YOKOTA
@@ -20,7 +21,7 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/mouse.h 281708 2015-04-18 21:24:46Z rpaulo $
*/
#ifndef _SYS_MOUSE_H_
@@ -86,7 +87,7 @@
int type; /* mouse/track ball/pad... */
int model; /* I/F dependent model ID: MOUSE_MODEL_XXX */
int hwid; /* I/F dependent hardware ID
- * for the PS/2 mouse, it will be PSM_XXX_ID
+ * for the PS/2 mouse, it will be PSM_XXX_ID
*/
} mousehw_t;
@@ -107,6 +108,24 @@
int capMultiFinger;
int capPalmDetect;
int capPassthrough;
+ int capMiddle;
+ int nExtendedButtons;
+ int nExtendedQueries;
+ int capClickPad;
+ int capDeluxeLEDs;
+ int noAbsoluteFilter;
+ int capReportsV;
+ int capUniformClickPad;
+ int capReportsMin;
+ int capInterTouch;
+ int capReportsMax;
+ int capClearPad;
+ int capAdvancedGestures;
+ int multiFingerMode;
+ int capCoveredPad;
+ int verticalScroll;
+ int horizontalScroll;
+ int verticalWheel;
} synapticshw_t;
/* iftype */
@@ -266,7 +285,7 @@
#define MOUSE_PS2_BUTTON2DOWN 0x04 /* middle */
#define MOUSE_PS2_BUTTON3DOWN 0x02 /* right */
#define MOUSE_PS2_TAP MOUSE_PS2_SYNC /* GlidePoint (PS/2) `tapping'
- * Yes! this is the same bit
+ * Yes! this is the same bit
* as SYNC!
*/
@@ -321,11 +340,11 @@
#define MOUSE_PS2VERSA_TAP 0x02
/* A4 Tech 4D Mouse (PS/2) data packet */
-#define MOUSE_4D_PACKETSIZE 3
+#define MOUSE_4D_PACKETSIZE 3
#define MOUSE_4D_WHEELBITS 0xf0
/* A4 Tech 4D+ Mouse (PS/2) data packet */
-#define MOUSE_4DPLUS_PACKETSIZE 3
+#define MOUSE_4DPLUS_PACKETSIZE 3
#define MOUSE_4DPLUS_ZNEG 0x04 /* sign bit */
#define MOUSE_4DPLUS_BUTTON4DOWN 0x08
@@ -337,7 +356,7 @@
* as at the level 0. There are additional three bytes which shows
* `dz' and the states of additional buttons. `dz' is expressed as the
* sum of the byte 5 and 6 which contain signed seven bit values.
- * The states of the button 4 though 10 are in the bit 0 though 6 in
+ * The states of the button 4 though 10 are in the bit 0 though 6 in
* the byte 7 respectively: 1 indicates the button is up.
*/
#define MOUSE_SYS_PACKETSIZE 8
Modified: trunk/sys/sys/mpt_ioctl.h
===================================================================
--- trunk/sys/sys/mpt_ioctl.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/mpt_ioctl.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2008 Yahoo!, Inc.
* All rights reserved.
@@ -29,7 +30,7 @@
*
* LSI MPT-Fusion Host Adapter FreeBSD userland interface
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/mpt_ioctl.h 178814 2008-05-06 20:49:53Z jhb $
*/
#ifndef _MPT_IOCTL_H_
Modified: trunk/sys/sys/msgbuf.h
===================================================================
--- trunk/sys/sys/msgbuf.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/msgbuf.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1981, 1984, 1993
* The Regents of the University of California. All rights reserved.
@@ -27,7 +28,7 @@
* SUCH DAMAGE.
*
* @(#)msgbuf.h 8.1 (Berkeley) 6/2/93
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/msgbuf.h 233135 2012-03-19 00:36:32Z eadler $
*/
#ifndef _SYS_MSGBUF_H_
@@ -78,7 +79,7 @@
void msgbuf_reinit(struct msgbuf *mbp, void *ptr, int size);
#ifndef MSGBUF_SIZE
-#define MSGBUF_SIZE (32768 * 2)
+#define MSGBUF_SIZE (32768 * 3)
#endif
#endif /* KERNEL */
Modified: trunk/sys/sys/mtio.h
===================================================================
--- trunk/sys/sys/mtio.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/mtio.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
@@ -27,7 +28,7 @@
* SUCH DAMAGE.
*
* @(#)mtio.h 8.1 (Berkeley) 6/2/93
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/mtio.h 280438 2015-03-24 14:36:10Z ken $
*/
#ifndef _SYS_MTIO_H_
@@ -80,6 +81,8 @@
#define MTWSS 16 /* write setmark(s) */
#define MTFSS 17 /* forward space setmark */
#define MTBSS 18 /* backward space setmark */
+#define MTLOAD 19 /* load tape in drive */
+#define MTWEOFI 20 /* write an end-of-file record without waiting*/
#define MT_COMP_ENABLE 0xffffffff
#define MT_COMP_DISABLED 0xfffffffe
@@ -176,7 +179,113 @@
char _reserved_padding[256];
};
+struct mtrblim {
+ uint32_t granularity;
+ uint32_t min_block_length;
+ uint32_t max_block_length;
+};
+
+typedef enum {
+ MT_LOCATE_DEST_OBJECT = 0x00,
+ MT_LOCATE_DEST_FILE = 0x01,
+ MT_LOCATE_DEST_SET = 0x02,
+ MT_LOCATE_DEST_EOD = 0x03
+} mt_locate_dest_type;
+
+typedef enum {
+ MT_LOCATE_BAM_IMPLICIT = 0x00,
+ MT_LOCATE_BAM_EXPLICIT = 0x01
+} mt_locate_bam;
+
+typedef enum {
+ MT_LOCATE_FLAG_IMMED = 0x01,
+ MT_LOCATE_FLAG_CHANGE_PART = 0x02
+} mt_locate_flags;
+
+struct mtlocate {
+ mt_locate_flags flags;
+ mt_locate_dest_type dest_type;
+ mt_locate_bam block_address_mode;
+ int64_t partition;
+ uint64_t logical_id;
+ uint8_t reserved[64];
+};
+
+typedef enum {
+ MT_EXT_GET_NONE,
+ MT_EXT_GET_OK,
+ MT_EXT_GET_NEED_MORE_SPACE,
+ MT_EXT_GET_ERROR
+} mt_ext_get_status;
+
+struct mtextget {
+ uint32_t alloc_len;
+ char *status_xml;
+ uint32_t fill_len;
+ mt_ext_get_status status;
+ char error_str[128];
+ uint8_t reserved[64];
+};
+
+#define MT_EXT_GET_ROOT_NAME "mtextget"
+#define MT_DENSITY_ROOT_NAME "mtdensity"
+#define MT_MEDIA_DENSITY_NAME "media_density"
+#define MT_DENSITY_REPORT_NAME "density_report"
+#define MT_MEDIUM_TYPE_REPORT_NAME "medium_type_report"
+#define MT_MEDIA_REPORT_NAME "media_report"
+#define MT_DENSITY_ENTRY_NAME "density_entry"
+
+#define MT_DENS_WRITE_OK 0x80
+#define MT_DENS_DUP 0x40
+#define MT_DENS_DEFLT 0x20
+
+
+#define MT_PARAM_FIXED_STR_LEN 32
+union mt_param_value {
+ int64_t value_signed;
+ uint64_t value_unsigned;
+ char *value_var_str;
+ char value_fixed_str[MT_PARAM_FIXED_STR_LEN];
+ uint8_t reserved[64];
+};
+
+typedef enum {
+ MT_PARAM_SET_NONE,
+ MT_PARAM_SET_SIGNED,
+ MT_PARAM_SET_UNSIGNED,
+ MT_PARAM_SET_VAR_STR,
+ MT_PARAM_SET_FIXED_STR
+} mt_param_set_type;
+
+typedef enum {
+ MT_PARAM_STATUS_NONE,
+ MT_PARAM_STATUS_OK,
+ MT_PARAM_STATUS_ERROR
+} mt_param_set_status;
+
+#define MT_PARAM_VALUE_NAME_LEN 64
+struct mtparamset {
+ char value_name[MT_PARAM_VALUE_NAME_LEN];
+ mt_param_set_type value_type;
+ int value_len;
+ union mt_param_value value;
+ mt_param_set_status status;
+ char error_str[128];
+};
+
+#define MT_PARAM_ROOT_NAME "mtparamget"
+#define MT_PROTECTION_NAME "protection"
+
/*
+ * Set a list of parameters.
+ */
+struct mtsetlist {
+ int num_params;
+ int param_len;
+ struct mtparamset *params;
+};
+
+/*
* Constants for mt_type byte. These are the same
* for controllers compatible with the types listed.
*/
@@ -218,6 +327,7 @@
#define MTIOCSLOCATE _IOW('m', 5, u_int32_t) /* seek to logical blk addr */
#define MTIOCHLOCATE _IOW('m', 6, u_int32_t) /* seek to hardware blk addr */
#define MTIOCERRSTAT _IOR('m', 7, union mterrstat) /* get tape errors */
+
/*
* Set EOT model- argument is number of filemarks to end a tape with.
* Note that not all possible values will be accepted.
@@ -226,6 +336,13 @@
/* Get current EOT model */
#define MTIOCGETEOTMODEL _IOR('m', 8, u_int32_t)
+#define MTIOCRBLIM _IOR('m', 9, struct mtrblim) /* get block limits */
+#define MTIOCEXTLOCATE _IOW('m', 10, struct mtlocate) /* seek to position */
+#define MTIOCEXTGET _IOWR('m', 11, struct mtextget) /* get tape status */
+#define MTIOCPARAMGET _IOWR('m', 12, struct mtextget) /* get tape params */
+#define MTIOCPARAMSET _IOWR('m', 13, struct mtparamset) /* set tape params */
+#define MTIOCSETLIST _IOWR('m', 14, struct mtsetlist) /* set N params */
+
#ifndef _KERNEL
#define DEFTAPE "/dev/nsa0"
#endif
Modified: trunk/sys/sys/mutex.h
===================================================================
--- trunk/sys/sys/mutex.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/mutex.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1997 Berkeley Software Design, Inc. All rights reserved.
*
@@ -25,8 +26,8 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * from BSDI $Id: mutex.h,v 1.5 2012-10-09 04:05:36 laffer1 Exp $
- * $MidnightBSD$
+ * from BSDI $Id: mutex.h,v 2.7.2.35 2000/04/27 03:10:26 cp Exp $
+ * $FreeBSD: stable/10/sys/sys/mutex.h 323870 2017-09-21 19:24:11Z marius $
*/
#ifndef _SYS_MUTEX_H_
@@ -52,6 +53,7 @@
#define MTX_RECURSE 0x00000004 /* Option: lock allowed to recurse */
#define MTX_NOWITNESS 0x00000008 /* Don't do any witness checking. */
#define MTX_NOPROFILE 0x00000020 /* Don't profile this lock */
+#define MTX_NEW 0x00000040 /* Don't check for double-init */
/*
* Option flags passed to certain lock/unlock routines, through the use
@@ -79,7 +81,8 @@
*
* NOTE: Functions prepended with `_' (underscore) are exported to other parts
* of the kernel via macros, thus allowing us to use the cpp LOCK_FILE
- * and LOCK_LINE. These functions should not be called directly by any
+ * and LOCK_LINE or for hiding the lock cookie crunching to the
+ * consumers. These functions should not be called directly by any
* code using the API. Their macros cover their functionality.
* Functions with a `_' suffix are the entrypoint for the common
* KPI covering both compat shims and fast path case. These can be
@@ -89,42 +92,78 @@
* [See below for descriptions]
*
*/
-void mtx_init(struct mtx *m, const char *name, const char *type, int opts);
-void mtx_destroy(struct mtx *m);
+void _mtx_init(volatile uintptr_t *c, const char *name, const char *type,
+ int opts);
+void _mtx_destroy(volatile uintptr_t *c);
void mtx_sysinit(void *arg);
+int _mtx_trylock_flags_(volatile uintptr_t *c, int opts, const char *file,
+ int line);
void mutex_init(void);
-void _mtx_lock_sleep(struct mtx *m, uintptr_t tid, int opts,
+void __mtx_lock_sleep(volatile uintptr_t *c, uintptr_t tid, int opts,
const char *file, int line);
-void _mtx_unlock_sleep(struct mtx *m, int opts, const char *file, int line);
+void __mtx_unlock_sleep(volatile uintptr_t *c, int opts, const char *file,
+ int line);
#ifdef SMP
-void _mtx_lock_spin(struct mtx *m, uintptr_t tid, int opts,
+void _mtx_lock_spin_cookie(volatile uintptr_t *c, uintptr_t tid, int opts,
const char *file, int line);
#endif
-void _mtx_unlock_spin(struct mtx *m, int opts, const char *file, int line);
-int _mtx_trylock(struct mtx *m, int opts, const char *file, int line);
-void _mtx_lock_flags(struct mtx *m, int opts, const char *file, int line);
-void _mtx_unlock_flags(struct mtx *m, int opts, const char *file, int line);
-void _mtx_lock_spin_flags(struct mtx *m, int opts, const char *file,
+void __mtx_lock_flags(volatile uintptr_t *c, int opts, const char *file,
+ int line);
+void __mtx_unlock_flags(volatile uintptr_t *c, int opts, const char *file,
+ int line);
+void __mtx_lock_spin_flags(volatile uintptr_t *c, int opts, const char *file,
int line);
-void _mtx_unlock_spin_flags(struct mtx *m, int opts, const char *file,
- int line);
+int __mtx_trylock_spin_flags(volatile uintptr_t *c, int opts,
+ const char *file, int line);
+void __mtx_unlock_spin_flags(volatile uintptr_t *c, int opts,
+ const char *file, int line);
#if defined(INVARIANTS) || defined(INVARIANT_SUPPORT)
-void _mtx_assert(struct mtx *m, int what, const char *file, int line);
+void __mtx_assert(const volatile uintptr_t *c, int what, const char *file,
+ int line);
#endif
-void _thread_lock_flags(struct thread *, int, const char *, int);
+void thread_lock_flags_(struct thread *, int, const char *, int);
-#define mtx_trylock_flags_(m, opts, file, line) \
- _mtx_trylock((m), (opts), (file), (line))
-
-#define thread_lock_flags_(tdp, opts, file, line) \
- _thread_lock_flags((tdp), (opts), (file), (line))
#define thread_lock(tdp) \
- _thread_lock_flags((tdp), 0, __FILE__, __LINE__)
+ thread_lock_flags_((tdp), 0, __FILE__, __LINE__)
#define thread_lock_flags(tdp, opt) \
- _thread_lock_flags((tdp), (opt), __FILE__, __LINE__)
+ thread_lock_flags_((tdp), (opt), __FILE__, __LINE__)
#define thread_unlock(tdp) \
mtx_unlock_spin((tdp)->td_lock)
+/*
+ * Top-level macros to provide lock cookie once the actual mtx is passed.
+ * They will also prevent passing a malformed object to the mtx KPI by
+ * failing compilation as the mtx_lock reserved member will not be found.
+ */
+#define mtx_init(m, n, t, o) \
+ _mtx_init(&(m)->mtx_lock, n, t, o)
+#define mtx_destroy(m) \
+ _mtx_destroy(&(m)->mtx_lock)
+#define mtx_trylock_flags_(m, o, f, l) \
+ _mtx_trylock_flags_(&(m)->mtx_lock, o, f, l)
+#define _mtx_lock_sleep(m, t, o, f, l) \
+ __mtx_lock_sleep(&(m)->mtx_lock, t, o, f, l)
+#define _mtx_unlock_sleep(m, o, f, l) \
+ __mtx_unlock_sleep(&(m)->mtx_lock, o, f, l)
+#ifdef SMP
+#define _mtx_lock_spin(m, t, o, f, l) \
+ _mtx_lock_spin_cookie(&(m)->mtx_lock, t, o, f, l)
+#endif
+#define _mtx_lock_flags(m, o, f, l) \
+ __mtx_lock_flags(&(m)->mtx_lock, o, f, l)
+#define _mtx_unlock_flags(m, o, f, l) \
+ __mtx_unlock_flags(&(m)->mtx_lock, o, f, l)
+#define _mtx_lock_spin_flags(m, o, f, l) \
+ __mtx_lock_spin_flags(&(m)->mtx_lock, o, f, l)
+#define _mtx_trylock_spin_flags(m, o, f, l) \
+ __mtx_trylock_spin_flags(&(m)->mtx_lock, o, f, l)
+#define _mtx_unlock_spin_flags(m, o, f, l) \
+ __mtx_unlock_spin_flags(&(m)->mtx_lock, o, f, l)
+#if defined(INVARIANTS) || defined(INVARIANT_SUPPORT)
+#define _mtx_assert(m, w, f, l) \
+ __mtx_assert(&(m)->mtx_lock, w, f, l)
+#endif
+
#define mtx_recurse lock_object.lo_data
/* Very simple operations on mtx_lock. */
@@ -151,7 +190,7 @@
#define __mtx_lock(mp, tid, opts, file, line) do { \
uintptr_t _tid = (uintptr_t)(tid); \
\
- if (!_mtx_obtain_lock((mp), _tid)) \
+ if (((mp)->mtx_lock != MTX_UNOWNED || !_mtx_obtain_lock((mp), _tid)))\
_mtx_lock_sleep((mp), _tid, (opts), (file), (line)); \
else \
LOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(LS_MTX_LOCK_ACQUIRE, \
@@ -169,7 +208,7 @@
uintptr_t _tid = (uintptr_t)(tid); \
\
spinlock_enter(); \
- if (!_mtx_obtain_lock((mp), _tid)) { \
+ if (((mp)->mtx_lock != MTX_UNOWNED || !_mtx_obtain_lock((mp), _tid))) {\
if ((mp)->mtx_lock == _tid) \
(mp)->mtx_recurse++; \
else \
@@ -178,6 +217,21 @@
LOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(LS_MTX_SPIN_LOCK_ACQUIRE, \
mp, 0, 0, (file), (line)); \
} while (0)
+#define __mtx_trylock_spin(mp, tid, opts, file, line) __extension__ ({ \
+ uintptr_t _tid = (uintptr_t)(tid); \
+ int _ret; \
+ \
+ spinlock_enter(); \
+ if (((mp)->mtx_lock != MTX_UNOWNED || !_mtx_obtain_lock((mp), _tid))) {\
+ spinlock_exit(); \
+ _ret = 0; \
+ } else { \
+ LOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(LS_MTX_SPIN_LOCK_ACQUIRE, \
+ mp, 0, 0, file, line); \
+ _ret = 1; \
+ } \
+ _ret; \
+})
#else /* SMP */
#define __mtx_lock_spin(mp, tid, opts, file, line) do { \
uintptr_t _tid = (uintptr_t)(tid); \
@@ -190,6 +244,20 @@
(mp)->mtx_lock = _tid; \
} \
} while (0)
+#define __mtx_trylock_spin(mp, tid, opts, file, line) __extension__ ({ \
+ uintptr_t _tid = (uintptr_t)(tid); \
+ int _ret; \
+ \
+ spinlock_enter(); \
+ if ((mp)->mtx_lock != MTX_UNOWNED) { \
+ spinlock_exit(); \
+ _ret = 0; \
+ } else { \
+ (mp)->mtx_lock = _tid; \
+ _ret = 1; \
+ } \
+ _ret; \
+})
#endif /* SMP */
/* Unlock a normal mutex. */
@@ -196,7 +264,7 @@
#define __mtx_unlock(mp, tid, opts, file, line) do { \
uintptr_t _tid = (uintptr_t)(tid); \
\
- if (!_mtx_release_lock((mp), _tid)) \
+ if ((mp)->mtx_lock != _tid || !_mtx_release_lock((mp), _tid)) \
_mtx_unlock_sleep((mp), (opts), (file), (line)); \
} while (0)
@@ -259,6 +327,10 @@
* mtx_trylock_flags(m, opts) is used the same way as mtx_trylock() but accepts
* relevant option flags `opts.'
*
+ * mtx_trylock_spin(m) attempts to acquire MTX_SPIN mutex `m' but doesn't
+ * spin if it cannot. Rather, it returns 0 on failure and non-zero on
+ * success. It always returns failure for recursed lock attempts.
+ *
* mtx_initialized(m) returns non-zero if the lock `m' has been initialized.
*
* mtx_owned(m) returns non-zero if the current thread owns the lock `m'
@@ -268,6 +340,7 @@
#define mtx_lock(m) mtx_lock_flags((m), 0)
#define mtx_lock_spin(m) mtx_lock_spin_flags((m), 0)
#define mtx_trylock(m) mtx_trylock_flags((m), 0)
+#define mtx_trylock_spin(m) mtx_trylock_spin_flags((m), 0)
#define mtx_unlock(m) mtx_unlock_flags((m), 0)
#define mtx_unlock_spin(m) mtx_unlock_spin_flags((m), 0)
@@ -305,6 +378,8 @@
_mtx_unlock_flags((m), (opts), (file), (line))
#define mtx_lock_spin_flags_(m, opts, file, line) \
_mtx_lock_spin_flags((m), (opts), (file), (line))
+#define mtx_trylock_spin_flags_(m, opts, file, line) \
+ _mtx_trylock_spin_flags((m), (opts), (file), (line))
#define mtx_unlock_spin_flags_(m, opts, file, line) \
_mtx_unlock_spin_flags((m), (opts), (file), (line))
#else /* LOCK_DEBUG == 0 && !MUTEX_NOINLINE */
@@ -314,6 +389,8 @@
__mtx_unlock((m), curthread, (opts), (file), (line))
#define mtx_lock_spin_flags_(m, opts, file, line) \
__mtx_lock_spin((m), curthread, (opts), (file), (line))
+#define mtx_trylock_spin_flags_(m, opts, file, line) \
+ __mtx_trylock_spin((m), curthread, (opts), (file), (line))
#define mtx_unlock_spin_flags_(m, opts, file, line) \
__mtx_unlock_spin((m))
#endif /* LOCK_DEBUG > 0 || MUTEX_NOINLINE */
@@ -339,11 +416,14 @@
mtx_unlock_spin_flags_((m), (opts), LOCK_FILE, LOCK_LINE)
#define mtx_trylock_flags(m, opts) \
mtx_trylock_flags_((m), (opts), LOCK_FILE, LOCK_LINE)
+#define mtx_trylock_spin_flags(m, opts) \
+ mtx_trylock_spin_flags_((m), (opts), LOCK_FILE, LOCK_LINE)
#define mtx_assert(m, what) \
mtx_assert_((m), (what), __FILE__, __LINE__)
#define mtx_sleep(chan, mtx, pri, wmesg, timo) \
- _sleep((chan), &(mtx)->lock_object, (pri), (wmesg), (timo))
+ _sleep((chan), &(mtx)->lock_object, (pri), (wmesg), \
+ tick_sbt * (timo), 0, C_HARDCLOCK)
#define mtx_initialized(m) lock_initalized(&(m)->lock_object)
@@ -392,14 +472,8 @@
}
#endif
-#define UGAR(rval) do { \
- int _val = (rval); \
- mtx_unlock(&Giant); \
- return (_val); \
-} while (0)
-
struct mtx_args {
- struct mtx *ma_mtx;
+ void *ma_mtx;
const char *ma_desc;
int ma_opts;
};
@@ -413,7 +487,7 @@
SYSINIT(name##_mtx_sysinit, SI_SUB_LOCK, SI_ORDER_MIDDLE, \
mtx_sysinit, &name##_args); \
SYSUNINIT(name##_mtx_sysuninit, SI_SUB_LOCK, SI_ORDER_MIDDLE, \
- mtx_destroy, (mtx))
+ _mtx_destroy, __DEVOLATILE(void *, &(mtx)->mtx_lock))
/*
* The INVARIANTS-enabled mtx_assert() functionality.
Modified: trunk/sys/sys/namei.h
===================================================================
--- trunk/sys/sys/namei.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/namei.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1985, 1989, 1991, 1993
* The Regents of the University of California. All rights reserved.
@@ -27,12 +28,14 @@
* SUCH DAMAGE.
*
* @(#)namei.h 8.5 (Berkeley) 1/9/95
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/namei.h 255219 2013-09-05 00:09:56Z pjd $
*/
#ifndef _SYS_NAMEI_H_
#define _SYS_NAMEI_H_
+#include <sys/caprights.h>
+#include <sys/filedesc.h>
#include <sys/queue.h>
#include <sys/uio.h>
@@ -75,7 +78,7 @@
/*
* Results: returned from namei
*/
- cap_rights_t ni_baserights; /* rights the *at base has (or -1) */
+ struct filecaps ni_filecaps; /* rights the *at base has */
/*
* Results: returned from/manipulated by lookup
*/
@@ -107,7 +110,7 @@
/*
* namei operational modifier flags, stored in ni_cnd.flags
*/
-#define LOCKLEAF 0x0004 /* lock inode on return */
+#define LOCKLEAF 0x0004 /* lock vnode on return */
#define LOCKPARENT 0x0008 /* want parent vnode returned locked */
#define WANTPARENT 0x0010 /* want parent vnode returned unlocked */
#define NOCACHE 0x0020 /* name must not be left in cache */
@@ -144,15 +147,12 @@
#define ISOPEN 0x00200000 /* caller is opening; return a real vnode. */
#define NOCROSSMOUNT 0x00400000 /* do not cross mount points */
#define NOMACCHECK 0x00800000 /* do not perform MAC checks */
-#define MPSAFE 0x01000000 /* namei() must acquire Giant if needed. */
-#define GIANTHELD 0x02000000 /* namei() is holding giant. */
#define AUDITVNODE1 0x04000000 /* audit the looked up vnode information */
-#define AUDITVNODE2 0x08000000 /* audit the looked up vnode information */
+#define AUDITVNODE2 0x08000000 /* audit the looked up vnode information */
#define TRAILINGSLASH 0x10000000 /* path ended in a slash */
-#define PARAMASK 0x1ffffe00 /* mask of parameter descriptors */
+#define NOCAPCHECK 0x20000000 /* do not perform capability checks */
+#define PARAMASK 0x3ffffe00 /* mask of parameter descriptors */
-#define NDHASGIANT(NDP) (((NDP)->ni_cnd.cn_flags & GIANTHELD) != 0)
-
/*
* Initialization of a nameidata structure.
*/
@@ -160,32 +160,14 @@
NDINIT_ALL(ndp, op, flags, segflg, namep, AT_FDCWD, NULL, 0, td)
#define NDINIT_AT(ndp, op, flags, segflg, namep, dirfd, td) \
NDINIT_ALL(ndp, op, flags, segflg, namep, dirfd, NULL, 0, td)
-#define NDINIT_ATRIGHTS(ndp, op, flags, segflg, namep, dirfd, rights, td) \
- NDINIT_ALL(ndp, op, flags, segflg, namep, dirfd, NULL, rights, td)
+#define NDINIT_ATRIGHTS(ndp, op, flags, segflg, namep, dirfd, rightsp, td) \
+ NDINIT_ALL(ndp, op, flags, segflg, namep, dirfd, NULL, rightsp, td)
#define NDINIT_ATVP(ndp, op, flags, segflg, namep, vp, td) \
NDINIT_ALL(ndp, op, flags, segflg, namep, AT_FDCWD, vp, 0, td)
-static __inline void
-NDINIT_ALL(struct nameidata *ndp,
- u_long op, u_long flags,
- enum uio_seg segflg,
- const char *namep,
- int dirfd,
- struct vnode *startdir,
- cap_rights_t rights,
- struct thread *td)
-{
- ndp->ni_cnd.cn_nameiop = op;
- ndp->ni_cnd.cn_flags = flags;
- ndp->ni_segflg = segflg;
- ndp->ni_dirp = namep;
- ndp->ni_dirfd = dirfd;
- ndp->ni_startdir = startdir;
- ndp->ni_strictrelative = 0;
- ndp->ni_rightsneeded = rights;
- ndp->ni_baserights = 0;
- ndp->ni_cnd.cn_thread = td;
-}
+void NDINIT_ALL(struct nameidata *ndp, u_long op, u_long flags,
+ enum uio_seg segflg, const char *namep, int dirfd, struct vnode *startdir,
+ cap_rights_t *rightsp, struct thread *td);
#define NDF_NO_DVP_RELE 0x00000001
#define NDF_NO_DVP_UNLOCK 0x00000002
Modified: trunk/sys/sys/nlist_aout.h
===================================================================
--- trunk/sys/sys/nlist_aout.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/nlist_aout.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
@@ -33,7 +34,7 @@
*
* @(#)nlist.h 8.2 (Berkeley) 1/21/94
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/nlist_aout.h 208986 2010-06-10 14:19:51Z bz $
*/
#ifndef _SYS_NLIST_AOUT_H_
Added: trunk/sys/sys/nv.h
===================================================================
--- trunk/sys/sys/nv.h (rev 0)
+++ trunk/sys/sys/nv.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -0,0 +1,201 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2009-2013 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Pawel Jakub Dawidek under sponsorship from
+ * the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: stable/10/sys/sys/nv.h 292973 2015-12-31 03:28:14Z ngie $
+ */
+
+#ifndef _NV_H_
+#define _NV_H_
+
+#include <sys/cdefs.h>
+
+#ifndef _KERNEL
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdio.h>
+#endif
+
+#ifndef _NVLIST_T_DECLARED
+#define _NVLIST_T_DECLARED
+struct nvlist;
+
+typedef struct nvlist nvlist_t;
+#endif
+
+#define NV_NAME_MAX 2048
+
+#define NV_TYPE_NONE 0
+
+#define NV_TYPE_NULL 1
+#define NV_TYPE_BOOL 2
+#define NV_TYPE_NUMBER 3
+#define NV_TYPE_STRING 4
+#define NV_TYPE_NVLIST 5
+#define NV_TYPE_DESCRIPTOR 6
+#define NV_TYPE_BINARY 7
+
+/*
+ * Perform case-insensitive lookups of provided names.
+ */
+#define NV_FLAG_IGNORE_CASE 0x01
+
+#if defined(_KERNEL) && defined(MALLOC_DECLARE)
+MALLOC_DECLARE(M_NVLIST);
+#endif
+
+__BEGIN_DECLS
+
+nvlist_t *nvlist_create(int flags);
+void nvlist_destroy(nvlist_t *nvl);
+int nvlist_error(const nvlist_t *nvl);
+bool nvlist_empty(const nvlist_t *nvl);
+int nvlist_flags(const nvlist_t *nvl);
+void nvlist_set_error(nvlist_t *nvl, int error);
+
+nvlist_t *nvlist_clone(const nvlist_t *nvl);
+
+#ifndef _KERNEL
+void nvlist_dump(const nvlist_t *nvl, int fd);
+void nvlist_fdump(const nvlist_t *nvl, FILE *fp);
+#endif
+
+size_t nvlist_size(const nvlist_t *nvl);
+void *nvlist_pack(const nvlist_t *nvl, size_t *sizep);
+nvlist_t *nvlist_unpack(const void *buf, size_t size);
+
+int nvlist_send(int sock, const nvlist_t *nvl);
+nvlist_t *nvlist_recv(int sock);
+nvlist_t *nvlist_xfer(int sock, nvlist_t *nvl);
+
+const char *nvlist_next(const nvlist_t *nvl, int *typep, void **cookiep);
+
+const nvlist_t *nvlist_get_parent(const nvlist_t *nvl, void **cookiep);
+
+/*
+ * The nvlist_exists functions check if the given name (optionally of the given
+ * type) exists on nvlist.
+ */
+
+bool nvlist_exists(const nvlist_t *nvl, const char *name);
+bool nvlist_exists_type(const nvlist_t *nvl, const char *name, int type);
+
+bool nvlist_exists_null(const nvlist_t *nvl, const char *name);
+bool nvlist_exists_bool(const nvlist_t *nvl, const char *name);
+bool nvlist_exists_number(const nvlist_t *nvl, const char *name);
+bool nvlist_exists_string(const nvlist_t *nvl, const char *name);
+bool nvlist_exists_nvlist(const nvlist_t *nvl, const char *name);
+#ifndef _KERNEL
+bool nvlist_exists_descriptor(const nvlist_t *nvl, const char *name);
+#endif
+bool nvlist_exists_binary(const nvlist_t *nvl, const char *name);
+
+/*
+ * The nvlist_add functions add the given name/value pair.
+ * If a pointer is provided, nvlist_add will internally allocate memory for the
+ * given data (in other words it won't consume provided buffer).
+ */
+
+void nvlist_add_null(nvlist_t *nvl, const char *name);
+void nvlist_add_bool(nvlist_t *nvl, const char *name, bool value);
+void nvlist_add_number(nvlist_t *nvl, const char *name, uint64_t value);
+void nvlist_add_string(nvlist_t *nvl, const char *name, const char *value);
+void nvlist_add_stringf(nvlist_t *nvl, const char *name, const char *valuefmt, ...) __printflike(3, 4);
+#ifdef _VA_LIST_DECLARED
+void nvlist_add_stringv(nvlist_t *nvl, const char *name, const char *valuefmt, va_list valueap) __printflike(3, 0);
+#endif
+void nvlist_add_nvlist(nvlist_t *nvl, const char *name, const nvlist_t *value);
+#ifndef _KERNEL
+void nvlist_add_descriptor(nvlist_t *nvl, const char *name, int value);
+#endif
+void nvlist_add_binary(nvlist_t *nvl, const char *name, const void *value, size_t size);
+
+/*
+ * The nvlist_move functions add the given name/value pair.
+ * The functions consumes provided buffer.
+ */
+
+void nvlist_move_string(nvlist_t *nvl, const char *name, char *value);
+void nvlist_move_nvlist(nvlist_t *nvl, const char *name, nvlist_t *value);
+#ifndef _KERNEL
+void nvlist_move_descriptor(nvlist_t *nvl, const char *name, int value);
+#endif
+void nvlist_move_binary(nvlist_t *nvl, const char *name, void *value, size_t size);
+
+/*
+ * The nvlist_get functions returns value associated with the given name.
+ * If it returns a pointer, the pointer represents internal buffer and should
+ * not be freed by the caller.
+ */
+
+bool nvlist_get_bool(const nvlist_t *nvl, const char *name);
+uint64_t nvlist_get_number(const nvlist_t *nvl, const char *name);
+const char *nvlist_get_string(const nvlist_t *nvl, const char *name);
+const nvlist_t *nvlist_get_nvlist(const nvlist_t *nvl, const char *name);
+#ifndef _KERNEL
+int nvlist_get_descriptor(const nvlist_t *nvl, const char *name);
+#endif
+const void *nvlist_get_binary(const nvlist_t *nvl, const char *name, size_t *sizep);
+
+/*
+ * The nvlist_take functions returns value associated with the given name and
+ * remove the given entry from the nvlist.
+ * The caller is responsible for freeing received data.
+ */
+
+bool nvlist_take_bool(nvlist_t *nvl, const char *name);
+uint64_t nvlist_take_number(nvlist_t *nvl, const char *name);
+char *nvlist_take_string(nvlist_t *nvl, const char *name);
+nvlist_t *nvlist_take_nvlist(nvlist_t *nvl, const char *name);
+#ifndef _KERNEL
+int nvlist_take_descriptor(nvlist_t *nvl, const char *name);
+#endif
+void *nvlist_take_binary(nvlist_t *nvl, const char *name, size_t *sizep);
+
+/*
+ * The nvlist_free functions removes the given name/value pair from the nvlist
+ * and frees memory associated with it.
+ */
+
+void nvlist_free(nvlist_t *nvl, const char *name);
+void nvlist_free_type(nvlist_t *nvl, const char *name, int type);
+
+void nvlist_free_null(nvlist_t *nvl, const char *name);
+void nvlist_free_bool(nvlist_t *nvl, const char *name);
+void nvlist_free_number(nvlist_t *nvl, const char *name);
+void nvlist_free_string(nvlist_t *nvl, const char *name);
+void nvlist_free_nvlist(nvlist_t *nvl, const char *name);
+#ifndef _KERNEL
+void nvlist_free_descriptor(nvlist_t *nvl, const char *name);
+#endif
+void nvlist_free_binary(nvlist_t *nvl, const char *name);
+
+__END_DECLS
+
+#endif /* !_NV_H_ */
Property changes on: trunk/sys/sys/nv.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/nv_impl.h
===================================================================
--- trunk/sys/sys/nv_impl.h (rev 0)
+++ trunk/sys/sys/nv_impl.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -0,0 +1,132 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2013 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Pawel Jakub Dawidek under sponsorship from
+ * the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: stable/10/sys/sys/nv_impl.h 292973 2015-12-31 03:28:14Z ngie $
+ */
+
+#ifndef _NV_IMPL_H_
+#define _NV_IMPL_H_
+
+#ifndef _NVPAIR_T_DECLARED
+#define _NVPAIR_T_DECLARED
+struct nvpair;
+
+typedef struct nvpair nvpair_t;
+#endif
+
+#define NV_TYPE_NVLIST_UP 255
+
+#define NV_TYPE_FIRST NV_TYPE_NULL
+#define NV_TYPE_LAST NV_TYPE_BINARY
+
+#define NV_FLAG_BIG_ENDIAN 0x80
+
+#ifdef _KERNEL
+#define nv_malloc(size) malloc((size), M_NVLIST, M_NOWAIT)
+#define nv_calloc(n, size) malloc((n) * (size), M_NVLIST, \
+ M_NOWAIT | M_ZERO)
+#define nv_realloc(buf, size) realloc((buf), (size), M_NVLIST, \
+ M_NOWAIT)
+#define nv_free(buf) free((buf), M_NVLIST)
+#define nv_strdup(buf) strdup((buf), M_NVLIST)
+#define nv_vasprintf(ptr, ...) vasprintf(ptr, M_NVLIST, __VA_ARGS__)
+
+#define SAVE_ERRNO(var) ((void)(var))
+#define RESTORE_ERRNO(var) ((void)(var))
+
+#define ERRNO_OR_DEFAULT(default) (default)
+
+#else
+
+#define nv_malloc(size) malloc((size))
+#define nv_calloc(n, size) calloc((n), (size))
+#define nv_realloc(buf, size) realloc((buf), (size))
+#define nv_free(buf) free((buf))
+#define nv_strdup(buf) strdup((buf))
+#define nv_vasprintf(ptr, ...) vasprintf(ptr, __VA_ARGS__)
+
+#define SAVE_ERRNO(var) (var) = errno
+#define RESTORE_ERRNO(var) errno = (var)
+
+#define ERRNO_OR_DEFAULT(default) (errno == 0 ? (default) : errno)
+
+#endif
+
+int *nvlist_descriptors(const nvlist_t *nvl, size_t *nitemsp);
+size_t nvlist_ndescriptors(const nvlist_t *nvl);
+
+nvpair_t *nvlist_first_nvpair(const nvlist_t *nvl);
+nvpair_t *nvlist_next_nvpair(const nvlist_t *nvl, const nvpair_t *nvp);
+nvpair_t *nvlist_prev_nvpair(const nvlist_t *nvl, const nvpair_t *nvp);
+
+void nvlist_add_nvpair(nvlist_t *nvl, const nvpair_t *nvp);
+
+void nvlist_move_nvpair(nvlist_t *nvl, nvpair_t *nvp);
+
+void nvlist_set_parent(nvlist_t *nvl, nvpair_t *parent);
+
+const nvpair_t *nvlist_get_nvpair(const nvlist_t *nvl, const char *name);
+
+nvpair_t *nvlist_take_nvpair(nvlist_t *nvl, const char *name);
+
+/* Function removes the given nvpair from the nvlist. */
+void nvlist_remove_nvpair(nvlist_t *nvl, nvpair_t *nvp);
+
+void nvlist_free_nvpair(nvlist_t *nvl, nvpair_t *nvp);
+
+int nvpair_type(const nvpair_t *nvp);
+const char *nvpair_name(const nvpair_t *nvp);
+
+nvpair_t *nvpair_clone(const nvpair_t *nvp);
+
+nvpair_t *nvpair_create_null(const char *name);
+nvpair_t *nvpair_create_bool(const char *name, bool value);
+nvpair_t *nvpair_create_number(const char *name, uint64_t value);
+nvpair_t *nvpair_create_string(const char *name, const char *value);
+nvpair_t *nvpair_create_stringf(const char *name, const char *valuefmt, ...) __printflike(2, 3);
+nvpair_t *nvpair_create_stringv(const char *name, const char *valuefmt, va_list valueap) __printflike(2, 0);
+nvpair_t *nvpair_create_nvlist(const char *name, const nvlist_t *value);
+nvpair_t *nvpair_create_descriptor(const char *name, int value);
+nvpair_t *nvpair_create_binary(const char *name, const void *value, size_t size);
+
+nvpair_t *nvpair_move_string(const char *name, char *value);
+nvpair_t *nvpair_move_nvlist(const char *name, nvlist_t *value);
+nvpair_t *nvpair_move_descriptor(const char *name, int value);
+nvpair_t *nvpair_move_binary(const char *name, void *value, size_t size);
+
+bool nvpair_get_bool(const nvpair_t *nvp);
+uint64_t nvpair_get_number(const nvpair_t *nvp);
+const char *nvpair_get_string(const nvpair_t *nvp);
+const nvlist_t *nvpair_get_nvlist(const nvpair_t *nvp);
+int nvpair_get_descriptor(const nvpair_t *nvp);
+const void *nvpair_get_binary(const nvpair_t *nvp, size_t *sizep);
+
+void nvpair_free(nvpair_t *nvp);
+
+#endif /* !_NV_IMPL_H_ */
Property changes on: trunk/sys/sys/nv_impl.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/nvlist_impl.h
===================================================================
--- trunk/sys/sys/nvlist_impl.h (rev 0)
+++ trunk/sys/sys/nvlist_impl.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -0,0 +1,50 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2013 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Pawel Jakub Dawidek under sponsorship from
+ * the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: stable/10/sys/sys/nvlist_impl.h 292973 2015-12-31 03:28:14Z ngie $
+ */
+
+#ifndef _NVLIST_IMPL_H_
+#define _NVLIST_IMPL_H_
+
+#ifndef _KERNEL
+#include <stdint.h>
+#endif
+
+#include "nv.h"
+
+void *nvlist_xpack(const nvlist_t *nvl, int64_t *fdidxp, size_t *sizep);
+nvlist_t *nvlist_xunpack(const void *buf, size_t size, const int *fds,
+ size_t nfds);
+
+nvpair_t *nvlist_get_nvpair_parent(const nvlist_t *nvl);
+const unsigned char *nvlist_unpack_header(nvlist_t *nvl,
+ const unsigned char *ptr, size_t nfds, bool *isbep, size_t *leftp);
+
+#endif /* !_NVLIST_IMPL_H_ */
Property changes on: trunk/sys/sys/nvlist_impl.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sys/sys/nvpair_impl.h
===================================================================
--- trunk/sys/sys/nvpair_impl.h (rev 0)
+++ trunk/sys/sys/nvpair_impl.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -0,0 +1,95 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2009-2013 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Pawel Jakub Dawidek under sponsorship from
+ * the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: stable/10/sys/sys/nvpair_impl.h 292973 2015-12-31 03:28:14Z ngie $
+ */
+
+#ifndef _NVPAIR_IMPL_H_
+#define _NVPAIR_IMPL_H_
+
+#include <sys/queue.h>
+
+#ifndef _KERNEL
+#include <stdint.h>
+#endif
+
+#include "nv.h"
+
+TAILQ_HEAD(nvl_head, nvpair);
+
+void nvpair_assert(const nvpair_t *nvp);
+nvlist_t *nvpair_nvlist(const nvpair_t *nvp);
+nvpair_t *nvpair_next(const nvpair_t *nvp);
+nvpair_t *nvpair_prev(const nvpair_t *nvp);
+void nvpair_insert(struct nvl_head *head, nvpair_t *nvp, nvlist_t *nvl);
+void nvpair_remove(struct nvl_head *head, nvpair_t *nvp, const nvlist_t *nvl);
+size_t nvpair_header_size(void);
+size_t nvpair_size(const nvpair_t *nvp);
+const unsigned char *nvpair_unpack(bool isbe, const unsigned char *ptr,
+ size_t *leftp, nvpair_t **nvpp);
+void nvpair_free_structure(nvpair_t *nvp);
+void nvpair_init_datasize(nvpair_t *nvp);
+const char *nvpair_type_string(int type);
+
+/* Pack functions. */
+unsigned char *nvpair_pack_header(const nvpair_t *nvp, unsigned char *ptr,
+ size_t *leftp);
+unsigned char *nvpair_pack_null(const nvpair_t *nvp, unsigned char *ptr,
+ size_t *leftp);
+unsigned char *nvpair_pack_bool(const nvpair_t *nvp, unsigned char *ptr,
+ size_t *leftp);
+unsigned char *nvpair_pack_number(const nvpair_t *nvp, unsigned char *ptr,
+ size_t *leftp);
+unsigned char *nvpair_pack_string(const nvpair_t *nvp, unsigned char *ptr,
+ size_t *leftp);
+unsigned char *nvpair_pack_descriptor(const nvpair_t *nvp, unsigned char *ptr,
+ int64_t *fdidxp, size_t *leftp);
+unsigned char *nvpair_pack_binary(const nvpair_t *nvp, unsigned char *ptr,
+ size_t *leftp);
+unsigned char *nvpair_pack_nvlist_up(unsigned char *ptr, size_t *leftp);
+
+/* Unpack data functions. */
+const unsigned char *nvpair_unpack_header(bool isbe, nvpair_t *nvp,
+ const unsigned char *ptr, size_t *leftp);
+const unsigned char *nvpair_unpack_null(bool isbe, nvpair_t *nvp,
+ const unsigned char *ptr, size_t *leftp);
+const unsigned char *nvpair_unpack_bool(bool isbe, nvpair_t *nvp,
+ const unsigned char *ptr, size_t *leftp);
+const unsigned char *nvpair_unpack_number(bool isbe, nvpair_t *nvp,
+ const unsigned char *ptr, size_t *leftp);
+const unsigned char *nvpair_unpack_string(bool isbe, nvpair_t *nvp,
+ const unsigned char *ptr, size_t *leftp);
+const unsigned char *nvpair_unpack_nvlist(bool isbe, nvpair_t *nvp,
+ const unsigned char *ptr, size_t *leftp, size_t nvlist, nvlist_t **child);
+const unsigned char *nvpair_unpack_descriptor(bool isbe, nvpair_t *nvp,
+ const unsigned char *ptr, size_t *leftp, const int *fds, size_t nfds);
+const unsigned char *nvpair_unpack_binary(bool isbe, nvpair_t *nvp,
+ const unsigned char *ptr, size_t *leftp);
+
+#endif /* !_NVPAIR_IMPL_H_ */
Property changes on: trunk/sys/sys/nvpair_impl.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/sys/sys/osd.h
===================================================================
--- trunk/sys/sys/osd.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/osd.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2007 Pawel Jakub Dawidek <pjd at FreeBSD.org>
* All rights reserved.
@@ -23,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/osd.h 298834 2016-04-30 04:01:22Z jamie $
*/
#ifndef _SYS_OSD_H_
@@ -59,6 +60,10 @@
void osd_deregister(u_int type, u_int slot);
int osd_set(u_int type, struct osd *osd, u_int slot, void *value);
+void *osd_reserve(u_int slot);
+int osd_set_reserved(u_int type, struct osd *osd, u_int slot, void *rsv,
+ void *value);
+void osd_free_reserved(void *rsv);
void *osd_get(u_int type, struct osd *osd, u_int slot);
void osd_del(u_int type, struct osd *osd, u_int slot);
int osd_call(u_int type, u_int method, void *obj, void *data);
@@ -71,6 +76,8 @@
osd_deregister(OSD_THREAD, (slot))
#define osd_thread_set(td, slot, value) \
osd_set(OSD_THREAD, &(td)->td_osd, (slot), (value))
+#define osd_thread_set_reserved(td, slot, rsv, value) \
+ osd_set_reserved(OSD_THREAD, &(td)->td_osd, (slot), (rsv), (value))
#define osd_thread_get(td, slot) \
osd_get(OSD_THREAD, &(td)->td_osd, (slot))
#define osd_thread_del(td, slot) do { \
@@ -88,6 +95,8 @@
osd_deregister(OSD_JAIL, (slot))
#define osd_jail_set(pr, slot, value) \
osd_set(OSD_JAIL, &(pr)->pr_osd, (slot), (value))
+#define osd_jail_set_reserved(pr, slot, rsv, value) \
+ osd_set_reserved(OSD_JAIL, &(pr)->pr_osd, (slot), (rsv), (value))
#define osd_jail_get(pr, slot) \
osd_get(OSD_JAIL, &(pr)->pr_osd, (slot))
#define osd_jail_del(pr, slot) \
Modified: trunk/sys/sys/param.h
===================================================================
--- trunk/sys/sys/param.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/param.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -51,11 +51,11 @@
* or r is 5-9 in stable after 1.0 is released.
*/
#undef __MidnightBSD_version
-#define __MidnightBSD_version 100000 /* Master, propagated to newvers */
+#define __MidnightBSD_version 100001 /* Master, propagated to newvers */
/* Version of FreeBSD we're compatible with */
#undef __FreeBSD_version
-#define __FreeBSD_version 901504
+#define __FreeBSD_version 1004501 /* Master, propagated to newvers */
/*
* It is tempting to use this macro in userland code when we want to enable
@@ -69,10 +69,13 @@
#undef __MidnightBSD_kernel__
#define __MidnightBSD_kernel__
-#ifdef _KERNEL
+#if defined(_KERNEL) || defined(IN_RTLD)
#define P_OSREL_SIGWAIT 700000
#define P_OSREL_SIGSEGV 700004
#define P_OSREL_MAP_ANON 800104
+#define P_OSREL_MAP_GUARD 1200035
+
+#define P_OSREL_MAJOR(x) ((x) / 100000)
#endif
#ifndef LOCORE
@@ -149,8 +152,8 @@
* MCLBYTES must be no larger than PAGE_SIZE.
*/
#ifndef MSIZE
-#define MSIZE 256 /* size of an mbuf */
-#endif /* MSIZE */
+#define MSIZE 256 /* size of an mbuf */
+#endif
#ifndef MCLSHIFT
#define MCLSHIFT 11 /* convert bytes to mbuf clusters */
@@ -204,7 +207,6 @@
#define PRIMASK 0x0ff
#define PCATCH 0x100 /* OR'd with pri for tsleep to check signals */
#define PDROP 0x200 /* OR'd with pri to stop re-entry of interlock mutex */
-#define PBDRY 0x400 /* for PCATCH stop is done on the user boundary */
#define NZERO 0 /* default "nice" */
@@ -224,15 +226,22 @@
* and may be made smaller at the risk of not being able to use
* filesystems which require a block size exceeding MAXBSIZE.
*
+ * MAXBCACHEBUF - Maximum size of a buffer in the buffer cache. This must
+ * be >= MAXBSIZE and can be set differently for different
+ * architectures by defining it in <machine/param.h>.
+ * Making this larger allows NFS to do larger reads/writes.
+ *
* BKVASIZE - Nominal buffer space per buffer, in bytes. BKVASIZE is the
* minimum KVM memory reservation the kernel is willing to make.
- * Filesystems can of course request smaller chunks. Actual
+ * Filesystems can of course request smaller chunks. Actual
* backing memory uses a chunk size of a page (PAGE_SIZE).
+ * The default value here can be overridden on a per-architecture
+ * basis by defining it in <machine/param.h>.
*
* If you make BKVASIZE too small you risk seriously fragmenting
* the buffer KVM map which may slow things down a bit. If you
- * make it too big the kernel will not be able to optimally use
- * the KVM memory reserved for the buffer cache and will wind
+ * make it too big the kernel will not be able to optimally use
+ * the KVM memory reserved for the buffer cache and will wind
* up with too-few buffers.
*
* The default is 16384, roughly 2x the block size used by a
@@ -239,7 +248,12 @@
* normal UFS filesystem.
*/
#define MAXBSIZE 65536 /* must be power of 2 */
+#ifndef MAXBCACHEBUF
+#define MAXBCACHEBUF MAXBSIZE /* must be a power of 2 >= MAXBSIZE */
+#endif
+#ifndef BKVASIZE
#define BKVASIZE 16384 /* must be power of 2 */
+#endif
#define BKVAMASK (BKVASIZE-1)
/*
@@ -268,6 +282,7 @@
#endif
#define nitems(x) (sizeof((x)) / sizeof((x)[0]))
#define rounddown(x, y) (((x)/(y))*(y))
+#define rounddown2(x, y) ((x)&(~((y)-1))) /* if y is power of two */
#define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) /* to any y */
#define roundup2(x, y) (((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */
#define powerof2(x) ((((x)-1)&(x))==0)
@@ -319,7 +334,7 @@
#define dbtoc(db) /* calculates devblks to pages */ \
((db + (ctodb(1) - 1)) >> (PAGE_SHIFT - DEV_BSHIFT))
-
+
#define ctodb(db) /* calculates pages to devblks */ \
((db) << (PAGE_SHIFT - DEV_BSHIFT))
Modified: trunk/sys/sys/pciio.h
===================================================================
--- trunk/sys/sys/pciio.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/pciio.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1997, Stefan Esser <se at FreeBSD.ORG>
* Copyright (c) 1997, 1998, 1999, Kenneth D. Merry <ken at FreeBSD.ORG>
@@ -24,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/pciio.h 262134 2014-02-17 22:19:49Z jhb $
*
*/
@@ -116,10 +117,31 @@
uint64_t pbi_length; /* length of BAR */
};
+struct pci_vpd_element {
+ char pve_keyword[2];
+ uint8_t pve_flags;
+ uint8_t pve_datalen;
+ uint8_t pve_data[0];
+};
+
+#define PVE_FLAG_IDENT 0x01 /* Element is the string identifier */
+#define PVE_FLAG_RW 0x02 /* Element is read/write */
+
+#define PVE_NEXT(pve) \
+ ((struct pci_vpd_element *)((char *)(pve) + \
+ sizeof(struct pci_vpd_element) + (pve)->pve_datalen))
+
+struct pci_list_vpd_io {
+ struct pcisel plvi_sel; /* device to operate on */
+ size_t plvi_len; /* size of the data area */
+ struct pci_vpd_element *plvi_data;
+};
+
#define PCIOCGETCONF _IOWR('p', 5, struct pci_conf_io)
#define PCIOCREAD _IOWR('p', 2, struct pci_io)
#define PCIOCWRITE _IOWR('p', 3, struct pci_io)
#define PCIOCATTACHED _IOWR('p', 4, struct pci_io)
#define PCIOCGETBAR _IOWR('p', 6, struct pci_bar_io)
+#define PCIOCLISTVPD _IOWR('p', 7, struct pci_list_vpd_io)
#endif /* !_SYS_PCIIO_H_ */
Modified: trunk/sys/sys/pcpu.h
===================================================================
--- trunk/sys/sys/pcpu.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/pcpu.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2001 Wind River Systems, Inc.
* All rights reserved.
@@ -27,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/pcpu.h 290741 2015-11-13 02:16:08Z markj $
*/
#ifndef _SYS_PCPU_H_
@@ -38,7 +39,11 @@
#endif
#include <sys/_cpuset.h>
+#include <sys/_lock.h>
+#include <sys/_mutex.h>
+#include <sys/_sx.h>
#include <sys/queue.h>
+#include <sys/_rmlock.h>
#include <sys/vmmeter.h>
#include <sys/resource.h>
#include <machine/pcpu.h>
@@ -137,15 +142,6 @@
#endif /* _KERNEL */
-/*
- * XXXUPS remove as soon as we have per cpu variable
- * linker sets and can define rm_queue in _rm_lock.h
- */
-struct rm_queue {
- struct rm_queue* volatile rmq_next;
- struct rm_queue* volatile rmq_prev;
-};
-
/*
* This structure maps out the global data that needs to be kept on a
* per-cpu basis. The members are accessed via the PCPU_GET/SET/PTR
@@ -167,17 +163,9 @@
long pc_cp_time[CPUSTATES]; /* statclock ticks */
struct device *pc_device;
void *pc_netisr; /* netisr SWI cookie */
- int pc_dnweight; /* vm_page_dontneed() */
+ int pc_unused1; /* unused field */
int pc_domain; /* Memory domain. */
-
- /*
- * Stuff for read mostly lock
- *
- * XXXUPS remove as soon as we have per cpu variable
- * linker sets.
- */
- struct rm_queue pc_rm_queue;
-
+ struct rm_queue pc_rm_queue; /* rmlock list of trackers */
uintptr_t pc_dynamic; /* Dynamic per-cpu data area */
/*
@@ -193,6 +181,14 @@
PCPU_MD_FIELDS;
} __aligned(CACHE_LINE_SIZE);
+#ifdef CTASSERT
+/*
+ * To minimize memory waste in per-cpu UMA zones, size of struct pcpu
+ * should be denominator of PAGE_SIZE.
+ */
+CTASSERT((PAGE_SIZE / sizeof(struct pcpu)) * sizeof(struct pcpu) == PAGE_SIZE);
+#endif
+
#ifdef _KERNEL
STAILQ_HEAD(cpuhead, pcpu);
@@ -207,6 +203,21 @@
#endif
#define curvidata PCPU_GET(vidata)
+/* Accessor to elements allocated via UMA_ZONE_PCPU zone. */
+static inline void *
+zpcpu_get(void *base)
+{
+
+ return ((char *)(base) + sizeof(struct pcpu) * curcpu);
+}
+
+static inline void *
+zpcpu_get_cpu(void *base, int cpu)
+{
+
+ return ((char *)(base) + sizeof(struct pcpu) * cpu);
+}
+
/*
* Machine dependent callouts. cpu_pcpu_init() is responsible for
* initializing machine dependent fields of struct pcpu, and
Added: trunk/sys/sys/pctrie.h
===================================================================
--- trunk/sys/sys/pctrie.h (rev 0)
+++ trunk/sys/sys/pctrie.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -0,0 +1,124 @@
+/* $MidnightBSD$ */
+/*
+ * Copyright (c) 2013 EMC Corp.
+ * Copyright (c) 2011 Jeffrey Roberson <jeff at freebsd.org>
+ * Copyright (c) 2008 Mayur Shardul <mayur.shardul at gmail.com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: stable/10/sys/sys/pctrie.h 260266 2014-01-04 17:36:13Z dim $
+ */
+
+#ifndef _SYS_PCTRIE_H_
+#define _SYS_PCTRIE_H_
+
+#include <sys/_pctrie.h>
+
+#ifdef _KERNEL
+
+#define PCTRIE_DEFINE(name, type, field, allocfn, freefn) \
+ \
+CTASSERT(sizeof(((struct type *)0)->field) == sizeof(uint64_t)); \
+/* \
+ * XXX This assert protects flag bits, it does not enforce natural \
+ * alignment. 32bit architectures do not naturally align 64bit fields. \
+ */ \
+CTASSERT((__offsetof(struct type, field) & (sizeof(uint32_t) - 1)) == 0); \
+ \
+static __inline struct type * \
+name##_PCTRIE_VAL2PTR(uint64_t *val) \
+{ \
+ \
+ if (val == NULL) \
+ return (NULL); \
+ return (struct type *) \
+ ((uintptr_t)val - __offsetof(struct type, field)); \
+} \
+ \
+static __inline uint64_t * \
+name##_PCTRIE_PTR2VAL(struct type *ptr) \
+{ \
+ \
+ return &ptr->field; \
+} \
+ \
+static __inline int \
+name##_PCTRIE_INSERT(struct pctrie *ptree, struct type *ptr) \
+{ \
+ \
+ return pctrie_insert(ptree, name##_PCTRIE_PTR2VAL(ptr), \
+ allocfn); \
+} \
+ \
+static __inline struct type * \
+name##_PCTRIE_LOOKUP(struct pctrie *ptree, uint64_t key) \
+{ \
+ \
+ return name##_PCTRIE_VAL2PTR(pctrie_lookup(ptree, key)); \
+} \
+ \
+static __inline struct type * \
+name##_PCTRIE_LOOKUP_LE(struct pctrie *ptree, uint64_t key) \
+{ \
+ \
+ return name##_PCTRIE_VAL2PTR(pctrie_lookup_le(ptree, key)); \
+} \
+ \
+static __inline __unused struct type * \
+name##_PCTRIE_LOOKUP_GE(struct pctrie *ptree, uint64_t key) \
+{ \
+ \
+ return name##_PCTRIE_VAL2PTR(pctrie_lookup_ge(ptree, key)); \
+} \
+ \
+static __inline __unused void \
+name##_PCTRIE_RECLAIM(struct pctrie *ptree) \
+{ \
+ \
+ pctrie_reclaim_allnodes(ptree, freefn); \
+} \
+ \
+static __inline void \
+name##_PCTRIE_REMOVE(struct pctrie *ptree, uint64_t key) \
+{ \
+ \
+ pctrie_remove(ptree, key, freefn); \
+}
+
+typedef void *(*pctrie_alloc_t)(struct pctrie *ptree);
+typedef void (*pctrie_free_t)(struct pctrie *ptree, void *node);
+
+int pctrie_insert(struct pctrie *ptree, uint64_t *val,
+ pctrie_alloc_t allocfn);
+uint64_t *pctrie_lookup(struct pctrie *ptree, uint64_t key);
+uint64_t *pctrie_lookup_ge(struct pctrie *ptree, uint64_t key);
+uint64_t *pctrie_lookup_le(struct pctrie *ptree, uint64_t key);
+void pctrie_reclaim_allnodes(struct pctrie *ptree,
+ pctrie_free_t freefn);
+void pctrie_remove(struct pctrie *ptree, uint64_t key,
+ pctrie_free_t freefn);
+size_t pctrie_node_size(void);
+int pctrie_zone_init(void *mem, int size, int flags);
+
+#endif /* _KERNEL */
+#endif /* !_SYS_PCTRIE_H_ */
Property changes on: trunk/sys/sys/pctrie.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/sys/sys/pioctl.h
===================================================================
--- trunk/sys/sys/pioctl.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/pioctl.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright 1997 Sean Eric Fagan
*
@@ -33,7 +34,7 @@
/*
* procfs ioctl definitions.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/pioctl.h 217747 2011-01-23 12:44:17Z kib $
*/
#ifndef _SYS_PIOCTL_H
Modified: trunk/sys/sys/pipe.h
===================================================================
--- trunk/sys/sys/pipe.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/pipe.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1996 John S. Dyson
* All rights reserved.
@@ -18,7 +19,7 @@
* 5. Modifications may be freely made to this file if the above conditions
* are met.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/pipe.h 268335 2014-07-06 22:47:18Z mjg $
*/
#ifndef _SYS_PIPE_H_
@@ -57,6 +58,7 @@
* See sys_pipe.c for info on what these limits mean.
*/
extern long maxpipekva;
+extern struct fileops pipeops;
/*
* Pipe buffer information.
@@ -94,6 +96,7 @@
#define PIPE_LWANT 0x200 /* Process wants exclusive access to pointers/data. */
#define PIPE_DIRECTW 0x400 /* Pipe direct write active. */
#define PIPE_DIRECTOK 0x800 /* Direct mode ok. */
+#define PIPE_NAMED 0x1000 /* Is a named pipe. */
/*
* Per-pipe data structure.
@@ -112,6 +115,7 @@
u_int pipe_state; /* pipe status info */
int pipe_busy; /* busy flag, mostly to handle rundown sanely */
int pipe_present; /* still present? */
+ int pipe_wgen; /* writer generation for named pipe */
ino_t pipe_ino; /* fake inode for stat(2) */
};
@@ -138,5 +142,7 @@
#define PIPE_UNLOCK(pipe) mtx_unlock(PIPE_MTX(pipe))
#define PIPE_LOCK_ASSERT(pipe, type) mtx_assert(PIPE_MTX(pipe), (type))
-
+void pipe_dtor(struct pipe *dpipe);
+void pipe_named_ctor(struct pipe **ppipe, struct thread *td);
+void pipeselwakeup(struct pipe *cpipe);
#endif /* !_SYS_PIPE_H_ */
Modified: trunk/sys/sys/pmc.h
===================================================================
--- trunk/sys/sys/pmc.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/pmc.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2003-2008, Joseph Koshy
* Copyright (c) 2007 The FreeBSD Foundation
@@ -27,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/pmc.h 320113 2017-06-19 15:34:07Z avg $
*/
#ifndef _SYS_PMC_H_
@@ -91,9 +92,19 @@
__PMC_CPU(INTEL_SANDYBRIDGE_XEON, 0x8F, "Intel Sandy Bridge Xeon") \
__PMC_CPU(INTEL_IVYBRIDGE_XEON, 0x90, "Intel Ivy Bridge Xeon") \
__PMC_CPU(INTEL_HASWELL, 0x91, "Intel Haswell") \
+ __PMC_CPU(INTEL_ATOM_SILVERMONT, 0x92, "Intel Atom Silvermont") \
+ __PMC_CPU(INTEL_NEHALEM_EX, 0x93, "Intel Nehalem Xeon 7500") \
+ __PMC_CPU(INTEL_WESTMERE_EX, 0x94, "Intel Westmere Xeon E7") \
+ __PMC_CPU(INTEL_HASWELL_XEON, 0x95, "Intel Haswell Xeon E5 v3") \
+ __PMC_CPU(INTEL_BROADWELL, 0x96, "Intel Broadwell") \
+ __PMC_CPU(INTEL_BROADWELL_XEON, 0x97, "Intel Broadwell Xeon") \
+ __PMC_CPU(INTEL_SKYLAKE, 0x98, "Intel Skylake") \
+ __PMC_CPU(INTEL_SKYLAKE_XEON, 0x99, "Intel Skylake Xeon") \
__PMC_CPU(INTEL_XSCALE, 0x100, "Intel XScale") \
__PMC_CPU(MIPS_24K, 0x200, "MIPS 24K") \
+ __PMC_CPU(MIPS_OCTEON, 0x201, "Cavium Octeon") \
__PMC_CPU(PPC_7450, 0x300, "PowerPC MPC7450") \
+ __PMC_CPU(PPC_970, 0x380, "IBM PowerPC 970") \
__PMC_CPU(GENERIC, 0x400, "Generic")
enum pmc_cputype {
@@ -121,8 +132,10 @@
__PMC_CLASS(UCF) /* Intel Uncore fixed function */ \
__PMC_CLASS(UCP) /* Intel Uncore programmable */ \
__PMC_CLASS(XSCALE) /* Intel XScale counters */ \
- __PMC_CLASS(MIPS24K) /* MIPS 24K */ \
+ __PMC_CLASS(MIPS24K) /* MIPS 24K */ \
+ __PMC_CLASS(OCTEON) /* Cavium Octeon */ \
__PMC_CLASS(PPC7450) /* Motorola MPC7450 class */ \
+ __PMC_CLASS(PPC970) /* IBM PowerPC 970 class */ \
__PMC_CLASS(SOFT) /* Software events */
enum pmc_class {
@@ -256,7 +269,7 @@
__PMC_CAP(THRESHOLD, 4, "ignore events below a threshold") \
__PMC_CAP(READ, 5, "read PMC counter") \
__PMC_CAP(WRITE, 6, "reprogram PMC counter") \
- __PMC_CAP(INVERT, 7, "invert comparision sense") \
+ __PMC_CAP(INVERT, 7, "invert comparison sense") \
__PMC_CAP(QUALIFIER, 8, "further qualify monitored events") \
__PMC_CAP(PRECISE, 9, "perform precise sampling") \
__PMC_CAP(TAGGING, 10, "tag upstream events") \
@@ -342,7 +355,7 @@
#define PMC_F_NEEDS_LOGFILE 0x00020000 /*needs log file */
#define PMC_F_ATTACH_DONE 0x00040000 /*attached at least once */
-#define PMC_CALLCHAIN_DEPTH_MAX 32
+#define PMC_CALLCHAIN_DEPTH_MAX 128
#define PMC_CC_F_USERSPACE 0x01 /*userspace callchain*/
@@ -526,14 +539,15 @@
*/
struct pmc_op_getdriverstats {
- int pm_intr_ignored; /* #interrupts ignored */
- int pm_intr_processed; /* #interrupts processed */
- int pm_intr_bufferfull; /* #interrupts with ENOSPC */
- int pm_syscalls; /* #syscalls */
- int pm_syscall_errors; /* #syscalls with errors */
- int pm_buffer_requests; /* #buffer requests */
- int pm_buffer_requests_failed; /* #failed buffer requests */
- int pm_log_sweeps; /* #sample buffer processing passes */
+ unsigned int pm_intr_ignored; /* #interrupts ignored */
+ unsigned int pm_intr_processed; /* #interrupts processed */
+ unsigned int pm_intr_bufferfull; /* #interrupts with ENOSPC */
+ unsigned int pm_syscalls; /* #syscalls */
+ unsigned int pm_syscall_errors; /* #syscalls with errors */
+ unsigned int pm_buffer_requests; /* #buffer requests */
+ unsigned int pm_buffer_requests_failed; /* #failed buffer requests */
+ unsigned int pm_log_sweeps; /* #sample buffer processing
+ passes */
};
/*
@@ -559,7 +573,7 @@
/*
* OP GETMSR
*
- * Retrieve the machine specific address assoicated with the allocated
+ * Retrieve the machine specific address associated with the allocated
* PMC. This number can be used subsequently with a read-performance-counter
* instruction.
*/
@@ -590,6 +604,7 @@
#include <sys/malloc.h>
#include <sys/sysctl.h>
+#include <sys/_cpuset.h>
#include <machine/frame.h>
@@ -598,7 +613,7 @@
#define PMC_LOG_BUFFER_SIZE 4
#define PMC_NLOGBUFFERS 1024
#define PMC_NSAMPLES 1024
-#define PMC_CALLCHAIN_DEPTH 16
+#define PMC_CALLCHAIN_DEPTH 32
#define PMC_SYSCTL_NAME_PREFIX "kern." PMC_MODULE_NAME "."
@@ -615,7 +630,7 @@
*/
struct pmc_syscall_args {
- uint32_t pmop_code; /* one of PMC_OP_* */
+ register_t pmop_code; /* one of PMC_OP_* */
void *pmop_data; /* syscall parameter */
};
@@ -705,7 +720,8 @@
pmc_value_t pm_initial; /* counting PMC modes */
} pm_sc;
- uint32_t pm_stalled; /* marks stalled sampling PMCs */
+ volatile cpuset_t pm_stalled; /* marks stalled sampling PMCs */
+ volatile cpuset_t pm_cpustate; /* CPUs where PMC should be active */
uint32_t pm_caps; /* PMC capabilities */
enum pmc_event pm_event; /* event being measured */
uint32_t pm_flags; /* additional flags PMC_F_... */
@@ -982,7 +998,8 @@
/* driver statistics */
extern struct pmc_op_getdriverstats pmc_stats;
-#if defined(DEBUG)
+#if defined(HWPMC_DEBUG)
+#include <sys/ktr.h>
/* debug flags, major flag groups */
struct pmc_debugflags {
@@ -999,14 +1016,42 @@
extern struct pmc_debugflags pmc_debugflags;
+#define KTR_PMC KTR_SUBSYS
+
#define PMC_DEBUG_STRSIZE 128
#define PMC_DEBUG_DEFAULT_FLAGS { 0, 0, 0, 0, 0, 0, 0, 0 }
-#define PMCDBG(M,N,L,F,...) do { \
+#define PMCDBG0(M, N, L, F) do { \
if (pmc_debugflags.pdb_ ## M & (1 << PMC_DEBUG_MIN_ ## N)) \
- printf(#M ":" #N ":" #L ": " F "\n", __VA_ARGS__); \
+ CTR0(KTR_PMC, #M ":" #N ":" #L ": " F); \
} while (0)
-
+#define PMCDBG1(M, N, L, F, p1) do { \
+ if (pmc_debugflags.pdb_ ## M & (1 << PMC_DEBUG_MIN_ ## N)) \
+ CTR1(KTR_PMC, #M ":" #N ":" #L ": " F, p1); \
+} while (0)
+#define PMCDBG2(M, N, L, F, p1, p2) do { \
+ if (pmc_debugflags.pdb_ ## M & (1 << PMC_DEBUG_MIN_ ## N)) \
+ CTR2(KTR_PMC, #M ":" #N ":" #L ": " F, p1, p2); \
+} while (0)
+#define PMCDBG3(M, N, L, F, p1, p2, p3) do { \
+ if (pmc_debugflags.pdb_ ## M & (1 << PMC_DEBUG_MIN_ ## N)) \
+ CTR3(KTR_PMC, #M ":" #N ":" #L ": " F, p1, p2, p3); \
+} while (0)
+#define PMCDBG4(M, N, L, F, p1, p2, p3, p4) do { \
+ if (pmc_debugflags.pdb_ ## M & (1 << PMC_DEBUG_MIN_ ## N)) \
+ CTR4(KTR_PMC, #M ":" #N ":" #L ": " F, p1, p2, p3, p4);\
+} while (0)
+#define PMCDBG5(M, N, L, F, p1, p2, p3, p4, p5) do { \
+ if (pmc_debugflags.pdb_ ## M & (1 << PMC_DEBUG_MIN_ ## N)) \
+ CTR5(KTR_PMC, #M ":" #N ":" #L ": " F, p1, p2, p3, p4, \
+ p5); \
+} while (0)
+#define PMCDBG6(M, N, L, F, p1, p2, p3, p4, p5, p6) do { \
+ if (pmc_debugflags.pdb_ ## M & (1 << PMC_DEBUG_MIN_ ## N)) \
+ CTR6(KTR_PMC, #M ":" #N ":" #L ": " F, p1, p2, p3, p4, \
+ p5, p6); \
+} while (0)
+
/* Major numbers */
#define PMC_DEBUG_MAJ_CPU 0 /* cpu switches */
#define PMC_DEBUG_MAJ_CSW 1 /* context switches */
@@ -1072,7 +1117,13 @@
#define PMC_DEBUG_MIN_CLO 12 /* close */
#else
-#define PMCDBG(M,N,L,F,...) /* nothing */
+#define PMCDBG0(M, N, L, F) /* nothing */
+#define PMCDBG1(M, N, L, F, p1)
+#define PMCDBG2(M, N, L, F, p1, p2)
+#define PMCDBG3(M, N, L, F, p1, p2, p3)
+#define PMCDBG4(M, N, L, F, p1, p2, p3, p4)
+#define PMCDBG5(M, N, L, F, p1, p2, p3, p4, p5)
+#define PMCDBG6(M, N, L, F, p1, p2, p3, p4, p5, p6)
#endif
/* declare a dedicated memory pool */
Modified: trunk/sys/sys/pmckern.h
===================================================================
--- trunk/sys/sys/pmckern.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/pmckern.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2003-2007, Joseph Koshy
* Copyright (c) 2007 The FreeBSD Foundation
@@ -27,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/pmckern.h 254813 2013-08-24 21:13:38Z markj $
*/
/*
@@ -51,8 +52,8 @@
#define PMC_FN_CSW_IN 2
#define PMC_FN_CSW_OUT 3
#define PMC_FN_DO_SAMPLES 4
-#define PMC_FN_KLD_LOAD 5
-#define PMC_FN_KLD_UNLOAD 6
+#define PMC_FN_UNUSED1 5
+#define PMC_FN_UNUSED2 6
#define PMC_FN_MMAP 7
#define PMC_FN_MUNMAP 8
#define PMC_FN_USER_CALLCHAIN 9
Modified: trunk/sys/sys/pmclog.h
===================================================================
--- trunk/sys/sys/pmclog.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/pmclog.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2005-2007, Joseph Koshy
* Copyright (c) 2007 The FreeBSD Foundation
@@ -27,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/pmclog.h 233628 2012-03-28 20:58:30Z fabient $
*/
#ifndef _SYS_PMCLOG_H_
Modified: trunk/sys/sys/poll.h
===================================================================
--- trunk/sys/sys/poll.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/poll.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1997 Peter Wemm <peter at freebsd.org>
* All rights reserved.
@@ -25,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/poll.h 275986 2014-12-21 07:58:28Z dchagin $
*/
#ifndef _SYS_POLL_H_
@@ -95,8 +96,26 @@
#ifndef _KERNEL
+#if __BSD_VISIBLE
+#include <sys/_types.h>
+
+#include <sys/_sigset.h>
+#include <sys/timespec.h>
+
+#ifndef _SIGSET_T_DECLARED
+#define _SIGSET_T_DECLARED
+typedef __sigset_t sigset_t;
+#endif
+
+#endif
+
__BEGIN_DECLS
int poll(struct pollfd _pfd[], nfds_t _nfds, int _timeout);
+#if __BSD_VISIBLE
+int ppoll(struct pollfd _pfd[], nfds_t _nfds,
+ const struct timespec *__restrict _timeout,
+ const sigset_t *__restrict _newsigmask);
+#endif
__END_DECLS
#endif /* !_KERNEL */
Modified: trunk/sys/sys/posix4.h
===================================================================
--- trunk/sys/sys/posix4.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/posix4.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
#ifndef _P1003_1B_P1003_1B_H_
#define _P1003_1B_P1003_1B_H_
/*-
@@ -31,7 +32,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/posix4.h 287507 2015-09-06 17:32:33Z kib $
*/
#include <sys/param.h>
@@ -56,9 +57,6 @@
MALLOC_DECLARE(M_P31B);
-#define p31b_malloc(SIZE) malloc((SIZE), M_P31B, M_WAITOK)
-#define p31b_free(P) free((P), M_P31B)
-
int p31b_proc(struct proc *, pid_t, struct proc **);
void p31b_setcfg(int, int);
Modified: trunk/sys/sys/power.h
===================================================================
--- trunk/sys/sys/power.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/power.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2001 Mitsuru IWASAKI
* All rights reserved.
@@ -23,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/power.h 100084 2002-07-15 14:06:03Z markm $
*/
#ifndef _SYS_POWER_H_
Modified: trunk/sys/sys/priority.h
===================================================================
--- trunk/sys/sys/priority.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/priority.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1994, Henrik Vestergaard Draboel
* All rights reserved.
@@ -28,7 +29,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/priority.h 300060 2016-05-17 15:18:01Z pfg $
*/
#ifndef _SYS_PRIORITY_H_
@@ -126,7 +127,7 @@
struct priority {
u_char pri_class; /* Scheduling class. */
u_char pri_level; /* Normal priority level. */
- u_char pri_native; /* Priority before propogation. */
+ u_char pri_native; /* Priority before propagation. */
u_char pri_user; /* User priority based on p_cpu and p_nice. */
};
Modified: trunk/sys/sys/priv.h
===================================================================
--- trunk/sys/sys/priv.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/priv.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2006 nCircle Network Security, Inc.
* All rights reserved.
@@ -26,7 +27,7 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/priv.h 325099 2017-10-29 09:48:28Z kib $
*/
/*
@@ -111,6 +112,7 @@
#define PRIV_DEBUG_DIFFCRED 80 /* Exempt debugging other users. */
#define PRIV_DEBUG_SUGID 81 /* Exempt debugging setuid proc. */
#define PRIV_DEBUG_UNPRIV 82 /* Exempt unprivileged debug limit. */
+#define PRIV_DEBUG_DENIED 83 /* Exempt P2_NOTRACE. */
/*
* Dtrace privileges.
@@ -132,7 +134,7 @@
#define PRIV_JAIL_REMOVE 112 /* Remove a jail. */
/*
- * Kernel environment priveleges.
+ * Kernel environment privileges.
*/
#define PRIV_KENV_SET 120 /* Set kernel env. variables. */
#define PRIV_KENV_UNSET 121 /* Unset kernel env. variables. */
@@ -158,7 +160,8 @@
#define PRIV_PROC_SETRLIMIT 162 /* Can raise resources limits. */
#define PRIV_PROC_SETLOGINCLASS 163 /* Can call setloginclass(2). */
-/* System V IPC privileges.
+/*
+ * System V IPC privileges.
*/
#define PRIV_IPC_READ 170 /* Can override IPC read perm. */
#define PRIV_IPC_WRITE 171 /* Can override IPC write perm. */
@@ -263,7 +266,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(). */
@@ -338,6 +341,7 @@
#define PRIV_NET_SETIFVNET 417 /* Move interface to vnet. */
#define PRIV_NET_SETIFDESCR 418 /* Set interface description. */
#define PRIV_NET_SETIFFIB 419 /* Set interface fib. */
+#define PRIV_NET_VXLAN 420 /* Administer vxlan. */
/*
* 802.11-related privileges.
@@ -494,9 +498,15 @@
#define PRIV_RCTL_REMOVE_RULE 674
/*
+ * mem(4) privileges.
+ */
+#define PRIV_KMEM_READ 680 /* Open mem/kmem for reading. */
+#define PRIV_KMEM_WRITE 681 /* Open mem/kmem for writing. */
+
+/*
* Track end of privilege list.
*/
-#define _PRIV_HIGHEST 675
+#define _PRIV_HIGHEST 682
/*
* Validate that a named privilege is known by the privilege system. Invalid
Modified: trunk/sys/sys/proc.h
===================================================================
--- trunk/sys/sys/proc.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/proc.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1986, 1989, 1991, 1993
* The Regents of the University of California. All rights reserved.
@@ -32,7 +33,7 @@
* SUCH DAMAGE.
*
* @(#)proc.h 8.15 (Berkeley) 5/19/95
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/proc.h 318743 2017-05-23 12:40:50Z badger $
*/
#ifndef _SYS_PROC_H_
@@ -158,6 +159,7 @@
* for write access.
*/
struct cpuset;
+struct filemon;
struct kaioinfo;
struct kaudit_record;
struct kdtrace_proc;
@@ -170,6 +172,7 @@
struct racct;
struct sbuf;
struct sleepqueue;
+struct syscall_args;
struct td_sched;
struct thread;
struct trapframe;
@@ -213,10 +216,11 @@
struct seltd *td_sel; /* Select queue/channel. */
struct sleepqueue *td_sleepqueue; /* (k) Associated sleep queue. */
struct turnstile *td_turnstile; /* (k) Associated turnstile. */
+ struct rl_q_entry *td_rlqe; /* (k) Associated range lock entry. */
struct umtx_q *td_umtxq; /* (c?) Link for when we're blocked. */
lwpid_t td_tid; /* (b) Thread ID. */
- sigqueue_t td_sigqueue; /* (c) Sigs arrived, not delivered. */
-#define td_siglist td_sigqueue.sq_signals
+ uint64_t padding1[4];
+ void *padding2[4];
u_char td_lend_user_pri; /* (t) Lend user pri. */
/* Cleared during fork1() */
@@ -258,7 +262,6 @@
u_int td_uticks; /* (t) Statclock hits in user mode. */
int td_intrval; /* (t) Return value for sleepq. */
sigset_t td_oldsigmask; /* (k) Saved mask from pre sigpause. */
- sigset_t td_sigmask; /* (c) Current signal mask. */
volatile u_int td_generation; /* (k) For detection of preemption */
stack_t td_sigstk; /* (k) Stack ptr and on-stack flag. */
int td_xsig; /* (c) Signal for ptrace */
@@ -272,10 +275,14 @@
struct osd td_osd; /* (k) Object specific data. */
struct vm_map_entry *td_map_def_user; /* (k) Deferred entries. */
pid_t td_dbg_forked; /* (c) Child pid for debugger. */
-#define td_endzero td_rqindex
+ u_int td_vp_reserv; /* (k) Count of reserved vnodes. */
+ int td_no_sleeping; /* (k) Sleeping disabled count. */
+ int td_dom_rr_idx; /* (k) RR Numa domain selection. */
+#define td_endzero td_sigmask
-/* Copied during fork1() or thread_sched_upcall(). */
+/* Copied during fork1() or create_thread(). */
#define td_startcopy td_endzero
+ sigset_t td_sigmask; /* (c) Current signal mask. */
u_char td_rqindex; /* (t) Run queue index. */
u_char td_base_pri; /* (t) Thread base kernel priority. */
u_char td_priority; /* (t) Thread active priority. */
@@ -285,7 +292,7 @@
#define td_endcopy td_pcb
/*
- * Fields that must be manually set in fork1() or thread_sched_upcall()
+ * Fields that must be manually set in fork1() or create_thread()
* or already have been set in the allocator, constructor, etc.
*/
struct pcb *td_pcb; /* (k) Kernel VA of pcb and kstack. */
@@ -312,12 +319,16 @@
struct vnet *td_vnet; /* (k) Effective vnet. */
const char *td_vnet_lpush; /* (k) Debugging vnet push / pop. */
struct trapframe *td_intr_frame;/* (k) Frame of the current irq */
- struct proc *td_rfppwait_p; /* (k) The vforked child */
- struct vm_page **td_ma; /* (k) uio pages held */
- int td_ma_cnt; /* (k) size of *td_ma */
- struct rl_q_entry *td_rlqe; /* (k) Associated range lock entry. */
- u_int td_vp_reserv; /* (k) Count of reserved vnodes. */
- void *td_machdata; /* (k) mach state. */
+ struct proc *td_rfppwait_p; /* (k) The vforked child */
+ struct vm_page **td_ma; /* (k) uio pages held */
+ int td_ma_cnt; /* (k) size of *td_ma */
+ void *td_su; /* (k) FFS SU private */
+ u_int td_dbg_sc_code; /* (c) Syscall code to debugger. */
+ u_int td_dbg_sc_narg; /* (c) Syscall arg count to debugger.*/
+ void *td_emuldata; /* Emulator state data */
+ sbintime_t td_sleeptimo; /* (t) Sleep timeout. */
+ sigqueue_t td_sigqueue; /* (c) Sigs arrived, not delivered. */
+#define td_siglist td_sigqueue.sq_signals
};
struct mtx *thread_lock_block(struct thread *);
@@ -341,9 +352,6 @@
#define THREAD_LOCKPTR_ASSERT(td, lock)
#endif
-#define CRITICAL_ASSERT(td) \
- KASSERT((td)->td_critnest >= 1, ("Not in critical section"));
-
/*
* Flags kept in td_flags:
* To change these you MUST have the scheduler lock.
@@ -357,10 +365,10 @@
#define TDF_CANSWAP 0x00000040 /* Thread can be swapped. */
#define TDF_SLEEPABORT 0x00000080 /* sleepq_abort was called. */
#define TDF_KTH_SUSP 0x00000100 /* kthread is suspended */
-#define TDF_UNUSED09 0x00000200 /* --available-- */
+#define TDF_ALLPROCSUSP 0x00000200 /* suspended by SINGLE_ALLPROC */
#define TDF_BOUNDARY 0x00000400 /* Thread suspended at user boundary */
#define TDF_ASTPENDING 0x00000800 /* Thread has some asynchronous events. */
-#define TDF_TIMOFAIL 0x00001000 /* Timeout from sleep after we were awake. */
+#define TDF_UNUSED12 0x00001000 /* --available-- */
#define TDF_SBDRY 0x00002000 /* Stop only on usermode boundary. */
#define TDF_UPIBLOCKED 0x00004000 /* Thread blocked on user PI mutex. */
#define TDF_NEEDSUSPCHK 0x00008000 /* Thread may need to suspend. */
@@ -392,6 +400,10 @@
#define TDB_STOPATFORK 0x00000080 /* Stop at the return from fork (child
only) */
#define TDB_CHILD 0x00000100 /* New child indicator for ptrace() */
+#define TDB_BORN 0x00000200 /* New LWP indicator for ptrace() */
+#define TDB_EXIT 0x00000400 /* Exiting LWP indicator for ptrace() */
+#define TDB_VFORK 0x00000800 /* vfork indicator for ptrace() */
+#define TDB_FSTP 0x00001000 /* The thread is PT_ATTACH leader */
/*
* "Private" flags kept in td_pflags:
@@ -403,9 +415,9 @@
#define TDP_BUFNEED 0x00000008 /* Do not recurse into the buf flush */
#define TDP_COWINPROGRESS 0x00000010 /* Snapshot copy-on-write in progress. */
#define TDP_ALTSTACK 0x00000020 /* Have alternate signal stack. */
-#define TDP_DEADLKTREAT 0x00000040 /* Lock aquisition - deadlock treatment. */
+#define TDP_DEADLKTREAT 0x00000040 /* Lock acquisition - deadlock treatment. */
#define TDP_NOFAULTING 0x00000080 /* Do not handle page faults. */
-#define TDP_NOSLEEPING 0x00000100 /* Thread is not allowed to sleep on a sq. */
+#define TDP_UNUSED9 0x00000100 /* --available-- */
#define TDP_OWEUPC 0x00000200 /* Call addupc() at next AST. */
#define TDP_ITHREAD 0x00000400 /* Thread is an interrupt thread. */
#define TDP_SYNCIO 0x00000800 /* Local override, disable async i/o. */
@@ -426,6 +438,8 @@
#define TDP_RESETSPUR 0x04000000 /* Reset spurious page fault history. */
#define TDP_NERRNO 0x08000000 /* Last errno is already in td_errno */
#define TDP_UIOHELD 0x10000000 /* Current uio has pages held in td_ma */
+#define TDP_UNUSED29 0x20000000 /* --available-- */
+#define TDP_EXECVMSPC 0x40000000 /* Execve destroyed old vmspace */
/*
* Reasons that the current thread can not be run yet.
@@ -450,6 +464,12 @@
#define TD_ON_UPILOCK(td) ((td)->td_flags & TDF_UPIBLOCKED)
#define TD_IS_IDLETHREAD(td) ((td)->td_flags & TDF_IDLETD)
+#define KTDSTATE(td) \
+ (((td)->td_inhibitors & TDI_SLEEPING) != 0 ? "sleep" : \
+ ((td)->td_inhibitors & TDI_SUSPENDED) != 0 ? "suspended" : \
+ ((td)->td_inhibitors & TDI_SWAPPED) != 0 ? "swapped" : \
+ ((td)->td_inhibitors & TDI_LOCK) != 0 ? "blocked" : \
+ ((td)->td_inhibitors & TDI_IWAIT) != 0 ? "iwait" : "yielding")
#define TD_SET_INHIB(td, inhib) do { \
(td)->td_state = TDS_INHIBITED; \
@@ -494,11 +514,8 @@
struct callout p_limco; /* (c) Limit callout handle */
struct sigacts *p_sigacts; /* (x) Signal actions, state (CPU). */
- /*
- * The following don't make too much sense.
- * See the td_ or ke_ versions of the same flags.
- */
int p_flag; /* (c) P_* flags. */
+ int p_flag2; /* (c) P2_* flags. */
enum {
PRS_NEW = 0, /* In creation */
PRS_NORMAL, /* threads can be run. */
@@ -512,13 +529,12 @@
LIST_HEAD(, proc) p_children; /* (e) Pointer to list of children. */
struct mtx p_mtx; /* (n) Lock for this struct. */
struct ksiginfo *p_ksi; /* Locked by parent proc lock */
- sigqueue_t p_sigqueue; /* (c) Sigs not delivered to a td. */
-#define p_siglist p_sigqueue.sq_signals
+ uint64_t padding1[4];
+ void *padding2[4];
/* The following fields are all zeroed upon creation in fork. */
#define p_startzero p_oppid
pid_t p_oppid; /* (c + e) Save ppid in ptrace. XXX */
- int p_pad_dbg_child;
struct vmspace *p_vmspace; /* (b) Address space. */
u_int p_swtick; /* (c) Tick when swapped in or out. */
struct itimerval p_realtimer; /* (c) Alarm timer. */
@@ -549,6 +565,7 @@
int p_pendingcnt; /* how many signals are pending */
struct itimers *p_itimers; /* (c) POSIX interval timers. */
struct procdesc *p_procdesc; /* (e) Process descriptor, if any. */
+ int p_pendingexits; /* (c) Count of pending thread exits. */
/* End area that is zeroed on creation. */
#define p_endzero p_magic
@@ -557,13 +574,14 @@
u_int p_magic; /* (b) Magic number. */
int p_osrel; /* (x) osreldate for the
binary (from ELF note, if any) */
- char p_comm[MAXCOMLEN + 1]; /* (b) Process name. */
- struct pgrp *p_pgrp; /* (c + e) Pointer to process group. */
+ char p_comm[MAXCOMLEN + 1]; /* (x) Process name. */
+ void *p_pad0;
struct sysentvec *p_sysent; /* (b) Syscall dispatch info. */
struct pargs *p_args; /* (c) Process arguments. */
rlim_t p_cpulimit; /* (c) Current CPU limit in seconds. */
signed char p_nice; /* (c) Process "nice" value. */
int p_fibnum; /* in this routing domain XXX MRT */
+
/* End area that is copied on creation. */
#define p_endcopy p_xstat
@@ -586,6 +604,7 @@
after fork. */
uint64_t p_prev_runtime; /* (c) Resource usage accounting. */
struct racct *p_racct; /* (b) Resource accounting. */
+ u_char p_throttled; /* (c) Flag for racct pcpu throttling */
/*
* An orphan is the child that has beed re-parented to the
* debugger as a result of attaching to it. Need to keep
@@ -594,9 +613,22 @@
*/
LIST_ENTRY(proc) p_orphan; /* (e) List of orphan processes. */
LIST_HEAD(, proc) p_orphans; /* (e) Pointer to list of orphans. */
-
- u_char p_throttled; /* (c) Flag for racct pcpu throttling */
- void *p_machdata; /* (c) Mach state data. */
+ u_int p_treeflag; /* (e) P_TREE flags */
+ struct proc *p_reaper; /* (e) My reaper. */
+ LIST_HEAD(, proc) p_reaplist; /* (e) List of my descendants
+ (if I am reaper). */
+ LIST_ENTRY(proc) p_reapsibling; /* (e) List of siblings - descendants of
+ the same reaper. */
+ pid_t p_reapsubtree; /* (e) Pid of the direct child of the
+ reaper which spawned
+ our subtree. */
+ struct pgrp *p_pgrp; /* (c + e) Pointer to process group. */
+ struct filemon *p_filemon; /* (c) filemon-specific data. */
+ u_int p_ptevents; /* (c) ptrace() event mask. */
+ uint16_t p_elf_machine; /* (x) ELF machine type */
+ uint64_t p_elf_flags; /* (x) ELF flags */
+ sigqueue_t p_sigqueue; /* (c) Sigs not delivered to a td. */
+#define p_siglist p_sigqueue.sq_signals
};
#define p_session p_pgrp->pg_session
@@ -608,11 +640,23 @@
#define PROC_SUNLOCK(p) mtx_unlock_spin(&(p)->p_slock)
#define PROC_SLOCK_ASSERT(p, type) mtx_assert(&(p)->p_slock, (type))
+#define PROC_STATLOCK(p) mtx_lock_spin(&(p)->p_slock)
+#define PROC_STATUNLOCK(p) mtx_unlock_spin(&(p)->p_slock)
+#define PROC_STATLOCK_ASSERT(p, type) mtx_assert(&(p)->p_slock, (type))
+
+#define PROC_ITIMLOCK(p) mtx_lock_spin(&(p)->p_slock)
+#define PROC_ITIMUNLOCK(p) mtx_unlock_spin(&(p)->p_slock)
+#define PROC_ITIMLOCK_ASSERT(p, type) mtx_assert(&(p)->p_slock, (type))
+
+#define PROC_PROFLOCK(p) mtx_lock_spin(&(p)->p_slock)
+#define PROC_PROFUNLOCK(p) mtx_unlock_spin(&(p)->p_slock)
+#define PROC_PROFLOCK_ASSERT(p, type) mtx_assert(&(p)->p_slock, (type))
+
/* These flags are kept in p_flag. */
#define P_ADVLOCK 0x00001 /* Process may hold a POSIX advisory lock. */
#define P_CONTROLT 0x00002 /* Has a controlling terminal. */
#define P_KTHREAD 0x00004 /* Kernel thread (*). */
-#define P_FOLLOWFORK 0x00008 /* Attach parent debugger to children. */
+#define P_UNUSED3 0x00008 /* --available-- */
#define P_PPWAIT 0x00010 /* Parent is waiting for child to exec/exit. */
#define P_PROFIL 0x00020 /* Has started profiling. */
#define P_STOPPROF 0x00040 /* Has thread requesting to stop profiling. */
@@ -634,7 +678,7 @@
#define P_SINGLE_BOUNDARY 0x400000 /* Threads should suspend at user boundary. */
#define P_HWPMC 0x800000 /* Process is using HWPMCs */
#define P_JAILED 0x1000000 /* Process is in jail. */
-#define P_ORPHAN 0x2000000 /* Orphaned. */
+#define P_TOTAL_STOP 0x2000000 /* Stopped in proc_stop_total. */
#define P_INEXEC 0x4000000 /* Process is in execve(). */
#define P_STATCHILD 0x8000000 /* Child process stopped or exited. */
#define P_INMEM 0x10000000 /* Loaded into memory. */
@@ -646,6 +690,19 @@
#define P_SHOULDSTOP(p) ((p)->p_flag & P_STOPPED)
#define P_KILLED(p) ((p)->p_flag & P_WKILLED)
+/* These flags are kept in p_flag2. */
+#define P2_INHERIT_PROTECTED 0x00000001 /* New children get P_PROTECTED. */
+#define P2_NOTRACE 0x00000002 /* No ptrace(2) attach or coredumps. */
+#define P2_NOTRACE_EXEC 0x00000004 /* Keep P2_NOPTRACE on exec(2). */
+#define P2_AST_SU 0x00000008 /* Handles SU ast for kthreads. */
+#define P2_PTRACE_FSTP 0x00000010 /* SIGSTOP from PT_ATTACH not yet handled. */
+
+/* Flags protected by proctree_lock, kept in p_treeflags. */
+#define P_TREE_ORPHANED 0x00000001 /* Reparented, on orphan list */
+#define P_TREE_FIRST_ORPHAN 0x00000002 /* First element of orphan
+ list */
+#define P_TREE_REAPER 0x00000004 /* Reaper of subtree */
+
/*
* These were process status values (p_stat), now they are only used in
* legacy conversion code.
@@ -666,7 +723,7 @@
#define SW_TYPE_MASK 0xff /* First 8 bits are switch type */
#define SWT_NONE 0 /* Unspecified switch. */
#define SWT_PREEMPT 1 /* Switching due to preemption. */
-#define SWT_OWEPREEMPT 2 /* Switching due to opepreempt. */
+#define SWT_OWEPREEMPT 2 /* Switching due to owepreempt. */
#define SWT_TURNSTILE 3 /* Turnstile contention. */
#define SWT_SLEEPQ 4 /* Sleepq wait. */
#define SWT_SLEEPQTIMO 5 /* Sleepq timeout wait. */
@@ -687,6 +744,7 @@
#define SINGLE_NO_EXIT 0
#define SINGLE_EXIT 1
#define SINGLE_BOUNDARY 2
+#define SINGLE_ALLPROC 3
#ifdef MALLOC_DECLARE
MALLOC_DECLARE(M_PARGS);
@@ -794,18 +852,12 @@
#define thread_safetoswapout(td) ((td)->td_flags & TDF_CANSWAP)
/* Control whether or not it is safe for curthread to sleep. */
-#define THREAD_NO_SLEEPING() do { \
- KASSERT(!(curthread->td_pflags & TDP_NOSLEEPING), \
- ("nested no sleeping")); \
- curthread->td_pflags |= TDP_NOSLEEPING; \
-} while (0)
+#define THREAD_NO_SLEEPING() ((curthread)->td_no_sleeping++)
-#define THREAD_SLEEPING_OK() do { \
- KASSERT((curthread->td_pflags & TDP_NOSLEEPING), \
- ("nested sleeping ok")); \
- curthread->td_pflags &= ~TDP_NOSLEEPING; \
-} while (0)
+#define THREAD_SLEEPING_OK() ((curthread)->td_no_sleeping--)
+#define THREAD_CAN_SLEEP() ((curthread)->td_no_sleeping == 0)
+
#define PIDHASH(pid) (&pidhashtbl[(pid) & pidhash])
extern LIST_HEAD(pidhashhead, proc) *pidhashtbl;
extern u_long pidhash;
@@ -819,6 +871,7 @@
extern u_long pgrphash;
extern struct sx allproc_lock;
+extern int allproc_gen;
extern struct sx proctree_lock;
extern struct mtx ppeers_lock;
extern struct proc proc0; /* Process slot for swapper. */
@@ -892,11 +945,14 @@
void procinit(void);
void proc_linkup0(struct proc *p, struct thread *td);
void proc_linkup(struct proc *p, struct thread *td);
+struct proc *proc_realparent(struct proc *child);
void proc_reap(struct thread *td, struct proc *p, int *status, int options);
void proc_reparent(struct proc *child, struct proc *newparent);
+void proc_set_traced(struct proc *p, bool stop);
struct pstats *pstats_alloc(void);
void pstats_fork(struct pstats *src, struct pstats *dst);
void pstats_free(struct pstats *ps);
+void reaper_abandon_children(struct proc *p, bool exiting);
int securelevel_ge(struct ucred *cr, int level);
int securelevel_gt(struct ucred *cr, int level);
void sess_hold(struct session *);
@@ -905,7 +961,6 @@
void setsugid(struct proc *p);
int should_yield(void);
int sigonstack(size_t sp);
-void sleepinit(void);
void stopevent(struct proc *, u_int, u_int);
struct thread *tdfind(lwpid_t, pid_t);
void threadinit(void);
@@ -913,7 +968,7 @@
void tidhash_remove(struct thread *);
void cpu_idle(int);
int cpu_idle_wakeup(int);
-extern void (*cpu_idle_hook)(void); /* Hook to machdep CPU idler. */
+extern void (*cpu_idle_hook)(sbintime_t); /* Hook to machdep CPU idler. */
void cpu_switch(struct thread *, struct thread *, struct mtx *);
void cpu_throw(struct thread *, struct thread *) __dead2;
void unsleep(struct thread *);
@@ -921,7 +976,6 @@
void cpu_exit(struct thread *);
void exit1(struct thread *, int) __dead2;
-struct syscall_args;
int cpu_fetch_syscall_args(struct thread *td, struct syscall_args *sa);
void cpu_fork(struct thread *, struct proc *, struct thread *, int);
void cpu_set_fork_handler(struct thread *, void (*)(void *), void *);
@@ -938,12 +992,14 @@
void cpu_thread_swapout(struct thread *);
struct thread *thread_alloc(int pages);
int thread_alloc_stack(struct thread *, int pages);
+int thread_create(struct thread *td, struct rtprio *rtp,
+ int (*initialize_thread)(struct thread *, void *), void *thunk);
void thread_exit(void) __dead2;
void thread_free(struct thread *td);
void thread_link(struct thread *td, struct proc *p);
void thread_reap(void);
-int thread_single(int how);
-void thread_single_end(void);
+int thread_single(struct proc *p, int how);
+void thread_single_end(struct proc *p, int how);
void thread_stash(struct thread *td);
void thread_stopped(struct proc *p);
void childproc_stopped(struct proc *child, int reason);
@@ -950,15 +1006,17 @@
void childproc_continued(struct proc *child);
void childproc_exited(struct proc *child);
int thread_suspend_check(int how);
-void thread_suspend_switch(struct thread *);
+bool thread_suspend_check_needed(void);
+void thread_suspend_switch(struct thread *, struct proc *p);
void thread_suspend_one(struct thread *td);
void thread_unlink(struct thread *td);
void thread_unsuspend(struct proc *p);
-int thread_unsuspend_one(struct thread *td);
-void thread_unthread(struct thread *td);
void thread_wait(struct proc *p);
struct thread *thread_find(struct proc *p, lwpid_t tid);
+void stop_all_proc(void);
+void resume_all_proc(void);
+
static __inline int
curthread_pflags_set(int flags)
{
Added: trunk/sys/sys/procctl.h
===================================================================
--- trunk/sys/sys/procctl.h (rev 0)
+++ trunk/sys/sys/procctl.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -0,0 +1,114 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2013 Hudson River Trading LLC
+ * Written by: John H. Baldwin <jhb at FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: stable/10/sys/sys/procctl.h 326397 2017-11-30 14:38:07Z kib $
+ */
+
+#ifndef _SYS_PROCCTL_H_
+#define _SYS_PROCCTL_H_
+
+#ifndef _KERNEL
+#include <sys/types.h>
+#include <sys/wait.h>
+#endif
+
+#define PROC_SPROTECT 1 /* set protected state */
+#define PROC_REAP_ACQUIRE 2 /* reaping enable */
+#define PROC_REAP_RELEASE 3 /* reaping disable */
+#define PROC_REAP_STATUS 4 /* reaping status */
+#define PROC_REAP_GETPIDS 5 /* get descendants */
+#define PROC_REAP_KILL 6 /* kill descendants */
+#define PROC_TRACE_CTL 7 /* en/dis ptrace and coredumps */
+#define PROC_TRACE_STATUS 8 /* query tracing status */
+
+/* Operations for PROC_SPROTECT (passed in integer arg). */
+#define PPROT_OP(x) ((x) & 0xf)
+#define PPROT_SET 1
+#define PPROT_CLEAR 2
+
+/* Flags for PROC_SPROTECT (ORed in with operation). */
+#define PPROT_FLAGS(x) ((x) & ~0xf)
+#define PPROT_DESCEND 0x10
+#define PPROT_INHERIT 0x20
+
+/* Result of PREAP_STATUS (returned by value). */
+struct procctl_reaper_status {
+ u_int rs_flags;
+ u_int rs_children;
+ u_int rs_descendants;
+ pid_t rs_reaper;
+ pid_t rs_pid;
+ u_int rs_pad0[15];
+};
+
+/* struct procctl_reaper_status rs_flags */
+#define REAPER_STATUS_OWNED 0x00000001
+#define REAPER_STATUS_REALINIT 0x00000002
+
+struct procctl_reaper_pidinfo {
+ pid_t pi_pid;
+ pid_t pi_subtree;
+ u_int pi_flags;
+ u_int pi_pad0[15];
+};
+
+#define REAPER_PIDINFO_VALID 0x00000001
+#define REAPER_PIDINFO_CHILD 0x00000002
+#define REAPER_PIDINFO_REAPER 0x00000004
+
+struct procctl_reaper_pids {
+ u_int rp_count;
+ u_int rp_pad0[15];
+ struct procctl_reaper_pidinfo *rp_pids;
+};
+
+struct procctl_reaper_kill {
+ int rk_sig; /* in - signal to send */
+ u_int rk_flags; /* in - REAPER_KILL flags */
+ pid_t rk_subtree; /* in - subtree, if REAPER_KILL_SUBTREE */
+ u_int rk_killed; /* out - count of processes successfully
+ killed */
+ pid_t rk_fpid; /* out - first failed pid for which error
+ is returned */
+ u_int rk_pad0[15];
+};
+
+#define REAPER_KILL_CHILDREN 0x00000001
+#define REAPER_KILL_SUBTREE 0x00000002
+
+#define PROC_TRACE_CTL_ENABLE 1
+#define PROC_TRACE_CTL_DISABLE 2
+#define PROC_TRACE_CTL_DISABLE_EXEC 3
+
+#ifndef _KERNEL
+__BEGIN_DECLS
+int procctl(idtype_t, id_t, int, void *);
+__END_DECLS
+
+#endif
+
+#endif /* !_SYS_PROCCTL_H_ */
Property changes on: trunk/sys/sys/procctl.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/sys/sys/procdesc.h
===================================================================
--- trunk/sys/sys/procdesc.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/procdesc.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2009 Robert N. M. Watson
* All rights reserved.
@@ -26,7 +27,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/procdesc.h 269619 2014-08-06 00:35:32Z emaste $
*/
#ifndef _SYS_PROCDESC_H_
@@ -47,7 +48,7 @@
* Locking key:
* (c) - Constant after initial setup.
* (p) - Protected by the process descriptor mutex.
- * (r) - Atomic eference count.
+ * (r) - Atomic reference count.
* (s) - Protected by selinfo.
* (t) - Protected by the proctree_lock
*/
@@ -92,8 +93,8 @@
* In-kernel interfaces to process descriptors.
*/
int procdesc_exit(struct proc *);
-int procdesc_find(struct thread *, int fd, cap_rights_t, struct proc **);
-int kern_pdgetpid(struct thread *, int fd, cap_rights_t, pid_t *pidp);
+int procdesc_find(struct thread *, int fd, cap_rights_t *, struct proc **);
+int kern_pdgetpid(struct thread *, int fd, cap_rights_t *, pid_t *pidp);
void procdesc_new(struct proc *, int);
void procdesc_finit(struct procdesc *, struct file *);
pid_t procdesc_pid(struct file *);
Modified: trunk/sys/sys/procfs.h
===================================================================
--- trunk/sys/sys/procfs.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/procfs.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1998 John D. Polstra.
* All rights reserved.
@@ -23,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/procfs.h 308009 2016-10-28 03:54:19Z jhb $
*/
#ifndef _SYS_PROCFS_H_
@@ -49,7 +50,10 @@
/*
* The parenthsized numbers like (1) indicate the minimum version number
- * for which each element exists in the structure.
+ * for which each element exists in the structure. The version number is
+ * not bumped when adding new fields to the end, only if the meaning of
+ * an existing field changes. Additional fields are annotated as (1a),
+ * (1b), etc. to indicate the groupings of additions.
*/
#define PRSTATUS_VERSION 1 /* Current version of prstatus_t */
@@ -61,7 +65,7 @@
size_t pr_fpregsetsz; /* sizeof(fpregset_t) (1) */
int pr_osreldate; /* Kernel version (1) */
int pr_cursig; /* Current signal (1) */
- pid_t pr_pid; /* Process ID (1) */
+ pid_t pr_pid; /* LWP (Thread) ID (1) */
gregset_t pr_reg; /* General purpose registers (1) */
} prstatus_t;
@@ -78,10 +82,9 @@
size_t pr_psinfosz; /* sizeof(prpsinfo_t) (1) */
char pr_fname[PRFNAMESZ+1]; /* Command name, null terminated (1) */
char pr_psargs[PRARGSZ+1]; /* Arguments, null terminated (1) */
+ pid_t pr_pid; /* Process ID (1a) */
} prpsinfo_t;
-#define THRMISC_VERSION 1 /* Current version of thrmisc_t */
-
typedef struct thrmisc {
char pr_tname[MAXCOMLEN+1]; /* Thread name, null terminated (1) */
u_int _pad; /* Convenience pad, 0-filled (1) */
@@ -89,4 +92,30 @@
typedef uint64_t psaddr_t; /* An address in the target process. */
+#ifdef __HAVE_REG32
+typedef struct prstatus32 {
+ int32_t pr_version;
+ uint32_t pr_statussz;
+ uint32_t pr_gregsetsz;
+ uint32_t pr_fpregsetsz;
+ int32_t pr_osreldate;
+ int32_t pr_cursig;
+ int32_t pr_pid;
+ struct reg32 pr_reg;
+} prstatus32_t;
+
+typedef struct prpsinfo32 {
+ int32_t pr_version;
+ uint32_t pr_psinfosz;
+ char pr_fname[PRFNAMESZ+1];
+ char pr_psargs[PRARGSZ+1];
+ int32_t pr_pid;
+} prpsinfo32_t;
+
+struct thrmisc32 {
+ char pr_tname[MAXCOMLEN+1];
+ uint32_t _pad;
+};
+#endif /* __HAVE_REG32 */
+
#endif /* _SYS_PROCFS_H_ */
Modified: trunk/sys/sys/protosw.h
===================================================================
--- trunk/sys/sys/protosw.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/protosw.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
@@ -27,7 +28,7 @@
* SUCH DAMAGE.
*
* @(#)protosw.h 8.1 (Berkeley) 6/2/93
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/protosw.h 247667 2013-03-02 21:11:30Z pjd $
*/
#ifndef _SYS_PROTOSW_H_
@@ -203,7 +204,7 @@
int (*pru_peeraddr)(struct socket *so, struct sockaddr **nam);
int (*pru_rcvd)(struct socket *so, int flags);
int (*pru_rcvoob)(struct socket *so, struct mbuf *m, int flags);
- int (*pru_send)(struct socket *so, int flags, struct mbuf *m,
+ int (*pru_send)(struct socket *so, int flags, struct mbuf *m,
struct sockaddr *addr, struct mbuf *control,
struct thread *td);
#define PRUS_OOB 0x1
@@ -210,8 +211,8 @@
#define PRUS_EOF 0x2
#define PRUS_MORETOCOME 0x4
int (*pru_sense)(struct socket *so, struct stat *sb);
- int (*pru_shutdown)(struct socket *so);
- int (*pru_flush)(struct socket *so, int direction);
+ int (*pru_shutdown)(struct socket *so);
+ int (*pru_flush)(struct socket *so, int direction);
int (*pru_sockaddr)(struct socket *so, struct sockaddr **nam);
int (*pru_sosend)(struct socket *so, struct sockaddr *addr,
struct uio *uio, struct mbuf *top, struct mbuf *control,
@@ -223,6 +224,10 @@
struct ucred *cred, struct thread *td);
void (*pru_sosetlabel)(struct socket *so);
void (*pru_close)(struct socket *so);
+ int (*pru_bindat)(int fd, struct socket *so, struct sockaddr *nam,
+ struct thread *td);
+ int (*pru_connectat)(int fd, struct socket *so,
+ struct sockaddr *nam, struct thread *td);
};
/*
@@ -232,8 +237,12 @@
int pru_attach_notsupp(struct socket *so, int proto, struct thread *td);
int pru_bind_notsupp(struct socket *so, struct sockaddr *nam,
struct thread *td);
+int pru_bindat_notsupp(int fd, struct socket *so, struct sockaddr *nam,
+ struct thread *td);
int pru_connect_notsupp(struct socket *so, struct sockaddr *nam,
struct thread *td);
+int pru_connectat_notsupp(int fd, struct socket *so, struct sockaddr *nam,
+ struct thread *td);
int pru_connect2_notsupp(struct socket *so1, struct socket *so2);
int pru_control_notsupp(struct socket *so, u_long cmd, caddr_t data,
struct ifnet *ifp, struct thread *td);
@@ -266,7 +275,7 @@
*/
#define PRC_IFDOWN 0 /* interface transition */
#define PRC_ROUTEDEAD 1 /* select new route if possible ??? */
-#define PRC_IFUP 2 /* interface has come back up */
+#define PRC_IFUP 2 /* interface has come back up */
#define PRC_QUENCH2 3 /* DEC congestion bit says slow down */
#define PRC_QUENCH 4 /* some one said to slow down */
#define PRC_MSGSIZE 5 /* message size forced drop */
@@ -330,6 +339,7 @@
#ifdef _KERNEL
void pfctlinput(int, struct sockaddr *);
void pfctlinput2(int, struct sockaddr *, void *);
+struct domain *pffinddomain(int family);
struct protosw *pffindproto(int family, int protocol, int type);
struct protosw *pffindtype(int family, int type);
int pf_proto_register(int family, struct protosw *npr);
Modified: trunk/sys/sys/ptio.h
===================================================================
--- trunk/sys/sys/ptio.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/ptio.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1999 Kenneth D. Merry.
* All rights reserved.
@@ -23,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/ptio.h 50477 1999-08-28 01:08:13Z peter $
*/
#ifndef _SYS_PTIO_H_
Modified: trunk/sys/sys/ptrace.h
===================================================================
--- trunk/sys/sys/ptrace.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/ptrace.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1984, 1993
* The Regents of the University of California. All rights reserved.
@@ -27,7 +28,7 @@
* SUCH DAMAGE.
*
* @(#)ptrace.h 8.2 (Berkeley) 1/4/94
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/ptrace.h 304499 2016-08-19 20:17:57Z jhb $
*/
#ifndef _SYS_PTRACE_H_
@@ -64,7 +65,11 @@
#define PT_SYSCALL 22
#define PT_FOLLOW_FORK 23
+#define PT_LWP_EVENTS 24 /* report LWP birth and exit */
+#define PT_GET_EVENT_MASK 25 /* get mask of optional events */
+#define PT_SET_EVENT_MASK 26 /* set mask of optional events */
+
#define PT_GETREGS 33 /* get general-purpose registers */
#define PT_SETREGS 34 /* set general-purpose registers */
#define PT_GETFPREGS 35 /* get floating-point registers */
@@ -78,6 +83,17 @@
#define PT_FIRSTMACH 64 /* for machine-specific requests */
#include <machine/ptrace.h> /* machine-specific requests, if any */
+/* Events used with PT_GET_EVENT_MASK and PT_SET_EVENT_MASK */
+#define PTRACE_EXEC 0x0001
+#define PTRACE_SCE 0x0002
+#define PTRACE_SCX 0x0004
+#define PTRACE_SYSCALL (PTRACE_SCE | PTRACE_SCX)
+#define PTRACE_FORK 0x0008
+#define PTRACE_LWP 0x0010
+#define PTRACE_VFORK 0x0020
+
+#define PTRACE_DEFAULT (PTRACE_EXEC)
+
struct ptrace_io_desc {
int piod_op; /* I/O operation */
void *piod_offs; /* child offset */
@@ -108,11 +124,17 @@
#define PL_FLAG_SI 0x20 /* siginfo is valid */
#define PL_FLAG_FORKED 0x40 /* new child */
#define PL_FLAG_CHILD 0x80 /* I am from child */
+#define PL_FLAG_BORN 0x100 /* new LWP */
+#define PL_FLAG_EXITED 0x200 /* exiting LWP */
+#define PL_FLAG_VFORKED 0x400 /* new child via vfork */
+#define PL_FLAG_VFORK_DONE 0x800 /* vfork parent has resumed */
sigset_t pl_sigmask; /* LWP signal mask */
sigset_t pl_siglist; /* LWP pending signal */
struct __siginfo pl_siginfo; /* siginfo for signal */
char pl_tdname[MAXCOMLEN + 1]; /* LWP name */
- int pl_child_pid; /* New child pid */
+ pid_t pl_child_pid; /* New child pid */
+ u_int pl_syscall_code;
+ u_int pl_syscall_narg;
};
/* Argument structure for PT_VM_ENTRY. */
@@ -131,13 +153,6 @@
#ifdef _KERNEL
-/*
- * The flags below are used for ptrace(2) tracing and have no relation
- * to procfs. They are stored in struct proc's p_stops member.
- */
-#define S_PT_SCE 0x000010000
-#define S_PT_SCX 0x000020000
-
int ptrace_set_pc(struct thread *_td, unsigned long _addr);
int ptrace_single_step(struct thread *_td);
int ptrace_clear_single_step(struct thread *_td);
Modified: trunk/sys/sys/queue.h
===================================================================
--- trunk/sys/sys/queue.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/queue.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
@@ -27,7 +28,7 @@
* SUCH DAMAGE.
*
* @(#)queue.h 8.5 (Berkeley) 8/20/94
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/queue.h 307534 2016-10-17 21:49:54Z mckusick $
*/
#ifndef _SYS_QUEUE_H_
@@ -76,11 +77,17 @@
*
* For details on the use of these macros, see the queue(3) manual page.
*
+ * Below is a summary of implemented functions where:
+ * + means the macro is available
+ * - means the macro is not available
+ * s means the macro is available but is slow (runs in O(n) time)
*
* SLIST LIST STAILQ TAILQ
* _HEAD + + + +
+ * _CLASS_HEAD + + + +
* _HEAD_INITIALIZER + + + +
* _ENTRY + + + +
+ * _CLASS_ENTRY + + + +
* _INIT + + + +
* _EMPTY + + + +
* _FIRST + + + +
@@ -88,17 +95,21 @@
* _PREV - + - +
* _LAST - - + +
* _FOREACH + + + +
+ * _FOREACH_FROM + + + +
* _FOREACH_SAFE + + + +
+ * _FOREACH_FROM_SAFE + + + +
* _FOREACH_REVERSE - - - +
+ * _FOREACH_REVERSE_FROM - - - +
* _FOREACH_REVERSE_SAFE - - - +
+ * _FOREACH_REVERSE_FROM_SAFE - - - +
* _INSERT_HEAD + + + +
* _INSERT_BEFORE - + - +
* _INSERT_AFTER + + + +
* _INSERT_TAIL - - + +
- * _CONCAT - - + +
+ * _CONCAT s s + +
* _REMOVE_AFTER + - + -
* _REMOVE_HEAD + - + -
- * _REMOVE + + + +
+ * _REMOVE s + s +
* _SWAP + + + +
*
*/
@@ -105,13 +116,14 @@
#ifdef QUEUE_MACRO_DEBUG
/* Store the last 2 places the queue element or head was altered */
struct qm_trace {
- char * lastfile;
- int lastline;
- char * prevfile;
- int prevline;
+ unsigned long lastline;
+ unsigned long prevline;
+ const char *lastfile;
+ const char *prevfile;
};
#define TRACEBUF struct qm_trace trace;
+#define TRACEBUF_INITIALIZER { __LINE__, 0, __FILE__, NULL } ,
#define TRASHIT(x) do {(x) = (void *)-1;} while (0)
#define QMD_SAVELINK(name, link) void **name = (void *)&(link)
@@ -134,10 +146,20 @@
#define QMD_TRACE_HEAD(head)
#define QMD_SAVELINK(name, link)
#define TRACEBUF
+#define TRACEBUF_INITIALIZER
#define TRASHIT(x)
#endif /* QUEUE_MACRO_DEBUG */
+#ifdef __cplusplus
/*
+ * In C++ there can be structure lists and class lists:
+ */
+#define QUEUE_TYPEOF(type) type
+#else
+#define QUEUE_TYPEOF(type) struct type
+#endif
+
+/*
* Singly-linked List declarations.
*/
#define SLIST_HEAD(name, type) \
@@ -145,6 +167,11 @@
struct type *slh_first; /* first element */ \
}
+#define SLIST_CLASS_HEAD(name, type) \
+struct name { \
+ class type *slh_first; /* first element */ \
+}
+
#define SLIST_HEAD_INITIALIZER(head) \
{ NULL }
@@ -153,9 +180,27 @@
struct type *sle_next; /* next element */ \
}
+#define SLIST_CLASS_ENTRY(type) \
+struct { \
+ class type *sle_next; /* next element */ \
+}
+
/*
* Singly-linked List functions.
*/
+#define SLIST_CONCAT(head1, head2, type, field) do { \
+ QUEUE_TYPEOF(type) *curelm = SLIST_FIRST(head1); \
+ if (curelm == NULL) { \
+ if ((SLIST_FIRST(head1) = SLIST_FIRST(head2)) != NULL) \
+ SLIST_INIT(head2); \
+ } else if (SLIST_FIRST(head2) != NULL) { \
+ while (SLIST_NEXT(curelm, field) != NULL) \
+ curelm = SLIST_NEXT(curelm, field); \
+ SLIST_NEXT(curelm, field) = SLIST_FIRST(head2); \
+ SLIST_INIT(head2); \
+ } \
+} while (0)
+
#define SLIST_EMPTY(head) ((head)->slh_first == NULL)
#define SLIST_FIRST(head) ((head)->slh_first)
@@ -165,11 +210,21 @@
(var); \
(var) = SLIST_NEXT((var), field))
+#define SLIST_FOREACH_FROM(var, head, field) \
+ for ((var) = ((var) ? (var) : SLIST_FIRST((head))); \
+ (var); \
+ (var) = SLIST_NEXT((var), field))
+
#define SLIST_FOREACH_SAFE(var, head, field, tvar) \
for ((var) = SLIST_FIRST((head)); \
(var) && ((tvar) = SLIST_NEXT((var), field), 1); \
(var) = (tvar))
+#define SLIST_FOREACH_FROM_SAFE(var, head, field, tvar) \
+ for ((var) = ((var) ? (var) : SLIST_FIRST((head))); \
+ (var) && ((tvar) = SLIST_NEXT((var), field), 1); \
+ (var) = (tvar))
+
#define SLIST_FOREACH_PREVPTR(var, varp, head, field) \
for ((varp) = &SLIST_FIRST((head)); \
((var) = *(varp)) != NULL; \
@@ -197,7 +252,7 @@
SLIST_REMOVE_HEAD((head), field); \
} \
else { \
- struct type *curelm = SLIST_FIRST((head)); \
+ QUEUE_TYPEOF(type) *curelm = SLIST_FIRST(head); \
while (SLIST_NEXT(curelm, field) != (elm)) \
curelm = SLIST_NEXT(curelm, field); \
SLIST_REMOVE_AFTER(curelm, field); \
@@ -215,7 +270,7 @@
} while (0)
#define SLIST_SWAP(head1, head2, type) do { \
- struct type *swap_first = SLIST_FIRST(head1); \
+ QUEUE_TYPEOF(type) *swap_first = SLIST_FIRST(head1); \
SLIST_FIRST(head1) = SLIST_FIRST(head2); \
SLIST_FIRST(head2) = swap_first; \
} while (0)
@@ -229,6 +284,12 @@
struct type **stqh_last;/* addr of last next element */ \
}
+#define STAILQ_CLASS_HEAD(name, type) \
+struct name { \
+ class type *stqh_first; /* first element */ \
+ class type **stqh_last; /* addr of last next element */ \
+}
+
#define STAILQ_HEAD_INITIALIZER(head) \
{ NULL, &(head).stqh_first }
@@ -237,6 +298,11 @@
struct type *stqe_next; /* next element */ \
}
+#define STAILQ_CLASS_ENTRY(type) \
+struct { \
+ class type *stqe_next; /* next element */ \
+}
+
/*
* Singly-linked Tail queue functions.
*/
@@ -257,6 +323,10 @@
(var); \
(var) = STAILQ_NEXT((var), field))
+#define STAILQ_FOREACH_FROM(var, head, field) \
+ for ((var) = ((var) ? (var) : STAILQ_FIRST((head))); \
+ (var); \
+ (var) = STAILQ_NEXT((var), field))
#define STAILQ_FOREACH_SAFE(var, head, field, tvar) \
for ((var) = STAILQ_FIRST((head)); \
@@ -263,6 +333,11 @@
(var) && ((tvar) = STAILQ_NEXT((var), field), 1); \
(var) = (tvar))
+#define STAILQ_FOREACH_FROM_SAFE(var, head, field, tvar) \
+ for ((var) = ((var) ? (var) : STAILQ_FIRST((head))); \
+ (var) && ((tvar) = STAILQ_NEXT((var), field), 1); \
+ (var) = (tvar))
+
#define STAILQ_INIT(head) do { \
STAILQ_FIRST((head)) = NULL; \
(head)->stqh_last = &STAILQ_FIRST((head)); \
@@ -286,9 +361,10 @@
(head)->stqh_last = &STAILQ_NEXT((elm), field); \
} while (0)
-#define STAILQ_LAST(head, type, field) \
- (STAILQ_EMPTY((head)) ? NULL : \
- __containerof((head)->stqh_last, struct type, field.stqe_next))
+#define STAILQ_LAST(head, type, field) \
+ (STAILQ_EMPTY((head)) ? NULL : \
+ __containerof((head)->stqh_last, \
+ QUEUE_TYPEOF(type), field.stqe_next))
#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next)
@@ -298,7 +374,7 @@
STAILQ_REMOVE_HEAD((head), field); \
} \
else { \
- struct type *curelm = STAILQ_FIRST((head)); \
+ QUEUE_TYPEOF(type) *curelm = STAILQ_FIRST(head); \
while (STAILQ_NEXT(curelm, field) != (elm)) \
curelm = STAILQ_NEXT(curelm, field); \
STAILQ_REMOVE_AFTER(head, curelm, field); \
@@ -319,8 +395,8 @@
} while (0)
#define STAILQ_SWAP(head1, head2, type) do { \
- struct type *swap_first = STAILQ_FIRST(head1); \
- struct type **swap_last = (head1)->stqh_last; \
+ QUEUE_TYPEOF(type) *swap_first = STAILQ_FIRST(head1); \
+ QUEUE_TYPEOF(type) **swap_last = (head1)->stqh_last; \
STAILQ_FIRST(head1) = STAILQ_FIRST(head2); \
(head1)->stqh_last = (head2)->stqh_last; \
STAILQ_FIRST(head2) = swap_first; \
@@ -340,6 +416,11 @@
struct type *lh_first; /* first element */ \
}
+#define LIST_CLASS_HEAD(name, type) \
+struct name { \
+ class type *lh_first; /* first element */ \
+}
+
#define LIST_HEAD_INITIALIZER(head) \
{ NULL }
@@ -349,6 +430,12 @@
struct type **le_prev; /* address of previous next element */ \
}
+#define LIST_CLASS_ENTRY(type) \
+struct { \
+ class type *le_next; /* next element */ \
+ class type **le_prev; /* address of previous next element */ \
+}
+
/*
* List functions.
*/
@@ -378,6 +465,23 @@
#define QMD_LIST_CHECK_PREV(elm, field)
#endif /* (_KERNEL && INVARIANTS) */
+#define LIST_CONCAT(head1, head2, type, field) do { \
+ QUEUE_TYPEOF(type) *curelm = LIST_FIRST(head1); \
+ if (curelm == NULL) { \
+ if ((LIST_FIRST(head1) = LIST_FIRST(head2)) != NULL) { \
+ LIST_FIRST(head2)->field.le_prev = \
+ &LIST_FIRST((head1)); \
+ LIST_INIT(head2); \
+ } \
+ } else if (LIST_FIRST(head2) != NULL) { \
+ while (LIST_NEXT(curelm, field) != NULL) \
+ curelm = LIST_NEXT(curelm, field); \
+ LIST_NEXT(curelm, field) = LIST_FIRST(head2); \
+ LIST_FIRST(head2)->field.le_prev = &LIST_NEXT(curelm, field); \
+ LIST_INIT(head2); \
+ } \
+} while (0)
+
#define LIST_EMPTY(head) ((head)->lh_first == NULL)
#define LIST_FIRST(head) ((head)->lh_first)
@@ -387,11 +491,21 @@
(var); \
(var) = LIST_NEXT((var), field))
+#define LIST_FOREACH_FROM(var, head, field) \
+ for ((var) = ((var) ? (var) : LIST_FIRST((head))); \
+ (var); \
+ (var) = LIST_NEXT((var), field))
+
#define LIST_FOREACH_SAFE(var, head, field, tvar) \
for ((var) = LIST_FIRST((head)); \
(var) && ((tvar) = LIST_NEXT((var), field), 1); \
(var) = (tvar))
+#define LIST_FOREACH_FROM_SAFE(var, head, field, tvar) \
+ for ((var) = ((var) ? (var) : LIST_FIRST((head))); \
+ (var) && ((tvar) = LIST_NEXT((var), field), 1); \
+ (var) = (tvar))
+
#define LIST_INIT(head) do { \
LIST_FIRST((head)) = NULL; \
} while (0)
@@ -423,9 +537,10 @@
#define LIST_NEXT(elm, field) ((elm)->field.le_next)
-#define LIST_PREV(elm, head, type, field) \
- ((elm)->field.le_prev == &LIST_FIRST((head)) ? NULL : \
- __containerof((elm)->field.le_prev, struct type, field.le_next))
+#define LIST_PREV(elm, head, type, field) \
+ ((elm)->field.le_prev == &LIST_FIRST((head)) ? NULL : \
+ __containerof((elm)->field.le_prev, \
+ QUEUE_TYPEOF(type), field.le_next))
#define LIST_REMOVE(elm, field) do { \
QMD_SAVELINK(oldnext, (elm)->field.le_next); \
@@ -441,7 +556,7 @@
} while (0)
#define LIST_SWAP(head1, head2, type, field) do { \
- struct type *swap_tmp = LIST_FIRST((head1)); \
+ QUEUE_TYPEOF(type) *swap_tmp = LIST_FIRST(head1); \
LIST_FIRST((head1)) = LIST_FIRST((head2)); \
LIST_FIRST((head2)) = swap_tmp; \
if ((swap_tmp = LIST_FIRST((head1))) != NULL) \
@@ -460,8 +575,15 @@
TRACEBUF \
}
+#define TAILQ_CLASS_HEAD(name, type) \
+struct name { \
+ class type *tqh_first; /* first element */ \
+ class type **tqh_last; /* addr of last next element */ \
+ TRACEBUF \
+}
+
#define TAILQ_HEAD_INITIALIZER(head) \
- { NULL, &(head).tqh_first }
+ { NULL, &(head).tqh_first, TRACEBUF_INITIALIZER }
#define TAILQ_ENTRY(type) \
struct { \
@@ -470,6 +592,13 @@
TRACEBUF \
}
+#define TAILQ_CLASS_ENTRY(type) \
+struct { \
+ class type *tqe_next; /* next element */ \
+ class type **tqe_prev; /* address of previous next element */ \
+ TRACEBUF \
+}
+
/*
* Tail queue functions.
*/
@@ -524,21 +653,41 @@
(var); \
(var) = TAILQ_NEXT((var), field))
+#define TAILQ_FOREACH_FROM(var, head, field) \
+ for ((var) = ((var) ? (var) : TAILQ_FIRST((head))); \
+ (var); \
+ (var) = TAILQ_NEXT((var), field))
+
#define TAILQ_FOREACH_SAFE(var, head, field, tvar) \
for ((var) = TAILQ_FIRST((head)); \
(var) && ((tvar) = TAILQ_NEXT((var), field), 1); \
(var) = (tvar))
+#define TAILQ_FOREACH_FROM_SAFE(var, head, field, tvar) \
+ for ((var) = ((var) ? (var) : TAILQ_FIRST((head))); \
+ (var) && ((tvar) = TAILQ_NEXT((var), field), 1); \
+ (var) = (tvar))
+
#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \
for ((var) = TAILQ_LAST((head), headname); \
(var); \
(var) = TAILQ_PREV((var), headname, field))
+#define TAILQ_FOREACH_REVERSE_FROM(var, head, headname, field) \
+ for ((var) = ((var) ? (var) : TAILQ_LAST((head), headname)); \
+ (var); \
+ (var) = TAILQ_PREV((var), headname, field))
+
#define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar) \
for ((var) = TAILQ_LAST((head), headname); \
(var) && ((tvar) = TAILQ_PREV((var), headname, field), 1); \
(var) = (tvar))
+#define TAILQ_FOREACH_REVERSE_FROM_SAFE(var, head, headname, field, tvar) \
+ for ((var) = ((var) ? (var) : TAILQ_LAST((head), headname)); \
+ (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1); \
+ (var) = (tvar))
+
#define TAILQ_INIT(head) do { \
TAILQ_FIRST((head)) = NULL; \
(head)->tqh_last = &TAILQ_FIRST((head)); \
@@ -557,7 +706,7 @@
TAILQ_NEXT((listelm), field) = (elm); \
(elm)->field.tqe_prev = &TAILQ_NEXT((listelm), field); \
QMD_TRACE_ELEM(&(elm)->field); \
- QMD_TRACE_ELEM(&listelm->field); \
+ QMD_TRACE_ELEM(&(listelm)->field); \
} while (0)
#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \
@@ -567,7 +716,7 @@
*(listelm)->field.tqe_prev = (elm); \
(listelm)->field.tqe_prev = &TAILQ_NEXT((elm), field); \
QMD_TRACE_ELEM(&(elm)->field); \
- QMD_TRACE_ELEM(&listelm->field); \
+ QMD_TRACE_ELEM(&(listelm)->field); \
} while (0)
#define TAILQ_INSERT_HEAD(head, elm, field) do { \
@@ -620,8 +769,8 @@
} while (0)
#define TAILQ_SWAP(head1, head2, type, field) do { \
- struct type *swap_first = (head1)->tqh_first; \
- struct type **swap_last = (head1)->tqh_last; \
+ QUEUE_TYPEOF(type) *swap_first = (head1)->tqh_first; \
+ QUEUE_TYPEOF(type) **swap_last = (head1)->tqh_last; \
(head1)->tqh_first = (head2)->tqh_first; \
(head1)->tqh_last = (head2)->tqh_last; \
(head2)->tqh_first = swap_first; \
Modified: trunk/sys/sys/racct.h
===================================================================
--- trunk/sys/sys/racct.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/racct.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2010 The FreeBSD Foundation
* All rights reserved.
@@ -26,7 +27,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/racct.h 299616 2016-05-13 08:17:42Z ngie $
*/
/*
@@ -82,13 +83,18 @@
#define RACCT_DECAYING 0x20
extern int racct_types[];
+extern int racct_enable;
+#define ASSERT_RACCT_ENABLED() KASSERT(racct_enable, \
+ ("%s called with !racct_enable", __func__))
+
/*
* Amount stored in c_resources[] is 10**6 times bigger than what's
* visible to the userland. It gets fixed up when retrieving resource
* usage or adding rules.
*/
-#define RACCT_IS_IN_MILLIONS(X) (racct_types[X] & RACCT_IN_MILLIONS)
+#define RACCT_IS_IN_MILLIONS(X) \
+ ((X) != RACCT_UNDEFINED && (racct_types[(X)] & RACCT_IN_MILLIONS) != 0)
/*
* Resource usage can drop, as opposed to only grow. When the process
Modified: trunk/sys/sys/random.h
===================================================================
--- trunk/sys/sys/random.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/random.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,5 +1,6 @@
+/* $MidnightBSD$ */
/*-
- * Copyright (c) 2000 Mark R. V. Murray
+ * Copyright (c) 2000-2013 Mark R. V. Murray
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -23,7 +24,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/random.h 268933 2014-07-21 00:21:56Z jhb $
*/
#ifndef _SYS_RANDOM_H_
@@ -39,15 +40,27 @@
*/
enum esource {
RANDOM_START = 0,
- RANDOM_WRITE = 0,
+ RANDOM_CACHED = 0,
+ RANDOM_ATTACH,
RANDOM_KEYBOARD,
RANDOM_MOUSE,
- RANDOM_NET,
+ RANDOM_NET_TUN,
+ RANDOM_NET_ETHER,
+ RANDOM_NET_NG,
RANDOM_INTERRUPT,
- RANDOM_PURE,
+ RANDOM_SWI,
+ RANDOM_PURE_OCTEON,
+ RANDOM_PURE_SAFE,
+ RANDOM_PURE_GLXSB,
+ RANDOM_PURE_UBSEC,
+ RANDOM_PURE_HIFN,
+ RANDOM_PURE_RDRAND,
+ RANDOM_PURE_NEHEMIAH,
+ RANDOM_PURE_RNDTEST,
+ RANDOM_PURE_VIRTIO,
ENTROPYSOURCE
};
-void random_harvest(void *, u_int, u_int, u_int, enum esource);
+void random_harvest(void *, u_int, u_int, enum esource);
/* Allow the sysadmin to select the broad category of
* entropy types to harvest
@@ -57,6 +70,7 @@
int point_to_point;
int interrupt;
int swi;
+ int namei;
};
extern struct harvest_select harvest;
Modified: trunk/sys/sys/rangelock.h
===================================================================
--- trunk/sys/sys/rangelock.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/rangelock.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2009 Konstantin Belousov <kib at FreeBSD.org>
* All rights reserved.
@@ -23,7 +24,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD$
+ * $FreeBSD: stable/10/sys/sys/rangelock.h 254380 2013-08-15 20:19:17Z cperciva $
*/
#ifndef _SYS_RANGELOCK_H
@@ -48,9 +49,13 @@
* Access to the structure itself is synchronized with the externally
* supplied mutex.
*
- * rl_waiters is the queue of lock requests in the order of arrival.
+ * rl_waiters is the queue containing in order (a) granted write lock
+ * requests, (b) granted read lock requests, and (c) in order of arrival,
+ * lock requests which cannot be granted yet.
+ *
* rl_currdep is the first lock request that cannot be granted now due
- * to the preceding requests conflicting with it.
+ * to the preceding requests conflicting with it (i.e., it points to
+ * position (c) in the list above).
*/
struct rangelock {
TAILQ_HEAD(, rl_q_entry) rl_waiters;
Modified: trunk/sys/sys/rctl.h
===================================================================
--- trunk/sys/sys/rctl.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/rctl.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2010 The FreeBSD Foundation
* All rights reserved.
@@ -26,7 +27,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/rctl.h 242139 2012-10-26 16:01:08Z trasz $
*/
/*
Modified: trunk/sys/sys/reboot.h
===================================================================
--- trunk/sys/sys/reboot.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/reboot.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1982, 1986, 1988, 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -27,7 +28,7 @@
* SUCH DAMAGE.
*
* @(#)reboot.h 8.3 (Berkeley) 12/13/94
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/reboot.h 293743 2016-01-12 10:11:29Z trasz $
*/
#ifndef _SYS_REBOOT_H_
@@ -59,6 +60,7 @@
#define RB_RESERVED1 0x40000 /* reserved for internal use of boot blocks */
#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_MULTIPLE 0x20000000 /* use multiple consoles */
#define RB_BOOTINFO 0x80000000 /* have `struct bootinfo *' arg */
Modified: trunk/sys/sys/refcount.h
===================================================================
--- trunk/sys/sys/refcount.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/refcount.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2005 John Baldwin <jhb at FreeBSD.org>
* All rights reserved.
@@ -10,9 +11,6 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -26,12 +24,13 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/refcount.h 262192 2014-02-18 20:27:17Z jhb $
*/
#ifndef __SYS_REFCOUNT_H__
#define __SYS_REFCOUNT_H__
+#include <sys/limits.h>
#include <machine/atomic.h>
#ifdef _KERNEL
@@ -51,6 +50,7 @@
refcount_acquire(volatile u_int *count)
{
+ KASSERT(*count < UINT_MAX, ("refcount %p overflowed", count));
atomic_add_acq_int(count, 1);
}
Modified: trunk/sys/sys/regression.h
===================================================================
--- trunk/sys/sys/regression.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/regression.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2001 Robert N. M. Watson
* All rights reserved.
@@ -23,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/regression.h 129096 2004-05-10 18:38:07Z rwatson $
*/
#ifndef _SYS_REGRESSION_H_
#define _SYS_REGRESSION_H_
Modified: trunk/sys/sys/resource.h
===================================================================
--- trunk/sys/sys/resource.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/resource.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
@@ -27,7 +28,7 @@
* SUCH DAMAGE.
*
* @(#)resource.h 8.4 (Berkeley) 1/9/95
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/resource.h 314392 2017-02-28 15:03:34Z kib $
*/
#ifndef _SYS_RESOURCE_H_
@@ -103,14 +104,13 @@
#define RLIMIT_AS RLIMIT_VMEM /* standard name for RLIMIT_VMEM */
#define RLIMIT_NPTS 11 /* pseudo-terminals */
#define RLIMIT_SWAP 12 /* swap used */
-#define RLIMIT_KQUEUES 13 /* kqueues allocated */
-#define RLIM_NLIMITS 14 /* number of resource limits */
+#define RLIM_NLIMITS 13 /* number of resource limits */
#define RLIM_INFINITY ((rlim_t)(((uint64_t)1 << 63) - 1))
-/* XXX Missing: RLIM_SAVED_MAX, RLIM_SAVED_CUR */
+#define RLIM_SAVED_MAX RLIM_INFINITY
+#define RLIM_SAVED_CUR RLIM_INFINITY
-
/*
* Resource limit string identifiers
*/
@@ -130,7 +130,6 @@
"vmem",
"npts",
"swap",
- "kqueues",
};
#endif
Modified: trunk/sys/sys/resourcevar.h
===================================================================
--- trunk/sys/sys/resourcevar.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/resourcevar.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
@@ -27,7 +28,7 @@
* SUCH DAMAGE.
*
* @(#)resourcevar.h 8.4 (Berkeley) 1/9/95
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/resourcevar.h 230470 2012-01-22 20:25:00Z trociny $
*/
#ifndef _SYS_RESOURCEVAR_H_
@@ -99,7 +100,6 @@
long ui_sbsize; /* (b) socket buffer space consumed */
long ui_proccnt; /* (b) number of processes */
long ui_ptscnt; /* (b) number of pseudo-terminals */
- long ui_kqcnt; /* (b) number of kqueues */
uid_t ui_uid; /* (a) uid */
u_int ui_ref; /* (b) reference count */
struct racct *ui_racct; /* (a) resource accounting */
@@ -116,7 +116,6 @@
void addupc_task(struct thread *td, uintfptr_t pc, u_int ticks);
void calccru(struct proc *p, struct timeval *up, struct timeval *sp);
void calcru(struct proc *p, struct timeval *up, struct timeval *sp);
-int chgkqcnt(struct uidinfo *uip, int diff, rlim_t max);
int chgproccnt(struct uidinfo *uip, int diff, rlim_t maxval);
int chgsbsize(struct uidinfo *uip, u_int *hiwat, u_int to,
rlim_t maxval);
Modified: trunk/sys/sys/rman.h
===================================================================
--- trunk/sys/sys/rman.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/rman.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright 1998 Massachusetts Institute of Technology
*
@@ -26,7 +27,7 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/rman.h 303254 2016-07-24 04:38:50Z jhb $
*/
#ifndef _SYS_RMAN_H_
@@ -42,8 +43,8 @@
#define RF_ALLOCATED 0x0001 /* resource has been reserved */
#define RF_ACTIVE 0x0002 /* resource allocation has been activated */
#define RF_SHAREABLE 0x0004 /* resource permits contemporaneous sharing */
-#define RF_TIMESHARE 0x0008 /* resource permits time-division sharing */
-#define RF_WANTED 0x0010 /* somebody is waiting for this resource */
+#define RF_SPARE1 0x0008
+#define RF_SPARE2 0x0010
#define RF_FIRSTSHARE 0x0020 /* first in sharing list */
#define RF_PREFETCHABLE 0x0040 /* resource is prefetchable */
#define RF_OPTIONAL 0x0080 /* for bus_alloc_resources() */
@@ -50,7 +51,7 @@
#define RF_ALIGNMENT_SHIFT 10 /* alignment size bit starts bit 10 */
#define RF_ALIGNMENT_MASK (0x003F << RF_ALIGNMENT_SHIFT)
- /* resource address alignemnt size bit mask */
+ /* resource address alignment size bit mask */
#define RF_ALIGNMENT_LOG2(x) ((x) << RF_ALIGNMENT_SHIFT)
#define RF_ALIGNMENT(x) (((x) & RF_ALIGNMENT_MASK) >> RF_ALIGNMENT_SHIFT)
@@ -117,7 +118,6 @@
int rman_activate_resource(struct resource *r);
int rman_adjust_resource(struct resource *r, u_long start, u_long end);
-int rman_await_resource(struct resource *r, int pri, int timo);
int rman_first_free_region(struct rman *rm, u_long *start, u_long *end);
bus_space_handle_t rman_get_bushandle(struct resource *);
bus_space_tag_t rman_get_bustag(struct resource *);
Modified: trunk/sys/sys/rmlock.h
===================================================================
--- trunk/sys/sys/rmlock.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/rmlock.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2007 Stephan Uphoff <ups at FreeBSD.org>
* All rights reserved.
@@ -26,7 +27,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/rmlock.h 323870 2017-09-21 19:24:11Z marius $
*/
#ifndef _SYS_RMLOCK_H_
@@ -40,16 +41,17 @@
#ifdef _KERNEL
/*
- * Flags passed to rm_init(9).
+ * Flags passed to rm_init_flags(9).
*/
#define RM_NOWITNESS 0x00000001
#define RM_RECURSE 0x00000002
#define RM_SLEEPABLE 0x00000004
+#define RM_NEW 0x00000008
void rm_init(struct rmlock *rm, const char *name);
void rm_init_flags(struct rmlock *rm, const char *name, int opts);
void rm_destroy(struct rmlock *rm);
-int rm_wowned(struct rmlock *rm);
+int rm_wowned(const struct rmlock *rm);
void rm_sysinit(void *arg);
void rm_sysinit_flags(void *arg);
@@ -65,6 +67,10 @@
int _rm_rlock(struct rmlock *rm, struct rm_priotracker *tracker,
int trylock);
void _rm_runlock(struct rmlock *rm, struct rm_priotracker *tracker);
+#if defined(INVARIANTS) || defined(INVARIANT_SUPPORT)
+void _rm_assert(const struct rmlock *rm, int what, const char *file,
+ int line);
+#endif
/*
* Public interface for lock operations.
@@ -89,6 +95,9 @@
#define rm_try_rlock(rm,tracker) _rm_rlock((rm),(tracker), 1)
#define rm_runlock(rm,tracker) _rm_runlock((rm), (tracker))
#endif
+#define rm_sleep(chan, rm, pri, wmesg, timo) \
+ _sleep((chan), &(rm)->lock_object, (pri), (wmesg), \
+ tick_sbt * (timo), 0, C_HARDCLOCK)
struct rm_args {
struct rmlock *ra_rm;
@@ -123,5 +132,20 @@
SYSUNINIT(name##_rm_sysuninit, SI_SUB_LOCK, SI_ORDER_MIDDLE, \
rm_destroy, (rm))
+#if defined(INVARIANTS) || defined(INVARIANT_SUPPORT)
+#define RA_LOCKED LA_LOCKED
+#define RA_RLOCKED LA_SLOCKED
+#define RA_WLOCKED LA_XLOCKED
+#define RA_UNLOCKED LA_UNLOCKED
+#define RA_RECURSED LA_RECURSED
+#define RA_NOTRECURSED LA_NOTRECURSED
+#endif
+
+#ifdef INVARIANTS
+#define rm_assert(rm, what) _rm_assert((rm), (what), LOCK_FILE, LOCK_LINE)
+#else
+#define rm_assert(rm, what)
+#endif
+
#endif /* _KERNEL */
#endif /* !_SYS_RMLOCK_H_ */
Modified: trunk/sys/sys/rtprio.h
===================================================================
--- trunk/sys/sys/rtprio.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/rtprio.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1994, Henrik Vestergaard Draboel
* All rights reserved.
@@ -28,7 +29,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/rtprio.h 165898 2007-01-08 21:21:45Z imp $
*/
#ifndef _SYS_RTPRIO_H_
Modified: trunk/sys/sys/runq.h
===================================================================
--- trunk/sys/sys/runq.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/runq.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2001 Jake Burkholder <jake at FreeBSD.org>
* All rights reserved.
@@ -23,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/runq.h 177435 2008-03-20 05:51:16Z jeff $
*/
#ifndef _RUNQ_H_
Modified: trunk/sys/sys/rwlock.h
===================================================================
--- trunk/sys/sys/rwlock.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/rwlock.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2006 John Baldwin <jhb at FreeBSD.org>
* All rights reserved.
@@ -10,9 +11,6 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -26,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/rwlock.h 323870 2017-09-21 19:24:11Z marius $
*/
#ifndef _SYS_RWLOCK_H_
@@ -99,7 +97,7 @@
#define __rw_wlock(rw, tid, file, line) do { \
uintptr_t _tid = (uintptr_t)(tid); \
\
- if (!_rw_write_lock((rw), _tid)) \
+ if ((rw)->rw_lock != RW_UNLOCKED || !_rw_write_lock((rw), _tid))\
_rw_wlock_hard((rw), _tid, (file), (line)); \
else \
LOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(LS_RW_WLOCK_ACQUIRE, \
@@ -121,29 +119,67 @@
* external API and should not be called directly. Wrapper macros should
* be used instead.
*/
-
-#define rw_init(rw, name) rw_init_flags((rw), (name), 0)
-void rw_init_flags(struct rwlock *rw, const char *name, int opts);
-void rw_destroy(struct rwlock *rw);
+void _rw_init_flags(volatile uintptr_t *c, const char *name, int opts);
+void _rw_destroy(volatile uintptr_t *c);
void rw_sysinit(void *arg);
void rw_sysinit_flags(void *arg);
-int rw_wowned(struct rwlock *rw);
-void _rw_wlock(struct rwlock *rw, const char *file, int line);
-int _rw_try_wlock(struct rwlock *rw, const char *file, int line);
-void _rw_wunlock(struct rwlock *rw, const char *file, int line);
-void _rw_rlock(struct rwlock *rw, const char *file, int line);
-int _rw_try_rlock(struct rwlock *rw, const char *file, int line);
-void _rw_runlock(struct rwlock *rw, const char *file, int line);
-void _rw_wlock_hard(struct rwlock *rw, uintptr_t tid, const char *file,
+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(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(volatile uintptr_t *c, const char *file, int line);
+int __rw_try_rlock(volatile uintptr_t *c, const char *file, int line);
+void _rw_runlock_cookie(volatile uintptr_t *c, const char *file, int line);
+void __rw_wlock_hard(volatile uintptr_t *c, uintptr_t tid, const char *file,
int line);
-void _rw_wunlock_hard(struct rwlock *rw, uintptr_t tid, const char *file,
+void __rw_wunlock_hard(volatile uintptr_t *c, uintptr_t tid,
+ const char *file, int line);
+int __rw_try_upgrade(volatile uintptr_t *c, const char *file, int line);
+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,
int line);
-int _rw_try_upgrade(struct rwlock *rw, const char *file, int line);
-void _rw_downgrade(struct rwlock *rw, const char *file, int line);
+#endif
+
+/*
+ * Top-level macros to provide lock cookie once the actual rwlock is passed.
+ * They will also prevent passing a malformed object to the rwlock KPI by
+ * failing compilation as the rw_lock reserved member will not be found.
+ */
+#define rw_init(rw, n) \
+ _rw_init_flags(&(rw)->rw_lock, n, 0)
+#define rw_init_flags(rw, n, o) \
+ _rw_init_flags(&(rw)->rw_lock, n, o)
+#define rw_destroy(rw) \
+ _rw_destroy(&(rw)->rw_lock)
+#define rw_wowned(rw) \
+ _rw_wowned(&(rw)->rw_lock)
+#define _rw_wlock(rw, f, l) \
+ _rw_wlock_cookie(&(rw)->rw_lock, f, l)
+#define _rw_try_wlock(rw, f, l) \
+ __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)
+#define _rw_runlock(rw, f, l) \
+ _rw_runlock_cookie(&(rw)->rw_lock, f, l)
+#define _rw_wlock_hard(rw, t, f, l) \
+ __rw_wlock_hard(&(rw)->rw_lock, t, f, l)
+#define _rw_wunlock_hard(rw, t, f, l) \
+ __rw_wunlock_hard(&(rw)->rw_lock, t, 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)
#if defined(INVARIANTS) || defined(INVARIANT_SUPPORT)
-void _rw_assert(struct rwlock *rw, int what, const char *file, int line);
+#define _rw_assert(rw, w, f, l) \
+ __rw_assert(&(rw)->rw_lock, w, f, l)
#endif
+
/*
* Public interface for lock operations.
*/
@@ -173,17 +209,18 @@
rw_runlock(rw); \
} while (0)
#define rw_sleep(chan, rw, pri, wmesg, timo) \
- _sleep((chan), &(rw)->lock_object, (pri), (wmesg), (timo))
+ _sleep((chan), &(rw)->lock_object, (pri), (wmesg), \
+ tick_sbt * (timo), 0, C_HARDCLOCK)
#define rw_initialized(rw) lock_initalized(&(rw)->lock_object)
struct rw_args {
- struct rwlock *ra_rw;
+ void *ra_rw;
const char *ra_desc;
};
struct rw_args_flags {
- struct rwlock *ra_rw;
+ void *ra_rw;
const char *ra_desc;
int ra_flags;
};
@@ -196,7 +233,7 @@
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, (rw))
+ _rw_destroy, __DEVOLATILE(void *, &(rw)->rw_lock))
#define RW_SYSINIT_FLAGS(name, rw, desc, flags) \
@@ -208,7 +245,7 @@
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, (rw))
+ _rw_destroy, __DEVOLATILE(void *, &(rw)->rw_lock))
/*
* Options passed to rw_init_flags().
@@ -218,6 +255,7 @@
#define RW_NOWITNESS 0x04
#define RW_QUIET 0x08
#define RW_RECURSE 0x10
+#define RW_NEW 0x20
/*
* The INVARIANTS-enabled rw_assert() functionality.
Modified: trunk/sys/sys/sbuf.h
===================================================================
--- trunk/sys/sys/sbuf.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/sbuf.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2000-2008 Poul-Henning Kamp
* Copyright (c) 2000-2008 Dag-Erling Coïdan Smørgrav
@@ -25,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/sbuf.h 321112 2017-07-18 08:15:02Z ngie $
*/
#ifndef _SYS_SBUF_H_
@@ -48,6 +49,7 @@
ssize_t s_len; /* current length of string */
#define SBUF_FIXEDLEN 0x00000000 /* fixed length buffer (default) */
#define SBUF_AUTOEXTEND 0x00000001 /* automatically extend buffer */
+#define SBUF_INCLUDENUL 0x00000002 /* nulterm byte is counted in len */
#define SBUF_USRFLAGMSK 0x0000ffff /* mask of flags the user may specify */
#define SBUF_DYNAMIC 0x00010000 /* s_buf must be freed */
#define SBUF_FINISHED 0x00020000 /* set by sbuf_finish() */
@@ -57,6 +59,14 @@
ssize_t s_sect_len; /* current length of section */
};
+#ifndef HD_COLUMN_MASK
+#define HD_COLUMN_MASK 0xff
+#define HD_DELIM_MASK 0xff00
+#define HD_OMIT_COUNT (1 << 16)
+#define HD_OMIT_HEX (1 << 17)
+#define HD_OMIT_CHARS (1 << 18)
+#endif /* HD_COLUMN_MASK */
+
__BEGIN_DECLS
/*
* API functions
@@ -64,6 +74,9 @@
struct sbuf *sbuf_new(struct sbuf *, char *, int, int);
#define sbuf_new_auto() \
sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND)
+int sbuf_get_flags(struct sbuf *);
+void sbuf_clear_flags(struct sbuf *, int);
+void sbuf_set_flags(struct sbuf *, int);
void sbuf_clear(struct sbuf *);
int sbuf_setpos(struct sbuf *, ssize_t);
int sbuf_bcat(struct sbuf *, const void *, size_t);
@@ -85,6 +98,9 @@
void sbuf_delete(struct sbuf *);
void sbuf_start_section(struct sbuf *, ssize_t *);
ssize_t sbuf_end_section(struct sbuf *, ssize_t, size_t, int);
+void sbuf_hexdump(struct sbuf *, const void *, int, const char *,
+ int);
+void sbuf_putbuf(struct sbuf *);
#ifdef _KERNEL
struct uio;
Modified: trunk/sys/sys/sched.h
===================================================================
--- trunk/sys/sys/sched.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/sched.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1996, 1997
* HD Associates, Inc. All rights reserved.
@@ -56,7 +57,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/sched.h 253604 2013-07-24 09:45:31Z avg $
*/
#ifndef _SCHED_H_
@@ -151,11 +152,13 @@
sched_pin(void)
{
curthread->td_pinned++;
+ __compiler_membar();
}
static __inline void
sched_unpin(void)
{
+ __compiler_membar();
curthread->td_pinned--;
}
@@ -180,7 +183,7 @@
#name, CTLTYPE_LONG|CTLFLAG_RD|CTLFLAG_MPSAFE, \
ptr, 0, sysctl_dpcpu_long, "LU", descr); \
} \
-SYSINIT(name, SI_SUB_RUN_SCHEDULER, SI_ORDER_MIDDLE, name ## _add_proc, NULL);
+SYSINIT(name, SI_SUB_LAST, SI_ORDER_MIDDLE, name ## _add_proc, NULL);
#define SCHED_STAT_DEFINE(name, descr) \
DPCPU_DEFINE(unsigned long, name); \
Modified: trunk/sys/sys/sdt.h
===================================================================
--- trunk/sys/sys/sdt.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/sdt.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright 2006-2008 John Birrell <jb at FreeBSD.org>
*
@@ -22,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/sdt.h 289795 2015-10-23 07:37:44Z avg $
*
* Statically Defined Tracing (SDT) definitions.
*
@@ -77,20 +78,28 @@
#else /* _KERNEL */
+#include <sys/cdefs.h>
+#include <sys/linker_set.h>
+
#ifndef KDTRACE_HOOKS
#define SDT_PROVIDER_DEFINE(prov)
#define SDT_PROVIDER_DECLARE(prov)
-#define SDT_PROBE_DEFINE(prov, mod, func, name, sname)
+#define SDT_PROBE_DEFINE(prov, mod, func, name)
#define SDT_PROBE_DECLARE(prov, mod, func, name)
#define SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4)
-#define SDT_PROBE_ARGTYPE(prov, mod, func, name, num, type)
+#define SDT_PROBE_ARGTYPE(prov, mod, func, name, num, type, xtype)
-#define SDT_PROBE_DEFINE1(prov, mod, func, name, sname, arg0)
-#define SDT_PROBE_DEFINE2(prov, mod, func, name, sname, arg0, arg1)
-#define SDT_PROBE_DEFINE3(prov, mod, func, name, sname, arg0, arg1, arg2)
-#define SDT_PROBE_DEFINE4(prov, mod, func, name, sname, arg0, arg1, arg2, arg3)
-#define SDT_PROBE_DEFINE5(prov, mod, func, name, sname, arg0, arg1, arg2, arg3, arg4)
+#define SDT_PROBE_DEFINE0(prov, mod, func, name)
+#define SDT_PROBE_DEFINE1(prov, mod, func, name, arg0)
+#define SDT_PROBE_DEFINE2(prov, mod, func, name, arg0, arg1)
+#define SDT_PROBE_DEFINE3(prov, mod, func, name, arg0, arg1, arg2)
+#define SDT_PROBE_DEFINE4(prov, mod, func, name, arg0, arg1, arg2, arg3)
+#define SDT_PROBE_DEFINE5(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4)
+#define SDT_PROBE_DEFINE6(prov, mod, func, name, arg0, arg1, arg2, \
+ arg3, arg4, arg5)
+#define SDT_PROBE_DEFINE7(prov, mod, func, name, arg0, arg1, arg2, \
+ arg3, arg4, arg5, arg6)
#define SDT_PROBE0(prov, mod, func, name)
#define SDT_PROBE1(prov, mod, func, name, arg0)
@@ -98,140 +107,187 @@
#define SDT_PROBE3(prov, mod, func, name, arg0, arg1, arg2)
#define SDT_PROBE4(prov, mod, func, name, arg0, arg1, arg2, arg3)
#define SDT_PROBE5(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4)
+#define SDT_PROBE6(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4, arg5)
+#define SDT_PROBE7(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4, arg5, \
+ arg6)
-#else
+#define SDT_PROBE_DEFINE0_XLATE(prov, mod, func, name)
+#define SDT_PROBE_DEFINE1_XLATE(prov, mod, func, name, arg0, xarg0)
+#define SDT_PROBE_DEFINE2_XLATE(prov, mod, func, name, arg0, xarg0, \
+ arg1, xarg1)
+#define SDT_PROBE_DEFINE3_XLATE(prov, mod, func, name, arg0, xarg0, \
+ arg1, xarg1, arg2, xarg2)
+#define SDT_PROBE_DEFINE4_XLATE(prov, mod, func, name, arg0, xarg0, \
+ arg1, xarg1, arg2, xarg2, arg3, xarg3)
+#define SDT_PROBE_DEFINE5_XLATE(prov, mod, func, name, arg0, xarg0, \
+ arg1, xarg1, arg2, xarg2, arg3, xarg3, arg4, xarg4)
+#define SDT_PROBE_DEFINE6_XLATE(prov, mod, func, name, arg0, xarg0, \
+ arg1, xarg1, arg2, xarg2, arg3, xarg3, arg4, xarg4, arg5, xarg5)
+#define SDT_PROBE_DEFINE7_XLATE(prov, mod, func, name, arg0, xarg0, \
+ arg1, xarg1, arg2, xarg2, arg3, xarg3, arg4, xarg4, arg5, xarg5, arg6, \
+ xarg6)
-/*
- * This type definition must match that of dtrace_probe. It is defined this
- * way to avoid having to rely on CDDL code.
- */
-typedef void (*sdt_probe_func_t)(u_int32_t, uintptr_t arg0, uintptr_t arg1,
- uintptr_t arg2, uintptr_t arg3, uintptr_t arg4);
+#define DTRACE_PROBE(name)
+#define DTRACE_PROBE1(name, type0, arg0)
+#define DTRACE_PROBE2(name, type0, arg0, type1, arg1)
+#define DTRACE_PROBE3(name, type0, arg0, type1, arg1, type2, arg2)
+#define DTRACE_PROBE4(name, type0, arg0, type1, arg1, type2, arg2, type3, arg3)
+#define DTRACE_PROBE5(name, type0, arg0, type1, arg1, type2, arg2, type3, arg3,\
+ type4, arg4)
-/*
- * The hook for the probe function. See kern_sdt.c which defaults this to
- * it's own stub. The 'sdt' provider will set it to dtrace_probe when it
- * loads.
- */
-extern sdt_probe_func_t sdt_probe_func;
+#else
-typedef enum {
- SDT_UNINIT = 1,
- SDT_INIT,
-} sdt_state_t;
+SET_DECLARE(sdt_providers_set, struct sdt_provider);
+SET_DECLARE(sdt_probes_set, struct sdt_probe);
+SET_DECLARE(sdt_argtypes_set, struct sdt_argtype);
-struct sdt_probe;
-struct sdt_provider;
-
-struct sdt_argtype {
- int ndx; /* Argument index. */
- const char *type; /* Argument type string. */
- TAILQ_ENTRY(sdt_argtype)
- argtype_entry; /* Argument type list entry. */
- struct sdt_probe
- *probe; /* Ptr to the probe structure. */
-};
-
-struct sdt_probe {
- int version; /* Set to sizeof(struct sdt_ref). */
- sdt_state_t state;
- struct sdt_provider
- *prov; /* Ptr to the provider structure. */
- TAILQ_ENTRY(sdt_probe)
- probe_entry; /* SDT probe list entry. */
- TAILQ_HEAD(argtype_list_head, sdt_argtype) argtype_list;
- const char *mod;
- const char *func;
- const char *name;
- id_t id; /* DTrace probe ID. */
- int n_args; /* Number of arguments. */
-};
-
-struct sdt_provider {
- const char *name; /* Provider name. */
- TAILQ_ENTRY(sdt_provider)
- prov_entry; /* SDT provider list entry. */
- TAILQ_HEAD(probe_list_head, sdt_probe) probe_list;
- uintptr_t id; /* DTrace provider ID. */
-};
-
#define SDT_PROVIDER_DEFINE(prov) \
struct sdt_provider sdt_provider_##prov[1] = { \
- { #prov, { NULL, NULL }, { NULL, NULL } } \
+ { #prov, { NULL, NULL }, 0, 0 } \
}; \
- SYSINIT(sdt_provider_##prov##_init, SI_SUB_KDTRACE, \
- SI_ORDER_SECOND, sdt_provider_register, \
- sdt_provider_##prov ); \
- SYSUNINIT(sdt_provider_##prov##_uninit, SI_SUB_KDTRACE, \
- SI_ORDER_SECOND, sdt_provider_deregister, \
- sdt_provider_##prov )
+ DATA_SET(sdt_providers_set, sdt_provider_##prov);
#define SDT_PROVIDER_DECLARE(prov) \
extern struct sdt_provider sdt_provider_##prov[1]
-#define SDT_PROBE_DEFINE(prov, mod, func, name, sname) \
+#define SDT_PROBE_DEFINE(prov, mod, func, name) \
struct sdt_probe sdt_##prov##_##mod##_##func##_##name[1] = { \
- { sizeof(struct sdt_probe), 0, sdt_provider_##prov, \
- { NULL, NULL }, { NULL, NULL }, #mod, #func, #sname, 0, 0 } \
+ { sizeof(struct sdt_probe), sdt_provider_##prov, \
+ { NULL, NULL }, { NULL, NULL }, #mod, #func, #name, 0, 0, \
+ NULL } \
}; \
- SYSINIT(sdt_##prov##_##mod##_##func##_##name##_init, SI_SUB_KDTRACE, \
- SI_ORDER_SECOND + 1, sdt_probe_register, \
- sdt_##prov##_##mod##_##func##_##name ); \
- SYSUNINIT(sdt_##prov##_##mod##_##func##_##name##_uninit, \
- SI_SUB_KDTRACE, SI_ORDER_SECOND + 1, sdt_probe_deregister, \
- sdt_##prov##_##mod##_##func##_##name )
+ DATA_SET(sdt_probes_set, sdt_##prov##_##mod##_##func##_##name);
#define SDT_PROBE_DECLARE(prov, mod, func, name) \
extern struct sdt_probe sdt_##prov##_##mod##_##func##_##name[1]
-#define SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) \
+#define SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) do { \
if (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)
+ (uintptr_t) arg3, (uintptr_t) arg4); \
+} while (0)
-#define SDT_PROBE_ARGTYPE(prov, mod, func, name, num, type) \
- struct sdt_argtype sdt_##prov##_##mod##_##func##_##name##num[1] \
- = { { num, type, { NULL, NULL }, \
+#define SDT_PROBE_ARGTYPE(prov, mod, func, name, num, type, xtype) \
+ static struct sdt_argtype sdta_##prov##_##mod##_##func##_##name##num[1] \
+ = { { num, type, xtype, { NULL, NULL }, \
sdt_##prov##_##mod##_##func##_##name } \
}; \
- SYSINIT(sdt_##prov##_##mod##_##func##_##name##num##_init, \
- SI_SUB_KDTRACE, SI_ORDER_SECOND + 2, sdt_argtype_register, \
- sdt_##prov##_##mod##_##func##_##name##num ); \
- SYSUNINIT(sdt_##prov##_##mod##_##func##_##name##num##_uninit, \
- SI_SUB_KDTRACE, SI_ORDER_SECOND + 2, sdt_argtype_deregister, \
- sdt_##prov##_##mod##_##func##_##name##num )
+ DATA_SET(sdt_argtypes_set, sdta_##prov##_##mod##_##func##_##name##num);
-#define SDT_PROBE_DEFINE1(prov, mod, func, name, sname, arg0) \
- SDT_PROBE_DEFINE(prov, mod, func, name, sname); \
- SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0)
+#define SDT_PROBE_DEFINE0(prov, mod, func, name) \
+ SDT_PROBE_DEFINE(prov, mod, func, name)
-#define SDT_PROBE_DEFINE2(prov, mod, func, name, sname, arg0, arg1) \
- SDT_PROBE_DEFINE(prov, mod, func, name, sname); \
- SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0); \
- SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1)
+#define SDT_PROBE_DEFINE1(prov, mod, func, name, arg0) \
+ SDT_PROBE_DEFINE(prov, mod, func, name); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, NULL)
-#define SDT_PROBE_DEFINE3(prov, mod, func, name, sname, arg0, arg1, arg2)\
- SDT_PROBE_DEFINE(prov, mod, func, name, sname); \
- SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0); \
- SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1); \
- SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2)
+#define SDT_PROBE_DEFINE2(prov, mod, func, name, arg0, arg1) \
+ SDT_PROBE_DEFINE(prov, mod, func, name); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, NULL); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, NULL)
-#define SDT_PROBE_DEFINE4(prov, mod, func, name, sname, arg0, arg1, arg2, arg3) \
- SDT_PROBE_DEFINE(prov, mod, func, name, sname); \
- SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0); \
- SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1); \
- SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2); \
- SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3)
+#define SDT_PROBE_DEFINE3(prov, mod, func, name, arg0, arg1, arg2)\
+ SDT_PROBE_DEFINE(prov, mod, func, name); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, NULL); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, NULL); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, NULL)
-#define SDT_PROBE_DEFINE5(prov, mod, func, name, sname, arg0, arg1, arg2, arg3, arg4) \
- SDT_PROBE_DEFINE(prov, mod, func, name, sname); \
- SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0); \
- SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1); \
- SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2); \
- SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3); \
- SDT_PROBE_ARGTYPE(prov, mod, func, name, 4, arg4)
+#define SDT_PROBE_DEFINE4(prov, mod, func, name, arg0, arg1, arg2, arg3) \
+ SDT_PROBE_DEFINE(prov, mod, func, name); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, NULL); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, NULL); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, NULL); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3, NULL)
+#define SDT_PROBE_DEFINE5(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) \
+ SDT_PROBE_DEFINE(prov, mod, func, name); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, NULL); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, NULL); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, NULL); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3, NULL); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 4, arg4, NULL)
+
+#define SDT_PROBE_DEFINE6(prov, mod, func, name, arg0, arg1, arg2, arg3,\
+ arg4, arg5) \
+ SDT_PROBE_DEFINE(prov, mod, func, name); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, NULL); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, NULL); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, NULL); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3, NULL); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 4, arg4, NULL); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 5, arg5, NULL)
+
+#define SDT_PROBE_DEFINE7(prov, mod, func, name, arg0, arg1, arg2, arg3,\
+ arg4, arg5, arg6) \
+ SDT_PROBE_DEFINE(prov, mod, func, name); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, NULL); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, NULL); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, NULL); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3, NULL); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 4, arg4, NULL); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 5, arg5, NULL); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 6, arg6, NULL)
+
+#define SDT_PROBE_DEFINE0_XLATE(prov, mod, func, name) \
+ SDT_PROBE_DEFINE(prov, mod, func, name)
+
+#define SDT_PROBE_DEFINE1_XLATE(prov, mod, func, name, arg0, xarg0) \
+ SDT_PROBE_DEFINE(prov, mod, func, name); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, xarg0)
+
+#define SDT_PROBE_DEFINE2_XLATE(prov, mod, func, name, arg0, xarg0, \
+ arg1, xarg1) \
+ SDT_PROBE_DEFINE(prov, mod, func, name); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, xarg0); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, xarg1)
+
+#define SDT_PROBE_DEFINE3_XLATE(prov, mod, func, name, arg0, xarg0, \
+ arg1, xarg1, arg2, xarg2) \
+ SDT_PROBE_DEFINE(prov, mod, func, name); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, xarg0); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, xarg1); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, xarg2)
+
+#define SDT_PROBE_DEFINE4_XLATE(prov, mod, func, name, arg0, xarg0, \
+ arg1, xarg1, arg2, xarg2, arg3, xarg3) \
+ SDT_PROBE_DEFINE(prov, mod, func, name); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, xarg0); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, xarg1); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, xarg2); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3, xarg3)
+
+#define SDT_PROBE_DEFINE5_XLATE(prov, mod, func, name, arg0, xarg0, \
+ arg1, xarg1, arg2, xarg2, arg3, xarg3, arg4, xarg4) \
+ SDT_PROBE_DEFINE(prov, mod, func, name); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, xarg0); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, xarg1); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, xarg2); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3, xarg3); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 4, arg4, xarg4)
+
+#define SDT_PROBE_DEFINE6_XLATE(prov, mod, func, name, arg0, xarg0, \
+ arg1, xarg1, arg2, xarg2, arg3, xarg3, arg4, xarg4, arg5, xarg5) \
+ SDT_PROBE_DEFINE(prov, mod, func, name); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, xarg0); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, xarg1); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, xarg2); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3, xarg3); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 4, arg4, xarg4); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 5, arg5, xarg5)
+
+#define SDT_PROBE_DEFINE7_XLATE(prov, mod, func, name, arg0, xarg0, \
+ arg1, xarg1, arg2, xarg2, arg3, xarg3, arg4, xarg4, arg5, xarg5, arg6, \
+ xarg6) \
+ SDT_PROBE_DEFINE(prov, mod, func, name); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, xarg0); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, xarg1); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, xarg2); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3, xarg3); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 4, arg4, xarg4); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 5, arg5, xarg5); \
+ SDT_PROBE_ARGTYPE(prov, mod, func, name, 6, arg6, xarg6)
+
#define SDT_PROBE0(prov, mod, func, name) \
SDT_PROBE(prov, mod, func, name, 0, 0, 0, 0, 0)
#define SDT_PROBE1(prov, mod, func, name, arg0) \
@@ -244,29 +300,127 @@
SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, 0)
#define SDT_PROBE5(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) \
SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4)
+#define SDT_PROBE6(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4, arg5) \
+ do { \
+ if (sdt_##prov##_##mod##_##func##_##name->id) \
+ (*(void (*)(uint32_t, uintptr_t, uintptr_t, uintptr_t, \
+ uintptr_t, uintptr_t, uintptr_t))sdt_probe_func)( \
+ sdt_##prov##_##mod##_##func##_##name->id, \
+ (uintptr_t)arg0, (uintptr_t)arg1, (uintptr_t)arg2, \
+ (uintptr_t)arg3, (uintptr_t)arg4, (uintptr_t)arg5);\
+ } while (0)
+#define SDT_PROBE7(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4, arg5, \
+ arg6) \
+ do { \
+ if (sdt_##prov##_##mod##_##func##_##name->id) \
+ (*(void (*)(uint32_t, uintptr_t, uintptr_t, uintptr_t, \
+ uintptr_t, uintptr_t, uintptr_t, uintptr_t)) \
+ sdt_probe_func)( \
+ sdt_##prov##_##mod##_##func##_##name->id, \
+ (uintptr_t)arg0, (uintptr_t)arg1, (uintptr_t)arg2, \
+ (uintptr_t)arg3, (uintptr_t)arg4, (uintptr_t)arg5, \
+ (uintptr_t)arg6); \
+ } while (0)
-typedef int (*sdt_argtype_listall_func_t)(struct sdt_argtype *, void *);
-typedef int (*sdt_probe_listall_func_t)(struct sdt_probe *, void *);
-typedef int (*sdt_provider_listall_func_t)(struct sdt_provider *, void *);
+#define DTRACE_PROBE_IMPL_START(name, arg0, arg1, arg2, arg3, arg4) do { \
+ static SDT_PROBE_DEFINE(sdt, , , name); \
+ SDT_PROBE(sdt, , , name, arg0, arg1, arg2, arg3, arg4);
+#define DTRACE_PROBE_IMPL_END } while (0)
-void sdt_argtype_deregister(void *);
-void sdt_argtype_register(void *);
-void sdt_probe_deregister(void *);
-void sdt_probe_register(void *);
-void sdt_provider_deregister(void *);
-void sdt_provider_register(void *);
-void sdt_probe_stub(u_int32_t, uintptr_t arg0, uintptr_t arg1, uintptr_t arg2,
- uintptr_t arg3, uintptr_t arg4);
-int sdt_argtype_listall(struct sdt_probe *, sdt_argtype_listall_func_t, void *);
-int sdt_probe_listall(struct sdt_provider *, sdt_probe_listall_func_t, void *);
-int sdt_provider_listall(sdt_provider_listall_func_t,void *);
+#define DTRACE_PROBE(name) \
+ DTRACE_PROBE_IMPL_START(name, 0, 0, 0, 0, 0) \
+ DTRACE_PROBE_IMPL_END
-void sdt_register_callbacks(sdt_provider_listall_func_t, void *,
- sdt_provider_listall_func_t, void *, sdt_probe_listall_func_t, void *);
-void sdt_deregister_callbacks(void);
+#define DTRACE_PROBE1(name, type0, arg0) \
+ DTRACE_PROBE_IMPL_START(name, arg0, 0, 0, 0, 0) \
+ SDT_PROBE_ARGTYPE(sdt, , , name, 0, #type0, NULL); \
+ DTRACE_PROBE_IMPL_END
+#define DTRACE_PROBE2(name, type0, arg0, type1, arg1) \
+ DTRACE_PROBE_IMPL_START(name, arg0, arg1, 0, 0, 0) \
+ SDT_PROBE_ARGTYPE(sdt, , , name, 0, #type0, NULL); \
+ SDT_PROBE_ARGTYPE(sdt, , , name, 1, #type1, NULL); \
+ DTRACE_PROBE_IMPL_END
+
+#define DTRACE_PROBE3(name, type0, arg0, type1, arg1, type2, arg2) \
+ DTRACE_PROBE_IMPL_START(name, arg0, arg1, arg2, 0, 0) \
+ SDT_PROBE_ARGTYPE(sdt, , , name, 0, #type0, NULL); \
+ SDT_PROBE_ARGTYPE(sdt, , , name, 1, #type1, NULL); \
+ SDT_PROBE_ARGTYPE(sdt, , , name, 2, #type2, NULL); \
+ DTRACE_PROBE_IMPL_END
+
+#define DTRACE_PROBE4(name, type0, arg0, type1, arg1, type2, arg2, type3, arg3) \
+ DTRACE_PROBE_IMPL_START(name, arg0, arg1, arg2, arg3, 0) \
+ SDT_PROBE_ARGTYPE(sdt, , , name, 0, #type0, NULL); \
+ SDT_PROBE_ARGTYPE(sdt, , , name, 1, #type1, NULL); \
+ SDT_PROBE_ARGTYPE(sdt, , , name, 2, #type2, NULL); \
+ SDT_PROBE_ARGTYPE(sdt, , , name, 3, #type3, NULL); \
+ DTRACE_PROBE_IMPL_END
+
+#define DTRACE_PROBE5(name, type0, arg0, type1, arg1, type2, arg2, type3, arg3, \
+ type4, arg4) \
+ DTRACE_PROBE_IMPL_START(name, arg0, arg1, arg2, arg3, arg4) \
+ SDT_PROBE_ARGTYPE(sdt, , , name, 0, #type0, NULL); \
+ SDT_PROBE_ARGTYPE(sdt, , , name, 1, #type1, NULL); \
+ SDT_PROBE_ARGTYPE(sdt, , , name, 2, #type2, NULL); \
+ SDT_PROBE_ARGTYPE(sdt, , , name, 3, #type3, NULL); \
+ SDT_PROBE_ARGTYPE(sdt, , , name, 4, #type4, NULL); \
+ DTRACE_PROBE_IMPL_END
+
#endif /* KDTRACE_HOOKS */
+/*
+ * This type definition must match that of dtrace_probe. It is defined this
+ * way to avoid having to rely on CDDL code.
+ */
+typedef void (*sdt_probe_func_t)(uint32_t, uintptr_t arg0, uintptr_t arg1,
+ uintptr_t arg2, uintptr_t arg3, uintptr_t arg4);
+
+/*
+ * The 'sdt' provider will set it to dtrace_probe when it loads.
+ */
+extern sdt_probe_func_t sdt_probe_func;
+
+struct sdt_probe;
+struct sdt_provider;
+struct linker_file;
+
+struct sdt_argtype {
+ int ndx; /* Argument index. */
+ const char *type; /* Argument type string. */
+ const char *xtype; /* Translated argument type. */
+ TAILQ_ENTRY(sdt_argtype)
+ argtype_entry; /* Argument type list entry. */
+ struct sdt_probe *probe; /* Ptr to the probe structure. */
+};
+
+struct sdt_probe {
+ int version; /* Set to sizeof(struct sdt_probe). */
+ struct sdt_provider *prov; /* Ptr to the provider structure. */
+ TAILQ_ENTRY(sdt_probe)
+ probe_entry; /* SDT probe list entry. */
+ TAILQ_HEAD(, sdt_argtype) argtype_list;
+ const char *mod;
+ const char *func;
+ const char *name;
+ id_t id; /* DTrace probe ID. */
+ int n_args; /* Number of arguments. */
+ struct linker_file *sdtp_lf; /* Module in which we're defined. */
+};
+
+struct sdt_provider {
+ char *name; /* Provider name. */
+ TAILQ_ENTRY(sdt_provider)
+ prov_entry; /* SDT provider list entry. */
+ uintptr_t id; /* DTrace provider ID. */
+ int sdt_refs; /* Number of module references. */
+};
+
+void sdt_probe_stub(uint32_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t,
+ uintptr_t);
+
+SDT_PROVIDER_DECLARE(sdt);
+
#endif /* _KERNEL */
#endif /* _SYS_SDT_H */
Modified: trunk/sys/sys/select.h
===================================================================
--- trunk/sys/sys/select.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/select.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -26,7 +27,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/select.h 154090 2006-01-06 22:12:46Z marcel $
*/
#ifndef _SYS_SELECT_H_
Modified: trunk/sys/sys/selinfo.h
===================================================================
--- trunk/sys/sys/selinfo.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/selinfo.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -27,7 +28,7 @@
* SUCH DAMAGE.
*
* @(#)select.h 8.2 (Berkeley) 1/4/94
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/selinfo.h 225177 2011-08-25 15:51:54Z attilio $
*/
#ifndef _SYS_SELINFO_H_
Modified: trunk/sys/sys/sem.h
===================================================================
--- trunk/sys/sys/sem.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/sem.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,4 +1,5 @@
/* $MidnightBSD$ */
+/* $FreeBSD: stable/10/sys/sys/sem.h 224016 2011-07-14 14:18:14Z bz $ */
/* $NetBSD: sem.h,v 1.5 1994/06/29 06:45:15 cgd Exp $ */
/*
Modified: trunk/sys/sys/sema.h
===================================================================
--- trunk/sys/sys/sema.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/sema.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (C) 2001 Jason Evans <jasone at freebsd.org>. All rights reserved.
*
@@ -24,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/sema.h 139825 2005-01-07 02:29:27Z imp $
*/
#ifndef _SYS_SEMA_H_
Modified: trunk/sys/sys/serial.h
===================================================================
--- trunk/sys/sys/serial.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/serial.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2004 Poul-Henning Kamp
* All rights reserved.
@@ -27,7 +28,7 @@
* (both async and sync), but which do not necessarily have anything to
* do with tty processing.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/serial.h 157298 2006-03-30 17:24:42Z marcel $
*/
#ifndef _SYS_SERIAL_H_
Modified: trunk/sys/sys/sf_buf.h
===================================================================
--- trunk/sys/sys/sf_buf.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/sf_buf.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2003-2004 Alan L. Cox <alc at cs.rice.edu>
* All rights reserved.
@@ -23,14 +24,12 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/sf_buf.h 255786 2013-09-22 13:36:52Z glebius $
*/
#ifndef _SYS_SF_BUF_H_
#define _SYS_SF_BUF_H_
-#include <machine/sf_buf.h>
-
/*
* Options to sf_buf_alloc() are specified through its flags argument. This
* argument's value should be the result of a bitwise or'ing of one or more
@@ -44,13 +43,25 @@
struct vm_page;
-extern int nsfbufs; /* Number of sendfile(2) bufs alloced */
-extern int nsfbufspeak; /* Peak of nsfbufsused */
-extern int nsfbufsused; /* Number of sendfile(2) bufs in use */
+struct sfstat { /* sendfile statistics */
+ uint64_t sf_iocnt; /* times sendfile had to do disk I/O */
+ uint64_t sf_allocfail; /* times sfbuf allocation failed */
+ uint64_t sf_allocwait; /* times sfbuf allocation had to wait */
+};
-struct sf_buf *
- sf_buf_alloc(struct vm_page *m, int flags);
-void sf_buf_free(struct sf_buf *sf);
-void sf_buf_mext(void *addr, void *args);
+#ifdef _KERNEL
+#include <machine/sf_buf.h>
+#include <sys/systm.h>
+#include <sys/counter.h>
+struct mbuf; /* for sf_buf_mext() */
+extern counter_u64_t sfstat[sizeof(struct sfstat) / sizeof(uint64_t)];
+#define SFSTAT_ADD(name, val) \
+ counter_u64_add(sfstat[offsetof(struct sfstat, name) / sizeof(uint64_t)],\
+ (val))
+#define SFSTAT_INC(name) SFSTAT_ADD(name, 1)
+#endif /* _KERNEL */
+
+int sf_buf_mext(struct mbuf *mb, void *addr, void *args);
+
#endif /* !_SYS_SF_BUF_H_ */
Modified: trunk/sys/sys/sglist.h
===================================================================
--- trunk/sys/sys/sglist.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/sglist.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2008 Yahoo!, Inc.
* All rights reserved.
@@ -27,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/sglist.h 260856 2014-01-18 18:36:41Z bryanv $
*/
/*
@@ -53,6 +54,7 @@
u_short sg_maxseg;
};
+struct bio;
struct mbuf;
struct uio;
@@ -83,6 +85,7 @@
struct sglist *sglist_alloc(int nsegs, int mflags);
int sglist_append(struct sglist *sg, void *buf, size_t len);
+int sglist_append_bio(struct sglist *sg, struct bio *bp);
int sglist_append_mbuf(struct sglist *sg, struct mbuf *m0);
int sglist_append_phys(struct sglist *sg, vm_paddr_t paddr,
size_t len);
Modified: trunk/sys/sys/shm.h
===================================================================
--- trunk/sys/sys/shm.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/shm.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,4 +1,5 @@
/* $MidnightBSD$ */
+/* $FreeBSD: stable/10/sys/sys/shm.h 328294 2018-01-23 18:22:41Z jhb $ */
/* $NetBSD: shm.h,v 1.15 1994/06/29 06:45:17 cgd Exp $ */
/*-
@@ -56,7 +57,7 @@
#define SHM_LOCK 11
#define SHM_UNLOCK 12
-/* ipcs shmctl commands for Linux compatability */
+/* ipcs shmctl commands for Linux compatibility */
#define SHM_STAT 13
#define SHM_INFO 14
@@ -154,7 +155,7 @@
#endif
__BEGIN_DECLS
-#ifdef __BSD_VISIBLE
+#if __BSD_VISIBLE
int shmsys(int, ...);
#endif
void *shmat(int, const void *, int);
Modified: trunk/sys/sys/sigio.h
===================================================================
--- trunk/sys/sys/sigio.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/sigio.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
@@ -27,7 +28,7 @@
* SUCH DAMAGE.
*
* @(#)filedesc.h 8.1 (Berkeley) 6/2/93
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/sigio.h 139825 2005-01-07 02:29:27Z imp $
*/
#ifndef _SYS_SIGIO_H_
Modified: trunk/sys/sys/signal.h
===================================================================
--- trunk/sys/sys/signal.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/signal.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1982, 1986, 1989, 1991, 1993
* The Regents of the University of California. All rights reserved.
@@ -32,7 +33,7 @@
* SUCH DAMAGE.
*
* @(#)signal.h 8.4 (Berkeley) 5/4/95
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/signal.h 233519 2012-03-26 19:12:09Z rmh $
*/
#ifndef _SYS_SIGNAL_H_
@@ -111,6 +112,7 @@
#if __BSD_VISIBLE
#define SIGTHR 32 /* reserved by thread library. */
#define SIGLWP SIGTHR
+#define SIGLIBRT 33 /* reserved by real-time library. */
#endif
#define SIGRTMIN 65
Modified: trunk/sys/sys/signalvar.h
===================================================================
--- trunk/sys/sys/signalvar.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/signalvar.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
@@ -27,7 +28,7 @@
* SUCH DAMAGE.
*
* @(#)signalvar.h 8.6 (Berkeley) 2/19/95
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/signalvar.h 315949 2017-03-25 13:33:23Z badger $
*/
#ifndef _SYS_SIGNALVAR_H_
@@ -63,7 +64,7 @@
sigset_t ps_osigset; /* Signals using <= 3.x osigset_t. */
sigset_t ps_usertramp; /* SunOS compat; libc sigtramp. XXX */
int ps_flag;
- int ps_refcnt;
+ u_int ps_refcnt;
struct mtx ps_mtx;
};
@@ -233,9 +234,10 @@
#define KSI_TRAP 0x01 /* Generated by trap. */
#define KSI_EXT 0x02 /* Externally managed ksi. */
#define KSI_INS 0x04 /* Directly insert ksi, not the copy */
-#define KSI_SIGQ 0x08 /* Generated by sigqueue, might ret EGAIN. */
+#define KSI_SIGQ 0x08 /* Generated by sigqueue, might ret EAGAIN. */
#define KSI_HEAD 0x10 /* Insert into head, not tail. */
-#define KSI_COPYMASK (KSI_TRAP|KSI_SIGQ)
+#define KSI_PTRACE 0x20 /* Generated by ptrace. */
+#define KSI_COPYMASK (KSI_TRAP | KSI_SIGQ | KSI_PTRACE)
#define KSI_ONQ(ksi) ((ksi)->ksi_sigq != NULL)
@@ -242,6 +244,7 @@
typedef struct sigqueue {
sigset_t sq_signals; /* All pending signals. */
sigset_t sq_kill; /* Legacy depth 1 queue. */
+ sigset_t sq_ptrace; /* Depth 1 queue for ptrace(2). */
TAILQ_HEAD(, ksiginfo) sq_list;/* Queued signal info. */
struct proc *sq_proc;
int sq_flags;
@@ -318,18 +321,14 @@
extern struct mtx sigio_lock;
-/* Values for stop_allowed parameter for cursig(). */
-#define SIG_STOP_ALLOWED 100
-#define SIG_STOP_NOT_ALLOWED 101
-
/* Flags for kern_sigprocmask(). */
#define SIGPROCMASK_OLD 0x0001
#define SIGPROCMASK_PROC_LOCKED 0x0002
#define SIGPROCMASK_PS_LOCKED 0x0004
-int cursig(struct thread *td, int stop_allowed);
+int cursig(struct thread *td);
int sigdeferstop(void);
-void sigallowstop(void);
+int sigallowstop(void);
void execsigs(struct proc *p);
void gsignal(int pgid, int sig, ksiginfo_t *ksi);
void killproc(struct proc *p, char *why);
@@ -340,7 +339,7 @@
void pgsignal(struct pgrp *pgrp, int sig, int checkctty, ksiginfo_t *ksi);
int postsig(int sig);
void kern_psignal(struct proc *p, int sig);
-int ptracestop(struct thread *td, int sig);
+int ptracestop(struct thread *td, int sig, ksiginfo_t *si);
void sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *retmask);
struct sigacts *sigacts_alloc(void);
void sigacts_copy(struct sigacts *dest, struct sigacts *src);
Modified: trunk/sys/sys/sleepqueue.h
===================================================================
--- trunk/sys/sys/sleepqueue.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/sleepqueue.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2004 John Baldwin <jhb at FreeBSD.org>
* All rights reserved.
@@ -10,9 +11,6 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -26,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/sleepqueue.h 274139 2014-11-05 16:24:57Z lwhsu $
*/
#ifndef _SYS_SLEEPQUEUE_H_
@@ -49,13 +47,6 @@
* call sleepq_set_timeout() after sleepq_add() to setup a timeout. It
* should then use one of the sleepq_timedwait() functions to block.
*
- * If the thread wants the sleep to be interruptible by signals, it can
- * call sleepq_catch_signals() after sleepq_add(). It should then use
- * one of the sleepq_wait_sig() functions to block. After the thread has
- * been resumed, it should call sleepq_calc_signal_retval() to determine
- * if it should return EINTR or ERESTART passing in the value returned from
- * the earlier call to sleepq_catch_signals().
- *
* A thread is normally resumed from a sleep queue by either the
* sleepq_signal() or sleepq_broadcast() functions. Sleepq_signal() wakes
* the thread with the highest priority that is sleeping on the specified
@@ -93,8 +84,6 @@
#define SLEEPQ_SX 0x03 /* Used by an sx lock. */
#define SLEEPQ_LK 0x04 /* Used by a lockmgr. */
#define SLEEPQ_INTERRUPTIBLE 0x100 /* Sleep is interruptible. */
-#define SLEEPQ_STOP_ON_BDRY 0x200 /* Stop sleeping thread on
- user mode boundary */
void init_sleepqueues(void);
int sleepq_abort(struct thread *td, int intrval);
@@ -108,7 +97,10 @@
void sleepq_release(void *wchan);
void sleepq_remove(struct thread *td, void *wchan);
int sleepq_signal(void *wchan, int flags, int pri, int queue);
-void sleepq_set_timeout(void *wchan, int timo);
+void sleepq_set_timeout_sbt(void *wchan, sbintime_t sbt,
+ sbintime_t pr, int flags);
+#define sleepq_set_timeout(wchan, timo) \
+ sleepq_set_timeout_sbt((wchan), tick_sbt * (timo), 0, C_HARDCLOCK)
u_int sleepq_sleepcnt(void *wchan, int queue);
int sleepq_timedwait(void *wchan, int pri);
int sleepq_timedwait_sig(void *wchan, int pri);
Modified: trunk/sys/sys/smp.h
===================================================================
--- trunk/sys/sys/smp.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/smp.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
@@ -6,7 +7,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/smp.h 331910 2018-04-03 07:52:06Z avg $
*/
#ifndef _SYS_SMP_H_
@@ -71,11 +72,14 @@
struct cpu_group *smp_topo_find(struct cpu_group *top, int cpu);
extern void (*cpustop_restartfunc)(void);
-extern int smp_active;
extern int smp_cpus;
-extern volatile cpuset_t started_cpus;
-extern volatile cpuset_t stopped_cpus;
-extern cpuset_t hlt_cpus_mask;
+/* The suspend/resume cpusets are x86 only, but minimize ifdefs. */
+extern volatile cpuset_t resuming_cpus; /* woken up cpus in suspend pen */
+extern volatile cpuset_t started_cpus; /* cpus to let out of stop pen */
+extern volatile cpuset_t stopped_cpus; /* cpus in stop pen */
+extern volatile cpuset_t suspended_cpus; /* cpus [near] sleeping in susp pen */
+extern volatile cpuset_t toresume_cpus; /* cpus to let out of suspend pen */
+extern cpuset_t hlt_cpus_mask; /* XXX 'mask' is detail in old impl */
extern cpuset_t logical_cpus_mask;
#endif /* SMP */
@@ -140,7 +144,7 @@
* cpu_mp_start() will be called so that MP can be enabled. This function
* should do things such as startup secondary processors. It should also
* setup mp_ncpus, all_cpus, and smp_cpus. It should also ensure that
- * smp_active and smp_started are initialized at the appropriate time.
+ * smp_started is initialized at the appropriate time.
* Once cpu_mp_start() returns, machine independent MP startup code will be
* executed and a simple message will be output to the console. Finally,
* cpu_mp_announce() will be called so that machine dependent messages about
@@ -165,11 +169,16 @@
int stop_cpus_hard(cpuset_t);
#if defined(__amd64__) || defined(__i386__)
int suspend_cpus(cpuset_t);
+int resume_cpus(cpuset_t);
#endif
+
void smp_rendezvous_action(void);
extern struct mtx smp_ipi_mtx;
#endif /* SMP */
+
+int quiesce_all_cpus(const char *, int);
+int quiesce_cpus(cpuset_t, const char *, int);
void smp_no_rendevous_barrier(void *);
void smp_rendezvous(void (*)(void *),
void (*)(void *),
Modified: trunk/sys/sys/sockbuf.h
===================================================================
--- trunk/sys/sys/sockbuf.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/sockbuf.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1982, 1986, 1990, 1993
* The Regents of the University of California. All rights reserved.
@@ -28,7 +29,7 @@
*
* @(#)socketvar.h 8.3 (Berkeley) 2/19/95
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/sockbuf.h 279930 2015-03-12 17:07:45Z sjg $
*/
#ifndef _SYS_SOCKBUF_H_
#define _SYS_SOCKBUF_H_
@@ -52,6 +53,7 @@
#define SB_NOCOALESCE 0x200 /* don't coalesce new data into existing mbufs */
#define SB_IN_TOE 0x400 /* socket buffer is in the middle of an operation */
#define SB_AUTOSIZE 0x800 /* automatically size socket buffer */
+#define SB_STOP 0x1000 /* backpressure indicator */
#define SBS_CANTSENDMORE 0x0010 /* can't send more data to peer */
#define SBS_CANTRCVMORE 0x0020 /* can't receive more data from peer */
@@ -97,7 +99,7 @@
u_int sb_mbmax; /* (c/d) max chars of mbufs to use */
u_int sb_ctl; /* (c/d) non-data chars in buffer */
int sb_lowat; /* (c/d) low water mark */
- int sb_timeo; /* (c/d) timeout for read/write */
+ sbintime_t sb_timeo; /* (c/d) timeout for read/write */
short sb_flags; /* (c/d) flags, see below */
int (*sb_upcall)(struct socket *, void *, int); /* (c/d) */
void *sb_upcallarg; /* (c/d) */
@@ -127,6 +129,8 @@
struct mbuf *m0, struct mbuf *control);
int sbappendaddr_locked(struct sockbuf *sb, const struct sockaddr *asa,
struct mbuf *m0, struct mbuf *control);
+int sbappendaddr_nospacecheck_locked(struct sockbuf *sb,
+ const struct sockaddr *asa, struct mbuf *m0, struct mbuf *control);
int sbappendcontrol(struct sockbuf *sb, struct mbuf *m0,
struct mbuf *control);
int sbappendcontrol_locked(struct sockbuf *sb, struct mbuf *m0,
@@ -140,6 +144,8 @@
void sbdestroy(struct sockbuf *sb, struct socket *so);
void sbdrop(struct sockbuf *sb, int len);
void sbdrop_locked(struct sockbuf *sb, int len);
+struct mbuf *
+ sbcut_locked(struct sockbuf *sb, int len);
void sbdroprecord(struct sockbuf *sb);
void sbdroprecord_locked(struct sockbuf *sb);
void sbflush(struct sockbuf *sb);
@@ -153,6 +159,8 @@
struct thread *td);
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);
@@ -164,10 +172,19 @@
* still be negative (cc > hiwat or mbcnt > mbmax). Should detect
* overflow and return 0. Should use "lmin" but it doesn't exist now.
*/
-#define sbspace(sb) \
- ((long) imin((int)((sb)->sb_hiwat - (sb)->sb_cc), \
- (int)((sb)->sb_mbmax - (sb)->sb_mbcnt)))
+static __inline
+long
+sbspace(struct sockbuf *sb)
+{
+ int bleft, mleft; /* size should match sockbuf fields */
+ if (sb->sb_flags & SB_STOP)
+ return(0);
+ bleft = sb->sb_hiwat - sb->sb_cc;
+ mleft = sb->sb_mbmax - sb->sb_mbcnt;
+ return((bleft < mleft) ? bleft : mleft);
+}
+
/* adjust counters in sb reflecting allocation of m */
#define sballoc(sb, m) { \
(sb)->sb_cc += (m)->m_len; \
Modified: trunk/sys/sys/socket.h
===================================================================
--- trunk/sys/sys/socket.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/socket.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1982, 1985, 1986, 1988, 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -27,7 +28,7 @@
* SUCH DAMAGE.
*
* @(#)socket.h 8.4 (Berkeley) 2/21/94
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/socket.h 254925 2013-08-26 18:16:05Z jhb $
*/
#ifndef _SYS_SOCKET_H_
@@ -95,7 +96,15 @@
#endif
#define SOCK_SEQPACKET 5 /* sequenced packet stream */
+#if __BSD_VISIBLE
/*
+ * Creation flags, OR'ed into socket() and socketpair() type argument.
+ */
+#define SOCK_CLOEXEC 0x10000000
+#define SOCK_NONBLOCK 0x20000000
+#endif
+
+/*
* Option flags per-socket.
*/
#define SO_DEBUG 0x0001 /* turn on debugging info recording */
@@ -145,7 +154,7 @@
/*
* Space reserved for new socket options added by third-party vendors.
* This range applies to all socket option levels. New socket options
- * in MidnightBSD should always use an option value less than SO_VENDOR.
+ * in FreeBSD should always use an option value less than SO_VENDOR.
*/
#if __BSD_VISIBLE
#define SO_VENDOR 0x80000000
@@ -222,7 +231,9 @@
#define AF_ARP 35
#define AF_BLUETOOTH 36 /* Bluetooth sockets */
#define AF_IEEE80211 37 /* IEEE 802.11 protocol */
-#define AF_MAX 38
+#define AF_INET_SDP 40 /* OFED Socket Direct Protocol ipv4 */
+#define AF_INET6_SDP 42 /* OFED Socket Direct Protocol ipv6 */
+#define AF_MAX 42
/*
* When allocating a new AF_ constant, please only allocate
* even numbered constants for FreeBSD until 134 as odd numbered AF_
@@ -344,6 +355,9 @@
#define PF_SCLUSTER AF_SCLUSTER
#define PF_ARP AF_ARP
#define PF_BLUETOOTH AF_BLUETOOTH
+#define PF_IEEE80211 AF_IEEE80211
+#define PF_INET_SDP AF_INET_SDP
+#define PF_INET6_SDP AF_INET6_SDP
#define PF_MAX AF_MAX
@@ -357,44 +371,6 @@
*/
#define NET_MAXID AF_MAX
-#define CTL_NET_NAMES { \
- { 0, 0 }, \
- { "unix", CTLTYPE_NODE }, \
- { "inet", CTLTYPE_NODE }, \
- { "implink", CTLTYPE_NODE }, \
- { "pup", CTLTYPE_NODE }, \
- { "chaos", CTLTYPE_NODE }, \
- { "xerox_ns", CTLTYPE_NODE }, \
- { "iso", CTLTYPE_NODE }, \
- { "emca", CTLTYPE_NODE }, \
- { "datakit", CTLTYPE_NODE }, \
- { "ccitt", CTLTYPE_NODE }, \
- { "ibm_sna", CTLTYPE_NODE }, \
- { "decnet", CTLTYPE_NODE }, \
- { "dec_dli", CTLTYPE_NODE }, \
- { "lat", CTLTYPE_NODE }, \
- { "hylink", CTLTYPE_NODE }, \
- { "appletalk", CTLTYPE_NODE }, \
- { "route", CTLTYPE_NODE }, \
- { "link_layer", CTLTYPE_NODE }, \
- { "xtp", CTLTYPE_NODE }, \
- { "coip", CTLTYPE_NODE }, \
- { "cnt", CTLTYPE_NODE }, \
- { "rtip", CTLTYPE_NODE }, \
- { "ipx", CTLTYPE_NODE }, \
- { "sip", CTLTYPE_NODE }, \
- { "pip", CTLTYPE_NODE }, \
- { "isdn", CTLTYPE_NODE }, \
- { "key", CTLTYPE_NODE }, \
- { "inet6", CTLTYPE_NODE }, \
- { "natm", CTLTYPE_NODE }, \
- { "atm", CTLTYPE_NODE }, \
- { "hdrcomplete", CTLTYPE_NODE }, \
- { "netgraph", CTLTYPE_NODE }, \
- { "snp", CTLTYPE_NODE }, \
- { "scp", CTLTYPE_NODE }, \
-}
-
/*
* PF_ROUTE - Routing table
*
@@ -411,14 +387,6 @@
* versions of msghdr structs. */
#define NET_RT_MAXID 6
-#define CTL_NET_RT_NAMES { \
- { 0, 0 }, \
- { "dump", CTLTYPE_STRUCT }, \
- { "flags", CTLTYPE_STRUCT }, \
- { "iflist", CTLTYPE_STRUCT }, \
- { "ifmalist", CTLTYPE_STRUCT }, \
- { "iflistl", CTLTYPE_STRUCT }, \
-}
#endif /* __BSD_VISIBLE */
/*
@@ -447,19 +415,20 @@
#define MSG_TRUNC 0x10 /* data discarded before delivery */
#define MSG_CTRUNC 0x20 /* control data lost before delivery */
#define MSG_WAITALL 0x40 /* wait for full request or error */
-#define MSG_NOTIFICATION 0x2000 /* SCTP notification */
+#if __POSIX_VISIBLE >= 200809
+#define MSG_NOSIGNAL 0x20000 /* do not generate SIGPIPE on EOF */
+#endif
#if __BSD_VISIBLE
#define MSG_DONTWAIT 0x80 /* this message should be nonblocking */
#define MSG_EOF 0x100 /* data completes connection */
+#define MSG_NOTIFICATION 0x2000 /* SCTP notification */
#define MSG_NBIO 0x4000 /* FIONBIO mode, used by fifofs */
#define MSG_COMPAT 0x8000 /* used in sendit() */
+#define MSG_CMSG_CLOEXEC 0x40000 /* make received fds close-on-exec */
#endif
#ifdef _KERNEL
#define MSG_SOCALLBCK 0x10000 /* for use by socket callbacks - soreceive (TCP) */
#endif
-#if __BSD_VISIBLE
-#define MSG_NOSIGNAL 0x20000 /* do not generate SIGPIPE on EOF */
-#endif
/*
* Header for ancillary data objects in msg_control buffer.
@@ -588,10 +557,13 @@
#define SHUT_WR 1 /* shut down the writing side */
#define SHUT_RDWR 2 /* shut down both sides */
+#if __BSD_VISIBLE
+/* for SCTP */
/* we cheat and use the SHUT_XX defines for these */
#define PRU_FLUSH_RD SHUT_RD
#define PRU_FLUSH_WR SHUT_WR
#define PRU_FLUSH_RDWR SHUT_RDWR
+#endif
#if __BSD_VISIBLE
@@ -611,8 +583,12 @@
#define SF_NODISKIO 0x00000001
#define SF_MNOWAIT 0x00000002
#define SF_SYNC 0x00000004
-#endif
+#ifdef _KERNEL
+#define SFK_COMPAT 0x00000001
+#endif /* _KERNEL */
+#endif /* __BSD_VISIBLE */
+
#ifndef _KERNEL
#include <sys/cdefs.h>
@@ -621,6 +597,11 @@
int accept(int, struct sockaddr * __restrict, socklen_t * __restrict);
int bind(int, const struct sockaddr *, socklen_t);
int connect(int, const struct sockaddr *, socklen_t);
+#if __BSD_VISIBLE
+int accept4(int, struct sockaddr * __restrict, socklen_t * __restrict, int);
+int bindat(int, int, const struct sockaddr *, socklen_t);
+int connectat(int, int, const struct sockaddr *, socklen_t);
+#endif
int getpeername(int, struct sockaddr * __restrict, socklen_t * __restrict);
int getsockname(int, struct sockaddr * __restrict, socklen_t * __restrict);
int getsockopt(int, int, int, void * __restrict, socklen_t * __restrict);
Modified: trunk/sys/sys/socketvar.h
===================================================================
--- trunk/sys/sys/socketvar.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/socketvar.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1982, 1986, 1990, 1993
* The Regents of the University of California. All rights reserved.
@@ -28,7 +29,7 @@
*
* @(#)socketvar.h 8.3 (Berkeley) 2/19/95
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/socketvar.h 321021 2017-07-15 17:28:03Z dchagin $
*/
#ifndef _SYS_SOCKETVAR_H_
@@ -42,6 +43,7 @@
#include <sys/sockbuf.h>
#include <sys/sockstate.h>
#ifdef _KERNEL
+#include <sys/caprights.h>
#include <sys/sockopt.h>
#endif
@@ -76,7 +78,7 @@
short so_state; /* (b) internal state flags SS_* */
int so_qstate; /* (e) internal state flags SQ_* */
void *so_pcb; /* protocol control block */
- struct vnet *so_vnet; /* network stack instance */
+ struct vnet *so_vnet; /* (a) network stack instance */
struct protosw *so_proto; /* (a) protocol handle */
/*
* Variables for connection queuing.
@@ -294,9 +296,10 @@
extern int maxsockets;
extern u_long sb_max;
-extern struct uma_zone *socket_zone;
extern so_gen_t so_gencnt;
+struct file;
+struct filedesc;
struct mbuf;
struct sockaddr;
struct ucred;
@@ -313,16 +316,21 @@
/*
* From uipc_socket and friends
*/
-int sockargs(struct mbuf **mp, char *buf, int buflen, int type);
+int sockargs(struct mbuf **mp, caddr_t buf, int buflen, int type);
int getsockaddr(struct sockaddr **namp, caddr_t uaddr, size_t len);
+int getsock_cap(struct thread *td, int fd, cap_rights_t *rightsp,
+ struct file **fpp, u_int *fflagp);
void soabort(struct socket *so);
int soaccept(struct socket *so, struct sockaddr **nam);
int socheckuid(struct socket *so, uid_t uid);
int sobind(struct socket *so, struct sockaddr *nam, struct thread *td);
+int sobindat(int fd, struct socket *so, struct sockaddr *nam,
+ struct thread *td);
int soclose(struct socket *so);
int soconnect(struct socket *so, struct sockaddr *nam, struct thread *td);
+int soconnectat(int fd, struct socket *so, struct sockaddr *nam,
+ struct thread *td);
int soconnect2(struct socket *so1, struct socket *so2);
-int socow_setup(struct mbuf *m0, struct uio *uio);
int socreate(int dom, struct socket **aso, int type, int proto,
struct ucred *cred, struct thread *td);
int sodisconnect(struct socket *so);
Modified: trunk/sys/sys/sockio.h
===================================================================
--- trunk/sys/sys/sockio.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/sockio.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1982, 1986, 1990, 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -27,7 +28,7 @@
* SUCH DAMAGE.
*
* @(#)sockio.h 8.1 (Berkeley) 3/28/94
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/sockio.h 324462 2017-10-10 02:35:04Z sephe $
*/
#ifndef _SYS_SOCKIO_H_
@@ -44,8 +45,8 @@
#define SIOCSPGRP _IOW('s', 8, int) /* set process group */
#define SIOCGPGRP _IOR('s', 9, int) /* get process group */
-#define SIOCADDRT _IOW('r', 10, struct ortentry) /* add route */
-#define SIOCDELRT _IOW('r', 11, struct ortentry) /* delete route */
+/* SIOCADDRT _IOW('r', 10, struct ortentry) 4.3BSD */
+/* SIOCDELRT _IOW('r', 11, struct ortentry) 4.3BSD */
#define SIOCGETVIFCNT _IOWR('r', 15, struct sioc_vif_req)/* get vif pkt cnt */
#define SIOCGETSGCNT _IOWR('r', 16, struct sioc_sg_req) /* get s,g pkt cnt */
@@ -68,8 +69,7 @@
#define SIOCGIFMETRIC _IOWR('i', 23, struct ifreq) /* get IF metric */
#define SIOCSIFMETRIC _IOW('i', 24, struct ifreq) /* set IF metric */
#define SIOCDIFADDR _IOW('i', 25, struct ifreq) /* delete IF addr */
-#define SIOCAIFADDR _IOW('i', 26, struct ifaliasreq)/* add/chg IF alias */
-
+#define OSIOCAIFADDR _IOW('i', 26, struct oifaliasreq)/* add/chg IF alias */
#define SIOCALIFADDR _IOW('i', 27, struct if_laddrreq) /* add IF addr */
#define SIOCGLIFADDR _IOWR('i', 28, struct if_laddrreq) /* get IF addr */
#define SIOCDLIFADDR _IOW('i', 29, struct if_laddrreq) /* delete IF addr */
@@ -81,6 +81,7 @@
#define SIOCSIFNAME _IOW('i', 40, struct ifreq) /* set IF name */
#define SIOCSIFDESCR _IOW('i', 41, struct ifreq) /* set ifnet descr */
#define SIOCGIFDESCR _IOWR('i', 42, struct ifreq) /* get ifnet descr */
+#define SIOCAIFADDR _IOW('i', 43, struct ifaliasreq)/* add/chg IF alias */
#define SIOCADDMULTI _IOW('i', 49, struct ifreq) /* add m'cast addr */
#define SIOCDELMULTI _IOW('i', 50, struct ifreq) /* del m'cast addr */
@@ -96,8 +97,10 @@
#define SIOCGIFSTATUS _IOWR('i', 59, struct ifstat) /* get IF status */
#define SIOCSIFLLADDR _IOW('i', 60, struct ifreq) /* set linklevel addr */
+#define SIOCGI2C _IOWR('i', 61, struct ifreq) /* get I2C data */
+#define SIOCGHWADDR _IOWR('i', 62, struct ifreq) /* get hardware lladdr */
-#define SIOCSIFPHYADDR _IOW('i', 70, struct ifaliasreq) /* set gif addres */
+#define SIOCSIFPHYADDR _IOW('i', 70, struct ifaliasreq) /* set gif address */
#define SIOCGIFPSRCADDR _IOWR('i', 71, struct ifreq) /* get gif psrc addr */
#define SIOCGIFPDSTADDR _IOWR('i', 72, struct ifreq) /* get gif pdst addr */
#define SIOCDIFPHYADDR _IOW('i', 73, struct ifreq) /* delete gif addrs */
@@ -113,6 +116,9 @@
#define SIOCGIFFIB _IOWR('i', 92, struct ifreq) /* get IF fib */
#define SIOCSIFFIB _IOW('i', 93, struct ifreq) /* set IF fib */
+#define SIOCGTUNFIB _IOWR('i', 94, struct ifreq) /* get tunnel fib */
+#define SIOCSTUNFIB _IOW('i', 95, struct ifreq) /* set tunnel fib */
+
#define SIOCSDRVSPEC _IOW('i', 123, struct ifdrv) /* set driver-specific
parameters */
#define SIOCGDRVSPEC _IOWR('i', 123, struct ifdrv) /* get driver-specific
@@ -127,5 +133,10 @@
#define SIOCGIFGROUP _IOWR('i', 136, struct ifgroupreq) /* get ifgroups */
#define SIOCDIFGROUP _IOW('i', 137, struct ifgroupreq) /* delete ifgroup */
#define SIOCGIFGMEMB _IOWR('i', 138, struct ifgroupreq) /* get members */
+#define SIOCGIFXMEDIA _IOWR('i', 139, struct ifmediareq) /* get net xmedia */
+#define SIOCGIFRSSKEY _IOWR('i', 150, struct ifrsskey)/* get RSS key */
+#define SIOCGIFRSSHASH _IOWR('i', 151, struct ifrsshash)/* get the current RSS
+ type/func settings */
+
#endif /* !_SYS_SOCKIO_H_ */
Modified: trunk/sys/sys/sockopt.h
===================================================================
--- trunk/sys/sys/sockopt.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/sockopt.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1982, 1986, 1990, 1993
* The Regents of the University of California. All rights reserved.
@@ -28,7 +29,7 @@
*
* @(#)socketvar.h 8.3 (Berkeley) 2/19/95
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/sockopt.h 180948 2008-07-29 07:45:05Z kmacy $
*/
#ifndef _SYS_SOCKOPT_H_
#define _SYS_SOCKOPT_H_
Modified: trunk/sys/sys/sockstate.h
===================================================================
--- trunk/sys/sys/sockstate.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/sockstate.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1982, 1986, 1990, 1993
* The Regents of the University of California. All rights reserved.
@@ -28,7 +29,7 @@
*
* @(#)socketvar.h 8.3 (Berkeley) 2/19/95
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/sockstate.h 180948 2008-07-29 07:45:05Z kmacy $
*/
#ifndef _SYS_SOCKTATE_H_
#define _SYS_SOCKTATE_H_
Modified: trunk/sys/sys/soundcard.h
===================================================================
--- trunk/sys/sys/soundcard.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/soundcard.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* soundcard.h
*/
@@ -29,7 +30,7 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/soundcard.h 302006 2016-06-18 12:44:14Z ed $
*/
/*
@@ -185,7 +186,7 @@
#define AFMT_U24_LE 0x00040000 /* Little endian unsigned 24-bit */
#define AFMT_U24_BE 0x00080000 /* Big endian unsigned 24-bit */
-/* Machine dependant AFMT_* definitions. */
+/* Machine dependent AFMT_* definitions. */
#if BYTE_ORDER == LITTLE_ENDIAN
#define AFMT_S16_NE AFMT_S16_LE
#define AFMT_S24_NE AFMT_S24_LE
@@ -1261,7 +1262,7 @@
*/
#define LOCL_STARTAUDIO 1
-#if (!defined(_KERNEL) && !defined(INKERNEL)) || defined(USE_SEQ_MACROS)
+#if !defined(_KERNEL) || defined(USE_SEQ_MACROS)
/*
* Some convenience macros to simplify programming of the
* /dev/sequencer interface
@@ -1447,7 +1448,7 @@
SEQ_CONTROL(dev, voice, CTL_PAN, (pos+128) / 2)
/*
- * Timing and syncronization macros
+ * Timing and synchronization macros
*/
#define _TIMER_EVENT(ev, parm) { \
Modified: trunk/sys/sys/stack.h
===================================================================
--- trunk/sys/sys/stack.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/stack.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2005 Antoine Brodin
* All rights reserved.
@@ -23,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/stack.h 227581 2011-11-16 19:06:55Z pjd $
*/
#ifndef _SYS_STACK_H_
@@ -37,16 +38,17 @@
struct stack *stack_create(void);
void stack_destroy(struct stack *);
int stack_put(struct stack *, vm_offset_t);
-void stack_copy(struct stack *, struct stack *);
+void stack_copy(const struct stack *, struct stack *);
void stack_zero(struct stack *);
-void stack_print(struct stack *);
-void stack_print_ddb(struct stack *);
-void stack_print_short(struct stack *);
-void stack_print_short_ddb(struct stack *);
-void stack_sbuf_print(struct sbuf *, struct stack *);
-void stack_sbuf_print_ddb(struct sbuf *, struct stack *);
+void stack_print(const struct stack *);
+void stack_print_ddb(const struct stack *);
+void stack_print_short(const struct stack *);
+void stack_print_short_ddb(const struct stack *);
+void stack_sbuf_print(struct sbuf *, const struct stack *);
+void stack_sbuf_print_ddb(struct sbuf *, const struct stack *);
#ifdef KTR
-void stack_ktr(u_int, const char *, int, struct stack *, u_int, int);
+void stack_ktr(u_int, const char *, int, const struct stack *,
+ u_int, int);
#define CTRSTACK(m, st, depth, cheap) do { \
if (KTR_COMPILE & (m)) \
stack_ktr((m), __FILE__, __LINE__, st, depth, cheap); \
Modified: trunk/sys/sys/stat.h
===================================================================
--- trunk/sys/sys/stat.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/stat.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1982, 1986, 1989, 1993
* The Regents of the University of California. All rights reserved.
@@ -32,7 +33,7 @@
* SUCH DAMAGE.
*
* @(#)stat.h 8.12 (Berkeley) 6/16/95
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/stat.h 293474 2016-01-09 14:20:23Z dchagin $
*/
#ifndef _SYS_STAT_H_
@@ -228,8 +229,6 @@
#define S_IFREG 0100000 /* regular */
#define S_IFLNK 0120000 /* symbolic link */
#define S_IFSOCK 0140000 /* socket */
-#define S_IFPORT 0150000 /* mach port */
-#define S_IFPSET 0160000 /* mach portset */
#define S_ISVTX 0001000 /* save swapped text even after use */
#endif
#if __BSD_VISIBLE
@@ -267,9 +266,27 @@
#define UF_NODUMP 0x00000001 /* do not dump file */
#define UF_IMMUTABLE 0x00000002 /* file may not be changed */
#define UF_APPEND 0x00000004 /* writes to file may only append */
-#define UF_OPAQUE 0x00000008 /* directory is opaque wrt. union */
-#define UF_NOUNLINK 0x00000010 /* file may not be removed or renamed */
+#define UF_OPAQUE 0x00000008 /* directory is opaque wrt. union */
+#define UF_NOUNLINK 0x00000010 /* file may not be removed or renamed */
/*
+ * These two bits are defined in MacOS X. They are not currently used in
+ * FreeBSD.
+ */
+#if 0
+#define UF_COMPRESSED 0x00000020 /* file is compressed */
+#define UF_TRACKED 0x00000040 /* renames and deletes are tracked */
+#endif
+
+#define UF_SYSTEM 0x00000080 /* Windows system file bit */
+#define UF_SPARSE 0x00000100 /* sparse file */
+#define UF_OFFLINE 0x00000200 /* file is offline */
+#define UF_REPARSE 0x00000400 /* Windows reparse point file bit */
+#define UF_ARCHIVE 0x00000800 /* file needs to be archived */
+#define UF_READONLY 0x00001000 /* Windows readonly file bit */
+/* This is the same as the MacOS X definition of UF_HIDDEN. */
+#define UF_HIDDEN 0x00008000 /* file is hidden */
+
+/*
* Super-user changeable flags.
*/
#define SF_SETTABLE 0xffff0000 /* mask of superuser changeable flags */
@@ -291,10 +308,16 @@
#endif /* __BSD_VISIBLE */
+#if __POSIX_VISIBLE >= 200809
+#define UTIME_NOW -1
+#define UTIME_OMIT -2
+#endif
+
#ifndef _KERNEL
__BEGIN_DECLS
#if __BSD_VISIBLE
int chflags(const char *, unsigned long);
+int chflagsat(int, const char *, unsigned long, int);
#endif
int chmod(const char *, mode_t);
#if __BSD_VISIBLE
@@ -305,10 +328,13 @@
#endif
#if __POSIX_VISIBLE >= 200809
int fchmodat(int, const char *, mode_t, int);
+int futimens(int fd, const struct timespec times[2]);
+int utimensat(int fd, const char *path, const struct timespec times[2],
+ int flag);
#endif
int fstat(int, struct stat *);
#if __BSD_VISIBLE
-int lchflags(const char *, int);
+int lchflags(const char *, unsigned long);
int lchmod(const char *, mode_t);
#endif
#if __POSIX_VISIBLE >= 200112
Modified: trunk/sys/sys/statvfs.h
===================================================================
--- trunk/sys/sys/statvfs.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/statvfs.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright 2002 Massachusetts Institute of Technology
*
@@ -26,7 +27,7 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/statvfs.h 139825 2005-01-07 02:29:27Z imp $
*/
#ifndef _SYS_STATVFS_H_
Modified: trunk/sys/sys/stdint.h
===================================================================
--- trunk/sys/sys/stdint.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/stdint.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2001 Mike Barcroft <mike at FreeBSD.org>
* All rights reserved.
@@ -23,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/stdint.h 291134 2015-11-21 16:21:27Z kib $
*/
#ifndef _SYS_STDINT_H_
@@ -55,15 +56,6 @@
typedef __uint_fast32_t uint_fast32_t;
typedef __uint_fast64_t uint_fast64_t;
-#ifndef _INTMAX_T_DECLARED
-typedef __intmax_t intmax_t;
-#define _INTMAX_T_DECLARED
-#endif
-#ifndef _UINTMAX_T_DECLARED
-typedef __uintmax_t uintmax_t;
-#define _UINTMAX_T_DECLARED
-#endif
-
/* GNU and Darwin define this and people seem to think it's portable */
#if defined(UINTPTR_MAX) && defined(UINT64_MAX) && (UINTPTR_MAX == UINT64_MAX)
#define __WORDSIZE 64
@@ -71,4 +63,8 @@
#define __WORDSIZE 32
#endif
+/* Limits of wchar_t. */
+#define WCHAR_MIN __WCHAR_MIN
+#define WCHAR_MAX __WCHAR_MAX
+
#endif /* !_SYS_STDINT_H_ */
Modified: trunk/sys/sys/sun_disklabel.h
===================================================================
--- trunk/sys/sys/sun_disklabel.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/sun_disklabel.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -34,7 +35,7 @@
* @(#)sun_disklabel.h 8.1 (Berkeley) 6/11/93
* $NetBSD: disklabel.h,v 1.2 1998/08/22 14:55:28 mrg Exp $
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/sun_disklabel.h 144328 2005-03-30 09:33:10Z joerg $
*/
#ifndef _SYS_SUN_DISKLABEL_H_
Modified: trunk/sys/sys/syscall.mk
===================================================================
--- trunk/sys/sys/syscall.mk 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/syscall.mk 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,7 +1,6 @@
-# MidnightBSD system call names.
+# MidnightBSD system call object files.
# DO NOT EDIT-- this file is automatically generated.
# $MidnightBSD$
-# created from MidnightBSD
MIASM = \
syscall.o \
exit.o \
@@ -168,6 +167,10 @@
ktimer_gettime.o \
ktimer_getoverrun.o \
nanosleep.o \
+ ffclock_getcounter.o \
+ ffclock_setestimate.o \
+ ffclock_getestimate.o \
+ clock_getcpuclockid2.o \
ntp_gettime.o \
minherit.o \
rfork.o \
@@ -379,8 +382,7 @@
msgctl.o \
shmctl.o \
lpathconf.o \
- cap_new.o \
- cap_getrights.o \
+ __cap_rights_get.o \
cap_enter.o \
cap_getmode.o \
pdfork.o \
@@ -396,4 +398,19 @@
rctl_remove_rule.o \
posix_fallocate.o \
posix_fadvise.o \
- wait6.o
+ wait6.o \
+ cap_rights_limit.o \
+ cap_ioctls_limit.o \
+ cap_ioctls_get.o \
+ cap_fcntls_limit.o \
+ cap_fcntls_get.o \
+ bindat.o \
+ connectat.o \
+ chflagsat.o \
+ accept4.o \
+ pipe2.o \
+ aio_mlock.o \
+ procctl.o \
+ ppoll.o \
+ futimens.o \
+ utimensat.o
Modified: trunk/sys/sys/syscallsubr.h
===================================================================
--- trunk/sys/sys/syscallsubr.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/syscallsubr.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2002 Ian Dowse. All rights reserved.
*
@@ -22,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/syscallsubr.h 321009 2017-07-15 14:48:31Z dchagin $
*/
#ifndef _SYS_SYSCALLSUBR_H_
@@ -46,6 +47,7 @@
struct mbuf;
struct msghdr;
struct msqid_ds;
+struct pollfd;
struct ogetdirentries_args;
struct rlimit;
struct rusage;
@@ -54,12 +56,15 @@
struct sockaddr;
struct stat;
struct thr_param;
+struct sched_param;
struct __wrusage;
-int kern___getcwd(struct thread *td, u_char *buf, enum uio_seg bufseg,
- u_int buflen);
+int kern___getcwd(struct thread *td, char *buf, enum uio_seg bufseg,
+ u_int buflen, u_int path_max);
int kern_accept(struct thread *td, int s, struct sockaddr **name,
socklen_t *namelen, struct file **fp);
+int kern_accept4(struct thread *td, int s, struct sockaddr **name,
+ socklen_t *namelen, int flags, struct file **fp);
int kern_access(struct thread *td, char *path, enum uio_seg pathseg,
int flags);
int kern_accessat(struct thread *td, int fd, char *path,
@@ -69,11 +74,15 @@
int kern_alternate_path(struct thread *td, const char *prefix, const char *path,
enum uio_seg pathseg, char **pathbuf, int create, int dirfd);
int kern_bind(struct thread *td, int fd, struct sockaddr *sa);
+int kern_cap_ioctls_limit(struct thread *td, int fd, u_long *cmds,
+ size_t ncmds);
int kern_chdir(struct thread *td, char *path, enum uio_seg pathseg);
int kern_chmod(struct thread *td, char *path, enum uio_seg pathseg,
int mode);
int kern_chown(struct thread *td, char *path, enum uio_seg pathseg, int uid,
int gid);
+int kern_clock_getcpuclockid2(struct thread *td, id_t id, int which,
+ clockid_t *clk_id);
int kern_clock_getres(struct thread *td, clockid_t clock_id,
struct timespec *ts);
int kern_clock_gettime(struct thread *td, clockid_t clock_id,
@@ -91,6 +100,8 @@
int kern_fchownat(struct thread *td, int fd, char *path,
enum uio_seg pathseg, int uid, int gid, int flag);
int kern_fcntl(struct thread *td, int fd, int cmd, intptr_t arg);
+int kern_fcntl_freebsd(struct thread *td, int fd, int cmd, long arg);
+int kern_fhstat(struct thread *td, fhandle_t fh, struct stat *buf);
int kern_fhstatfs(struct thread *td, fhandle_t fh, struct statfs *buf);
int kern_fstat(struct thread *td, int fd, struct stat *sbp);
int kern_fstatfs(struct thread *td, int fd, struct statfs *buf);
@@ -97,8 +108,10 @@
int kern_ftruncate(struct thread *td, int fd, off_t length);
int kern_futimes(struct thread *td, int fd, struct timeval *tptr,
enum uio_seg tptrseg);
+int kern_futimens(struct thread *td, int fd, struct timespec *tptr,
+ enum uio_seg tptrseg);
int kern_getdirentries(struct thread *td, int fd, char *buf, u_int count,
- long *basep);
+ long *basep, ssize_t *residp, enum uio_seg bufseg);
int kern_getfsstat(struct thread *td, struct statfs **buf, size_t bufsize,
enum uio_seg bufseg, int flags);
int kern_getgroups(struct thread *td, u_int *ngrp, gid_t *groups);
@@ -116,6 +129,10 @@
int kern_jail_set(struct thread *td, struct uio *options, int flags);
int kern_kevent(struct thread *td, int fd, int nchanges, int nevents,
struct kevent_copyops *k_ops, const struct timespec *timeout);
+int kern_kevent_fp(struct thread *td, struct file *fp, int nchanges,
+ int nevents, struct kevent_copyops *k_ops,
+ const struct timespec *timeout);
+int kern_kqueue(struct thread *td, int flags);
int kern_kldload(struct thread *td, const char *file, int *fileid);
int kern_kldstat(struct thread *td, int fileid, struct kld_file_stat *stat);
int kern_kldunload(struct thread *td, int fileid, int flags);
@@ -142,8 +159,8 @@
int kern_mknodat(struct thread *td, int fd, char *path,
enum uio_seg pathseg, int mode, int dev);
int kern_msgctl(struct thread *, int, int, struct msqid_ds *);
+int kern_msgrcv(struct thread *, int, void *, size_t, long, int, long *);
int kern_msgsnd(struct thread *, int, const void *, size_t, int, long);
-int kern_msgrcv(struct thread *, int, void *, size_t, long, int, long *);
int kern_nanosleep(struct thread *td, struct timespec *rqt,
struct timespec *rmt);
int kern_ogetdirentries(struct thread *td, struct ogetdirentries_args *uap,
@@ -155,10 +172,15 @@
int kern_pathconf(struct thread *td, char *path, enum uio_seg pathseg,
int name, u_long flags);
int kern_pipe(struct thread *td, int fildes[2]);
+int kern_pipe2(struct thread *td, int fildes[2], int flags);
+int kern_poll(struct thread *td, struct pollfd *fds, u_int nfds,
+ struct timespec *tsp, sigset_t *uset);
int kern_posix_fadvise(struct thread *td, int fd, off_t offset, off_t len,
int advice);
int kern_posix_fallocate(struct thread *td, int fd, off_t offset,
off_t len);
+int kern_procctl(struct thread *td, enum idtype idtype, id_t id, int com,
+ void *data);
int kern_preadv(struct thread *td, int fd, struct uio *auio, off_t offset);
int kern_pselect(struct thread *td, int nd, fd_set *in, fd_set *ou,
fd_set *ex, struct timeval *tvp, sigset_t *uset, int abi_nfdbits);
@@ -179,8 +201,18 @@
int kern_rmdir(struct thread *td, char *path, enum uio_seg pathseg);
int kern_rmdirat(struct thread *td, int fd, char *path,
enum uio_seg pathseg);
+int kern_sched_getparam(struct thread *td, struct thread *targettd,
+ struct sched_param *param);
+int kern_sched_getscheduler(struct thread *td, struct thread *targettd,
+ int *policy);
+int kern_sched_setparam(struct thread *td, struct thread *targettd,
+ struct sched_param *param);
+int kern_sched_setscheduler(struct thread *td, struct thread *targettd,
+ int policy, struct sched_param *param);
int kern_sched_rr_get_interval(struct thread *td, pid_t pid,
struct timespec *ts);
+int kern_sched_rr_get_interval_td(struct thread *td, struct thread *targettd,
+ struct timespec *ts);
int kern_semctl(struct thread *td, int semid, int semnum, int cmd,
union semun *arg, register_t *rval);
int kern_select(struct thread *td, int nd, fd_set *fd_in, fd_set *fd_ou,
@@ -211,6 +243,8 @@
struct ksiginfo *ksi, struct timespec *timeout);
int kern_stat(struct thread *td, char *path, enum uio_seg pathseg,
struct stat *sbp);
+int kern_sigqueue(struct thread *td, pid_t pid, int signum,
+ union sigval *value);
int kern_statat(struct thread *td, int flag, int fd, char *path,
enum uio_seg pathseg, struct stat *sbp);
int kern_statat_vnhook(struct thread *td, int flag, int fd, char *path,
@@ -222,6 +256,16 @@
enum uio_seg segflg);
int kern_symlinkat(struct thread *td, char *path1, int fd, char *path2,
enum uio_seg segflg);
+int kern_ktimer_create(struct thread *td, clockid_t clock_id,
+ struct sigevent *evp, int *timerid, int preset_id);
+int kern_ktimer_delete(struct thread *, int);
+int kern_ktimer_settime(struct thread *td, int timer_id, int flags,
+ struct itimerspec *val, struct itimerspec *oval);
+int kern_ktimer_gettime(struct thread *td, int timer_id,
+ struct itimerspec *val);
+int kern_ktimer_getoverrun(struct thread *td, int timer_id);
+int kern_thr_alloc(struct proc *, int pages, struct thread **);
+int kern_thr_exit(struct thread *td);
int kern_thr_new(struct thread *td, struct thr_param *param);
int kern_thr_suspend(struct thread *td, struct timespec *tsp);
int kern_truncate(struct thread *td, char *path, enum uio_seg pathseg,
@@ -233,6 +277,9 @@
struct timeval *tptr, enum uio_seg tptrseg);
int kern_utimesat(struct thread *td, int fd, char *path,
enum uio_seg pathseg, struct timeval *tptr, enum uio_seg tptrseg);
+int kern_utimensat(struct thread *td, int fd, char *path,
+ enum uio_seg pathseg, struct timespec *tptr, enum uio_seg tptrseg,
+ int follow);
int kern_wait(struct thread *td, pid_t pid, int *status, int options,
struct rusage *rup);
int kern_wait6(struct thread *td, enum idtype idtype, id_t id, int *status,
Modified: trunk/sys/sys/sysctl.h
===================================================================
--- trunk/sys/sys/sysctl.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/sysctl.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
@@ -30,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)sysctl.h 8.1 (Berkeley) 6/2/93
- * $MidnightBSD: src/sys/sys/sysctl.h,v 1.14 2013/01/03 04:05:06 laffer1 Exp $
+ * $FreeBSD: stable/10/sys/sys/sysctl.h 324749 2017-10-19 08:00:34Z avg $
*/
#ifndef _SYS_SYSCTL_H_
@@ -48,7 +49,7 @@
* respective subsystem header files.
*/
-#define CTL_MAXNAME 24 /* largest number of components supported */
+#define CTL_MAXNAME 24 /* largest number of components supported */
/*
* Each subsystem defined by sysctl defines a list of variables
@@ -59,10 +60,10 @@
*/
struct ctlname {
char *ctl_name; /* subsystem name */
- int ctl_type; /* type of name */
+ int ctl_type; /* type of name */
};
-#define CTLTYPE 0xf /* Mask for the type */
+#define CTLTYPE 0xf /* mask for the type */
#define CTLTYPE_NODE 1 /* name is a node */
#define CTLTYPE_INT 2 /* name describes an integer */
#define CTLTYPE_STRING 3 /* name describes a string */
@@ -74,34 +75,37 @@
#define CTLTYPE_ULONG 8 /* name describes an unsigned long */
#define CTLTYPE_U64 9 /* name describes an unsigned 64-bit number */
-#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_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 */
-#define CTLFLAG_DYN 0x02000000 /* Dynamic oid - can be freed */
-#define CTLFLAG_SKIP 0x01000000 /* Skip this sysctl when listing */
-#define CTLMASK_SECURE 0x00F00000 /* Secure level */
-#define CTLFLAG_TUN 0x00080000 /* Tunable variable */
+#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 */
+#define CTLFLAG_DYN 0x02000000 /* Dynamic oid - can be freed */
+#define CTLFLAG_SKIP 0x01000000 /* Skip this sysctl when listing */
+#define CTLMASK_SECURE 0x00F00000 /* Secure level */
+#define CTLFLAG_TUN 0x00080000 /* Tunable variable */
#define CTLFLAG_RDTUN (CTLFLAG_RD|CTLFLAG_TUN)
#define CTLFLAG_RWTUN (CTLFLAG_RW|CTLFLAG_TUN)
-#define CTLFLAG_MPSAFE 0x00040000 /* Handler is MP safe */
-#define CTLFLAG_VNET 0x00020000 /* Prisons with vnet can fiddle */
-#define CTLFLAG_DYING 0x00010000 /* oid is being removed */
-#define CTLFLAG_CAPRD 0x00008000 /* Can be read in capability mode */
-#define CTLFLAG_CAPWR 0x00004000 /* Can be written in capability mode */
-#define CTLFLAG_CAPRW (CTLFLAG_CAPRD|CTLFLAG_CAPWR)
+#define CTLFLAG_MPSAFE 0x00040000 /* Handler is MP safe */
+#define CTLFLAG_VNET 0x00020000 /* Prisons with vnet can fiddle */
+#define CTLFLAG_DYING 0x00010000 /* Oid is being removed */
+#define CTLFLAG_CAPRD 0x00008000 /* Can be read in capability mode */
+#define CTLFLAG_CAPWR 0x00004000 /* Can be written in capability mode */
+#define CTLFLAG_STATS 0x00002000 /* Statistics, not a tuneable */
+#define CTLFLAG_NOFETCH 0x00001000 /* Don't fetch tunable from getenv() */
+#define CTLFLAG_CAPRW (CTLFLAG_CAPRD|CTLFLAG_CAPWR)
/*
- * Secure level. Note that CTLFLAG_SECURE == CTLFLAG_SECURE1.
+ * Secure level. Note that CTLFLAG_SECURE == CTLFLAG_SECURE1.
*
* Secure when the securelevel is raised to at least N.
*/
-#define CTLSHIFT_SECURE 20
-#define CTLFLAG_SECURE1 (CTLFLAG_SECURE | (0 << CTLSHIFT_SECURE))
-#define CTLFLAG_SECURE2 (CTLFLAG_SECURE | (1 << CTLSHIFT_SECURE))
-#define CTLFLAG_SECURE3 (CTLFLAG_SECURE | (2 << CTLSHIFT_SECURE))
+#define CTLSHIFT_SECURE 20
+#define CTLFLAG_SECURE1 (CTLFLAG_SECURE | (0 << CTLSHIFT_SECURE))
+#define CTLFLAG_SECURE2 (CTLFLAG_SECURE | (1 << CTLSHIFT_SECURE))
+#define CTLFLAG_SECURE3 (CTLFLAG_SECURE | (2 << CTLSHIFT_SECURE))
/*
* USE THIS instead of a hardwired number from the categories below
@@ -109,19 +113,26 @@
* technology. This is the way nearly all new sysctl variables should
* be implemented.
* e.g. SYSCTL_INT(_parent, OID_AUTO, name, CTLFLAG_RW, &variable, 0, "");
- */
-#define OID_AUTO (-1)
+ */
+#define OID_AUTO (-1)
/*
* The starting number for dynamically-assigned entries. WARNING!
* ALL static sysctl entries should have numbers LESS than this!
*/
-#define CTL_AUTO_START 0x100
+#define CTL_AUTO_START 0x100
#ifdef _KERNEL
#include <sys/linker_set.h>
-#define SYSCTL_HANDLER_ARGS struct sysctl_oid *oidp, void *arg1, \
+#ifdef KLD_MODULE
+/* XXX allow overspecification of type in external kernel modules */
+#define SYSCTL_CT_ASSERT_MASK CTLTYPE
+#else
+#define SYSCTL_CT_ASSERT_MASK 0
+#endif
+
+#define SYSCTL_HANDLER_ARGS struct sysctl_oid *oidp, void *arg1, \
intptr_t arg2, struct sysctl_req *req
/* definitions for sysctl_req 'lock' member */
@@ -129,7 +140,8 @@
#define REQ_WIRED 2
/* definitions for sysctl_req 'flags' member */
-#if defined(__amd64__) || defined(__ia64__) || defined(__powerpc64__)
+#if defined(__amd64__) || defined(__ia64__) || defined(__powerpc64__) ||\
+ (defined(__mips__) && defined(__mips_n64))
#define SCTL_MASK32 1 /* 32 bit emulation */
#endif
@@ -139,17 +151,17 @@
*/
struct sysctl_req {
struct thread *td; /* used for access checking */
- int lock; /* wiring state */
+ int lock; /* wiring state */
void *oldptr;
- size_t oldlen;
- size_t oldidx;
+ size_t oldlen;
+ size_t oldidx;
int (*oldfunc)(struct sysctl_req *, const void *, size_t);
void *newptr;
- size_t newlen;
- size_t newidx;
+ size_t newlen;
+ size_t newidx;
int (*newfunc)(struct sysctl_req *, void *, size_t);
- size_t validlen;
- int flags;
+ size_t validlen;
+ int flags;
};
SLIST_HEAD(sysctl_oid_list, sysctl_oid);
@@ -161,20 +173,20 @@
struct sysctl_oid {
struct sysctl_oid_list *oid_parent;
SLIST_ENTRY(sysctl_oid) oid_link;
- int oid_number;
- u_int oid_kind;
+ int oid_number;
+ u_int oid_kind;
void *oid_arg1;
- intptr_t oid_arg2;
+ intptr_t oid_arg2;
const char *oid_name;
- int (*oid_handler)(SYSCTL_HANDLER_ARGS);
+ int (*oid_handler)(SYSCTL_HANDLER_ARGS);
const char *oid_fmt;
- int oid_refcnt;
- u_int oid_running;
+ int oid_refcnt;
+ u_int oid_running;
const char *oid_descr;
};
-#define SYSCTL_IN(r, p, l) (r->newfunc)(r, p, l)
-#define SYSCTL_OUT(r, p, l) (r->oldfunc)(r, p, l)
+#define SYSCTL_IN(r, p, l) (r->newfunc)(r, p, l)
+#define SYSCTL_OUT(r, p, l) (r->oldfunc)(r, p, l)
int sysctl_handle_int(SYSCTL_HANDLER_ARGS);
int sysctl_msec_to_ticks(SYSCTL_HANDLER_ARGS);
@@ -182,7 +194,11 @@
int sysctl_handle_64(SYSCTL_HANDLER_ARGS);
int sysctl_handle_string(SYSCTL_HANDLER_ARGS);
int sysctl_handle_opaque(SYSCTL_HANDLER_ARGS);
+int sysctl_handle_counter_u64(SYSCTL_HANDLER_ARGS);
+int sysctl_handle_uma_zone_max(SYSCTL_HANDLER_ARGS);
+int sysctl_handle_uma_zone_cur(SYSCTL_HANDLER_ARGS);
+
int sysctl_dpcpu_int(SYSCTL_HANDLER_ARGS);
int sysctl_dpcpu_long(SYSCTL_HANDLER_ARGS);
int sysctl_dpcpu_quad(SYSCTL_HANDLER_ARGS);
@@ -191,21 +207,22 @@
* 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. */
-#define SYSCTL_DECL(name) \
+#define SYSCTL_DECL(name) \
extern struct sysctl_oid_list sysctl_##name##_children
-/* Hide these in macros */
-#define SYSCTL_CHILDREN(oid_ptr) (struct sysctl_oid_list *) \
- (oid_ptr)->oid_arg1
-#define SYSCTL_CHILDREN_SET(oid_ptr, val) \
- (oid_ptr)->oid_arg1 = (val);
-#define SYSCTL_STATIC_CHILDREN(oid_name) \
- (&sysctl_##oid_name##_children)
+/* Hide these in macros. */
+#define SYSCTL_CHILDREN(oid_ptr) \
+ (struct sysctl_oid_list *)(oid_ptr)->oid_arg1
+#define SYSCTL_PARENT(oid_ptr) NULL /* not supported */
+#define SYSCTL_CHILDREN_SET(oid_ptr, val) (oid_ptr)->oid_arg1 = (val)
+#define SYSCTL_STATIC_CHILDREN(oid_name) (&sysctl_##oid_name##_children)
-/* === Structs and macros related to context handling === */
+/* === Structs and macros related to context handling. === */
/* All dynamically created sysctls can be tracked in a context list. */
struct sysctl_ctx_entry {
@@ -215,204 +232,325 @@
TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry);
-#define SYSCTL_NODE_CHILDREN(parent, name) \
+#define SYSCTL_NODE_CHILDREN(parent, name) \
sysctl_##parent##_##name##_children
-/*
- * These macros provide type safety for sysctls. SYSCTL_ALLOWED_TYPES()
- * defines a transparent union of the allowed types. SYSCTL_ASSERT_TYPE()
- * and SYSCTL_ADD_ASSERT_TYPE() use the transparent union to assert that
- * the pointer matches the allowed types.
- *
- * The allow_0 member allows a literal 0 to be passed for ptr.
- */
-#define SYSCTL_ALLOWED_TYPES(type, decls) \
- union sysctl_##type { \
- long allow_0; \
- decls \
- } __attribute__((__transparent_union__)); \
- \
- static inline void * \
- __sysctl_assert_##type(union sysctl_##type ptr) \
- { \
- return (ptr.a); \
- } \
- struct __hack
-
-SYSCTL_ALLOWED_TYPES(INT, int *a; );
-SYSCTL_ALLOWED_TYPES(UINT, unsigned int *a; );
-SYSCTL_ALLOWED_TYPES(LONG, long *a; );
-SYSCTL_ALLOWED_TYPES(ULONG, unsigned long *a; );
-SYSCTL_ALLOWED_TYPES(INT64, int64_t *a; long long *b; );
-SYSCTL_ALLOWED_TYPES(UINT64, uint64_t *a; unsigned long long *b; );
-
-#ifdef notyet
-#define SYSCTL_ADD_ASSERT_TYPE(type, ptr) \
- __sysctl_assert_ ## type (ptr)
-#define SYSCTL_ASSERT_TYPE(type, ptr, parent, name) \
- _SYSCTL_ASSERT_TYPE(type, ptr, __LINE__, parent##_##name)
-#else
-#define SYSCTL_ADD_ASSERT_TYPE(type, ptr) ptr
-#define SYSCTL_ASSERT_TYPE(type, ptr, parent, name)
-#endif
-#define _SYSCTL_ASSERT_TYPE(t, p, l, id) \
- __SYSCTL_ASSERT_TYPE(t, p, l, id)
-#define __SYSCTL_ASSERT_TYPE(type, ptr, line, id) \
- static inline void \
- sysctl_assert_##line##_##id(void) \
- { \
- (void)__sysctl_assert_##type(ptr); \
- } \
- struct __hack
-
#ifndef NO_SYSCTL_DESCR
-#define __DESCR(d) d
+#define __DESCR(d) d
#else
-#define __DESCR(d) ""
+#define __DESCR(d) ""
#endif
/* This constructs a "raw" MIB oid. */
-#define SYSCTL_OID(parent, nbr, name, kind, a1, a2, handler, fmt, descr) \
- static struct sysctl_oid sysctl__##parent##_##name = { \
- &sysctl_##parent##_children, { NULL }, nbr, kind, \
- a1, a2, #name, handler, fmt, 0, 0, __DESCR(descr) }; \
+#define SYSCTL_OID(parent, nbr, name, kind, a1, a2, handler, fmt, descr)\
+ static struct sysctl_oid sysctl__##parent##_##name = { \
+ &sysctl_##parent##_children, \
+ { NULL }, \
+ nbr, \
+ kind, \
+ a1, \
+ a2, \
+ #name, \
+ handler, \
+ fmt, \
+ 0, \
+ 0, \
+ __DESCR(descr) \
+ }; \
DATA_SET(sysctl_set, sysctl__##parent##_##name)
-#define SYSCTL_ADD_OID(ctx, parent, nbr, name, kind, a1, a2, handler, fmt, descr) \
+#define SYSCTL_ADD_OID(ctx, parent, nbr, name, kind, a1, a2, handler, fmt, descr) \
sysctl_add_oid(ctx, parent, nbr, name, kind, a1, a2, handler, fmt, __DESCR(descr))
+/* This constructs a root node from which other nodes can hang. */
+#define SYSCTL_ROOT_NODE(nbr, name, access, handler, descr) \
+ SYSCTL_NODE(, nbr, name, access, handler, descr); \
+ CTASSERT(((access) & CTLTYPE) == 0 || \
+ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_NODE)
+
/* This constructs a node from which other oids can hang. */
-#define SYSCTL_NODE(parent, nbr, name, access, handler, descr) \
+#define SYSCTL_NODE(parent, nbr, name, access, handler, descr) \
struct sysctl_oid_list SYSCTL_NODE_CHILDREN(parent, name); \
SYSCTL_OID(parent, nbr, name, CTLTYPE_NODE|(access), \
- (void*)&SYSCTL_NODE_CHILDREN(parent, name), 0, handler, "N", descr)
+ (void*)&SYSCTL_NODE_CHILDREN(parent, name), 0, handler, "N", descr); \
+ CTASSERT(((access) & CTLTYPE) == 0 || \
+ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_NODE)
-#define SYSCTL_ADD_NODE(ctx, parent, nbr, name, access, handler, descr) \
- sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_NODE|(access), \
- NULL, 0, handler, "N", __DESCR(descr))
+#define SYSCTL_ADD_ROOT_NODE(ctx, nbr, name, access, handler, descr) \
+ SYSCTL_ADD_NODE(ctx, SYSCTL_STATIC_CHILDREN(), nbr, name, access, handler, descr)
+#define SYSCTL_ADD_NODE(ctx, parent, nbr, name, access, handler, descr) \
+({ \
+ CTASSERT(((access) & CTLTYPE) == 0 || \
+ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_NODE); \
+ sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_NODE|(access), \
+ NULL, 0, handler, "N", __DESCR(descr)); \
+})
+
/* Oid for a string. len can be 0 to indicate '\0' termination. */
-#define SYSCTL_STRING(parent, nbr, name, access, arg, len, descr) \
- SYSCTL_OID(parent, nbr, name, CTLTYPE_STRING|(access), \
- arg, len, sysctl_handle_string, "A", descr)
+#define SYSCTL_STRING(parent, nbr, name, access, arg, len, descr) \
+ SYSCTL_OID(parent, nbr, name, CTLTYPE_STRING|(access), \
+ arg, len, sysctl_handle_string, "A", descr); \
+ CTASSERT(((access) & CTLTYPE) == 0 || \
+ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_STRING)
-#define SYSCTL_ADD_STRING(ctx, parent, nbr, name, access, arg, len, descr) \
- sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_STRING|(access), \
- arg, len, sysctl_handle_string, "A", __DESCR(descr))
+#define SYSCTL_ADD_STRING(ctx, parent, nbr, name, access, arg, len, descr) \
+({ \
+ char *__arg = (arg); \
+ CTASSERT(((access) & CTLTYPE) == 0 || \
+ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_STRING); \
+ sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_STRING|(access), \
+ __arg, len, sysctl_handle_string, "A", __DESCR(descr)); \
+})
-/* Oid for an int. If ptr is NULL, val is returned. */
-#define SYSCTL_INT(parent, nbr, name, access, ptr, val, descr) \
- SYSCTL_ASSERT_TYPE(INT, ptr, parent, name); \
- SYSCTL_OID(parent, nbr, name, \
- CTLTYPE_INT | CTLFLAG_MPSAFE | (access), \
- ptr, val, sysctl_handle_int, "I", descr)
+/* Oid for an int. If ptr is SYSCTL_NULL_INT_PTR, val is returned. */
+#define SYSCTL_NULL_INT_PTR ((int *)NULL)
+#define SYSCTL_INT(parent, nbr, name, access, ptr, val, descr) \
+ SYSCTL_OID(parent, nbr, name, \
+ CTLTYPE_INT | CTLFLAG_MPSAFE | (access), \
+ ptr, val, sysctl_handle_int, "I", descr); \
+ CTASSERT(((access) & CTLTYPE) == 0 || \
+ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_INT); \
+ CTASSERT(sizeof(int) == sizeof(*(ptr)))
#define SYSCTL_ADD_INT(ctx, parent, nbr, name, access, ptr, val, descr) \
+({ \
+ int *__ptr = (ptr); \
+ CTASSERT(((access) & CTLTYPE) == 0 || \
+ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_INT); \
sysctl_add_oid(ctx, parent, nbr, name, \
CTLTYPE_INT | CTLFLAG_MPSAFE | (access), \
- SYSCTL_ADD_ASSERT_TYPE(INT, ptr), val, \
- sysctl_handle_int, "I", __DESCR(descr))
+ __ptr, val, sysctl_handle_int, "I", __DESCR(descr)); \
+})
/* Oid for an unsigned int. If ptr is NULL, val is returned. */
-#define SYSCTL_UINT(parent, nbr, name, access, ptr, val, descr) \
- SYSCTL_ASSERT_TYPE(UINT, ptr, parent, name); \
- SYSCTL_OID(parent, nbr, name, \
- CTLTYPE_UINT | CTLFLAG_MPSAFE | (access), \
- ptr, val, sysctl_handle_int, "IU", descr)
+#define SYSCTL_NULL_UINT_PTR ((unsigned *)NULL)
+#define SYSCTL_UINT(parent, nbr, name, access, ptr, val, descr) \
+ SYSCTL_OID(parent, nbr, name, \
+ CTLTYPE_UINT | CTLFLAG_MPSAFE | (access), \
+ ptr, val, sysctl_handle_int, "IU", descr); \
+ CTASSERT(((access) & CTLTYPE) == 0 || \
+ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_UINT);\
+ CTASSERT(sizeof(unsigned) == sizeof(*(ptr)))
#define SYSCTL_ADD_UINT(ctx, parent, nbr, name, access, ptr, val, descr) \
+({ \
+ unsigned *__ptr = (ptr); \
+ CTASSERT(((access) & CTLTYPE) == 0 || \
+ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_UINT); \
sysctl_add_oid(ctx, parent, nbr, name, \
CTLTYPE_UINT | CTLFLAG_MPSAFE | (access), \
- SYSCTL_ADD_ASSERT_TYPE(UINT, ptr), val, \
- sysctl_handle_int, "IU", __DESCR(descr))
+ __ptr, val, sysctl_handle_int, "IU", __DESCR(descr)); \
+})
/* Oid for a long. The pointer must be non NULL. */
-#define SYSCTL_LONG(parent, nbr, name, access, ptr, val, descr) \
- SYSCTL_ASSERT_TYPE(LONG, ptr, parent, name); \
- SYSCTL_OID(parent, nbr, name, \
- CTLTYPE_LONG | CTLFLAG_MPSAFE | (access), \
- ptr, val, sysctl_handle_long, "L", descr)
+#define SYSCTL_NULL_LONG_PTR ((long *)NULL)
+#define SYSCTL_LONG(parent, nbr, name, access, ptr, val, descr) \
+ SYSCTL_OID(parent, nbr, name, \
+ CTLTYPE_LONG | CTLFLAG_MPSAFE | (access), \
+ ptr, val, sysctl_handle_long, "L", descr); \
+ CTASSERT(((access) & CTLTYPE) == 0 || \
+ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_LONG);\
+ CTASSERT(sizeof(long) == sizeof(*(ptr)))
#define SYSCTL_ADD_LONG(ctx, parent, nbr, name, access, ptr, descr) \
+({ \
+ long *__ptr = (ptr); \
+ CTASSERT(((access) & CTLTYPE) == 0 || \
+ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_LONG); \
sysctl_add_oid(ctx, parent, nbr, name, \
CTLTYPE_LONG | CTLFLAG_MPSAFE | (access), \
- SYSCTL_ADD_ASSERT_TYPE(LONG, ptr), 0, \
- sysctl_handle_long, "L", __DESCR(descr))
+ __ptr, 0, sysctl_handle_long, "L", __DESCR(descr)); \
+})
/* Oid for an unsigned long. The pointer must be non NULL. */
+#define SYSCTL_NULL_ULONG_PTR ((unsigned long *)NULL)
#define SYSCTL_ULONG(parent, nbr, name, access, ptr, val, descr) \
- SYSCTL_ASSERT_TYPE(ULONG, ptr, parent, name); \
SYSCTL_OID(parent, nbr, name, \
CTLTYPE_ULONG | CTLFLAG_MPSAFE | (access), \
- ptr, val, sysctl_handle_long, "LU", descr)
+ ptr, val, sysctl_handle_long, "LU", descr); \
+ CTASSERT(((access) & CTLTYPE) == 0 || \
+ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_ULONG); \
+ CTASSERT(sizeof(unsigned long) == sizeof(*(ptr)))
#define SYSCTL_ADD_ULONG(ctx, parent, nbr, name, access, ptr, descr) \
+({ \
+ unsigned long *__ptr = (ptr); \
+ CTASSERT(((access) & CTLTYPE) == 0 || \
+ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_ULONG); \
sysctl_add_oid(ctx, parent, nbr, name, \
CTLTYPE_ULONG | CTLFLAG_MPSAFE | (access), \
- SYSCTL_ADD_ASSERT_TYPE(ULONG, ptr), 0, \
- sysctl_handle_long, "LU", __DESCR(descr))
+ __ptr, 0, sysctl_handle_long, "LU", __DESCR(descr)); \
+})
/* Oid for a quad. The pointer must be non NULL. */
-#define SYSCTL_QUAD(parent, nbr, name, access, ptr, val, descr) \
- SYSCTL_ASSERT_TYPE(INT64, ptr, parent, name); \
- SYSCTL_OID(parent, nbr, name, \
- CTLTYPE_S64 | CTLFLAG_MPSAFE | (access), \
- ptr, val, sysctl_handle_64, "Q", descr)
+#define SYSCTL_NULL_QUAD_PTR ((int64_t *)NULL)
+#define SYSCTL_QUAD(parent, nbr, name, access, ptr, val, descr) \
+ SYSCTL_OID(parent, nbr, name, \
+ CTLTYPE_S64 | CTLFLAG_MPSAFE | (access), \
+ ptr, val, sysctl_handle_64, "Q", descr); \
+ CTASSERT(((access) & CTLTYPE) == 0 || \
+ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_S64); \
+ CTASSERT(sizeof(int64_t) == sizeof(*(ptr)))
#define SYSCTL_ADD_QUAD(ctx, parent, nbr, name, access, ptr, descr) \
+({ \
+ int64_t *__ptr = (ptr); \
+ CTASSERT(((access) & CTLTYPE) == 0 || \
+ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_S64); \
sysctl_add_oid(ctx, parent, nbr, name, \
CTLTYPE_S64 | CTLFLAG_MPSAFE | (access), \
- SYSCTL_ADD_ASSERT_TYPE(INT64, ptr), 0, \
- sysctl_handle_64, "Q", __DESCR(descr))
+ __ptr, 0, sysctl_handle_64, "Q", __DESCR(descr)); \
+})
+#define SYSCTL_NULL_UQUAD_PTR ((uint64_t *)NULL)
#define SYSCTL_UQUAD(parent, nbr, name, access, ptr, val, descr) \
- SYSCTL_ASSERT_TYPE(UINT64, ptr, parent, name); \
SYSCTL_OID(parent, nbr, name, \
CTLTYPE_U64 | CTLFLAG_MPSAFE | (access), \
- ptr, val, sysctl_handle_64, "QU", descr)
+ ptr, val, sysctl_handle_64, "QU", descr); \
+ CTASSERT(((access) & CTLTYPE) == 0 || \
+ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U64); \
+ CTASSERT(sizeof(uint64_t) == sizeof(*(ptr)))
#define SYSCTL_ADD_UQUAD(ctx, parent, nbr, name, access, ptr, descr) \
+({ \
+ uint64_t *__ptr = (ptr); \
+ CTASSERT(((access) & CTLTYPE) == 0 || \
+ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U64); \
sysctl_add_oid(ctx, parent, nbr, name, \
CTLTYPE_U64 | CTLFLAG_MPSAFE | (access), \
- SYSCTL_ADD_ASSERT_TYPE(UINT64, ptr), 0, \
- sysctl_handle_64, "QU", __DESCR(descr))
+ __ptr, 0, sysctl_handle_64, "QU", __DESCR(descr)); \
+})
+/* Oid for a CPU dependent variable */
+#define SYSCTL_ADD_UAUTO(ctx, parent, nbr, name, access, ptr, descr) \
+({ \
+ struct sysctl_oid *__ret; \
+ CTASSERT(sizeof(uint64_t) == sizeof(*(ptr)) || \
+ sizeof(unsigned) == sizeof(*(ptr))); \
+ CTASSERT(((access) & CTLTYPE) == 0); \
+ if (sizeof(uint64_t) == sizeof(*(ptr))) { \
+ __ret = sysctl_add_oid(ctx, parent, nbr, name, \
+ CTLTYPE_U64 | CTLFLAG_MPSAFE | (access), \
+ (ptr), 0, sysctl_handle_64, "QU", \
+ __DESCR(descr)); \
+ } else { \
+ __ret = sysctl_add_oid(ctx, parent, nbr, name, \
+ CTLTYPE_UINT | CTLFLAG_MPSAFE | (access), \
+ (ptr), 0, sysctl_handle_int, "IU", \
+ __DESCR(descr)); \
+ } \
+ __ret; \
+})
+
+/* Oid for a 64-bit unsigned counter(9). The pointer must be non NULL. */
+#define SYSCTL_COUNTER_U64(parent, nbr, name, access, ptr, descr) \
+ SYSCTL_OID(parent, nbr, name, \
+ CTLTYPE_U64 | CTLFLAG_MPSAFE | (access), \
+ (ptr), 0, sysctl_handle_counter_u64, "QU", descr); \
+ CTASSERT(((access) & CTLTYPE) == 0 || \
+ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U64); \
+ CTASSERT(sizeof(counter_u64_t) == sizeof(*(ptr))); \
+ CTASSERT(sizeof(uint64_t) == sizeof(**(ptr)))
+
+#define SYSCTL_ADD_COUNTER_U64(ctx, parent, nbr, name, access, ptr, descr) \
+({ \
+ counter_u64_t *__ptr = (ptr); \
+ CTASSERT(((access) & CTLTYPE) == 0 || \
+ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U64); \
+ sysctl_add_oid(ctx, parent, nbr, name, \
+ CTLTYPE_U64 | CTLFLAG_MPSAFE | (access), \
+ __ptr, 0, sysctl_handle_counter_u64, "QU", __DESCR(descr)); \
+})
+
/* Oid for an opaque object. Specified by a pointer and a length. */
-#define SYSCTL_OPAQUE(parent, nbr, name, access, ptr, len, fmt, descr) \
- SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|(access), \
- ptr, len, sysctl_handle_opaque, fmt, descr)
+#define SYSCTL_OPAQUE(parent, nbr, name, access, ptr, len, fmt, descr) \
+ SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|(access), \
+ ptr, len, sysctl_handle_opaque, fmt, descr); \
+ CTASSERT(((access) & CTLTYPE) == 0 || \
+ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_OPAQUE)
-#define SYSCTL_ADD_OPAQUE(ctx, parent, nbr, name, access, ptr, len, fmt, descr)\
- sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_OPAQUE|(access), \
- ptr, len, sysctl_handle_opaque, fmt, __DESCR(descr))
+#define SYSCTL_ADD_OPAQUE(ctx, parent, nbr, name, access, ptr, len, fmt, descr) \
+({ \
+ CTASSERT(((access) & CTLTYPE) == 0 || \
+ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_OPAQUE); \
+ sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_OPAQUE|(access), \
+ ptr, len, sysctl_handle_opaque, fmt, __DESCR(descr)); \
+})
/* Oid for a struct. Specified by a pointer and a type. */
-#define SYSCTL_STRUCT(parent, nbr, name, access, ptr, type, descr) \
- SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|(access), \
- ptr, sizeof(struct type), sysctl_handle_opaque, \
- "S," #type, descr)
+#define SYSCTL_STRUCT(parent, nbr, name, access, ptr, type, descr) \
+ SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|(access), \
+ ptr, sizeof(struct type), sysctl_handle_opaque, \
+ "S," #type, descr); \
+ CTASSERT(((access) & CTLTYPE) == 0 || \
+ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_OPAQUE)
-#define SYSCTL_ADD_STRUCT(ctx, parent, nbr, name, access, ptr, type, descr) \
- sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_OPAQUE|(access), \
- ptr, sizeof(struct type), sysctl_handle_opaque, "S," #type, __DESCR(descr))
+#define SYSCTL_ADD_STRUCT(ctx, parent, nbr, name, access, ptr, type, descr) \
+({ \
+ CTASSERT(((access) & CTLTYPE) == 0 || \
+ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_OPAQUE); \
+ sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_OPAQUE|(access), \
+ (ptr), sizeof(struct type), \
+ sysctl_handle_opaque, "S," #type, __DESCR(descr)); \
+})
/* Oid for a procedure. Specified by a pointer and an arg. */
-#define SYSCTL_PROC(parent, nbr, name, access, ptr, arg, handler, fmt, descr) \
+#define SYSCTL_PROC(parent, nbr, name, access, ptr, arg, handler, fmt, descr) \
+ SYSCTL_OID(parent, nbr, name, (access), \
+ ptr, arg, handler, fmt, descr); \
+ CTASSERT(((access) & CTLTYPE) != 0)
+
+#define SYSCTL_ADD_PROC(ctx, parent, nbr, name, access, ptr, arg, handler, fmt, descr) \
+({ \
CTASSERT(((access) & CTLTYPE) != 0); \
- SYSCTL_OID(parent, nbr, name, (access), \
- ptr, arg, handler, fmt, descr)
+ sysctl_add_oid(ctx, parent, nbr, name, (access), \
+ (ptr), (arg), (handler), (fmt), __DESCR(descr)); \
+})
-#define SYSCTL_ADD_PROC(ctx, parent, nbr, name, access, ptr, arg, handler, fmt, descr) \
- sysctl_add_oid(ctx, parent, nbr, name, (access), \
- ptr, arg, handler, fmt, __DESCR(descr))
+/* Oid to handle limits on uma(9) zone specified by pointer. */
+#define SYSCTL_UMA_MAX(parent, nbr, name, access, ptr, descr) \
+ SYSCTL_OID(parent, nbr, name, \
+ CTLTYPE_INT | CTLFLAG_MPSAFE | (access), \
+ (ptr), 0, sysctl_handle_uma_zone_max, "I", descr); \
+ CTASSERT(((access) & CTLTYPE) == 0 || \
+ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_INT)
+#define SYSCTL_ADD_UMA_MAX(ctx, parent, nbr, name, access, ptr, descr) \
+({ \
+ uma_zone_t __ptr = (ptr); \
+ CTASSERT(((access) & CTLTYPE) == 0 || \
+ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_INT); \
+ sysctl_add_oid(ctx, parent, nbr, name, \
+ CTLTYPE_INT | CTLFLAG_MPSAFE | (access), \
+ __ptr, 0, sysctl_handle_uma_zone_max, "I", __DESCR(descr)); \
+})
+
+/* Oid to obtain current use of uma(9) zone specified by pointer. */
+#define SYSCTL_UMA_CUR(parent, nbr, name, access, ptr, descr) \
+ SYSCTL_OID(parent, nbr, name, \
+ CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RD | (access), \
+ (ptr), 0, sysctl_handle_uma_zone_cur, "I", descr); \
+ CTASSERT(((access) & CTLTYPE) == 0 || \
+ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_INT)
+
+#define SYSCTL_ADD_UMA_CUR(ctx, parent, nbr, name, access, ptr, descr) \
+({ \
+ uma_zone_t __ptr = (ptr); \
+ CTASSERT(((access) & CTLTYPE) == 0 || \
+ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_INT); \
+ sysctl_add_oid(ctx, parent, nbr, name, \
+ CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RD | (access), \
+ __ptr, 0, sysctl_handle_uma_zone_cur, "I", __DESCR(descr)); \
+})
+
/*
- * A macro to generate a read-only sysctl to indicate the presense of optional
+ * A macro to generate a read-only sysctl to indicate the presence of optional
* kernel features.
*/
#define FEATURE(name, desc) \
SYSCTL_INT(_kern_features, OID_AUTO, name, CTLFLAG_RD | CTLFLAG_CAPRD, \
- 0, 1, desc)
+ SYSCTL_NULL_INT_PTR, 1, desc)
#endif /* _KERNEL */
@@ -431,31 +569,18 @@
#define CTL_P1003_1B 9 /* POSIX 1003.1B */
#define CTL_MAXID 10 /* number of valid top-level ids */
-#define CTL_NAMES { \
- { 0, 0 }, \
- { "kern", CTLTYPE_NODE }, \
- { "vm", CTLTYPE_NODE }, \
- { "vfs", CTLTYPE_NODE }, \
- { "net", CTLTYPE_NODE }, \
- { "debug", CTLTYPE_NODE }, \
- { "hw", CTLTYPE_NODE }, \
- { "machdep", CTLTYPE_NODE }, \
- { "user", CTLTYPE_NODE }, \
- { "p1003_1b", CTLTYPE_NODE }, \
-}
-
/*
* CTL_KERN identifiers
*/
-#define KERN_OSTYPE 1 /* string: system version */
-#define KERN_OSRELEASE 2 /* string: system release */
-#define KERN_OSREV 3 /* int: system revision */
-#define KERN_VERSION 4 /* string: compile time info */
-#define KERN_MAXVNODES 5 /* int: max vnodes */
-#define KERN_MAXPROC 6 /* int: max processes */
-#define KERN_MAXFILES 7 /* int: max open files */
-#define KERN_ARGMAX 8 /* int: max arguments to exec */
-#define KERN_SECURELVL 9 /* int: system security level */
+#define KERN_OSTYPE 1 /* string: system version */
+#define KERN_OSRELEASE 2 /* string: system release */
+#define KERN_OSREV 3 /* int: system revision */
+#define KERN_VERSION 4 /* string: compile time info */
+#define KERN_MAXVNODES 5 /* int: max vnodes */
+#define KERN_MAXPROC 6 /* int: max processes */
+#define KERN_MAXFILES 7 /* int: max open files */
+#define KERN_ARGMAX 8 /* int: max arguments to exec */
+#define KERN_SECURELVL 9 /* int: system security level */
#define KERN_HOSTNAME 10 /* string: hostname */
#define KERN_HOSTID 11 /* int: host identifier */
#define KERN_CLOCKRATE 12 /* struct: struct clockrate */
@@ -468,14 +593,14 @@
#define KERN_JOB_CONTROL 19 /* int: is job control available */
#define KERN_SAVED_IDS 20 /* int: saved set-user/group-ID */
#define KERN_BOOTTIME 21 /* struct: time kernel was booted */
-#define KERN_NISDOMAINNAME 22 /* string: YP domain name */
-#define KERN_UPDATEINTERVAL 23 /* int: update process sleep time */
-#define KERN_OSRELDATE 24 /* int: kernel release date */
-#define KERN_NTP_PLL 25 /* node: NTP PLL control */
+#define KERN_NISDOMAINNAME 22 /* string: YP domain name */
+#define KERN_UPDATEINTERVAL 23 /* int: update process sleep time */
+#define KERN_OSRELDATE 24 /* int: kernel release date */
+#define KERN_NTP_PLL 25 /* node: NTP PLL control */
#define KERN_BOOTFILE 26 /* string: name of booted kernel */
#define KERN_MAXFILESPERPROC 27 /* int: max open files per proc */
-#define KERN_MAXPROCPERUID 28 /* int: max processes per uid */
-#define KERN_DUMPDEV 29 /* struct cdev *: device to dump on */
+#define KERN_MAXPROCPERUID 28 /* int: max processes per uid */
+#define KERN_DUMPDEV 29 /* struct cdev *: device to dump on */
#define KERN_IPC 30 /* node: anything related to IPC */
#define KERN_DUMMY 31 /* unused */
#define KERN_PS_STRINGS 32 /* int: address of PS_STRINGS */
@@ -485,58 +610,10 @@
#define KERN_HOSTUUID 36 /* string: host UUID identifier */
#define KERN_ARND 37 /* int: from arc4rand() */
#define KERN_MAXID 38 /* number of valid kern ids */
-
-#define CTL_KERN_NAMES { \
- { 0, 0 }, \
- { "ostype", CTLTYPE_STRING }, \
- { "osrelease", CTLTYPE_STRING }, \
- { "osrevision", CTLTYPE_INT }, \
- { "version", CTLTYPE_STRING }, \
- { "maxvnodes", CTLTYPE_INT }, \
- { "maxproc", CTLTYPE_INT }, \
- { "maxfiles", CTLTYPE_INT }, \
- { "argmax", CTLTYPE_INT }, \
- { "securelevel", CTLTYPE_INT }, \
- { "hostname", CTLTYPE_STRING }, \
- { "hostid", CTLTYPE_UINT }, \
- { "clockrate", CTLTYPE_STRUCT }, \
- { "vnode", CTLTYPE_STRUCT }, \
- { "proc", CTLTYPE_STRUCT }, \
- { "file", CTLTYPE_STRUCT }, \
- { "profiling", CTLTYPE_NODE }, \
- { "posix1version", CTLTYPE_INT }, \
- { "ngroups", CTLTYPE_INT }, \
- { "job_control", CTLTYPE_INT }, \
- { "saved_ids", CTLTYPE_INT }, \
- { "boottime", CTLTYPE_STRUCT }, \
- { "nisdomainname", CTLTYPE_STRING }, \
- { "update", CTLTYPE_INT }, \
- { "osreldate", CTLTYPE_INT }, \
- { "ntp_pll", CTLTYPE_NODE }, \
- { "bootfile", CTLTYPE_STRING }, \
- { "maxfilesperproc", CTLTYPE_INT }, \
- { "maxprocperuid", CTLTYPE_INT }, \
- { "ipc", CTLTYPE_NODE }, \
- { "dummy", CTLTYPE_INT }, \
- { "ps_strings", CTLTYPE_INT }, \
- { "usrstack", CTLTYPE_INT }, \
- { "logsigexit", CTLTYPE_INT }, \
- { "iov_max", CTLTYPE_INT }, \
- { "hostuuid", CTLTYPE_STRING }, \
- { "arc4rand", CTLTYPE_OPAQUE }, \
-}
-
/*
- * CTL_VFS identifiers
- */
-#define CTL_VFS_NAMES { \
- { "vfsconf", CTLTYPE_STRUCT }, \
-}
-
-/*
* KERN_PROC subtypes
*/
-#define KERN_PROC_ALL 0 /* everything */
+#define KERN_PROC_ALL 0 /* everything */
#define KERN_PROC_PID 1 /* by process id */
#define KERN_PROC_PGRP 2 /* by process group id */
#define KERN_PROC_SESSION 3 /* by session of pid */
@@ -566,11 +643,12 @@
#define KERN_PROC_PS_STRINGS 38 /* get ps_strings location */
#define KERN_PROC_UMASK 39 /* process umask */
#define KERN_PROC_OSREL 40 /* osreldate for process binary */
+#define KERN_PROC_SIGTRAMP 41 /* signal trampoline location */
/*
* KERN_IPC identifiers
*/
-#define KIPC_MAXSOCKBUF 1 /* int: max size of a socket buffer */
+#define KIPC_MAXSOCKBUF 1 /* int: max size of a socket buffer */
#define KIPC_SOCKBUF_WASTE 2 /* int: wastage factor in sockbuf */
#define KIPC_SOMAXCONN 3 /* int: max length of connection q */
#define KIPC_MAX_LINKHDR 4 /* int: max length of link header */
@@ -590,29 +668,11 @@
#define HW_PAGESIZE 7 /* int: software page size */
#define HW_DISKNAMES 8 /* strings: disk drive names */
#define HW_DISKSTATS 9 /* struct: diskstats[] */
-#define HW_FLOATINGPT 10 /* int: has HW floating point? */
-#define HW_MACHINE_ARCH 11 /* string: machine architecture */
+#define HW_FLOATINGPT 10 /* int: has HW floating point? */
+#define HW_MACHINE_ARCH 11 /* string: machine architecture */
#define HW_REALMEM 12 /* int: 'real' memory */
-#define HW_SENSORS 13 /* node: hardware monitors */
-#define HW_MAXID 14 /* number of valid hw ids */
+#define HW_MAXID 13 /* number of valid hw ids */
-#define CTL_HW_NAMES { \
- { 0, 0 }, \
- { "machine", CTLTYPE_STRING }, \
- { "model", CTLTYPE_STRING }, \
- { "ncpu", CTLTYPE_INT }, \
- { "byteorder", CTLTYPE_INT }, \
- { "physmem", CTLTYPE_ULONG }, \
- { "usermem", CTLTYPE_ULONG }, \
- { "pagesize", CTLTYPE_INT }, \
- { "disknames", CTLTYPE_STRUCT }, \
- { "diskstats", CTLTYPE_STRUCT }, \
- { "floatingpoint", CTLTYPE_INT }, \
- { "machine_arch", CTLTYPE_STRING }, \
- { "realmem", CTLTYPE_ULONG }, \
- { "sensors", CTLTYPE_NODE }, \
-}
-
/*
* CTL_USER definitions
*/
@@ -638,87 +698,34 @@
#define USER_TZNAME_MAX 20 /* int: POSIX2_TZNAME_MAX */
#define USER_MAXID 21 /* number of valid user ids */
-#define CTL_USER_NAMES { \
- { 0, 0 }, \
- { "cs_path", CTLTYPE_STRING }, \
- { "bc_base_max", CTLTYPE_INT }, \
- { "bc_dim_max", CTLTYPE_INT }, \
- { "bc_scale_max", CTLTYPE_INT }, \
- { "bc_string_max", CTLTYPE_INT }, \
- { "coll_weights_max", CTLTYPE_INT }, \
- { "expr_nest_max", CTLTYPE_INT }, \
- { "line_max", CTLTYPE_INT }, \
- { "re_dup_max", CTLTYPE_INT }, \
- { "posix2_version", CTLTYPE_INT }, \
- { "posix2_c_bind", CTLTYPE_INT }, \
- { "posix2_c_dev", CTLTYPE_INT }, \
- { "posix2_char_term", CTLTYPE_INT }, \
- { "posix2_fort_dev", CTLTYPE_INT }, \
- { "posix2_fort_run", CTLTYPE_INT }, \
- { "posix2_localedef", CTLTYPE_INT }, \
- { "posix2_sw_dev", CTLTYPE_INT }, \
- { "posix2_upe", CTLTYPE_INT }, \
- { "stream_max", CTLTYPE_INT }, \
- { "tzname_max", CTLTYPE_INT }, \
-}
+#define CTL_P1003_1B_ASYNCHRONOUS_IO 1 /* boolean */
+#define CTL_P1003_1B_MAPPED_FILES 2 /* boolean */
+#define CTL_P1003_1B_MEMLOCK 3 /* boolean */
+#define CTL_P1003_1B_MEMLOCK_RANGE 4 /* boolean */
+#define CTL_P1003_1B_MEMORY_PROTECTION 5 /* boolean */
+#define CTL_P1003_1B_MESSAGE_PASSING 6 /* boolean */
+#define CTL_P1003_1B_PRIORITIZED_IO 7 /* boolean */
+#define CTL_P1003_1B_PRIORITY_SCHEDULING 8 /* boolean */
+#define CTL_P1003_1B_REALTIME_SIGNALS 9 /* boolean */
+#define CTL_P1003_1B_SEMAPHORES 10 /* boolean */
+#define CTL_P1003_1B_FSYNC 11 /* boolean */
+#define CTL_P1003_1B_SHARED_MEMORY_OBJECTS 12 /* boolean */
+#define CTL_P1003_1B_SYNCHRONIZED_IO 13 /* boolean */
+#define CTL_P1003_1B_TIMERS 14 /* boolean */
+#define CTL_P1003_1B_AIO_LISTIO_MAX 15 /* int */
+#define CTL_P1003_1B_AIO_MAX 16 /* int */
+#define CTL_P1003_1B_AIO_PRIO_DELTA_MAX 17 /* int */
+#define CTL_P1003_1B_DELAYTIMER_MAX 18 /* int */
+#define CTL_P1003_1B_MQ_OPEN_MAX 19 /* int */
+#define CTL_P1003_1B_PAGESIZE 20 /* int */
+#define CTL_P1003_1B_RTSIG_MAX 21 /* int */
+#define CTL_P1003_1B_SEM_NSEMS_MAX 22 /* int */
+#define CTL_P1003_1B_SEM_VALUE_MAX 23 /* int */
+#define CTL_P1003_1B_SIGQUEUE_MAX 24 /* int */
+#define CTL_P1003_1B_TIMER_MAX 25 /* int */
-#define CTL_P1003_1B_ASYNCHRONOUS_IO 1 /* boolean */
-#define CTL_P1003_1B_MAPPED_FILES 2 /* boolean */
-#define CTL_P1003_1B_MEMLOCK 3 /* boolean */
-#define CTL_P1003_1B_MEMLOCK_RANGE 4 /* boolean */
-#define CTL_P1003_1B_MEMORY_PROTECTION 5 /* boolean */
-#define CTL_P1003_1B_MESSAGE_PASSING 6 /* boolean */
-#define CTL_P1003_1B_PRIORITIZED_IO 7 /* boolean */
-#define CTL_P1003_1B_PRIORITY_SCHEDULING 8 /* boolean */
-#define CTL_P1003_1B_REALTIME_SIGNALS 9 /* boolean */
-#define CTL_P1003_1B_SEMAPHORES 10 /* boolean */
-#define CTL_P1003_1B_FSYNC 11 /* boolean */
-#define CTL_P1003_1B_SHARED_MEMORY_OBJECTS 12 /* boolean */
-#define CTL_P1003_1B_SYNCHRONIZED_IO 13 /* boolean */
-#define CTL_P1003_1B_TIMERS 14 /* boolean */
-#define CTL_P1003_1B_AIO_LISTIO_MAX 15 /* int */
-#define CTL_P1003_1B_AIO_MAX 16 /* int */
-#define CTL_P1003_1B_AIO_PRIO_DELTA_MAX 17 /* int */
-#define CTL_P1003_1B_DELAYTIMER_MAX 18 /* int */
-#define CTL_P1003_1B_MQ_OPEN_MAX 19 /* int */
-#define CTL_P1003_1B_PAGESIZE 20 /* int */
-#define CTL_P1003_1B_RTSIG_MAX 21 /* int */
-#define CTL_P1003_1B_SEM_NSEMS_MAX 22 /* int */
-#define CTL_P1003_1B_SEM_VALUE_MAX 23 /* int */
-#define CTL_P1003_1B_SIGQUEUE_MAX 24 /* int */
-#define CTL_P1003_1B_TIMER_MAX 25 /* int */
+#define CTL_P1003_1B_MAXID 26
-#define CTL_P1003_1B_MAXID 26
-
-#define CTL_P1003_1B_NAMES { \
- { 0, 0 }, \
- { "asynchronous_io", CTLTYPE_INT }, \
- { "mapped_files", CTLTYPE_INT }, \
- { "memlock", CTLTYPE_INT }, \
- { "memlock_range", CTLTYPE_INT }, \
- { "memory_protection", CTLTYPE_INT }, \
- { "message_passing", CTLTYPE_INT }, \
- { "prioritized_io", CTLTYPE_INT }, \
- { "priority_scheduling", CTLTYPE_INT }, \
- { "realtime_signals", CTLTYPE_INT }, \
- { "semaphores", CTLTYPE_INT }, \
- { "fsync", CTLTYPE_INT }, \
- { "shared_memory_objects", CTLTYPE_INT }, \
- { "synchronized_io", CTLTYPE_INT }, \
- { "timers", CTLTYPE_INT }, \
- { "aio_listio_max", CTLTYPE_INT }, \
- { "aio_max", CTLTYPE_INT }, \
- { "aio_prio_delta_max", CTLTYPE_INT }, \
- { "delaytimer_max", CTLTYPE_INT }, \
- { "mq_open_max", CTLTYPE_INT }, \
- { "pagesize", CTLTYPE_INT }, \
- { "rtsig_max", CTLTYPE_INT }, \
- { "nsems_max", CTLTYPE_INT }, \
- { "sem_value_max", CTLTYPE_INT }, \
- { "sigqueue_max", CTLTYPE_INT }, \
- { "timer_max", CTLTYPE_INT }, \
-}
-
#ifdef _KERNEL
/*
@@ -758,43 +765,42 @@
/* Dynamic oid handling */
struct sysctl_oid *sysctl_add_oid(struct sysctl_ctx_list *clist,
- struct sysctl_oid_list *parent, int nbr, const char *name,
- int kind, void *arg1, intptr_t arg2,
- int (*handler) (SYSCTL_HANDLER_ARGS),
- const char *fmt, const char *descr);
+ struct sysctl_oid_list *parent, int nbr, const char *name, int kind,
+ void *arg1, intptr_t arg2, int (*handler)(SYSCTL_HANDLER_ARGS),
+ const char *fmt, const char *descr);
int sysctl_remove_name(struct sysctl_oid *parent, const char *name, int del,
- int recurse);
+ int recurse);
void sysctl_rename_oid(struct sysctl_oid *oidp, const char *name);
int sysctl_move_oid(struct sysctl_oid *oidp,
- struct sysctl_oid_list *parent);
+ struct sysctl_oid_list *parent);
int sysctl_remove_oid(struct sysctl_oid *oidp, int del, int recurse);
int sysctl_ctx_init(struct sysctl_ctx_list *clist);
int sysctl_ctx_free(struct sysctl_ctx_list *clist);
struct sysctl_ctx_entry *sysctl_ctx_entry_add(struct sysctl_ctx_list *clist,
- struct sysctl_oid *oidp);
+ struct sysctl_oid *oidp);
struct sysctl_ctx_entry *sysctl_ctx_entry_find(struct sysctl_ctx_list *clist,
- struct sysctl_oid *oidp);
+ struct sysctl_oid *oidp);
int sysctl_ctx_entry_del(struct sysctl_ctx_list *clist,
- struct sysctl_oid *oidp);
+ struct sysctl_oid *oidp);
int kernel_sysctl(struct thread *td, int *name, u_int namelen, void *old,
- size_t *oldlenp, void *new, size_t newlen,
- size_t *retval, int flags);
-int kernel_sysctlbyname(struct thread *td, char *name,
- void *old, size_t *oldlenp, void *new, size_t newlen,
- size_t *retval, int flags);
+ size_t *oldlenp, void *new, size_t newlen, size_t *retval,
+ int flags);
+int kernel_sysctlbyname(struct thread *td, char *name, void *old,
+ size_t *oldlenp, void *new, size_t newlen, size_t *retval,
+ int flags);
int userland_sysctl(struct thread *td, int *name, u_int namelen, void *old,
- size_t *oldlenp, int inkernel, void *new, size_t newlen,
- size_t *retval, int flags);
+ size_t *oldlenp, int inkernel, void *new, size_t newlen,
+ size_t *retval, int flags);
int sysctl_find_oid(int *name, u_int namelen, struct sysctl_oid **noid,
- int *nindx, struct sysctl_req *req);
+ int *nindx, struct sysctl_req *req);
void sysctl_lock(void);
void sysctl_unlock(void);
int sysctl_wire_old_buffer(struct sysctl_req *req, size_t len);
struct sbuf;
-struct sbuf *sbuf_new_for_sysctl(struct sbuf *, char *, int,
- struct sysctl_req *);
+struct sbuf *sbuf_new_for_sysctl(struct sbuf *, char *, int,
+ struct sysctl_req *);
#else /* !_KERNEL */
#include <sys/cdefs.h>
Modified: trunk/sys/sys/sysent.h
===================================================================
--- trunk/sys/sys/sysent.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/sysent.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1982, 1988, 1991 The Regents of the University of California.
* All rights reserved.
@@ -26,7 +27,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/sysent.h 303395 2016-07-27 16:27:41Z julian $
*/
#ifndef _SYS_SYSENT_H_
@@ -130,6 +131,8 @@
uint32_t sv_timekeep_gen;
void *sv_shared_page_obj;
void (*sv_schedtail)(struct thread *);
+ void (*sv_thread_detach)(struct thread *);
+ int (*sv_trap)(struct thread *);
};
#define SV_ILP32 0x000100
@@ -139,6 +142,8 @@
#define SV_SHP 0x010000
#define SV_ABI_MASK 0xff
+#define SV_ABI_ERRNO(p, e) ((p)->p_sysent->sv_errsize <= 0 ? e : \
+ ((e) >= (p)->p_sysent->sv_errsize ? -1 : (p)->p_sysent->sv_errtbl[e]))
#define SV_PROC_FLAG(p, x) ((p)->p_sysent->sv_flags & (x))
#define SV_PROC_ABI(p) ((p)->p_sysent->sv_flags & SV_ABI_MASK)
#define SV_CURPROC_FLAG(x) SV_PROC_FLAG(curproc, x)
@@ -150,8 +155,6 @@
#ifdef _KERNEL
extern struct sysentvec aout_sysvec;
-extern struct sysentvec elf_freebsd_sysvec;
-extern struct sysentvec null_sysvec;
extern struct sysent sysent[];
extern const char *syscallnames[];
@@ -171,14 +174,22 @@
struct sysent old_sysent; /* old sysent */
};
-#define MAKE_SYSENT(syscallname) \
-static struct sysent syscallname##_sysent = { \
- (sizeof(struct syscallname ## _args ) \
+/* separate initialization vector so it can be used in a substructure */
+#define SYSENT_INIT_VALS(_syscallname) { \
+ .sy_narg = (sizeof(struct _syscallname ## _args ) \
/ sizeof(register_t)), \
- (sy_call_t *)& sys_##syscallname, \
- SYS_AUE_##syscallname \
-}
+ .sy_call = (sy_call_t *)&sys_##_syscallname, \
+ .sy_auevent = SYS_AUE_##_syscallname, \
+ .sy_systrace_args_func = NULL, \
+ .sy_entry = 0, \
+ .sy_return = 0, \
+ .sy_flags = 0, \
+ .sy_thrcnt = 0 \
+}
+#define MAKE_SYSENT(syscallname) \
+static struct sysent syscallname##_sysent = SYSENT_INIT_VALS(syscallname);
+
#define MAKE_SYSENT_COMPAT(syscallname) \
static struct sysent syscallname##_sysent = { \
(sizeof(struct syscallname ## _args ) \
Modified: trunk/sys/sys/syslog.h
===================================================================
--- trunk/sys/sys/syslog.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/syslog.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1982, 1986, 1988, 1993
* The Regents of the University of California. All rights reserved.
@@ -27,7 +28,7 @@
* SUCH DAMAGE.
*
* @(#)syslog.h 8.1 (Berkeley) 6/2/93
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/syslog.h 249311 2013-04-09 16:16:34Z ed $
*/
#ifndef _SYS_SYSLOG_H_
@@ -69,7 +70,7 @@
int c_val;
} CODE;
-CODE prioritynames[] = {
+static const CODE prioritynames[] = {
{ "alert", LOG_ALERT, },
{ "crit", LOG_CRIT, },
{ "debug", LOG_DEBUG, },
@@ -122,7 +123,7 @@
#define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3)
#ifdef SYSLOG_NAMES
-CODE facilitynames[] = {
+static const CODE facilitynames[] = {
{ "auth", LOG_AUTH, },
{ "authpriv", LOG_AUTHPRIV, },
{ "console", LOG_CONSOLE, },
Modified: trunk/sys/sys/sysproto.h
===================================================================
--- trunk/sys/sys/sysproto.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/sysproto.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,9 +1,9 @@
+/* $MidnightBSD$ */
/*
* System call prototypes.
*
* DO NOT EDIT-- this file is automatically generated.
- * $MidnightBSD$
- * created from MidnightBSD
+ * $FreeBSD: stable/10/sys/sys/sysproto.h 318164 2017-05-10 23:09:17Z jhb $
*/
#ifndef _SYS_SYSPROTO_H_
@@ -12,9 +12,11 @@
#include <sys/signal.h>
#include <sys/acl.h>
#include <sys/cpuset.h>
+#include <sys/_ffcounter.h>
#include <sys/_semaphore.h>
#include <sys/ucontext.h>
#include <sys/wait.h>
+
#include <bsm/audit_kevents.h>
struct proc;
@@ -161,12 +163,12 @@
char amode_l_[PADL_(int)]; int amode; char amode_r_[PADR_(int)];
};
struct chflags_args {
- char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
- char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
+ char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)];
+ char flags_l_[PADL_(u_long)]; u_long flags; char flags_r_[PADR_(u_long)];
};
struct fchflags_args {
char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
- char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
+ char flags_l_[PADL_(u_long)]; u_long flags; char flags_r_[PADR_(u_long)];
};
struct sync_args {
register_t dummy;
@@ -726,6 +728,20 @@
char rqtp_l_[PADL_(const struct timespec *)]; const struct timespec * rqtp; char rqtp_r_[PADR_(const struct timespec *)];
char rmtp_l_[PADL_(struct timespec *)]; struct timespec * rmtp; char rmtp_r_[PADR_(struct timespec *)];
};
+struct ffclock_getcounter_args {
+ char ffcount_l_[PADL_(ffcounter *)]; ffcounter * ffcount; char ffcount_r_[PADR_(ffcounter *)];
+};
+struct ffclock_setestimate_args {
+ char cest_l_[PADL_(struct ffclock_estimate *)]; struct ffclock_estimate * cest; char cest_r_[PADR_(struct ffclock_estimate *)];
+};
+struct ffclock_getestimate_args {
+ char cest_l_[PADL_(struct ffclock_estimate *)]; struct ffclock_estimate * cest; char cest_r_[PADR_(struct ffclock_estimate *)];
+};
+struct clock_getcpuclockid2_args {
+ char id_l_[PADL_(id_t)]; id_t id; char id_r_[PADR_(id_t)];
+ char which_l_[PADL_(int)]; int which; char which_r_[PADR_(int)];
+ char clock_id_l_[PADL_(clockid_t *)]; clockid_t * clock_id; char clock_id_r_[PADR_(clockid_t *)];
+};
struct ntp_gettime_args {
char ntvp_l_[PADL_(struct ntptimeval *)]; struct ntptimeval * ntvp; char ntvp_r_[PADR_(struct ntptimeval *)];
};
@@ -889,7 +905,7 @@
register_t dummy;
};
struct __getcwd_args {
- char buf_l_[PADL_(u_char *)]; u_char * buf; char buf_r_[PADR_(u_char *)];
+ char buf_l_[PADL_(char *)]; char * buf; char buf_r_[PADR_(char *)];
char buflen_l_[PADL_(u_int)]; u_int buflen; char buflen_r_[PADR_(u_int)];
};
struct sched_setparam_args {
@@ -1119,7 +1135,7 @@
};
struct lchflags_args {
char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)];
- char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
+ char flags_l_[PADL_(u_long)]; u_long flags; char flags_r_[PADR_(u_long)];
};
struct uuidgen_args {
char store_l_[PADL_(struct uuid *)]; struct uuid * store; char store_r_[PADR_(struct uuid *)];
@@ -1657,14 +1673,11 @@
char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
char name_l_[PADL_(int)]; int name; char name_r_[PADR_(int)];
};
-struct cap_new_args {
+struct __cap_rights_get_args {
+ char version_l_[PADL_(int)]; int version; char version_r_[PADR_(int)];
char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
- char rights_l_[PADL_(u_int64_t)]; u_int64_t rights; char rights_r_[PADR_(u_int64_t)];
+ char rightsp_l_[PADL_(cap_rights_t *)]; cap_rights_t * rightsp; char rightsp_r_[PADR_(cap_rights_t *)];
};
-struct cap_getrights_args {
- char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
- char rightsp_l_[PADL_(u_int64_t *)]; u_int64_t * rightsp; char rightsp_r_[PADR_(u_int64_t *)];
-};
struct cap_enter_args {
register_t dummy;
};
@@ -1740,7 +1753,7 @@
char advice_l_[PADL_(int)]; int advice; char advice_r_[PADR_(int)];
};
struct wait6_args {
- char idtype_l_[PADL_(int)]; int idtype; char idtype_r_[PADR_(int)];
+ char idtype_l_[PADL_(idtype_t)]; idtype_t idtype; char idtype_r_[PADR_(idtype_t)];
char id_l_[PADL_(id_t)]; id_t id; char id_r_[PADR_(id_t)];
char status_l_[PADL_(int *)]; int * status; char status_r_[PADR_(int *)];
char options_l_[PADL_(int)]; int options; char options_r_[PADR_(int)];
@@ -1747,6 +1760,81 @@
char wrusage_l_[PADL_(struct __wrusage *)]; struct __wrusage * wrusage; char wrusage_r_[PADR_(struct __wrusage *)];
char info_l_[PADL_(siginfo_t *)]; siginfo_t * info; char info_r_[PADR_(siginfo_t *)];
};
+struct cap_rights_limit_args {
+ char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
+ char rightsp_l_[PADL_(cap_rights_t *)]; cap_rights_t * rightsp; char rightsp_r_[PADR_(cap_rights_t *)];
+};
+struct cap_ioctls_limit_args {
+ char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
+ char cmds_l_[PADL_(const u_long *)]; const u_long * cmds; char cmds_r_[PADR_(const u_long *)];
+ char ncmds_l_[PADL_(size_t)]; size_t ncmds; char ncmds_r_[PADR_(size_t)];
+};
+struct cap_ioctls_get_args {
+ char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
+ char cmds_l_[PADL_(u_long *)]; u_long * cmds; char cmds_r_[PADR_(u_long *)];
+ char maxcmds_l_[PADL_(size_t)]; size_t maxcmds; char maxcmds_r_[PADR_(size_t)];
+};
+struct cap_fcntls_limit_args {
+ char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
+ char fcntlrights_l_[PADL_(uint32_t)]; uint32_t fcntlrights; char fcntlrights_r_[PADR_(uint32_t)];
+};
+struct cap_fcntls_get_args {
+ char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
+ char fcntlrightsp_l_[PADL_(uint32_t *)]; uint32_t * fcntlrightsp; char fcntlrightsp_r_[PADR_(uint32_t *)];
+};
+struct bindat_args {
+ char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
+ char s_l_[PADL_(int)]; int s; char s_r_[PADR_(int)];
+ char name_l_[PADL_(caddr_t)]; caddr_t name; char name_r_[PADR_(caddr_t)];
+ char namelen_l_[PADL_(int)]; int namelen; char namelen_r_[PADR_(int)];
+};
+struct connectat_args {
+ char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
+ char s_l_[PADL_(int)]; int s; char s_r_[PADR_(int)];
+ char name_l_[PADL_(caddr_t)]; caddr_t name; char name_r_[PADR_(caddr_t)];
+ char namelen_l_[PADL_(int)]; int namelen; char namelen_r_[PADR_(int)];
+};
+struct chflagsat_args {
+ char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
+ char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)];
+ char flags_l_[PADL_(u_long)]; u_long flags; char flags_r_[PADR_(u_long)];
+ char atflag_l_[PADL_(int)]; int atflag; char atflag_r_[PADR_(int)];
+};
+struct accept4_args {
+ char s_l_[PADL_(int)]; int s; char s_r_[PADR_(int)];
+ char name_l_[PADL_(struct sockaddr *__restrict)]; struct sockaddr *__restrict name; char name_r_[PADR_(struct sockaddr *__restrict)];
+ char anamelen_l_[PADL_(__socklen_t *__restrict)]; __socklen_t *__restrict anamelen; char anamelen_r_[PADR_(__socklen_t *__restrict)];
+ char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
+};
+struct pipe2_args {
+ char fildes_l_[PADL_(int *)]; int * fildes; char fildes_r_[PADR_(int *)];
+ char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
+};
+struct aio_mlock_args {
+ char aiocbp_l_[PADL_(struct aiocb *)]; struct aiocb * aiocbp; char aiocbp_r_[PADR_(struct aiocb *)];
+};
+struct procctl_args {
+ char idtype_l_[PADL_(idtype_t)]; idtype_t idtype; char idtype_r_[PADR_(idtype_t)];
+ char id_l_[PADL_(id_t)]; id_t id; char id_r_[PADR_(id_t)];
+ char com_l_[PADL_(int)]; int com; char com_r_[PADR_(int)];
+ char data_l_[PADL_(void *)]; void * data; char data_r_[PADR_(void *)];
+};
+struct ppoll_args {
+ char fds_l_[PADL_(struct pollfd *)]; struct pollfd * fds; char fds_r_[PADR_(struct pollfd *)];
+ char nfds_l_[PADL_(u_int)]; u_int nfds; char nfds_r_[PADR_(u_int)];
+ char ts_l_[PADL_(const struct timespec *)]; const struct timespec * ts; char ts_r_[PADR_(const struct timespec *)];
+ char set_l_[PADL_(const sigset_t *)]; const sigset_t * set; char set_r_[PADR_(const sigset_t *)];
+};
+struct futimens_args {
+ char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
+ char times_l_[PADL_(struct timespec *)]; struct timespec * times; char times_r_[PADR_(struct timespec *)];
+};
+struct utimensat_args {
+ char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
+ char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
+ char times_l_[PADL_(struct timespec *)]; struct timespec * times; char times_r_[PADR_(struct timespec *)];
+ char flag_l_[PADL_(int)]; int flag; char flag_r_[PADR_(int)];
+};
int nosys(struct thread *, struct nosys_args *);
void sys_sys_exit(struct thread *, struct sys_exit_args *);
int sys_fork(struct thread *, struct fork_args *);
@@ -1902,6 +1990,10 @@
int sys_ktimer_gettime(struct thread *, struct ktimer_gettime_args *);
int sys_ktimer_getoverrun(struct thread *, struct ktimer_getoverrun_args *);
int sys_nanosleep(struct thread *, struct nanosleep_args *);
+int sys_ffclock_getcounter(struct thread *, struct ffclock_getcounter_args *);
+int sys_ffclock_setestimate(struct thread *, struct ffclock_setestimate_args *);
+int sys_ffclock_getestimate(struct thread *, struct ffclock_getestimate_args *);
+int sys_clock_getcpuclockid2(struct thread *, struct clock_getcpuclockid2_args *);
int sys_ntp_gettime(struct thread *, struct ntp_gettime_args *);
int sys_minherit(struct thread *, struct minherit_args *);
int sys_rfork(struct thread *, struct rfork_args *);
@@ -2107,8 +2199,7 @@
int sys_msgctl(struct thread *, struct msgctl_args *);
int sys_shmctl(struct thread *, struct shmctl_args *);
int sys_lpathconf(struct thread *, struct lpathconf_args *);
-int sys_cap_new(struct thread *, struct cap_new_args *);
-int sys_cap_getrights(struct thread *, struct cap_getrights_args *);
+int sys___cap_rights_get(struct thread *, struct __cap_rights_get_args *);
int sys_cap_enter(struct thread *, struct cap_enter_args *);
int sys_cap_getmode(struct thread *, struct cap_getmode_args *);
int sys_pdfork(struct thread *, struct pdfork_args *);
@@ -2125,6 +2216,21 @@
int sys_posix_fallocate(struct thread *, struct posix_fallocate_args *);
int sys_posix_fadvise(struct thread *, struct posix_fadvise_args *);
int sys_wait6(struct thread *, struct wait6_args *);
+int sys_cap_rights_limit(struct thread *, struct cap_rights_limit_args *);
+int sys_cap_ioctls_limit(struct thread *, struct cap_ioctls_limit_args *);
+int sys_cap_ioctls_get(struct thread *, struct cap_ioctls_get_args *);
+int sys_cap_fcntls_limit(struct thread *, struct cap_fcntls_limit_args *);
+int sys_cap_fcntls_get(struct thread *, struct cap_fcntls_get_args *);
+int sys_bindat(struct thread *, struct bindat_args *);
+int sys_connectat(struct thread *, struct connectat_args *);
+int sys_chflagsat(struct thread *, struct chflagsat_args *);
+int sys_accept4(struct thread *, struct accept4_args *);
+int sys_pipe2(struct thread *, struct pipe2_args *);
+int sys_aio_mlock(struct thread *, struct aio_mlock_args *);
+int sys_procctl(struct thread *, struct procctl_args *);
+int sys_ppoll(struct thread *, struct ppoll_args *);
+int sys_futimens(struct thread *, struct futimens_args *);
+int sys_utimensat(struct thread *, struct utimensat_args *);
#ifdef COMPAT_43
@@ -2590,6 +2696,10 @@
#define SYS_AUE_ktimer_gettime AUE_NULL
#define SYS_AUE_ktimer_getoverrun AUE_NULL
#define SYS_AUE_nanosleep AUE_NULL
+#define SYS_AUE_ffclock_getcounter AUE_NULL
+#define SYS_AUE_ffclock_setestimate AUE_NULL
+#define SYS_AUE_ffclock_getestimate AUE_NULL
+#define SYS_AUE_clock_getcpuclockid2 AUE_NULL
#define SYS_AUE_ntp_gettime AUE_NULL
#define SYS_AUE_minherit AUE_MINHERIT
#define SYS_AUE_rfork AUE_RFORK
@@ -2799,8 +2909,7 @@
#define SYS_AUE_msgctl AUE_MSGCTL
#define SYS_AUE_shmctl AUE_SHMCTL
#define SYS_AUE_lpathconf AUE_LPATHCONF
-#define SYS_AUE_cap_new AUE_CAP_NEW
-#define SYS_AUE_cap_getrights AUE_CAP_GETRIGHTS
+#define SYS_AUE___cap_rights_get AUE_CAP_RIGHTS_GET
#define SYS_AUE_cap_enter AUE_CAP_ENTER
#define SYS_AUE_cap_getmode AUE_CAP_GETMODE
#define SYS_AUE_pdfork AUE_PDFORK
@@ -2817,6 +2926,21 @@
#define SYS_AUE_posix_fallocate AUE_NULL
#define SYS_AUE_posix_fadvise AUE_NULL
#define SYS_AUE_wait6 AUE_WAIT6
+#define SYS_AUE_cap_rights_limit AUE_CAP_RIGHTS_LIMIT
+#define SYS_AUE_cap_ioctls_limit AUE_CAP_IOCTLS_LIMIT
+#define SYS_AUE_cap_ioctls_get AUE_CAP_IOCTLS_GET
+#define SYS_AUE_cap_fcntls_limit AUE_CAP_FCNTLS_LIMIT
+#define SYS_AUE_cap_fcntls_get AUE_CAP_FCNTLS_GET
+#define SYS_AUE_bindat AUE_BINDAT
+#define SYS_AUE_connectat AUE_CONNECTAT
+#define SYS_AUE_chflagsat AUE_CHFLAGSAT
+#define SYS_AUE_accept4 AUE_ACCEPT
+#define SYS_AUE_pipe2 AUE_PIPE
+#define SYS_AUE_aio_mlock AUE_NULL
+#define SYS_AUE_procctl AUE_NULL
+#define SYS_AUE_ppoll AUE_POLL
+#define SYS_AUE_futimens AUE_FUTIMES
+#define SYS_AUE_utimensat AUE_FUTIMESAT
#undef PAD_
#undef PADL_
Modified: trunk/sys/sys/systm.h
===================================================================
--- trunk/sys/sys/systm.h 2018-05-25 12:31:27 UTC (rev 9911)
+++ trunk/sys/sys/systm.h 2018-05-25 12:38:16 UTC (rev 9912)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1982, 1988, 1991, 1993
* The Regents of the University of California. All rights reserved.
@@ -32,7 +33,7 @@
* SUCH DAMAGE.
*
* @(#)systm.h 8.7 (Berkeley) 3/29/95
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/sys/systm.h 303433 2016-07-28 11:51:20Z kib $
*/
#ifndef _SYS_SYSTM_H_
@@ -46,6 +47,7 @@
#include <sys/stdint.h> /* for people using printf mainly */
extern int cold; /* nonzero if we are doing a cold boot */
+extern int suspend_blocked; /* block suspend due to pending shutdown */
extern int rebooting; /* kern_reboot() has been called. */
extern const char *panicstr; /* panic message */
extern char version[]; /* system version */
@@ -70,18 +72,24 @@
* Detected virtual machine guest types. The intention is to expand
* and/or add to the VM_GUEST_VM type if specific VM functionality is
* ever implemented (e.g. vendor-specific paravirtualization features).
+ * Keep in sync with vm_guest_sysctl_names[].
*/
-enum VM_GUEST { VM_GUEST_NO = 0, VM_GUEST_VM, VM_GUEST_XEN };
+enum VM_GUEST { VM_GUEST_NO = 0, VM_GUEST_VM, VM_GUEST_XEN, VM_GUEST_HV,
+ VM_GUEST_VMWARE, VM_LAST };
+#if defined(WITNESS) || defined(INVARIANTS)
+void kassert_panic(const char *fmt, ...) __printflike(1, 2);
+#endif
+
#ifdef INVARIANTS /* The option is always available */
#define KASSERT(exp,msg) do { \
if (__predict_false(!(exp))) \
- panic msg; \
+ kassert_panic msg; \
} while (0)
#define VNASSERT(exp, vp, msg) do { \
if (__predict_false(!(exp))) { \
vn_printf(vp, "VNASSERT failed\n"); \
- panic msg; \
+ kassert_panic msg; \
} \
} while (0)
#else
@@ -92,10 +100,8 @@
} while (0)
#endif
-#ifndef CTASSERT /* Allow lint to override */
-#define CTASSERT(x) _CTASSERT(x, __LINE__)
-#define _CTASSERT(x, y) __CTASSERT(x, y)
-#define __CTASSERT(x, y) typedef char __assert ## y[(x) ? 1 : -1]
+#ifndef CTASSERT /* Allow lint to override */
+#define CTASSERT(x) _Static_assert(x, "compile-time assertion failed")
#endif
/*
@@ -110,6 +116,12 @@
((uintptr_t)&(var) & (sizeof(void *) - 1)) == 0, msg)
/*
+ * Assert that a thread is in critical(9) section.
+ */
+#define CRITICAL_ASSERT(td) \
+ KASSERT((td)->td_critnest >= 1, ("Not in critical section"));
+
+/*
* If we have already panic'd and this is the thread that called
* panic(), then don't block on any mutexes but silently succeed.
* Otherwise, the kernel will deadlock since the scheduler isn't
@@ -138,7 +150,9 @@
extern int unmapped_buf_allowed;
extern int iosize_max_clamp;
+extern int devfs_iosize_max_clamp;
#define IOSIZE_MAX (iosize_max_clamp ? INT_MAX : SSIZE_MAX)
+#define DEVFS_IOSIZE_MAX (devfs_iosize_max_clamp ? INT_MAX : SSIZE_MAX)
/*
* General function declarations.
@@ -156,6 +170,7 @@
struct uio;
struct _jmp_buf;
struct trapframe;
+struct eventtimer;
int setjmp(struct _jmp_buf *) __returns_twice;
void longjmp(struct _jmp_buf *, int) __dead2;
@@ -174,6 +189,7 @@
void g_waitidle(void);
void panic(const char *, ...) __dead2 __printflike(1, 2);
+void vpanic(const char *, __va_list) __dead2 __printflike(1, 0);
void cpu_boot(int);
void cpu_flush_dcache(void *, size_t);
@@ -184,15 +200,23 @@
void init_param2(long physpages);
void init_static_kenv(char *, size_t);
void tablefull(const char *);
+#ifdef EARLY_PRINTF
+typedef void early_putc_t(int ch);
+extern early_putc_t *early_putc;
+#endif
int kvprintf(char const *, void (*)(int, void*), void *, int,
__va_list) __printflike(1, 0);
void log(int, const char *, ...) __printflike(2, 3);
void log_console(struct uio *);
+int asprintf(char **ret, struct malloc_type *mtp, const char *format,
+ ...) __printflike(3, 4);
int printf(const char *, ...) __printflike(1, 2);
int snprintf(char *, size_t, const char *, ...) __printflike(3, 4);
int sprintf(char *buf, const char *, ...) __printflike(2, 3);
int uprintf(const char *, ...) __printflike(1, 2);
int vprintf(const char *, __va_list) __printflike(1, 0);
+int vasprintf(char **ret, struct malloc_type *mtp, const char *format,
+ __va_list ap) __printflike(3, 0);
int vsnprintf(char *, size_t, const char *, __va_list) __printflike(3, 0);
int vsnrprintf(char *, size_t, int, const char *, __va_list) __printflike(4, 0);
int vsprintf(char *buf, const char *, __va_list) __printflike(2, 0);
@@ -204,6 +228,7 @@
quad_t strtoq(const char *, char **, int) __nonnull(1);
u_quad_t strtouq(const char *, char **, int) __nonnull(1);
void tprintf(struct proc *p, int pri, const char *, ...) __printflike(3, 4);
+void vtprintf(struct proc *, int, const char *, __va_list) __printflike(3, 0);
void hexdump(const void *ptr, int length, const char *hdr, int flags);
#define HD_COLUMN_MASK 0xff
#define HD_DELIM_MASK 0xff00
@@ -233,18 +258,25 @@
int copyout_nofault(const void * __restrict kaddr, void * __restrict udaddr,
size_t len) __nonnull(1) __nonnull(2);
-int fubyte(const void *base);
-long fuword(const void *base);
-int fuword16(void *base);
-int32_t fuword32(const void *base);
-int64_t fuword64(const void *base);
-int subyte(void *base, int byte);
-int suword(void *base, long word);
-int suword16(void *base, int word);
-int suword32(void *base, int32_t word);
-int suword64(void *base, int64_t word);
+int fubyte(volatile const void *base);
+long fuword(volatile const void *base);
+int fuword16(volatile const void *base);
+int32_t fuword32(volatile const void *base);
+int64_t fuword64(volatile const void *base);
+int fueword(volatile const void *base, long *val);
+int fueword32(volatile const void *base, int32_t *val);
+int fueword64(volatile const void *base, int64_t *val);
+int subyte(volatile void *base, int byte);
+int suword(volatile void *base, long word);
+int suword16(volatile void *base, int word);
+int suword32(volatile void *base, int32_t word);
+int suword64(volatile void *base, int64_t word);
uint32_t casuword32(volatile uint32_t *base, uint32_t oldval, uint32_t newval);
-u_long casuword(volatile u_long *p, u_long oldval, u_long newval);
+u_long casuword(volatile u_long *p, u_long oldval, u_long newval);
+int casueword32(volatile uint32_t *base, uint32_t oldval, uint32_t *oldvalp,
+ uint32_t newval);
+int casueword(volatile u_long *p, u_long oldval, u_long *oldvalp,
+ u_long newval);
void realitexpire(void *);
@@ -266,10 +298,13 @@
void stopprofclock(struct proc *);
void cpu_startprofclock(void);
void cpu_stopprofclock(void);
-void cpu_idleclock(void);
+sbintime_t cpu_idleclock(void);
void cpu_activeclock(void);
-extern int cpu_can_deep_sleep;
-extern int cpu_disable_deep_sleep;
+void cpu_new_callout(int cpu, sbintime_t bt, sbintime_t bt_opt);
+void cpu_et_frequency(struct eventtimer *et, uint64_t newfreq);
+extern int cpu_deepest_sleep;
+extern int cpu_disable_c2_sleep;
+extern int cpu_disable_c3_sleep;
int cr_cansee(struct ucred *u1, struct ucred *u2);
int cr_canseesocket(struct ucred *cred, struct socket *so);
@@ -319,11 +354,8 @@
void callout_handle_init(struct callout_handle *);
struct callout_handle timeout(timeout_t *, void *, int);
void untimeout(timeout_t *, void *, struct callout_handle);
-caddr_t kern_timeout_callwheel_alloc(caddr_t v);
-void kern_timeout_callwheel_init(void);
/* Stubs for obsolete functions that used to be for interrupt management */
-static __inline void spl0(void) { return; }
static __inline intrmask_t splbio(void) { return 0; }
static __inline intrmask_t splcam(void) { return 0; }
static __inline intrmask_t splclock(void) { return 0; }
@@ -330,12 +362,6 @@
static __inline intrmask_t splhigh(void) { return 0; }
static __inline intrmask_t splimp(void) { return 0; }
static __inline intrmask_t splnet(void) { return 0; }
-static __inline intrmask_t splsoftcam(void) { return 0; }
-static __inline intrmask_t splsoftclock(void) { return 0; }
-static __inline intrmask_t splsofttty(void) { return 0; }
-static __inline intrmask_t splsoftvm(void) { return 0; }
-static __inline intrmask_t splsofttq(void) { return 0; }
-static __inline intrmask_t splstatclock(void) { return 0; }
static __inline intrmask_t spltty(void) { return 0; }
static __inline intrmask_t splvm(void) { return 0; }
static __inline void splx(intrmask_t ipl __unused) { return; }
@@ -345,14 +371,27 @@
* less often.
*/
int _sleep(void *chan, struct lock_object *lock, int pri, const char *wmesg,
- int timo) __nonnull(1);
+ sbintime_t sbt, sbintime_t pr, int flags) __nonnull(1);
#define msleep(chan, mtx, pri, wmesg, timo) \
- _sleep((chan), &(mtx)->lock_object, (pri), (wmesg), (timo))
-int msleep_spin(void *chan, struct mtx *mtx, const char *wmesg, int timo)
- __nonnull(1);
-int pause(const char *wmesg, int timo);
+ _sleep((chan), &(mtx)->lock_object, (pri), (wmesg), \
+ tick_sbt * (timo), 0, C_HARDCLOCK)
+#define msleep_sbt(chan, mtx, pri, wmesg, bt, pr, flags) \
+ _sleep((chan), &(mtx)->lock_object, (pri), (wmesg), (bt), (pr), \
+ (flags))
+int msleep_spin_sbt(void *chan, struct mtx *mtx, const char *wmesg,
+ sbintime_t sbt, sbintime_t pr, int flags) __nonnull(1);
+#define msleep_spin(chan, mtx, wmesg, timo) \
+ msleep_spin_sbt((chan), (mtx), (wmesg), tick_sbt * (timo), \
+ 0, C_HARDCLOCK)
+int pause_sbt(const char *wmesg, sbintime_t sbt, sbintime_t pr,
+ int flags);
+#define pause(wmesg, timo) \
+ pause_sbt((wmesg), tick_sbt * (timo), 0, C_HARDCLOCK)
#define tsleep(chan, pri, wmesg, timo) \
- _sleep((chan), NULL, (pri), (wmesg), (timo))
+ _sleep((chan), NULL, (pri), (wmesg), tick_sbt * (timo), \
+ 0, C_HARDCLOCK)
+#define tsleep_sbt(chan, pri, wmesg, bt, pr, flags) \
+ _sleep((chan), NULL, (pri), (wmesg), (bt), (pr), (flags))
void wakeup(void *chan) __nonnull(1);
void wakeup_one(void *chan) __nonnull(1);
@@ -383,6 +422,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 clean_unrhdr(struct unrhdr *uh);
void clean_unrhdrl(struct unrhdr *uh);
@@ -391,31 +431,10 @@
int alloc_unrl(struct unrhdr *uh);
void free_unr(struct unrhdr *uh, u_int item);
-/*
- * Population count algorithm using SWAR approach
- * - "SIMD Within A Register".
- */
-static __inline uint32_t
-bitcount32(uint32_t x)
-{
+void intr_prof_stack_use(struct thread *td, struct trapframe *frame);
- x = (x & 0x55555555) + ((x & 0xaaaaaaaa) >> 1);
- x = (x & 0x33333333) + ((x & 0xcccccccc) >> 2);
- x = (x + (x >> 4)) & 0x0f0f0f0f;
- x = (x + (x >> 8));
- x = (x + (x >> 16)) & 0x000000ff;
- return (x);
-}
+extern void (*softdep_ast_cleanup)(void);
-static __inline uint16_t
-bitcount16(uint32_t x)
-{
+void counted_warning(unsigned *counter, const char *msg);
- x = (x & 0x5555) + ((x & 0xaaaa) >> 1);
- x = (x & 0x3333) + ((x & 0xcccc) >> 2);
- x = (x + (x >> 4)) & 0x0f0f;
- x = (x + (x >> 8)) & 0x00ff;
- return (x);
-}
-
#endif /* !_SYS_SYSTM_H_ */
More information about the Midnightbsd-cvs
mailing list