[Midnightbsd-cvs] src [12368] trunk/sys/sys: Sync with FreeBSD 11-stable

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sun Feb 16 16:51:02 EST 2020


Revision: 12368
          http://svnweb.midnightbsd.org/src/?rev=12368
Author:   laffer1
Date:     2020-02-16 16:51:02 -0500 (Sun, 16 Feb 2020)
Log Message:
-----------
Sync with FreeBSD 11-stable

Modified Paths:
--------------
    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

Modified: trunk/sys/sys/racct.h
===================================================================
--- trunk/sys/sys/racct.h	2020-02-16 21:41:01 UTC (rev 12367)
+++ trunk/sys/sys/racct.h	2020-02-16 21:51:02 UTC (rev 12368)
@@ -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/racct.h 299616 2016-05-13 08:17:42Z ngie $
+ * $FreeBSD: stable/11/sys/sys/racct.h 331722 2018-03-29 02:50:57Z eadler $
  */
 
 /*
@@ -38,9 +38,12 @@
 #define	_RACCT_H_
 
 #include <sys/cdefs.h>
+#include <sys/types.h>
 #include <sys/queue.h>
-#include <sys/types.h>
+#include <sys/stdint.h>
+#include <sys/sysctl.h>
 
+struct buf;
 struct proc;
 struct rctl_rule_link;
 struct ucred;
@@ -70,7 +73,11 @@
 #define	RACCT_SHMSIZE		18
 #define	RACCT_WALLCLOCK		19
 #define	RACCT_PCTCPU		20
-#define	RACCT_MAX		RACCT_PCTCPU
+#define	RACCT_READBPS		21
+#define	RACCT_WRITEBPS		22
+#define	RACCT_READIOPS		23
+#define	RACCT_WRITEIOPS		24
+#define	RACCT_MAX		RACCT_WRITEIOPS
 
 /*
  * Resource properties.
@@ -98,7 +105,7 @@
 
 /*
  * Resource usage can drop, as opposed to only grow.  When the process
- * terminates, its resource usage is freed from the respective
+ * terminates, its resource usage is subtracted from the respective
  * per-credential racct containers.
  */
 #define	RACCT_IS_RECLAIMABLE(X)	(racct_types[X] & RACCT_RECLAIMABLE)
@@ -126,8 +133,7 @@
  * When a process terminates, its resource usage is not automatically
  * subtracted from per-credential racct containers.  Instead, the resource
  * usage of per-credential racct containers decays in time.
- * Resource usage can olso drop for such resource.
- * So far, the only such resource is RACCT_PCTCPU.
+ * Resource usage can also drop for such resource.
  */
 #define RACCT_IS_DECAYING(X)		(racct_types[X] & RACCT_DECAYING)
 
@@ -147,9 +153,20 @@
 	LIST_HEAD(, rctl_rule_link)	r_rule_links;
 };
 
+SYSCTL_DECL(_kern_racct);
+
+#ifdef RACCT
+
+extern struct mtx racct_lock;
+
+#define RACCT_LOCK()		mtx_lock(&racct_lock)
+#define RACCT_UNLOCK()		mtx_unlock(&racct_lock)
+#define RACCT_LOCK_ASSERT()	mtx_assert(&racct_lock, MA_OWNED)
+
 int	racct_add(struct proc *p, int resource, uint64_t amount);
 void	racct_add_cred(struct ucred *cred, int resource, uint64_t amount);
 void	racct_add_force(struct proc *p, int resource, uint64_t amount);
+void	racct_add_buf(struct proc *p, const struct buf *bufp, int is_write);
 int	racct_set(struct proc *p, int resource, uint64_t amount);
 void	racct_set_force(struct proc *p, int resource, uint64_t amount);
 void	racct_sub(struct proc *p, int resource, uint64_t amount);
@@ -167,5 +184,83 @@
 void	racct_proc_ucred_changed(struct proc *p, struct ucred *oldcred,
 	    struct ucred *newcred);
 void	racct_move(struct racct *dest, struct racct *src);
+void	racct_proc_throttle(struct proc *p, int timeout);
 
