From 317043010879767bc6a3bef6cbec0c5f300d1ce0 Mon Sep 17 00:00:00 2001 From: Cem Keylan Date: Mon, 19 Oct 2020 13:54:31 +0300 Subject: sys: update to 6.8 --- sys/sys/systm.h | 52 ++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 36 insertions(+), 16 deletions(-) (limited to 'sys/sys/systm.h') diff --git a/sys/sys/systm.h b/sys/sys/systm.h index 5dec672..c982038 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -1,4 +1,4 @@ -/* $OpenBSD: systm.h,v 1.145 2020/03/20 03:37:08 cheloha Exp $ */ +/* $OpenBSD: systm.h,v 1.148 2020/08/26 03:29:07 visa Exp $ */ /* $NetBSD: systm.h,v 1.50 1996/06/09 04:55:09 briggs Exp $ */ /*- @@ -81,6 +81,12 @@ extern const char osrelease[]; extern int cold; /* cold start flag initialized in locore */ extern int db_active; /* running currently inside ddb(4) */ +extern char *hw_vendor; /* sysctl hw.vendor */ +extern char *hw_prod; /* sysctl hw.product */ +extern char *hw_uuid; /* sysctl hw.uuid */ +extern char *hw_serial; /* sysctl hw.serialno */ +extern char *hw_ver; /* sysctl hw.version */ + extern int ncpus; /* number of CPUs used */ extern int ncpusfound; /* number of CPUs found */ extern int nblkdev; /* number of entries in bdevsw */ @@ -211,6 +217,11 @@ int copyin(const void *, void *, size_t) int copyout(const void *, void *, size_t); int copyin32(const uint32_t *, uint32_t *); +void random_start(int); +void enqueue_randomness(unsigned int); +void suspend_randomness(void); +void resume_randomness(char *, size_t); + struct arc4random_ctx; void arc4random_buf(void *, size_t) __attribute__ ((__bounded__(__buffer__,1,2))); @@ -315,31 +326,40 @@ int uiomove(void *, size_t, struct uio *); extern struct rwlock netlock; -#define NET_LOCK() NET_WLOCK() -#define NET_UNLOCK() NET_WUNLOCK() -#define NET_ASSERT_UNLOCKED() NET_ASSERT_WUNLOCKED() +/* + * Network stack data structures are, unless stated otherwise, protected + * by the NET_LOCK(). It's a single non-recursive lock for the whole + * subsystem. + */ +#define NET_LOCK() do { rw_enter_write(&netlock); } while (0) +#define NET_UNLOCK() do { rw_exit_write(&netlock); } while (0) +/* + * Reader version of NET_LOCK() to be used in "softnet" thread only. -#define NET_WLOCK() do { rw_enter_write(&netlock); } while (0) -#define NET_WUNLOCK() do { rw_exit_write(&netlock); } while (0) + * The "softnet" thread should be the only thread processing packets + * without holding an exclusive lock. This is done to allow read-only + * ioctl(2) to not block. + */ +#define NET_RLOCK_IN_SOFTNET() do { rw_enter_read(&netlock); } while (0) +#define NET_RUNLOCK_IN_SOFTNET()do { rw_exit_read(&netlock); } while (0) -#define NET_ASSERT_WLOCKED() \ -do { \ - int _s = rw_status(&netlock); \ - if ((splassert_ctl > 0) && (_s != RW_WRITE)) \ - splassert_fail(RW_WRITE, _s, __func__); \ -} while (0) +/* + * Reader version of NET_LOCK() to be used in ioctl/sysctl path only. + * + * Can be grabbed instead of the exclusive version when no field + * protected by the NET_LOCK() is modified by the ioctl/sysctl. + */ +#define NET_RLOCK_IN_IOCTL() do { rw_enter_read(&netlock); } while (0) +#define NET_RUNLOCK_IN_IOCTL() do { rw_exit_read(&netlock); } while (0) -#define NET_ASSERT_WUNLOCKED() \ +#define NET_ASSERT_UNLOCKED() \ do { \ int _s = rw_status(&netlock); \ if ((splassert_ctl > 0) && (_s == RW_WRITE)) \ splassert_fail(0, RW_WRITE, __func__); \ } while (0) -#define NET_RLOCK() do { rw_enter_read(&netlock); } while (0) -#define NET_RUNLOCK() do { rw_exit_read(&netlock); } while (0) - #define NET_ASSERT_LOCKED() \ do { \ int _s = rw_status(&netlock); \ -- cgit v1.2.3