[Midnightbsd-cvs] src [12369] trunk/sys/sys: Sync with FreeBSD 11-stable
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sun Feb 16 16:59:53 EST 2020
Revision: 12369
http://svnweb.midnightbsd.org/src/?rev=12369
Author: laffer1
Date: 2020-02-16 16:59:52 -0500 (Sun, 16 Feb 2020)
Log Message:
-----------
Sync with FreeBSD 11-stable
Modified Paths:
--------------
trunk/sys/sys/pctrie.h
trunk/sys/sys/pmc.h
trunk/sys/sys/pmckern.h
trunk/sys/sys/pmclog.h
trunk/sys/sys/posix4.h
trunk/sys/sys/priv.h
trunk/sys/sys/proc.h
trunk/sys/sys/procctl.h
trunk/sys/sys/procdesc.h
trunk/sys/sys/protosw.h
trunk/sys/sys/ptio.h
trunk/sys/sys/ptrace.h
trunk/sys/sys/queue.h
Modified: trunk/sys/sys/pctrie.h
===================================================================
--- trunk/sys/sys/pctrie.h 2020-02-16 21:51:02 UTC (rev 12368)
+++ trunk/sys/sys/pctrie.h 2020-02-16 21:59:52 UTC (rev 12369)
@@ -26,7 +26,7 @@
* 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 $
+ * $FreeBSD: stable/11/sys/sys/pctrie.h 331722 2018-03-29 02:50:57Z eadler $
*/
#ifndef _SYS_PCTRIE_H_
@@ -77,7 +77,7 @@
return name##_PCTRIE_VAL2PTR(pctrie_lookup(ptree, key)); \
} \
\
-static __inline struct type * \
+static __inline __unused struct type * \
name##_PCTRIE_LOOKUP_LE(struct pctrie *ptree, uint64_t key) \
{ \
\
@@ -120,5 +120,32 @@
size_t pctrie_node_size(void);
int pctrie_zone_init(void *mem, int size, int flags);
+static __inline void
+pctrie_init(struct pctrie *ptree)
+{
+
+ ptree->pt_root = 0;
+}
+
+static __inline boolean_t
+pctrie_is_empty(struct pctrie *ptree)
+{
+
+ return (ptree->pt_root == 0);
+}
+
+/*
+ * These widths should allow the pointers to a node's children to fit within
+ * a single cache line. The extra levels from a narrow width should not be
+ * a problem thanks to path compression.
+ */
+#ifdef __LP64__
+#define PCTRIE_WIDTH 4
+#else
+#define PCTRIE_WIDTH 3
+#endif
+
+#define PCTRIE_COUNT (1 << PCTRIE_WIDTH)
+
#endif /* _KERNEL */
#endif /* !_SYS_PCTRIE_H_ */
Modified: trunk/sys/sys/pmc.h
===================================================================
--- trunk/sys/sys/pmc.h 2020-02-16 21:51:02 UTC (rev 12368)
+++ trunk/sys/sys/pmc.h 2020-02-16 21:59:52 UTC (rev 12369)
@@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: stable/10/sys/sys/pmc.h 320113 2017-06-19 15:34:07Z avg $
+ * $FreeBSD: stable/11/sys/sys/pmc.h 339767 2018-10-26 05:12:56Z mmacy $
*/
#ifndef _SYS_PMC_H_
@@ -74,6 +74,7 @@
#define __PMC_CPUS() \
__PMC_CPU(AMD_K7, 0x00, "AMD K7") \
__PMC_CPU(AMD_K8, 0x01, "AMD K8") \
+ __PMC_CPU(AMD_F17H, 0x02, "AMD F17H") \
__PMC_CPU(INTEL_P5, 0x80, "Intel Pentium") \
__PMC_CPU(INTEL_P6, 0x81, "Intel Pentium Pro") \
__PMC_CPU(INTEL_CL, 0x82, "Intel Celeron") \
@@ -103,9 +104,20 @@
__PMC_CPU(INTEL_XSCALE, 0x100, "Intel XScale") \
__PMC_CPU(MIPS_24K, 0x200, "MIPS 24K") \
__PMC_CPU(MIPS_OCTEON, 0x201, "Cavium Octeon") \
+ __PMC_CPU(MIPS_74K, 0x202, "MIPS 74K") \
__PMC_CPU(PPC_7450, 0x300, "PowerPC MPC7450") \
+ __PMC_CPU(PPC_E500, 0x340, "PowerPC e500 Core") \
+ __PMC_CPU(PPC_MPC85XX, 0x340, "Freescale PowerPC MPC85XX") \
__PMC_CPU(PPC_970, 0x380, "IBM PowerPC 970") \
- __PMC_CPU(GENERIC, 0x400, "Generic")
+ __PMC_CPU(GENERIC, 0x400, "Generic") \
+ __PMC_CPU(ARMV7_CORTEX_A5, 0x500, "ARMv7 Cortex A5") \
+ __PMC_CPU(ARMV7_CORTEX_A7, 0x501, "ARMv7 Cortex A7") \
+ __PMC_CPU(ARMV7_CORTEX_A8, 0x502, "ARMv7 Cortex A8") \
+ __PMC_CPU(ARMV7_CORTEX_A9, 0x503, "ARMv7 Cortex A9") \
+ __PMC_CPU(ARMV7_CORTEX_A15, 0x504, "ARMv7 Cortex A15") \
+ __PMC_CPU(ARMV7_CORTEX_A17, 0x505, "ARMv7 Cortex A17") \
+ __PMC_CPU(ARMV8_CORTEX_A53, 0x600, "ARMv8 Cortex A53") \
+ __PMC_CPU(ARMV8_CORTEX_A57, 0x601, "ARMv8 Cortex A57")
enum pmc_cputype {
#undef __PMC_CPU
@@ -121,31 +133,36 @@
*/
#define __PMC_CLASSES() \
- __PMC_CLASS(TSC) /* CPU Timestamp counter */ \
- __PMC_CLASS(K7) /* AMD K7 performance counters */ \
- __PMC_CLASS(K8) /* AMD K8 performance counters */ \
- __PMC_CLASS(P5) /* Intel Pentium counters */ \
- __PMC_CLASS(P6) /* Intel Pentium Pro counters */ \
- __PMC_CLASS(P4) /* Intel Pentium-IV counters */ \
- __PMC_CLASS(IAF) /* Intel Core2/Atom, fixed function */ \
- __PMC_CLASS(IAP) /* Intel Core...Atom, programmable */ \
- __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(OCTEON) /* Cavium Octeon */ \
- __PMC_CLASS(PPC7450) /* Motorola MPC7450 class */ \
- __PMC_CLASS(PPC970) /* IBM PowerPC 970 class */ \
- __PMC_CLASS(SOFT) /* Software events */
+ __PMC_CLASS(TSC, 0x00, "CPU Timestamp counter") \
+ __PMC_CLASS(K7, 0x01, "AMD K7 performance counters") \
+ __PMC_CLASS(K8, 0x02, "AMD K8 performance counters") \
+ __PMC_CLASS(P5, 0x03, "Intel Pentium counters") \
+ __PMC_CLASS(P6, 0x04, "Intel Pentium Pro counters") \
+ __PMC_CLASS(P4, 0x05, "Intel Pentium-IV counters") \
+ __PMC_CLASS(IAF, 0x06, "Intel Core2/Atom, fixed function") \
+ __PMC_CLASS(IAP, 0x07, "Intel Core...Atom, programmable") \
+ __PMC_CLASS(UCF, 0x08, "Intel Uncore fixed function") \
+ __PMC_CLASS(UCP, 0x09, "Intel Uncore programmable") \
+ __PMC_CLASS(XSCALE, 0x0A, "Intel XScale counters") \
+ __PMC_CLASS(MIPS24K, 0x0B, "MIPS 24K") \
+ __PMC_CLASS(OCTEON, 0x0C, "Cavium Octeon") \
+ __PMC_CLASS(PPC7450, 0x0D, "Motorola MPC7450 class") \
+ __PMC_CLASS(PPC970, 0x0E, "IBM PowerPC 970 class") \
+ __PMC_CLASS(SOFT, 0x0F, "Software events") \
+ __PMC_CLASS(ARMV7, 0x10, "ARMv7") \
+ __PMC_CLASS(ARMV8, 0x11, "ARMv8") \
+ __PMC_CLASS(MIPS74K, 0x12, "MIPS 74K") \
+ __PMC_CLASS(E500, 0x13, "Freescale e500 class") \
+ __PMC_CLASS(F17H, 0x14, "AMD F17H performance counters")
enum pmc_class {
#undef __PMC_CLASS
-#define __PMC_CLASS(N) PMC_CLASS_##N ,
+#define __PMC_CLASS(S,V,D) PMC_CLASS_##S = V,
__PMC_CLASSES()
};
#define PMC_CLASS_FIRST PMC_CLASS_TSC
-#define PMC_CLASS_LAST PMC_CLASS_SOFT
+#define PMC_CLASS_LAST PMC_CLASS_F17H
/*
* A PMC can be in the following states:
@@ -1019,7 +1036,7 @@
#define KTR_PMC KTR_SUBSYS
#define PMC_DEBUG_STRSIZE 128
-#define PMC_DEBUG_DEFAULT_FLAGS { 0, 0, 0, 0, 0, 0, 0, 0 }
+#define PMC_DEBUG_DEFAULT_FLAGS { 0, 0, 0, 0, 0, 0, 0, 0, 0 }
#define PMCDBG0(M, N, L, F) do { \
if (pmc_debugflags.pdb_ ## M & (1 << PMC_DEBUG_MIN_ ## N)) \
Modified: trunk/sys/sys/pmckern.h
===================================================================
--- trunk/sys/sys/pmckern.h 2020-02-16 21:51:02 UTC (rev 12368)
+++ trunk/sys/sys/pmckern.h 2020-02-16 21:59:52 UTC (rev 12369)
@@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: stable/10/sys/sys/pmckern.h 254813 2013-08-24 21:13:38Z markj $
+ * $FreeBSD: stable/11/sys/sys/pmckern.h 331722 2018-03-29 02:50:57Z eadler $
*/
/*
@@ -111,7 +111,7 @@
#ifdef PMC_FAKE_TRAPFRAME
#define PMC_SOFT_CALL(pr, mo, fu, na) \
do { \
- if (pmc_##pr##_##mo##_##fu##_##na.ps_running) { \
+ if (__predict_false(pmc_##pr##_##mo##_##fu##_##na.ps_running)) { \
struct pmckern_soft ks; \
register_t intr; \
intr = intr_disable(); \
@@ -136,7 +136,7 @@
*/
#define PMC_SOFT_CALL_TF(pr, mo, fu, na, tf) \
do { \
- if (pmc_##pr##_##mo##_##fu##_##na.ps_running) { \
+ if (__predict_false(pmc_##pr##_##mo##_##fu##_##na.ps_running)) { \
struct pmckern_soft ks; \
register_t intr; \
intr = intr_disable(); \
@@ -175,6 +175,9 @@
/* PMC soft per cpu trapframe */
extern struct trapframe pmc_tf[MAXCPU];
+/* Quick check if preparatory work is necessary */
+#define PMC_HOOK_INSTALLED(cmd) __predict_false(pmc_hook != NULL)
+
/* Hook invocation; for use within the kernel */
#define PMC_CALL_HOOK(t, cmd, arg) \
do { \
Modified: trunk/sys/sys/pmclog.h
===================================================================
--- trunk/sys/sys/pmclog.h 2020-02-16 21:51:02 UTC (rev 12368)
+++ trunk/sys/sys/pmclog.h 2020-02-16 21:59:52 UTC (rev 12369)
@@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: stable/10/sys/sys/pmclog.h 233628 2012-03-28 20:58:30Z fabient $
+ * $FreeBSD: stable/11/sys/sys/pmclog.h 331722 2018-03-29 02:50:57Z eadler $
*/
#ifndef _SYS_PMCLOG_H_
@@ -261,6 +261,8 @@
int pmclog_flush(struct pmc_owner *_po);
int pmclog_close(struct pmc_owner *_po);
void pmclog_initialize(void);
+int pmclog_proc_create(struct thread *td, void **handlep);
+void pmclog_proc_ignite(void *handle, struct pmc_owner *po);
void pmclog_process_callchain(struct pmc *_pm, struct pmc_sample *_ps);
void pmclog_process_closelog(struct pmc_owner *po);
void pmclog_process_dropnotify(struct pmc_owner *po);
Modified: trunk/sys/sys/posix4.h
===================================================================
--- trunk/sys/sys/posix4.h 2020-02-16 21:51:02 UTC (rev 12368)
+++ trunk/sys/sys/posix4.h 2020-02-16 21:59:52 UTC (rev 12369)
@@ -32,7 +32,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: stable/10/sys/sys/posix4.h 287507 2015-09-06 17:32:33Z kib $
+ * $FreeBSD: stable/11/sys/sys/posix4.h 331722 2018-03-29 02:50:57Z eadler $
*/
#include <sys/param.h>
Modified: trunk/sys/sys/priv.h
===================================================================
--- trunk/sys/sys/priv.h 2020-02-16 21:51:02 UTC (rev 12368)
+++ trunk/sys/sys/priv.h 2020-02-16 21:59:52 UTC (rev 12369)
@@ -27,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.
*
- * $FreeBSD: stable/10/sys/sys/priv.h 325099 2017-10-29 09:48:28Z kib $
+ * $FreeBSD: stable/11/sys/sys/priv.h 332991 2018-04-25 12:21:13Z kib $
*/
/*
@@ -46,8 +46,9 @@
* loadable kernel module ABI, and should not be changed across minor
* releases.
*
- * When adding a new privilege, remember to determine if it's appropriate for
- * use in jail, and update the privilege switch in kern_jail.c as necessary.
+ * When adding a new privilege, remember to determine if it's appropriate
+ * for use in jail, and update the privilege switch in prison_priv_check()
+ * in kern_jail.c as necessary.
*/
/*
@@ -342,6 +343,8 @@
#define PRIV_NET_SETIFDESCR 418 /* Set interface description. */
#define PRIV_NET_SETIFFIB 419 /* Set interface fib. */
#define PRIV_NET_VXLAN 420 /* Administer vxlan. */
+#define PRIV_NET_SETLANPCP 421 /* Set LAN priority. */
+#define PRIV_NET_SETVLANPCP PRIV_NET_SETLANPCP /* Alias Set VLAN priority */
/*
* 802.11-related privileges.
@@ -350,9 +353,9 @@
#define PRIV_NET80211_MANAGE 441 /* Administer 802.11. */
/*
- * AppleTalk privileges.
+ * Placeholder for AppleTalk privileges, not supported anymore.
*/
-#define PRIV_NETATALK_RESERVEDPORT 450 /* Bind low port number. */
+#define _PRIV_NETATALK_RESERVEDPORT 450 /* Bind low port number. */
/*
* ATM privileges.
@@ -393,12 +396,13 @@
#define PRIV_NETINET_REUSEPORT 504 /* Allow [rapid] port/address reuse. */
#define PRIV_NETINET_SETHDROPTS 505 /* Set certain IPv4/6 header options. */
#define PRIV_NETINET_BINDANY 506 /* Allow bind to any address. */
+#define PRIV_NETINET_HASHKEY 507 /* Get and set hash keys for IPv4/6. */
/*
- * IPX/SPX privileges.
+ * Placeholders for IPX/SPX privileges, not supported any more.
*/
-#define PRIV_NETIPX_RESERVEDPORT 520 /* Bind low port number. */
-#define PRIV_NETIPX_RAW 521 /* Open netipx raw socket. */
+#define _PRIV_NETIPX_RESERVEDPORT 520 /* Bind low port number. */
+#define _PRIV_NETIPX_RAW 521 /* Open netipx raw socket. */
/*
* NCP privileges.
Modified: trunk/sys/sys/proc.h
===================================================================
--- trunk/sys/sys/proc.h 2020-02-16 21:51:02 UTC (rev 12368)
+++ trunk/sys/sys/proc.h 2020-02-16 21:59:52 UTC (rev 12369)
@@ -33,7 +33,7 @@
* SUCH DAMAGE.
*
* @(#)proc.h 8.15 (Berkeley) 5/19/95
- * $FreeBSD: stable/10/sys/sys/proc.h 318743 2017-05-23 12:40:50Z badger $
+ * $FreeBSD: stable/11/sys/sys/proc.h 353789 2019-10-21 01:24:21Z kevans $
*/
#ifndef _SYS_PROC_H_
@@ -64,6 +64,7 @@
#endif
#include <sys/ucontext.h>
#include <sys/ucred.h>
+#include <sys/_vm_domain.h>
#include <machine/proc.h> /* Machine-dependent proc substruct. */
/*
@@ -142,6 +143,7 @@
* j - locked by proc slock
* k - only accessed by curthread
* k*- only accessed by curthread and from an interrupt
+ * kx- only accessed by curthread and by debugger
* l - the attaching proc or attaching proc parent
* m - Giant
* n - not locked, lazy
@@ -148,7 +150,10 @@
* o - ktrace lock
* q - td_contested lock
* r - p_peers lock
+ * s - see sleepq_switch(), sleeping_on_old_rtc(), and sleep(9)
* t - thread lock
+ * u - process stat lock
+ * w - process timer lock
* x - created at fork, only changes during single threading in exec
* y - created at first aio, doesn't change until exit or exec at which
* point we are single-threaded and only curthread changes it
@@ -159,6 +164,7 @@
* for write access.
*/
struct cpuset;
+struct filecaps;
struct filemon;
struct kaioinfo;
struct kaudit_record;
@@ -177,6 +183,8 @@
struct thread;
struct trapframe;
struct turnstile;
+struct vm_map;
+struct vm_map_entry;
/*
* XXX: Does this belong in resource.h or resourcevar.h instead?
@@ -186,14 +194,14 @@
* userland asks for rusage info. Backwards compatibility prevents putting
* this directly in the user-visible rusage struct.
*
- * Locking for p_rux: (cj) means (j) for p_rux and (c) for p_crux.
+ * Locking for p_rux: (cu) means (u) for p_rux and (c) for p_crux.
* Locking for td_rux: (t) for all fields.
*/
struct rusage_ext {
- uint64_t rux_runtime; /* (cj) Real time. */
- uint64_t rux_uticks; /* (cj) Statclock hits in user mode. */
- uint64_t rux_sticks; /* (cj) Statclock hits in sys mode. */
- uint64_t rux_iticks; /* (cj) Statclock hits in intr mode. */
+ uint64_t rux_runtime; /* (cu) Real time. */
+ uint64_t rux_uticks; /* (cu) Statclock hits in user mode. */
+ uint64_t rux_sticks; /* (cu) Statclock hits in sys mode. */
+ uint64_t rux_iticks; /* (cu) Statclock hits in intr mode. */
uint64_t rux_uu; /* (c) Previous user time in usec. */
uint64_t rux_su; /* (c) Previous sys time in usec. */
uint64_t rux_tu; /* (c) Previous total time in usec. */
@@ -218,9 +226,10 @@
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. */
+ struct vm_domain_policy td_vm_dom_policy; /* (c) current numa domain policy */
lwpid_t td_tid; /* (b) Thread ID. */
- uint64_t padding1[4];
- void *padding2[4];
+ uint64_t td_padding1[4];
+ void *td_padding2[4];
u_char td_lend_user_pri; /* (t) Lend user pri. */
/* Cleared during fork1() */
@@ -232,11 +241,9 @@
int td_sqqueue; /* (t) Sleepqueue queue blocked on. */
void *td_wchan; /* (t) Sleep address. */
const char *td_wmesg; /* (t) Reason for sleep. */
- u_char td_lastcpu; /* (t) Last cpu we were on. */
- u_char td_oncpu; /* (t) Which cpu we are on. */
volatile u_char td_owepreempt; /* (k*) Preempt on last critical_exit */
u_char td_tsqueue; /* (t) Turnstile queue blocked on. */
- short td_locks; /* (k) Count of non-spin locks. */
+ short td_locks; /* (k) Debug: count of non-spin locks */
short td_rw_rlocks; /* (k) Count of rwlock read locks. */
short td_lk_slocks; /* (k) Count of lockmgr shared locks. */
short td_stopsched; /* (k) Scheduler stopped. */
@@ -247,10 +254,11 @@
int td_intr_nesting_level; /* (k) Interrupt recursion. */
int td_pinned; /* (k) Temporary cpu pin count. */
struct ucred *td_ucred; /* (k) Reference to credentials. */
- u_int td_estcpu; /* (t) estimated cpu utilization */
+ struct plimit *td_limit; /* (k) Resource limits. */
int td_slptick; /* (t) Time at sleep. */
int td_blktick; /* (t) Time spent blocked. */
int td_swvoltick; /* (t) Time at last SW_VOL switch. */
+ int td_swinvoltick; /* (t) Time at last SW_INVOL switch. */
u_int td_cow; /* (*) Number of copy-on-write faults */
struct rusage td_ru; /* (t) rusage information. */
struct rusage_ext td_rux; /* (t) Internal rusage information. */
@@ -270,7 +278,7 @@
char td_name[MAXCOMLEN + 1]; /* (*) Thread name. */
struct file *td_fpop; /* (k) file referencing cdev under op */
int td_dbgflags; /* (c) Userland debugger flags */
- struct ksiginfo td_dbgksi; /* (c) ksi reflected to debugger. */
+ struct ksiginfo td_padding3;
int td_ng_outbound; /* (k) Thread entered ng from above. */
struct osd td_osd; /* (k) Object specific data. */
struct vm_map_entry *td_map_def_user; /* (k) Deferred entries. */
@@ -278,6 +286,8 @@
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. */
+ void *td_su; /* (k) FFS SU private */
+ int td_rtcgen; /* (s) rtc_generation of abs. sleep */
#define td_endzero td_sigmask
/* Copied during fork1() or create_thread(). */
@@ -289,6 +299,11 @@
u_char td_pri_class; /* (t) Scheduling class. */
u_char td_user_pri; /* (t) User pri from estcpu and nice. */
u_char td_base_user_pri; /* (t) Base user pri */
+ u_int td_padding4;
+ u_int td_padding5;
+ uintptr_t td_rb_list; /* (k) Robust list head. */
+ uintptr_t td_rbp_list; /* (k) Robust priv list head. */
+ uintptr_t td_rb_inact; /* (k) Current in-action mutex loc. */
#define td_endcopy td_pcb
/*
@@ -303,7 +318,12 @@
TDS_RUNQ,
TDS_RUNNING
} td_state; /* (t) thread state */
- register_t td_retval[2]; /* (k) Syscall aux returns. */
+ union {
+ register_t tdu_retval[2];
+ off_t tdu_off;
+ } td_uretoff; /* (k) Syscall aux returns. */
+#define td_retval td_uretoff.tdu_retval
+ u_int td_cowgen; /* (k) Generation of COW pointers. */
struct callout td_slpcallout; /* (h) Callout for sleep. */
struct trapframe *td_frame; /* (k) */
struct vm_object *td_kstack_obj;/* (a) Kstack object. */
@@ -311,7 +331,6 @@
int td_kstack_pages; /* (a) Size of the kstack. */
volatile u_int td_critnest; /* (k*) Critical section nest level. */
struct mdthread td_md; /* (k) Any machine-dependent fields. */
- struct td_sched *td_sched; /* (*) Scheduler-specific data. */
struct kaudit_record *td_ar; /* (k) Active audit record, if any. */
struct lpohead td_lprof[2]; /* (a) lock profiling objects. */
struct kdtrace_thread *td_dtrace; /* (*) DTrace-specific data. */
@@ -322,15 +341,24 @@
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 */
+ int td_lastcpu; /* (t) Last cpu we were on. */
+ int td_oncpu; /* (t) Which cpu we are on. */
sbintime_t td_sleeptimo; /* (t) Sleep timeout. */
sigqueue_t td_sigqueue; /* (c) Sigs arrived, not delivered. */
#define td_siglist td_sigqueue.sq_signals
+ struct syscall_args td_sa; /* (kx) Syscall parameters. Copied on
+ fork for child tracing. */
+ siginfo_t td_si; /* (c) For debugger or core file */
+ void *td_lkpi_task; /* LinuxKPI task struct pointer */
+ size_t td_vslock_sz; /* (k) amount of vslock-ed space */
};
+struct thread0_storage {
+ struct thread t0st_thread;
+ uint64_t t0st_sched[10];
+};
+
struct mtx *thread_lock_block(struct thread *);
void thread_lock_unblock(struct thread *, struct mtx *);
void thread_lock_set(struct thread *, struct mtx *);
@@ -348,8 +376,18 @@
KASSERT((__m == &blocked_lock || __m == (lock)), \
("Thread %p lock %p does not match %p", td, __m, (lock))); \
} while (0)
+
+#define TD_LOCKS_INC(td) ((td)->td_locks++)
+#define TD_LOCKS_DEC(td) do { \
+ KASSERT(SCHEDULER_STOPPED_TD(td) || (td)->td_locks > 0, \
+ ("thread %p owns no locks", (td))); \
+ (td)->td_locks--; \
+} while (0)
#else
#define THREAD_LOCKPTR_ASSERT(td, lock)
+
+#define TD_LOCKS_INC(td)
+#define TD_LOCKS_DEC(td)
#endif
/*
@@ -375,9 +413,9 @@
#define TDF_NEEDRESCHED 0x00010000 /* Thread needs to yield. */
#define TDF_NEEDSIGCHK 0x00020000 /* Thread may need signal delivery. */
#define TDF_NOLOAD 0x00040000 /* Ignore during load avg calculations. */
-#define TDF_UNUSED19 0x00080000 /* --available-- */
+#define TDF_SERESTART 0x00080000 /* ERESTART on stop attempts. */
#define TDF_THRWAKEUP 0x00100000 /* Libthr thread must not suspend itself. */
-#define TDF_UNUSED21 0x00200000 /* --available-- */
+#define TDF_SEINTR 0x00200000 /* EINTR on stop attempts. */
#define TDF_SWAPINREQ 0x00400000 /* Swapin request due to wakeup. */
#define TDF_UNUSED23 0x00800000 /* --available-- */
#define TDF_SCHED0 0x01000000 /* Reserved for scheduler private use */
@@ -404,6 +442,7 @@
#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 */
+#define TDB_STEP 0x00002000 /* (x86) PSL_T set for PT_STEP */
/*
* "Private" flags kept in td_pflags:
@@ -438,7 +477,7 @@
#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_FORKING 0x20000000 /* Thread is being created through fork() */
#define TDP_EXECVMSPC 0x40000000 /* Execve destroyed old vmspace */
/*
@@ -499,6 +538,11 @@
#define TD_SET_RUNQ(td) (td)->td_state = TDS_RUNQ
#define TD_SET_CAN_RUN(td) (td)->td_state = TDS_CAN_RUN
+#define TD_SBDRY_INTR(td) \
+ (((td)->td_flags & (TDF_SEINTR | TDF_SERESTART)) != 0)
+#define TD_SBDRY_ERRNO(td) \
+ (((td)->td_flags & TDF_SEINTR) != 0 ? EINTR : ERESTART)
+
/*
* Process structure.
*/
@@ -510,7 +554,7 @@
struct filedesc *p_fd; /* (b) Open files. */
struct filedesc_to_leader *p_fdtol; /* (b) Tracking node */
struct pstats *p_stats; /* (b) Accounting/statistics (CPU). */
- struct plimit *p_limit; /* (c) Process limits. */
+ struct plimit *p_limit; /* (c) Resource limits. */
struct callout p_limco; /* (c) Limit callout handle */
struct sigacts *p_sigacts; /* (x) Signal actions, state (CPU). */
@@ -527,7 +571,15 @@
struct proc *p_pptr; /* (c + e) Pointer to parent process. */
LIST_ENTRY(proc) p_sibling; /* (e) List of sibling processes. */
LIST_HEAD(, proc) p_children; /* (e) Pointer to list of children. */
+ 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. */
struct mtx p_mtx; /* (n) Lock for this struct. */
+ struct mtx p_statmtx; /* Lock for the stats */
+ struct mtx p_itimmtx; /* Lock for the virt/prof timers */
+ struct mtx p_profmtx; /* Lock for the profiling */
struct ksiginfo *p_ksi; /* Locked by parent proc lock */
uint64_t padding1[4];
void *padding2[4];
@@ -537,9 +589,10 @@
pid_t p_oppid; /* (c + e) Save ppid in ptrace. XXX */
struct vmspace *p_vmspace; /* (b) Address space. */
u_int p_swtick; /* (c) Tick when swapped in or out. */
+ u_int p_cowgen; /* (c) Generation of COW pointers. */
struct itimerval p_realtimer; /* (c) Alarm timer. */
struct rusage p_ru; /* (a) Exit information. */
- struct rusage_ext p_rux; /* (cj) Internal resource usage. */
+ struct rusage_ext p_rux; /* (cu) Internal resource usage. */
struct rusage_ext p_crux; /* (c) Internal child resource usage. */
int p_profthreads; /* (c) Num threads in addupc_task. */
volatile int p_exitthreads; /* (j) Number of threads exiting */
@@ -565,7 +618,9 @@
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. */
+ u_int p_treeflag; /* (e) P_TREE flags */
int p_pendingexits; /* (c) Count of pending thread exits. */
+ struct filemon *p_filemon; /* (c) filemon-specific data. */
/* End area that is zeroed on creation. */
#define p_endzero p_magic
@@ -575,18 +630,21 @@
int p_osrel; /* (x) osreldate for the
binary (from ELF note, if any) */
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 */
-
+ pid_t p_reapsubtree; /* (e) Pid of the direct child of the
+ reaper which spawned
+ our subtree. */
/* End area that is copied on creation. */
-#define p_endcopy p_xstat
+#define p_endcopy p_xexit
- u_short p_xstat; /* (c) Exit status; also stop sig. */
- struct knlist p_klist; /* (c) Knotes attached to this proc. */
+ u_int p_xexit; /* (c) Exit code. */
+ u_int p_xsig; /* (c) Stop/kill sig. */
+ struct pgrp *p_pgrp; /* (c + e) Pointer to process group. */
+ struct knlist *p_klist; /* (c) Knotes attached to this proc. */
int p_numthreads; /* (c) Number of threads. */
struct mdproc p_md; /* Any machine-dependent fields. */
struct callout p_itcallout; /* (h + c) Interval timer callout. */
@@ -595,16 +653,15 @@
struct proc *p_leader; /* (b) */
void *p_emuldata; /* (c) Emulator state data. */
struct label *p_label; /* (*) Proc (not subject) MAC label. */
- struct p_sched *p_sched; /* (*) Scheduler-specific data. */
STAILQ_HEAD(, ktr_request) p_ktr; /* (o) KTR event queue. */
LIST_HEAD(, mqueue_notifier) p_mqnotifier; /* (c) mqueue notifiers.*/
struct kdtrace_proc *p_dtrace; /* (*) DTrace-specific data. */
struct cv p_pwait; /* (*) wait cv for exit/exec. */
- struct cv p_dbgwait; /* (*) wait cv for debugger attach
- after fork. */
+ struct cv p_pad_dbgwait;
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 */
+ int p_throttled; /* (c) Flag for racct pcpu throttling */
+ struct vm_domain_policy p_vm_dom_policy; /* (c) process default VM domain, or -1 */
/*
* An orphan is the child that has beed re-parented to the
* debugger as a result of attaching to it. Need to keep
@@ -613,49 +670,41 @@
*/
LIST_ENTRY(proc) p_orphan; /* (e) List of orphan processes. */
LIST_HEAD(, proc) p_orphans; /* (e) Pointer to list of orphans. */
- 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. */
+ u_int p_ptevents; /* (c + e) 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
+ int p_pdeathsig; /* (c) Signal from parent on exit. */
};
#define p_session p_pgrp->pg_session
#define p_pgid p_pgrp->pg_id
-#define NOCPU 0xff /* For when we aren't on a CPU. */
+#define NOCPU (-1) /* For when we aren't on a CPU. */
+#define NOCPU_OLD (255)
+#define MAXCPU_OLD (254)
#define PROC_SLOCK(p) mtx_lock_spin(&(p)->p_slock)
#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_STATLOCK(p) mtx_lock_spin(&(p)->p_statmtx)
+#define PROC_STATUNLOCK(p) mtx_unlock_spin(&(p)->p_statmtx)
+#define PROC_STATLOCK_ASSERT(p, type) mtx_assert(&(p)->p_statmtx, (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_ITIMLOCK(p) mtx_lock_spin(&(p)->p_itimmtx)
+#define PROC_ITIMUNLOCK(p) mtx_unlock_spin(&(p)->p_itimmtx)
+#define PROC_ITIMLOCK_ASSERT(p, type) mtx_assert(&(p)->p_itimmtx, (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))
+#define PROC_PROFLOCK(p) mtx_lock_spin(&(p)->p_profmtx)
+#define PROC_PROFUNLOCK(p) mtx_unlock_spin(&(p)->p_profmtx)
+#define PROC_PROFLOCK_ASSERT(p, type) mtx_assert(&(p)->p_profmtx, (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_KPROC 0x00004 /* Kernel process. */
#define P_UNUSED3 0x00008 /* --available-- */
#define P_PPWAIT 0x00010 /* Parent is waiting for child to exec/exit. */
#define P_PROFIL 0x00020 /* Has started profiling. */
@@ -678,7 +727,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_TOTAL_STOP 0x2000000 /* Stopped in proc_stop_total. */
+#define P_TOTAL_STOP 0x2000000 /* Stopped in stop_all_proc. */
#define P_INEXEC 0x4000000 /* Process is in execve(). */
#define P_STATCHILD 0x8000000 /* Child process stopped or exited. */
#define P_INMEM 0x10000000 /* Loaded into memory. */
@@ -696,6 +745,9 @@
#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. */
+#define P2_TRAPCAP 0x00000020 /* SIGTRAP on ENOTCAPABLE */
+#define P2_STKGAP_DISABLE 0x00000800 /* Disable stack gap for MAP_STACK */
+#define P2_STKGAP_DISABLE_EXEC 0x00001000 /* Stack gap disabled after exec */
/* Flags protected by proctree_lock, kept in p_treeflags. */
#define P_TREE_ORPHANED 0x00000001 /* Reparented, on orphan list */
@@ -772,6 +824,8 @@
#define STOPEVENT(p, e, v) do { \
+ WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, \
+ "checking stopevent %d", (e)); \
if ((p)->p_stops & (e)) { \
PROC_LOCK(p); \
stopevent((p), (e), (v)); \
@@ -814,7 +868,20 @@
#define SESS_LOCKED(s) mtx_owned(&(s)->s_mtx)
#define SESS_LOCK_ASSERT(s, type) mtx_assert(&(s)->s_mtx, (type))
-/* Hold process U-area in memory, normally for ptrace/procfs work. */
+/*
+ * Non-zero p_lock ensures that:
+ * - exit1() is not performed until p_lock reaches zero;
+ * - the process' threads stack are not swapped out if they are currently
+ * not (P_INMEM).
+ *
+ * PHOLD() asserts that the process (except the current process) is
+ * not exiting, increments p_lock and swaps threads stacks into memory,
+ * if needed.
+ * _PHOLD() is same as PHOLD(), it takes the process locked.
+ * _PHOLD_LITE() also takes the process locked, but comparing with
+ * _PHOLD(), it only guarantees that exit1() is not executed,
+ * faultin() is not called.
+ */
#define PHOLD(p) do { \
PROC_LOCK(p); \
_PHOLD(p); \
@@ -823,14 +890,20 @@
#define _PHOLD(p) do { \
PROC_LOCK_ASSERT((p), MA_OWNED); \
KASSERT(!((p)->p_flag & P_WEXIT) || (p) == curproc, \
- ("PHOLD of exiting process")); \
+ ("PHOLD of exiting process %p", p)); \
(p)->p_lock++; \
if (((p)->p_flag & P_INMEM) == 0) \
faultin((p)); \
} while (0)
-#define PROC_ASSERT_HELD(p) do { \
- KASSERT((p)->p_lock > 0, ("process not held")); \
+#define _PHOLD_LITE(p) do { \
+ PROC_LOCK_ASSERT((p), MA_OWNED); \
+ KASSERT(!((p)->p_flag & P_WEXIT) || (p) == curproc, \
+ ("PHOLD of exiting process %p", p)); \
+ (p)->p_lock++; \
} while (0)
+#define PROC_ASSERT_HELD(p) do { \
+ KASSERT((p)->p_lock > 0, ("process %p not held", p)); \
+} while (0)
#define PRELE(p) do { \
PROC_LOCK((p)); \
@@ -844,10 +917,15 @@
if (((p)->p_flag & P_WEXIT) && (p)->p_lock == 0) \
wakeup(&(p)->p_lock); \
} while (0)
-#define PROC_ASSERT_NOT_HELD(p) do { \
- KASSERT((p)->p_lock == 0, ("process held")); \
+#define PROC_ASSERT_NOT_HELD(p) do { \
+ KASSERT((p)->p_lock == 0, ("process %p held", p)); \
} while (0)
+#define PROC_UPDATE_COW(p) do { \
+ PROC_LOCK_ASSERT((p), MA_OWNED); \
+ (p)->p_cowgen++; \
+} while (0)
+
/* Check whether a thread is safe to be swapped out. */
#define thread_safetoswapout(td) ((td)->td_flags & TDF_CANSWAP)
@@ -875,7 +953,8 @@
extern struct sx proctree_lock;
extern struct mtx ppeers_lock;
extern struct proc proc0; /* Process slot for swapper. */
-extern struct thread thread0; /* Primary thread in proc0. */
+extern struct thread0_storage thread0_st; /* Primary thread in proc0. */
+#define thread0 (thread0_st.t0st_thread)
extern struct vmspace vmspace0; /* VM space for proc0. */
extern int hogticks; /* Limit on kernel cpu hogs. */
extern int lastpid;
@@ -897,6 +976,18 @@
struct pgrp *pgfind(pid_t); /* Find process group by id. */
struct proc *zpfind(pid_t); /* Find zombie process by id. */
+struct fork_req {
+ int fr_flags;
+ int fr_pages;
+ int *fr_pidp;
+ struct proc **fr_procp;
+ int *fr_pd_fd;
+ int fr_pd_flags;
+ struct filecaps *fr_pd_fcaps;
+ int fr_flags2;
+#define FR2_DROPSIG_CAUGHT 0x00001 /* Drop caught non-DFL signals */
+};
+
/*
* pget() flags.
*/
@@ -920,13 +1011,16 @@
int enterthispgrp(struct proc *p, struct pgrp *pgrp);
void faultin(struct proc *p);
void fixjobc(struct proc *p, struct pgrp *pgrp, int entering);
-int fork1(struct thread *, int, int, struct proc **, int *, int);
+int fork1(struct thread *, struct fork_req *);
void fork_exit(void (*)(void *, struct trapframe *), void *,
struct trapframe *);
void fork_return(struct thread *, struct trapframe *);
int inferior(struct proc *p);
+void kern_proc_vmmap_resident(struct vm_map *map, struct vm_map_entry *entry,
+ int *resident_count, bool *super);
void kern_yield(int);
void kick_proc0(void);
+void killjobc(void);
int leavepgrp(struct proc *p);
int maybe_preempt(struct thread *td);
void maybe_yield(void);
@@ -949,6 +1043,7 @@
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);
+void proc_wkilled(struct proc *p);
struct pstats *pstats_alloc(void);
void pstats_fork(struct pstats *src, struct pstats *dst);
void pstats_free(struct pstats *ps);
@@ -975,13 +1070,13 @@
void userret(struct thread *, struct trapframe *);
void cpu_exit(struct thread *);
-void exit1(struct thread *, int) __dead2;
-int cpu_fetch_syscall_args(struct thread *td, struct syscall_args *sa);
+void exit1(struct thread *, int, int) __dead2;
+void cpu_copy_thread(struct thread *td, struct thread *td0);
+int cpu_fetch_syscall_args(struct thread *td);
void cpu_fork(struct thread *, struct proc *, struct thread *, int);
-void cpu_set_fork_handler(struct thread *, void (*)(void *), void *);
+void cpu_fork_kthread_handler(struct thread *, void (*)(void *), void *);
void cpu_set_syscall_retval(struct thread *, int);
-void cpu_set_upcall(struct thread *td, struct thread *td0);
-void cpu_set_upcall_kse(struct thread *, void (*)(void *), void *,
+void cpu_set_upcall(struct thread *, void (*)(void *), void *,
stack_t *);
int cpu_set_user_tls(struct thread *, void *tls_base);
void cpu_thread_alloc(struct thread *);
@@ -992,6 +1087,10 @@
void cpu_thread_swapout(struct thread *);
struct thread *thread_alloc(int pages);
int thread_alloc_stack(struct thread *, int pages);
+void thread_cow_get_proc(struct thread *newtd, struct proc *p);
+void thread_cow_get(struct thread *newtd, struct thread *td);
+void thread_cow_free(struct thread *td);
+void thread_cow_update(struct thread *td);
int thread_create(struct thread *td, struct rtprio *rtp,
int (*initialize_thread)(struct thread *, void *), void *thunk);
void thread_exit(void) __dead2;
@@ -1036,6 +1135,22 @@
curthread->td_pflags &= save;
}
+static __inline __pure2 struct td_sched *
+td_get_sched(struct thread *td)
+{
+
+ return ((struct td_sched *)&td[1]);
+}
+
+extern void (*softdep_ast_cleanup)(struct thread *);
+static __inline void
+td_softdep_cleanup(struct thread *td)
+{
+
+ if (td->td_su != NULL && softdep_ast_cleanup != NULL)
+ softdep_ast_cleanup(td);
+}
+
#endif /* _KERNEL */
#endif /* !_SYS_PROC_H_ */
Modified: trunk/sys/sys/procctl.h
===================================================================
--- trunk/sys/sys/procctl.h 2020-02-16 21:51:02 UTC (rev 12368)
+++ trunk/sys/sys/procctl.h 2020-02-16 21:59:52 UTC (rev 12369)
@@ -1,9 +1,13 @@
/* $MidnightBSD$ */
/*-
* Copyright (c) 2013 Hudson River Trading LLC
+ * Copyright (c) 2014, 2016 The FreeBSD Foundation
* Written by: John H. Baldwin <jhb at FreeBSD.org>
* All rights reserved.
*
+ * Portions of this software were developed by Konstantin Belousov
+ * 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:
@@ -25,7 +29,7 @@
* 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 $
+ * $FreeBSD: stable/11/sys/sys/procctl.h 352125 2019-09-10 07:29:21Z kib $
*/
#ifndef _SYS_PROCCTL_H_
@@ -44,6 +48,12 @@
#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 */
+#define PROC_TRAPCAP_CTL 9 /* trap capability errors */
+#define PROC_TRAPCAP_STATUS 10 /* query trap capability status */
+#define PROC_PDEATHSIG_CTL 11 /* set parent death signal */
+#define PROC_PDEATHSIG_STATUS 12 /* get parent death signal */
+#define PROC_STACKGAP_CTL 17 /* en/dis stack gap on MAP_STACK */
+#define PROC_STACKGAP_STATUS 18 /* query stack gap */
/* Operations for PROC_SPROTECT (passed in integer arg). */
#define PPROT_OP(x) ((x) & 0xf)
@@ -104,6 +114,14 @@
#define PROC_TRACE_CTL_DISABLE 2
#define PROC_TRACE_CTL_DISABLE_EXEC 3
+#define PROC_TRAPCAP_CTL_ENABLE 1
+#define PROC_TRAPCAP_CTL_DISABLE 2
+
+#define PROC_STACKGAP_ENABLE 0x0001
+#define PROC_STACKGAP_DISABLE 0x0002
+#define PROC_STACKGAP_ENABLE_EXEC 0x0004
+#define PROC_STACKGAP_DISABLE_EXEC 0x0008
+
#ifndef _KERNEL
__BEGIN_DECLS
int procctl(idtype_t, id_t, int, void *);
Modified: trunk/sys/sys/procdesc.h
===================================================================
--- trunk/sys/sys/procdesc.h 2020-02-16 21:51:02 UTC (rev 12368)
+++ trunk/sys/sys/procdesc.h 2020-02-16 21:59:52 UTC (rev 12369)
@@ -27,7 +27,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: stable/10/sys/sys/procdesc.h 269619 2014-08-06 00:35:32Z emaste $
+ * $FreeBSD: stable/11/sys/sys/procdesc.h 331722 2018-03-29 02:50:57Z eadler $
*/
#ifndef _SYS_PROCDESC_H_
@@ -34,6 +34,7 @@
#define _SYS_PROCDESC_H_
#ifdef _KERNEL
+
#include <sys/selinfo.h> /* struct selinfo */
#include <sys/_lock.h>
#include <sys/_mutex.h>
@@ -68,6 +69,7 @@
* In-flight data and notification of events.
*/
int pd_flags; /* (p) PD_ flags. */
+ u_short pd_xstat; /* (p) Exit status. */
struct selinfo pd_selinfo; /* (p) Event notification. */
struct mtx pd_lock; /* Protect data + events. */
};
@@ -100,15 +102,28 @@
pid_t procdesc_pid(struct file *);
void procdesc_reap(struct proc *);
+int procdesc_falloc(struct thread *, struct file **, int *, int,
+ struct filecaps *);
+
#else /* !_KERNEL */
+#include <sys/_types.h>
+
+#ifndef _PID_T_DECLARED
+typedef __pid_t pid_t;
+#define _PID_T_DECLARED
+#endif
+
+struct rusage;
+
/*
* Process descriptor system calls.
*/
-struct rusage;
-int pdfork(int *, int);
+__BEGIN_DECLS
+pid_t pdfork(int *, int);
int pdkill(int, int);
int pdgetpid(int, pid_t *);
+__END_DECLS
#endif /* _KERNEL */
@@ -116,5 +131,8 @@
* Flags which can be passed to pdfork(2).
*/
#define PD_DAEMON 0x00000001 /* Don't exit when procdesc closes. */
+#define PD_CLOEXEC 0x00000002 /* Close file descriptor on exec. */
+#define PD_ALLOWED_AT_FORK (PD_DAEMON | PD_CLOEXEC)
+
#endif /* !_SYS_PROCDESC_H_ */
Modified: trunk/sys/sys/protosw.h
===================================================================
--- trunk/sys/sys/protosw.h 2020-02-16 21:51:02 UTC (rev 12368)
+++ trunk/sys/sys/protosw.h 2020-02-16 21:59:52 UTC (rev 12369)
@@ -28,7 +28,7 @@
* SUCH DAMAGE.
*
* @(#)protosw.h 8.1 (Berkeley) 6/2/93
- * $FreeBSD: stable/10/sys/sys/protosw.h 247667 2013-03-02 21:11:30Z pjd $
+ * $FreeBSD: stable/11/sys/sys/protosw.h 331722 2018-03-29 02:50:57Z eadler $
*/
#ifndef _SYS_PROTOSW_H_
@@ -35,6 +35,7 @@
#define _SYS_PROTOSW_H_
/* Forward declare these structures referenced from prototypes below. */
+struct kaiocb;
struct mbuf;
struct thread;
struct sockaddr;
@@ -65,13 +66,11 @@
* similar to the vnode VOP interface.
*/
/* USE THESE FOR YOUR PROTOTYPES ! */
-typedef void pr_input_t (struct mbuf *, int);
-typedef int pr_input6_t (struct mbuf **, int*, int); /* XXX FIX THIS */
-typedef int pr_output_t (struct mbuf *, struct socket *);
+typedef int pr_input_t (struct mbuf **, int*, int);
+typedef int pr_output_t (struct mbuf *, struct socket *, ...);
typedef void pr_ctlinput_t (int, struct sockaddr *, void *);
typedef int pr_ctloutput_t (struct socket *, struct sockopt *);
typedef void pr_init_t (void);
-typedef void pr_destroy_t (void);
typedef void pr_fasttimo_t (void);
typedef void pr_slowtimo_t (void);
typedef void pr_drain_t (void);
@@ -88,7 +87,6 @@
pr_ctloutput_t *pr_ctloutput; /* control output (from above) */
/* utility hooks */
pr_init_t *pr_init;
- pr_destroy_t *pr_destroy;
pr_fasttimo_t *pr_fasttimo; /* fast timeout (200ms) */
pr_slowtimo_t *pr_slowtimo; /* slow timeout (500ms) */
pr_drain_t *pr_drain; /* flush any excess space possible */
@@ -210,6 +208,8 @@
#define PRUS_OOB 0x1
#define PRUS_EOF 0x2
#define PRUS_MORETOCOME 0x4
+#define PRUS_NOTREADY 0x8
+ int (*pru_ready)(struct socket *so, struct mbuf *m, int count);
int (*pru_sense)(struct socket *so, struct stat *sb);
int (*pru_shutdown)(struct socket *so);
int (*pru_flush)(struct socket *so, int direction);
@@ -228,6 +228,7 @@
struct thread *td);
int (*pru_connectat)(int fd, struct socket *so,
struct sockaddr *nam, struct thread *td);
+ int (*pru_aio_queue)(struct socket *so, struct kaiocb *job);
};
/*
@@ -234,6 +235,7 @@
* All nonvoid pru_*() functions below return EOPNOTSUPP.
*/
int pru_accept_notsupp(struct socket *so, struct sockaddr **nam);
+int pru_aio_queue_notsupp(struct socket *so, struct kaiocb *job);
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);
@@ -253,6 +255,7 @@
int pru_rcvoob_notsupp(struct socket *so, struct mbuf *m, int flags);
int pru_send_notsupp(struct socket *so, int flags, struct mbuf *m,
struct sockaddr *addr, struct mbuf *control, struct thread *td);
+int pru_ready_notsupp(struct socket *so, struct mbuf *m, int count);
int pru_sense_null(struct socket *so, struct stat *sb);
int pru_shutdown_notsupp(struct socket *so);
int pru_sockaddr_notsupp(struct socket *so, struct sockaddr **nam);
@@ -276,8 +279,8 @@
#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_QUENCH2 3 /* DEC congestion bit says slow down */
-#define PRC_QUENCH 4 /* some one said to slow down */
+/* was PRC_QUENCH2 3 DEC congestion bit says slow down */
+/* was PRC_QUENCH 4 Deprecated by RFC 6633 */
#define PRC_MSGSIZE 5 /* message size forced drop */
#define PRC_HOSTDEAD 6 /* host appears to be down */
#define PRC_HOSTUNREACH 7 /* deprecated (use PRC_UNREACH_HOST) */
Modified: trunk/sys/sys/ptio.h
===================================================================
--- trunk/sys/sys/ptio.h 2020-02-16 21:51:02 UTC (rev 12368)
+++ trunk/sys/sys/ptio.h 2020-02-16 21:59:52 UTC (rev 12369)
@@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: stable/10/sys/sys/ptio.h 50477 1999-08-28 01:08:13Z peter $
+ * $FreeBSD: stable/11/sys/sys/ptio.h 331722 2018-03-29 02:50:57Z eadler $
*/
#ifndef _SYS_PTIO_H_
Modified: trunk/sys/sys/ptrace.h
===================================================================
--- trunk/sys/sys/ptrace.h 2020-02-16 21:51:02 UTC (rev 12368)
+++ trunk/sys/sys/ptrace.h 2020-02-16 21:59:52 UTC (rev 12369)
@@ -28,7 +28,7 @@
* SUCH DAMAGE.
*
* @(#)ptrace.h 8.2 (Berkeley) 1/4/94
- * $FreeBSD: stable/10/sys/sys/ptrace.h 304499 2016-08-19 20:17:57Z jhb $
+ * $FreeBSD: stable/11/sys/sys/ptrace.h 331722 2018-03-29 02:50:57Z eadler $
*/
#ifndef _SYS_PTRACE_H_
@@ -70,6 +70,8 @@
#define PT_GET_EVENT_MASK 25 /* get mask of optional events */
#define PT_SET_EVENT_MASK 26 /* set mask of optional events */
+#define PT_GET_SC_ARGS 27 /* fetch syscall args */
+
#define PT_GETREGS 33 /* get general-purpose registers */
#define PT_SETREGS 34 /* set general-purpose registers */
#define PT_GETFPREGS 35 /* get floating-point registers */
@@ -137,6 +139,21 @@
u_int pl_syscall_narg;
};
+#if defined(_WANT_LWPINFO32) || (defined(_KERNEL) && defined(__LP64__))
+struct ptrace_lwpinfo32 {
+ lwpid_t pl_lwpid; /* LWP described. */
+ int pl_event; /* Event that stopped the LWP. */
+ int pl_flags; /* LWP flags. */
+ sigset_t pl_sigmask; /* LWP signal mask */
+ sigset_t pl_siglist; /* LWP pending signal */
+ struct siginfo32 pl_siginfo; /* siginfo for signal */
+ char pl_tdname[MAXCOMLEN + 1]; /* LWP name. */
+ pid_t pl_child_pid; /* New child pid */
+ u_int pl_syscall_code;
+ u_int pl_syscall_narg;
+};
+#endif
+
/* Argument structure for PT_VM_ENTRY. */
struct ptrace_vm_entry {
int pve_entry; /* Entry number used for iteration. */
@@ -179,6 +196,10 @@
int proc_write_dbregs(struct thread *_td, struct dbreg *_dbreg);
int proc_sstep(struct thread *_td);
int proc_rwmem(struct proc *_p, struct uio *_uio);
+ssize_t proc_readmem(struct thread *_td, struct proc *_p, vm_offset_t _va,
+ void *_buf, size_t _len);
+ssize_t proc_writemem(struct thread *_td, struct proc *_p, vm_offset_t _va,
+ void *_buf, size_t _len);
#ifdef COMPAT_FREEBSD32
struct reg32;
struct fpreg32;
Modified: trunk/sys/sys/queue.h
===================================================================
--- trunk/sys/sys/queue.h 2020-02-16 21:51:02 UTC (rev 12368)
+++ trunk/sys/sys/queue.h 2020-02-16 21:59:52 UTC (rev 12369)
@@ -28,7 +28,7 @@
* SUCH DAMAGE.
*
* @(#)queue.h 8.5 (Berkeley) 8/20/94
- * $FreeBSD: stable/10/sys/sys/queue.h 307534 2016-10-17 21:49:54Z mckusick $
+ * $FreeBSD: stable/11/sys/sys/queue.h 354405 2019-11-06 18:02:18Z mav $
*/
#ifndef _SYS_QUEUE_H_
@@ -94,6 +94,7 @@
* _NEXT + + + +
* _PREV - + - +
* _LAST - - + +
+ * _LAST_FAST - - - +
* _FOREACH + + + +
* _FOREACH_FROM + + + +
* _FOREACH_SAFE + + + +
@@ -745,11 +746,25 @@
#define TAILQ_LAST(head, headname) \
(*(((struct headname *)((head)->tqh_last))->tqh_last))
+/*
+ * The FAST function is fast in that it causes no data access other
+ * then the access to the head. The standard LAST function above
+ * will cause a data access of both the element you want and
+ * the previous element. FAST is very useful for instances when
+ * you may want to prefetch the last data element.
+ */
+#define TAILQ_LAST_FAST(head, type, field) \
+ (TAILQ_EMPTY(head) ? NULL : __containerof((head)->tqh_last, QUEUE_TYPEOF(type), field.tqe_next))
+
#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
#define TAILQ_PREV(elm, headname, field) \
(*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
+#define TAILQ_PREV_FAST(elm, head, type, field) \
+ ((elm)->field.tqe_prev == &(head)->tqh_first ? NULL : \
+ __containerof((elm)->field.tqe_prev, QUEUE_TYPEOF(type), field.tqe_next))
+
#define TAILQ_REMOVE(head, elm, field) do { \
QMD_SAVELINK(oldnext, (elm)->field.tqe_next); \
QMD_SAVELINK(oldprev, (elm)->field.tqe_prev); \
More information about the Midnightbsd-cvs
mailing list