+#else
+
+static inline int
+racct_add(struct proc *p, int resource, uint64_t amount)
+{
+
+	return (0);
+}
+
+static inline void
+racct_add_cred(struct ucred *cred, int resource, uint64_t amount)
+{
+}
+
+static inline void
+racct_add_force(struct proc *p, int resource, uint64_t amount)
+{
+}
+
+static inline int
+racct_set(struct proc *p, int resource, uint64_t amount)
+{
+
+	return (0);
+}
+
+static inline void
+racct_set_force(struct proc *p, int resource, uint64_t amount)
+{
+}
+
+static inline void
+racct_sub(struct proc *p, int resource, uint64_t amount)
+{
+}
+
+static inline void
+racct_sub_cred(struct ucred *cred, int resource, uint64_t amount)
+{
+}
+
+static inline uint64_t
+racct_get_limit(struct proc *p, int resource)
+{
+
+	return (UINT64_MAX);
+}
+
+static inline uint64_t
+racct_get_available(struct proc *p, int resource)
+{
+
+	return (UINT64_MAX);
+}
+
+#define	racct_create(x)
+#define	racct_destroy(x)
+
+static inline int
+racct_proc_fork(struct proc *parent, struct proc *child)
+{
+
+	return (0);
+}
+
+static inline void
+racct_proc_fork_done(struct proc *child)
+{
+}
+
+static inline void
+racct_proc_exit(struct proc *p)
+{
+}
+
+#endif
+
 #endif /* !_RACCT_H_ */

Modified: trunk/sys/sys/random.h
===================================================================
--- trunk/sys/sys/random.h	2020-02-16 21:41:01 UTC (rev 12367)
+++ trunk/sys/sys/random.h	2020-02-16 21:51:02 UTC (rev 12368)
@@ -1,6 +1,6 @@
 /* $MidnightBSD$ */
 /*-
- * Copyright (c) 2000-2013 Mark R. V. Murray
+ * Copyright (c) 2000-2015 Mark R. V. Murray
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -24,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: stable/10/sys/sys/random.h 268933 2014-07-21 00:21:56Z jhb $
+ * $FreeBSD: stable/11/sys/sys/random.h 346725 2019-04-26 01:58:36Z mw $
  */
 
 #ifndef	_SYS_RANDOM_H_
@@ -32,15 +32,44 @@
 
 #ifdef _KERNEL
 
-int read_random(void *, int);
+#include <sys/types.h>
 
+#if !defined(KLD_MODULE)
+#if defined(RANDOM_LOADABLE) && defined(RANDOM_YARROW)
+#error "Cannot define both RANDOM_LOADABLE and RANDOM_YARROW"
+#endif
+#endif
+
+struct uio;
+
+#if defined(DEV_RANDOM)
+u_int read_random(void *, u_int);
+int read_random_uio(struct uio *, bool);
+#else
+static __inline int
+read_random_uio(void *a __unused, u_int b __unused)
+{
+	return (0);
+}
+static __inline u_int
+read_random(void *a __unused, u_int b __unused)
+{
+	return (0);
+}
+#endif
+
 /*
- * Note: if you add or remove members of esource, remember to also update the
- * KASSERT regarding what valid members are in random_harvest_internal().
+ * Note: if you add or remove members of random_entropy_source, remember to also update the
+ * KASSERT regarding what valid members are in random_harvest_internal(), and remember the
+ * strings in the static array random_source_descr[] in random_harvestq.c.
+ *
+ * NOTE: complain loudly to markm@ or on the lists if this enum gets more than 32
+ * distinct values (0-31)! ENTROPYSOURCE may be == 32, but not > 32.
  */
