[Midnightbsd-cvs] src [12334] trunk/sys/sys/systm.h: sync with FreeBSD 11-stable
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sat Feb 8 15:02:26 EST 2020
Revision: 12334
http://svnweb.midnightbsd.org/src/?rev=12334
Author: laffer1
Date: 2020-02-08 15:02:25 -0500 (Sat, 08 Feb 2020)
Log Message:
-----------
sync with FreeBSD 11-stable
Modified Paths:
--------------
trunk/sys/sys/systm.h
Modified: trunk/sys/sys/systm.h
===================================================================
--- trunk/sys/sys/systm.h 2020-02-08 20:01:56 UTC (rev 12333)
+++ trunk/sys/sys/systm.h 2020-02-08 20:02:25 UTC (rev 12334)
@@ -33,7 +33,7 @@
* SUCH DAMAGE.
*
* @(#)systm.h 8.7 (Berkeley) 3/29/95
- * $FreeBSD: stable/10/sys/sys/systm.h 303433 2016-07-28 11:51:20Z kib $
+ * $FreeBSD: stable/11/sys/sys/systm.h 354405 2019-11-06 18:02:18Z mav $
*/
#ifndef _SYS_SYSTM_H_
@@ -46,6 +46,8 @@
#include <sys/queue.h>
#include <sys/stdint.h> /* for people using printf mainly */
+__NULLABILITY_PRAGMA_PUSH
+
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. */
@@ -75,9 +77,9 @@
* Keep in sync with vm_guest_sysctl_names[].
*/
enum VM_GUEST { VM_GUEST_NO = 0, VM_GUEST_VM, VM_GUEST_XEN, VM_GUEST_HV,
- VM_GUEST_VMWARE, VM_LAST };
+ VM_GUEST_VMWARE, VM_GUEST_KVM, VM_GUEST_BHYVE, VM_LAST };
-#if defined(WITNESS) || defined(INVARIANTS)
+#if defined(WITNESS) || defined(INVARIANT_SUPPORT)
void kassert_panic(const char *fmt, ...) __printflike(1, 2);
#endif
@@ -84,12 +86,12 @@
#ifdef INVARIANTS /* The option is always available */
#define KASSERT(exp,msg) do { \
if (__predict_false(!(exp))) \
- kassert_panic msg; \
+ kassert_panic msg; \
} while (0)
#define VNASSERT(exp, vp, msg) do { \
if (__predict_false(!(exp))) { \
vn_printf(vp, "VNASSERT failed\n"); \
- kassert_panic msg; \
+ kassert_panic msg; \
} \
} while (0)
#else
@@ -127,9 +129,20 @@
* Otherwise, the kernel will deadlock since the scheduler isn't
* going to run the thread that holds any lock we need.
*/
-#define SCHEDULER_STOPPED() __predict_false(curthread->td_stopsched)
+#define SCHEDULER_STOPPED_TD(td) ({ \
+ MPASS((td) == curthread); \
+ __predict_false((td)->td_stopsched); \
+})
+#define SCHEDULER_STOPPED() SCHEDULER_STOPPED_TD(curthread)
/*
+ * Align variables.
+ */
+#define __read_mostly __section(".data.read_mostly")
+#define __read_frequently __section(".data.read_frequently")
+#define __exclusive_cache_line __aligned(CACHE_LINE_SIZE) \
+ __section(".data.exclusive_cache_line")
+/*
* XXX the hints declarations are even more misplaced than most declarations
* in this file, since they are needed in one file (per arch) and only used
* in two files.
@@ -136,11 +149,10 @@
* XXX most of these variables should be const.
*/
extern int osreldate;
-extern int envmode;
-extern int hintmode; /* 0 = off. 1 = config, 2 = fallback */
-extern int dynamic_kenv;
+extern bool dynamic_kenv;
extern struct mtx kenv_lock;
extern char *kern_envp;
+extern char *md_envp;
extern char static_env[];
extern char static_hints[]; /* by config for now */
@@ -149,11 +161,15 @@
extern const void *zero_region; /* address space maps to a zeroed page */
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)
+#ifdef __LP64__
+#define IOSIZE_MAX iosize_max()
+#define DEVFS_IOSIZE_MAX devfs_iosize_max()
+#else
+#define IOSIZE_MAX SSIZE_MAX
+#define DEVFS_IOSIZE_MAX SSIZE_MAX
+#endif
+
/*
* General function declarations.
*/
@@ -186,6 +202,8 @@
#define HASH_WAITOK 0x00000002
void *phashinit(int count, struct malloc_type *type, u_long *nentries);
+void *phashinit_flags(int count, struct malloc_type *type, u_long *nentries,
+ int flags);
void g_waitidle(void);
void panic(const char *, ...) __dead2 __printflike(1, 2);
@@ -208,6 +226,7 @@
__va_list) __printflike(1, 0);
void log(int, const char *, ...) __printflike(2, 3);
void log_console(struct uio *);
+void vlog(int, const char *, __va_list) __printflike(2, 0);
int asprintf(char **ret, struct malloc_type *mtp, const char *format,
...) __printflike(3, 4);
int printf(const char *, ...) __printflike(1, 2);
@@ -221,12 +240,12 @@
int vsnrprintf(char *, size_t, int, const char *, __va_list) __printflike(4, 0);
int vsprintf(char *buf, const char *, __va_list) __printflike(2, 0);
int ttyprintf(struct tty *, const char *, ...) __printflike(2, 3);
-int sscanf(const char *, char const *, ...) __nonnull(1) __nonnull(2);
-int vsscanf(const char *, char const *, __va_list) __nonnull(1) __nonnull(2);
-long strtol(const char *, char **, int) __nonnull(1);
-u_long strtoul(const char *, char **, int) __nonnull(1);
-quad_t strtoq(const char *, char **, int) __nonnull(1);
-u_quad_t strtouq(const char *, char **, int) __nonnull(1);
+int sscanf(const char *, char const * _Nonnull, ...) __scanflike(2, 3);
+int vsscanf(const char * _Nonnull, char const * _Nonnull, __va_list) __scanflike(2, 0);
+long strtol(const char *, char **, int);
+u_long strtoul(const char *, char **, int);
+quad_t strtoq(const char *, char **, int);
+u_quad_t strtouq(const char *, char **, int);
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);
@@ -237,32 +256,27 @@
#define HD_OMIT_CHARS (1 << 18)
#define ovbcopy(f, t, l) bcopy((f), (t), (l))
-void bcopy(const void *from, void *to, size_t len) __nonnull(1) __nonnull(2);
-void bzero(void *buf, size_t len) __nonnull(1);
-#define bzero(buf, len) ({ \
- if (__builtin_constant_p(len) && (len) <= 64) \
- __builtin_memset((buf), 0, (len)); \
- else \
- bzero((buf), (len)); \
-})
+void bcopy(const void * _Nonnull from, void * _Nonnull to, size_t len);
+void bzero(void * _Nonnull buf, size_t len);
+void explicit_bzero(void * _Nonnull, size_t);
-void *memcpy(void *to, const void *from, size_t len) __nonnull(1) __nonnull(2);
-void *memmove(void *dest, const void *src, size_t n) __nonnull(1) __nonnull(2);
+void *memcpy(void * _Nonnull to, const void * _Nonnull from, size_t len);
+void *memmove(void * _Nonnull dest, const void * _Nonnull src, size_t n);
-int copystr(const void * __restrict kfaddr, void * __restrict kdaddr,
- size_t len, size_t * __restrict lencopied)
- __nonnull(1) __nonnull(2);
-int copyinstr(const void * __restrict udaddr, void * __restrict kaddr,
- size_t len, size_t * __restrict lencopied)
- __nonnull(1) __nonnull(2);
-int copyin(const void * __restrict udaddr, void * __restrict kaddr,
- size_t len) __nonnull(1) __nonnull(2);
-int copyin_nofault(const void * __restrict udaddr, void * __restrict kaddr,
- size_t len) __nonnull(1) __nonnull(2);
-int copyout(const void * __restrict kaddr, void * __restrict udaddr,
- size_t len) __nonnull(1) __nonnull(2);
-int copyout_nofault(const void * __restrict kaddr, void * __restrict udaddr,
- size_t len) __nonnull(1) __nonnull(2);
+int copystr(const void * _Nonnull __restrict kfaddr,
+ void * _Nonnull __restrict kdaddr, size_t len,
+ size_t * __restrict lencopied);
+int copyinstr(const void * __restrict udaddr,
+ void * _Nonnull __restrict kaddr, size_t len,
+ size_t * __restrict lencopied);
+int copyin(const void * __restrict udaddr,
+ void * _Nonnull __restrict kaddr, size_t len);
+int copyin_nofault(const void * __restrict udaddr,
+ void * _Nonnull __restrict kaddr, size_t len);
+int copyout(const void * _Nonnull __restrict kaddr,
+ void * __restrict udaddr, size_t len);
+int copyout_nofault(const void * _Nonnull __restrict kaddr,
+ void * __restrict udaddr, size_t len);
int fubyte(volatile const void *base);
long fuword(volatile const void *base);
@@ -304,11 +318,12 @@
void stopprofclock(struct proc *);
void cpu_startprofclock(void);
void cpu_stopprofclock(void);
+void suspendclock(void);
+void resumeclock(void);
sbintime_t cpu_idleclock(void);
void cpu_activeclock(void);
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;
@@ -316,7 +331,7 @@
int cr_canseesocket(struct ucred *cred, struct socket *so);
int cr_canseeinpcb(struct ucred *cred, struct inpcb *inp);
-char *getenv(const char *name);
+char *kern_getenv(const char *name);
void freeenv(char *env);
int getenv_int(const char *name, int *data);
int getenv_uint(const char *name, unsigned int *data);
@@ -323,11 +338,18 @@
int getenv_long(const char *name, long *data);
int getenv_ulong(const char *name, unsigned long *data);
int getenv_string(const char *name, char *data, int size);
+int getenv_int64(const char *name, int64_t *data);
+int getenv_uint64(const char *name, uint64_t *data);
int getenv_quad(const char *name, quad_t *data);
-int setenv(const char *name, const char *value);
-int unsetenv(const char *name);
+int kern_setenv(const char *name, const char *value);
+int kern_unsetenv(const char *name);
int testenv(const char *name);
+int getenv_array(const char *name, void *data, int size, int *psize,
+ int type_size, bool allow_signed);
+#define GETENV_UNSIGNED false /* negative numbers not allowed */
+#define GETENV_SIGNED true /* negative numbers allowed */
+
typedef uint64_t (cpu_tick_f)(void);
void set_cputicker(cpu_tick_f *func, uint64_t freq, unsigned var);
extern cpu_tick_f *cpu_ticks;
@@ -369,7 +391,6 @@
static __inline intrmask_t splimp(void) { return 0; }
static __inline intrmask_t splnet(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; }
/*
@@ -376,8 +397,8 @@
* Common `proc' functions are declared here so that proc.h can be included
* less often.
*/
-int _sleep(void *chan, struct lock_object *lock, int pri, const char *wmesg,
- sbintime_t sbt, sbintime_t pr, int flags) __nonnull(1);
+int _sleep(void * _Nonnull chan, struct lock_object *lock, int pri,
+ const char *wmesg, sbintime_t sbt, sbintime_t pr, int flags);
#define msleep(chan, mtx, pri, wmesg, timo) \
_sleep((chan), &(mtx)->lock_object, (pri), (wmesg), \
tick_sbt * (timo), 0, C_HARDCLOCK)
@@ -384,8 +405,8 @@
#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);
+int msleep_spin_sbt(void * _Nonnull chan, struct mtx *mtx,
+ const char *wmesg, sbintime_t sbt, sbintime_t pr, int flags);
#define msleep_spin(chan, mtx, wmesg, timo) \
msleep_spin_sbt((chan), (mtx), (wmesg), tick_sbt * (timo), \
0, C_HARDCLOCK)
@@ -393,13 +414,16 @@
int flags);
#define pause(wmesg, timo) \
pause_sbt((wmesg), tick_sbt * (timo), 0, C_HARDCLOCK)
+#define pause_sig(wmesg, timo) \
+ pause_sbt((wmesg), tick_sbt * (timo), 0, C_HARDCLOCK | C_CATCH)
#define tsleep(chan, 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);
+void wakeup(void * chan);
+void wakeup_one(void * chan);
+void wakeup_any(void * chan);
/*
* Common `struct cdev *' stuff are declared here to avoid #include poisoning
@@ -409,6 +433,11 @@
dev_t dev2udev(struct cdev *x);
const char *devtoname(struct cdev *cdev);
+#ifdef __LP64__
+size_t devfs_iosize_max(void);
+size_t iosize_max(void);
+#endif
+
int poll_no_poll(int events);
/* XXX: Should be void nanodelay(u_int nsec); */
@@ -419,7 +448,6 @@
struct root_hold_token *root_mount_hold(const char *identifier);
void root_mount_rel(struct root_hold_token *h);
-void root_mount_wait(void);
int root_mounted(void);
@@ -439,8 +467,27 @@
void intr_prof_stack_use(struct thread *td, struct trapframe *frame);
-extern void (*softdep_ast_cleanup)(void);
-
void counted_warning(unsigned *counter, const char *msg);
+/*
+ * APIs to manage deprecation and obsolescence.
+ */
+struct device;
+void _gone_in(int major, const char *msg);
+void _gone_in_dev(struct device *dev, int major, const char *msg);
+#ifdef NO_OBSOLETE_CODE
+#define __gone_ok(m, msg) \
+ _Static_assert(m < P_OSREL_MAJOR(__FreeBSD_version)), \
+ "Obsolete code" msg);
+#else
+#define __gone_ok(m, msg)
+#endif
+#define gone_in(major, msg) __gone_ok(major, msg) _gone_in(major, msg)
+#define gone_in_dev(dev, major, msg) __gone_ok(major, msg) _gone_in_dev(dev, major, msg)
+#define gone_by_fcp101_dev(dev) \
+ gone_in_dev((dev), 13, \
+ "see https://github.com/freebsd/fcp/blob/master/fcp-0101.md")
+
+__NULLABILITY_PRAGMA_POP
+
#endif /* !_SYS_SYSTM_H_ */
More information about the Midnightbsd-cvs
mailing list