-enum esource {
+enum random_entropy_source {
 	RANDOM_START = 0,
 	RANDOM_CACHED = 0,
+	/* Environmental sources */
 	RANDOM_ATTACH,
 	RANDOM_KEYBOARD,
 	RANDOM_MOUSE,
@@ -49,6 +78,10 @@
 	RANDOM_NET_NG,
 	RANDOM_INTERRUPT,
 	RANDOM_SWI,
+	RANDOM_FS_ATIME,
+	RANDOM_UMA,	/* Special!! UMA/SLAB Allocator */
+	RANDOM_ENVIRONMENTAL_END = RANDOM_UMA,
+	/* Fast hardware random-number sources from here on. */
 	RANDOM_PURE_OCTEON,
 	RANDOM_PURE_SAFE,
 	RANDOM_PURE_GLXSB,
@@ -58,23 +91,29 @@
 	RANDOM_PURE_NEHEMIAH,
 	RANDOM_PURE_RNDTEST,
 	RANDOM_PURE_VIRTIO,
+	RANDOM_PURE_BROADCOM,
+	RANDOM_PURE_TPM,
 	ENTROPYSOURCE
 };
-void random_harvest(void *, u_int, u_int, enum esource);
 
-/* Allow the sysadmin to select the broad category of
- * entropy types to harvest
- */
-struct harvest_select {
-	int ethernet;
-	int point_to_point;
-	int interrupt;
-	int swi;
-	int namei;
-};
+#define RANDOM_HARVEST_EVERYTHING_MASK ((1 << (RANDOM_ENVIRONMENTAL_END + 1)) - 1)
 
-extern struct harvest_select harvest;
+#if defined(DEV_RANDOM)
+void random_harvest_queue(const void *, u_int, u_int, enum random_entropy_source);
+void random_harvest_fast(const void *, u_int, u_int, enum random_entropy_source);
+void random_harvest_direct(const void *, u_int, u_int, enum random_entropy_source);
+#else
+#define random_harvest_queue(a, b, c, d) do {} while (0)
+#define random_harvest_fast(a, b, c, d) do {} while (0)
+#define random_harvest_direct(a, b, c, d) do {} while (0)
+#endif
 
+#if defined(RANDOM_ENABLE_UMA)
+#define random_harvest_fast_uma(a, b, c, d)	random_harvest_fast(a, b, c, d)
+#else /* !defined(RANDOM_ENABLE_UMA) */
+#define random_harvest_fast_uma(a, b, c, d)	do {} while (0)
+#endif /* defined(RANDOM_ENABLE_UMA) */
+
 #endif /* _KERNEL */
 
 #endif /* _SYS_RANDOM_H_ */

Modified: trunk/sys/sys/rangelock.h
===================================================================
--- trunk/sys/sys/rangelock.h	2020-02-16 21:41:01 UTC (rev 12367)
+++ trunk/sys/sys/rangelock.h	2020-02-16 21:51:02 UTC (rev 12368)
@@ -24,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: stable/10/sys/sys/rangelock.h 254380 2013-08-15 20:19:17Z cperciva $
+ * $FreeBSD: stable/11/sys/sys/rangelock.h 355690 2019-12-13 04:03:03Z kevans $
  */
 
 #ifndef	_SYS_RANGELOCK_H
@@ -77,7 +77,30 @@
 void	*rangelock_wlock(struct rangelock *lock, off_t start, off_t end,
 	    struct mtx *ilk);
 void	 rlqentry_free(struct rl_q_entry *rlqe);
+#if defined(INVARIANTS) || defined(INVARIANT_SUPPORT)
+void	_rangelock_cookie_assert(void *cookie, int what, const char *file,
+    int line);
+#endif
 
+#ifdef INVARIANTS
+#define	rangelock_cookie_assert_(cookie, what, file, line)	\
+	_rangelock_cookie_assert((cookie), (what), (file), (line))
+#else
+#define	rangelock_cookie_assert_(cookie, what, file, line)		(void)0
+#endif
+
+#define	rangelock_cookie_assert(cookie, what)	\
+	rangelock_cookie_assert_((cookie), (what), __FILE__, __LINE__)
+
+/*
+ * Assertion flags.
+ */
+#if defined(INVARIANTS) || defined(INVARIANT_SUPPORT)
+#define	RCA_LOCKED	0x0001
+#define	RCA_RLOCKED	0x0002
+#define	RCA_WLOCKED	0x0004
+#endif
+
 #endif	/* _KERNEL */
 
 #endif	/* _SYS_RANGELOCK_H */

Modified: trunk/sys/sys/rctl.h
===================================================================
--- trunk/sys/sys/rctl.h	2020-02-16 21:41:01 UTC (rev 12367)
+++ trunk/sys/sys/rctl.h	2020-02-16 21:51:02 UTC (rev 12368)
@@ -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/rctl.h 242139 2012-10-26 16:01:08Z trasz $
+ * $FreeBSD: stable/11/sys/sys/rctl.h 331722 2018-03-29 02:50:57Z eadler $
  */
 
 /*
@@ -130,7 +130,8 @@
 #define	RCTL_ACTION_DENY		(RCTL_ACTION_SIGNAL_MAX + 1)
 #define	RCTL_ACTION_LOG			(RCTL_ACTION_SIGNAL_MAX + 2)
 #define	RCTL_ACTION_DEVCTL		(RCTL_ACTION_SIGNAL_MAX + 3)
-#define	RCTL_ACTION_MAX			RCTL_ACTION_DEVCTL
+#define	RCTL_ACTION_THROTTLE		(RCTL_ACTION_SIGNAL_MAX + 4)
+#define	RCTL_ACTION_MAX			RCTL_ACTION_THROTTLE
 
 #define	RCTL_AMOUNT_UNDEFINED		-1
 
@@ -141,6 +142,7 @@
 int	rctl_rule_add(struct rctl_rule *rule);
 int	rctl_rule_remove(struct rctl_rule *filter);
 int	rctl_enforce(struct proc *p, int resource, uint64_t amount);
+void	rctl_throttle_decay(struct racct *racct, int resource);
 int64_t	rctl_pcpu_available(const struct proc *p);
 uint64_t rctl_get_limit(struct proc *p, int resource);
 uint64_t rctl_get_available(struct proc *p, int resource);

Modified: trunk/sys/sys/reboot.h
===================================================================
--- trunk/sys/sys/reboot.h	2020-02-16 21:41:01 UTC (rev 12367)
+++ trunk/sys/sys/reboot.h	2020-02-16 21:51:02 UTC (rev 12368)
@@ -28,7 +28,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)reboot.h	8.3 (Berkeley) 12/13/94
- * $FreeBSD: stable/10/sys/sys/reboot.h 293743 2016-01-12 10:11:29Z trasz $
+ * $FreeBSD: stable/11/sys/sys/reboot.h 344378 2019-02-20 19:19:24Z kevans $
  */
 
 #ifndef _SYS_REBOOT_H_
@@ -61,6 +61,7 @@
 #define	RB_RESERVED2	0x80000	/* reserved for internal use of boot blocks */
 #define	RB_PAUSE	0x100000 /* pause after each output line during probe */
 #define	RB_REROOT	0x200000 /* unmount the rootfs and mount it again */
+#define	RB_PROBE	0x10000000	/* Probe multiple consoles */
 #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	2020-02-16 21:41:01 UTC (rev 12367)
+++ trunk/sys/sys/refcount.h	2020-02-16 21:51:02 UTC (rev 12368)
@@ -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/refcount.h 262192 2014-02-18 20:27:17Z jhb $
+ * $FreeBSD: stable/11/sys/sys/refcount.h 339862 2018-10-29 14:37:27Z hselasky $
  */
 
 #ifndef __SYS_REFCOUNT_H__
@@ -51,7 +51,7 @@
 {
 
 	KASSERT(*count < UINT_MAX, ("refcount %p overflowed", count));
-	atomic_add_acq_int(count, 1);	
+	atomic_add_int(count, 1);
 }
 
 static __inline int
@@ -59,10 +59,56 @@
 {
 	u_int old;
 
-	/* XXX: Should this have a rel membar? */
+	atomic_thread_fence_rel();
 	old = atomic_fetchadd_int(count, -1);
-	KASSERT(old > 0, ("negative refcount %p", count));
-	return (old == 1);
+	KASSERT(old > 0, ("refcount %p is zero", count));
+	if (old > 1)
+		return (0);
+
+	/*
+	 * Last reference.  Signal the user to call the destructor.
+	 *
+	 * Ensure that the destructor sees all updates.  The fence_rel
+	 * at the start of the function synchronized with this fence.
+	 */
+	atomic_thread_fence_acq();
+	return (1);
 }
 
+/*
+ * This functions returns non-zero if the refcount was
+ * incremented. Else zero is returned.
+ *
+ * A temporary hack until refcount_* APIs are sorted out.
+ */
+static __inline __result_use_check int
+refcount_acquire_if_not_zero(volatile u_int *count)
+{
+	u_int old;
+
+	old = *count;
+	for (;;) {
+		KASSERT(old < UINT_MAX, ("refcount %p overflowed", count));
+		if (old == 0)
+			return (0);
+		if (atomic_fcmpset_int(count, &old, old + 1))
+			return (1);
+	}
+}
+
+static __inline __result_use_check int
+refcount_release_if_not_last(volatile u_int *count)
+{
+	u_int old;
+
+	old = *count;
+	for (;;) {
+		KASSERT(old > 0, ("refcount %p is zero", count));
+		if (old == 1)
+			return (0);
+		if (atomic_fcmpset_int(count, &old, old - 1))
+			return (1);
+	}
+}
+
 #endif	/* ! __SYS_REFCOUNT_H__ */

Modified: trunk/sys/sys/regression.h
===================================================================
--- trunk/sys/sys/regression.h	2020-02-16 21:41:01 UTC (rev 12367)
+++ trunk/sys/sys/regression.h	2020-02-16 21:51:02 UTC (rev 12368)
@@ -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/regression.h 129096 2004-05-10 18:38:07Z rwatson $
+ * $FreeBSD: stable/11/sys/sys/regression.h 331722 2018-03-29 02:50:57Z eadler $
  */
 #ifndef _SYS_REGRESSION_H_
 #define	_SYS_REGRESSION_H_

Modified: trunk/sys/sys/resource.h
===================================================================
--- trunk/sys/sys/resource.h	2020-02-16 21:41:01 UTC (rev 12367)
+++ trunk/sys/sys/resource.h	2020-02-16 21:51:02 UTC (rev 12368)
@@ -28,7 +28,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)resource.h	8.4 (Berkeley) 1/9/95
- * $FreeBSD: stable/10/sys/sys/resource.h 314392 2017-02-28 15:03:34Z kib $
+ * $FreeBSD: stable/11/sys/sys/resource.h 331722 2018-03-29 02:50:57Z eadler $
  */
 
 #ifndef _SYS_RESOURCE_H_
@@ -38,6 +38,16 @@
 #include <sys/_timeval.h>
 #include <sys/_types.h>
 
+#ifndef _ID_T_DECLARED
+typedef	__id_t		id_t;
+#define	_ID_T_DECLARED
+#endif
+
+#ifndef _RLIM_T_DECLARED
+typedef	__rlim_t	rlim_t;
+#define	_RLIM_T_DECLARED
+#endif
+
 /*
  * Process priority specifications to get/setpriority.
  */
@@ -104,10 +114,12 @@
 #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	RLIMIT_UMTXP	14		/* process-shared umtx */
 
-#define	RLIM_NLIMITS	13		/* number of resource limits */
+#define	RLIM_NLIMITS	15		/* number of resource limits */
 
-#define	RLIM_INFINITY	((rlim_t)(((uint64_t)1 << 63) - 1))
+#define	RLIM_INFINITY	((rlim_t)(((__uint64_t)1 << 63) - 1))
 #define	RLIM_SAVED_MAX	RLIM_INFINITY
 #define	RLIM_SAVED_CUR	RLIM_INFINITY
 
@@ -130,14 +142,11 @@
 	"vmem",
 	"npts",
 	"swap",
+	"kqueues",
+	"umtx",
 };
 #endif
 
-#ifndef _RLIM_T_DECLARED
-typedef	__rlim_t	rlim_t;
-#define	_RLIM_T_DECLARED
-#endif
-
 struct rlimit {
 	rlim_t	rlim_cur;		/* current (soft) limit */
 	rlim_t	rlim_max;		/* maximum value for rlim_cur */

Modified: trunk/sys/sys/resourcevar.h
===================================================================
--- trunk/sys/sys/resourcevar.h	2020-02-16 21:41:01 UTC (rev 12367)
+++ trunk/sys/sys/resourcevar.h	2020-02-16 21:51:02 UTC (rev 12368)
@@ -28,7 +28,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)resourcevar.h	8.4 (Berkeley) 1/9/95
- * $FreeBSD: stable/10/sys/sys/resourcevar.h 230470 2012-01-22 20:25:00Z trociny $
+ * $FreeBSD: stable/11/sys/sys/resourcevar.h 331722 2018-03-29 02:50:57Z eadler $
  */
 
 #ifndef	_SYS_RESOURCEVAR_H_
@@ -48,21 +48,22 @@
  * Locking key:
  *      b - created at fork, never changes
  *      c - locked by proc mtx
- *      j - locked by proc slock
  *      k - only accessed by curthread
+ *      w - locked by proc itim lock
+ *	w2 - locked by proc prof lock
  */
 struct pstats {
 #define	pstat_startzero	p_cru
 	struct	rusage p_cru;		/* Stats for reaped children. */
-	struct	itimerval p_timer[3];	/* (j) Virtual-time timers. */
+	struct	itimerval p_timer[3];	/* (w) Virtual-time timers. */
 #define	pstat_endzero	pstat_startcopy
 
 #define	pstat_startcopy	p_prof
 	struct uprof {			/* Profile arguments. */
-		caddr_t	pr_base;	/* (c + j) Buffer base. */
-		u_long	pr_size;	/* (c + j) Buffer size. */
-		u_long	pr_off;		/* (c + j) PC offset. */
-		u_long	pr_scale;	/* (c + j) PC scaling. */
+		caddr_t	pr_base;	/* (c + w2) Buffer base. */
+		u_long	pr_size;	/* (c + w2) Buffer size. */
+		u_long	pr_off;		/* (c + w2) PC offset. */
+		u_long	pr_scale;	/* (c + w2) PC scaling. */
 	} p_prof;
 #define	pstat_endcopy	p_start
 	struct	timeval p_start;	/* (b) Starting time. */
@@ -90,7 +91,7 @@
  * Locking guide:
  * (a) Constant from inception
  * (b) Lockless, updated using atomics
- * (c) Locked by global uihashtbl_mtx
+ * (c) Locked by global uihashtbl_lock
  * (d) Locked by the ui_vmsize_mtx
  */
 struct uidinfo {
@@ -100,9 +101,13 @@
 	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 */
+	long	ui_umtxcnt;		/* (b) number of shared umtxs */
 	uid_t	ui_uid;			/* (a) uid */
 	u_int	ui_ref;			/* (b) reference count */
+#ifdef	RACCT
 	struct racct *ui_racct;		/* (a) resource accounting */
+#endif
 };
 
 #define	UIDINFO_VMSIZE_LOCK(ui)		mtx_lock(&((ui)->ui_vmsize_mtx))
@@ -116,10 +121,12 @@
 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);
 int	 chgptscnt(struct uidinfo *uip, int diff, rlim_t maxval);
+int	 chgumtxcnt(struct uidinfo *uip, int diff, rlim_t maxval);
 int	 fuswintr(void *base);
 int	 kern_proc_setrlimit(struct thread *td, struct proc *p, u_int which,
 	    struct rlimit *limp);
@@ -126,13 +133,16 @@
 struct plimit
 	*lim_alloc(void);
 void	 lim_copy(struct plimit *dst, struct plimit *src);
-rlim_t	 lim_cur(struct proc *p, int which);
+rlim_t	 lim_cur(struct thread *td, int which);
+rlim_t	 lim_cur_proc(struct proc *p, int which);
 void	 lim_fork(struct proc *p1, struct proc *p2);
 void	 lim_free(struct plimit *limp);
 struct plimit
 	*lim_hold(struct plimit *limp);
-rlim_t	 lim_max(struct proc *p, int which);
-void	 lim_rlimit(struct proc *p, int which, struct rlimit *rlp);
+rlim_t	 lim_max(struct thread *td, int which);
+rlim_t	 lim_max_proc(struct proc *p, int which);
+void	 lim_rlimit(struct thread *td, int which, struct rlimit *rlp);
+void	 lim_rlimit_proc(struct proc *p, int which, struct rlimit *rlp);
 void	 ruadd(struct rusage *ru, struct rusage_ext *rux, struct rusage *ru2,
 	    struct rusage_ext *rux2);
 void	 rucollect(struct rusage *ru, struct rusage *ru2);
@@ -147,8 +157,11 @@
 void	 uifree(struct uidinfo *uip);
 void	 uihashinit(void);
 void	 uihold(struct uidinfo *uip);
+#ifdef	RACCT
 void	 ui_racct_foreach(void (*callback)(struct racct *racct,
-	    void *arg2, void *arg3), void *arg2, void *arg3);
+	    void *arg2, void *arg3), void (*pre)(void), void (*post)(void),
+	    void *arg2, void *arg3);
+#endif
 
 #endif /* _KERNEL */
 #endif /* !_SYS_RESOURCEVAR_H_ */



More information about the Midnightbsd-cvs mailing list