FreeBSD/Linux Kernel Cross Reference
sys/sys/systm.h
1 /*-
2 * SPDX-License-Identifier: BSD-3-Clause
3 *
4 * Copyright (c) 1982, 1988, 1991, 1993
5 * The Regents of the University of California. All rights reserved.
6 * (c) UNIX System Laboratories, Inc.
7 * All or some portions of this file are derived from material licensed
8 * to the University of California by American Telephone and Telegraph
9 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
10 * the permission of UNIX System Laboratories, Inc.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 * 3. Neither the name of the University nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * @(#)systm.h 8.7 (Berkeley) 3/29/95
37 * $FreeBSD$
38 */
39
40 #ifndef _SYS_SYSTM_H_
41 #define _SYS_SYSTM_H_
42
43 #include <sys/cdefs.h>
44 #include <machine/atomic.h>
45 #include <machine/cpufunc.h>
46 #include <sys/callout.h>
47 #include <sys/queue.h>
48 #include <sys/stdint.h> /* for people using printf mainly */
49
50 __NULLABILITY_PRAGMA_PUSH
51
52 extern int cold; /* nonzero if we are doing a cold boot */
53 extern int suspend_blocked; /* block suspend due to pending shutdown */
54 extern int rebooting; /* kern_reboot() has been called. */
55 extern const char *panicstr; /* panic message */
56 extern char version[]; /* system version */
57 extern char compiler_version[]; /* compiler version */
58 extern char copyright[]; /* system copyright */
59 extern int kstack_pages; /* number of kernel stack pages */
60
61 extern u_long pagesizes[]; /* supported page sizes */
62 extern long physmem; /* physical memory */
63 extern long realmem; /* 'real' memory */
64
65 extern char *rootdevnames[2]; /* names of possible root devices */
66
67 extern int boothowto; /* reboot flags, from console subsystem */
68 extern int bootverbose; /* nonzero to print verbose messages */
69
70 extern int maxusers; /* system tune hint */
71 extern int ngroups_max; /* max # of supplemental groups */
72 extern int vm_guest; /* Running as virtual machine guest? */
73
74 /*
75 * Detected virtual machine guest types. The intention is to expand
76 * and/or add to the VM_GUEST_VM type if specific VM functionality is
77 * ever implemented (e.g. vendor-specific paravirtualization features).
78 * Keep in sync with vm_guest_sysctl_names[].
79 */
80 enum VM_GUEST { VM_GUEST_NO = 0, VM_GUEST_VM, VM_GUEST_XEN, VM_GUEST_HV,
81 VM_GUEST_VMWARE, VM_GUEST_KVM, VM_GUEST_BHYVE, VM_LAST };
82
83 /*
84 * These functions need to be declared before the KASSERT macro is invoked in
85 * !KASSERT_PANIC_OPTIONAL builds, so their declarations are sort of out of
86 * place compared to other function definitions in this header. On the other
87 * hand, this header is a bit disorganized anyway.
88 */
89 void panic(const char *, ...) __dead2 __printflike(1, 2);
90 void vpanic(const char *, __va_list) __dead2 __printflike(1, 0);
91
92 #if defined(WITNESS) || defined(INVARIANT_SUPPORT)
93 #ifdef KASSERT_PANIC_OPTIONAL
94 void kassert_panic(const char *fmt, ...) __printflike(1, 2);
95 #else
96 #define kassert_panic panic
97 #endif
98 #endif
99
100 #ifdef INVARIANTS /* The option is always available */
101 #define KASSERT(exp,msg) do { \
102 if (__predict_false(!(exp))) \
103 kassert_panic msg; \
104 } while (0)
105 #define VNASSERT(exp, vp, msg) do { \
106 if (__predict_false(!(exp))) { \
107 vn_printf(vp, "VNASSERT failed\n"); \
108 kassert_panic msg; \
109 } \
110 } while (0)
111 #define __assert_unreachable() \
112 panic("executing segment marked as unreachable at %s:%d (%s)\n", \
113 __FILE__, __LINE__, __func__)
114 #else
115 #define KASSERT(exp,msg) do { \
116 } while (0)
117
118 #define VNASSERT(exp, vp, msg) do { \
119 } while (0)
120 #define __assert_unreachable() __unreachable()
121 #endif
122
123 #ifndef CTASSERT /* Allow lint to override */
124 #define CTASSERT(x) _Static_assert(x, "compile-time assertion failed")
125 #endif
126
127 #if defined(_KERNEL)
128 #include <sys/param.h> /* MAXCPU */
129 #include <sys/pcpu.h> /* curthread */
130 #include <sys/kpilite.h>
131 #endif
132
133 /*
134 * Assert that a pointer can be loaded from memory atomically.
135 *
136 * This assertion enforces stronger alignment than necessary. For example,
137 * on some architectures, atomicity for unaligned loads will depend on
138 * whether or not the load spans multiple cache lines.
139 */
140 #define ASSERT_ATOMIC_LOAD_PTR(var, msg) \
141 KASSERT(sizeof(var) == sizeof(void *) && \
142 ((uintptr_t)&(var) & (sizeof(void *) - 1)) == 0, msg)
143
144 /*
145 * Assert that a thread is in critical(9) section.
146 */
147 #define CRITICAL_ASSERT(td) \
148 KASSERT((td)->td_critnest >= 1, ("Not in critical section"));
149
150 /*
151 * If we have already panic'd and this is the thread that called
152 * panic(), then don't block on any mutexes but silently succeed.
153 * Otherwise, the kernel will deadlock since the scheduler isn't
154 * going to run the thread that holds any lock we need.
155 */
156 #define SCHEDULER_STOPPED_TD(td) ({ \
157 MPASS((td) == curthread); \
158 __predict_false((td)->td_stopsched); \
159 })
160 #define SCHEDULER_STOPPED() SCHEDULER_STOPPED_TD(curthread)
161
162 /*
163 * Align variables.
164 */
165 #define __read_mostly __section(".data.read_mostly")
166 #define __read_frequently __section(".data.read_frequently")
167 #define __exclusive_cache_line __aligned(CACHE_LINE_SIZE) \
168 __section(".data.exclusive_cache_line")
169 /*
170 * XXX the hints declarations are even more misplaced than most declarations
171 * in this file, since they are needed in one file (per arch) and only used
172 * in two files.
173 * XXX most of these variables should be const.
174 */
175 extern int osreldate;
176 extern bool dynamic_kenv;
177 extern struct mtx kenv_lock;
178 extern char *kern_envp;
179 extern char *md_envp;
180 extern char static_env[];
181 extern char static_hints[]; /* by config for now */
182
183 extern char **kenvp;
184
185 extern const void *zero_region; /* address space maps to a zeroed page */
186
187 extern int unmapped_buf_allowed;
188
189 #ifdef __LP64__
190 #define IOSIZE_MAX iosize_max()
191 #define DEVFS_IOSIZE_MAX devfs_iosize_max()
192 #else
193 #define IOSIZE_MAX SSIZE_MAX
194 #define DEVFS_IOSIZE_MAX SSIZE_MAX
195 #endif
196
197 /*
198 * General function declarations.
199 */
200
201 struct inpcb;
202 struct lock_object;
203 struct malloc_type;
204 struct mtx;
205 struct proc;
206 struct socket;
207 struct thread;
208 struct tty;
209 struct ucred;
210 struct uio;
211 struct _jmp_buf;
212 struct trapframe;
213 struct eventtimer;
214
215 int setjmp(struct _jmp_buf *) __returns_twice;
216 void longjmp(struct _jmp_buf *, int) __dead2;
217 int dumpstatus(vm_offset_t addr, off_t count);
218 int nullop(void);
219 int eopnotsupp(void);
220 int ureadc(int, struct uio *);
221 void hashdestroy(void *, struct malloc_type *, u_long);
222 void *hashinit(int count, struct malloc_type *type, u_long *hashmask);
223 void *hashinit_flags(int count, struct malloc_type *type,
224 u_long *hashmask, int flags);
225 #define HASH_NOWAIT 0x00000001
226 #define HASH_WAITOK 0x00000002
227
228 void *phashinit(int count, struct malloc_type *type, u_long *nentries);
229 void *phashinit_flags(int count, struct malloc_type *type, u_long *nentries,
230 int flags);
231 void g_waitidle(void);
232
233 void cpu_boot(int);
234 void cpu_flush_dcache(void *, size_t);
235 void cpu_rootconf(void);
236 void critical_enter_KBI(void);
237 void critical_exit_KBI(void);
238 void critical_exit_preempt(void);
239 void init_param1(void);
240 void init_param2(long physpages);
241 void init_static_kenv(char *, size_t);
242 void tablefull(const char *);
243
244 #if defined(KLD_MODULE) || defined(KTR_CRITICAL) || !defined(_KERNEL) || defined(GENOFFSET)
245 #define critical_enter() critical_enter_KBI()
246 #define critical_exit() critical_exit_KBI()
247 #else
248 static __inline void
249 critical_enter(void)
250 {
251 struct thread_lite *td;
252
253 td = (struct thread_lite *)curthread;
254 td->td_critnest++;
255 __compiler_membar();
256 }
257
258 static __inline void
259 critical_exit(void)
260 {
261 struct thread_lite *td;
262
263 td = (struct thread_lite *)curthread;
264 KASSERT(td->td_critnest != 0,
265 ("critical_exit: td_critnest == 0"));
266 __compiler_membar();
267 td->td_critnest--;
268 __compiler_membar();
269 if (__predict_false(td->td_owepreempt))
270 critical_exit_preempt();
271
272 }
273 #endif
274
275
276 #ifdef EARLY_PRINTF
277 typedef void early_putc_t(int ch);
278 extern early_putc_t *early_putc;
279 #endif
280 int kvprintf(char const *, void (*)(int, void*), void *, int,
281 __va_list) __printflike(1, 0);
282 void log(int, const char *, ...) __printflike(2, 3);
283 void log_console(struct uio *);
284 void vlog(int, const char *, __va_list) __printflike(2, 0);
285 int asprintf(char **ret, struct malloc_type *mtp, const char *format,
286 ...) __printflike(3, 4);
287 int printf(const char *, ...) __printflike(1, 2);
288 int snprintf(char *, size_t, const char *, ...) __printflike(3, 4);
289 int sprintf(char *buf, const char *, ...) __printflike(2, 3);
290 int uprintf(const char *, ...) __printflike(1, 2);
291 int vprintf(const char *, __va_list) __printflike(1, 0);
292 int vasprintf(char **ret, struct malloc_type *mtp, const char *format,
293 __va_list ap) __printflike(3, 0);
294 int vsnprintf(char *, size_t, const char *, __va_list) __printflike(3, 0);
295 int vsnrprintf(char *, size_t, int, const char *, __va_list) __printflike(4, 0);
296 int vsprintf(char *buf, const char *, __va_list) __printflike(2, 0);
297 int ttyprintf(struct tty *, const char *, ...) __printflike(2, 3);
298 int sscanf(const char *, char const * _Nonnull, ...) __scanflike(2, 3);
299 int vsscanf(const char * _Nonnull, char const * _Nonnull, __va_list) __scanflike(2, 0);
300 long strtol(const char *, char **, int);
301 u_long strtoul(const char *, char **, int);
302 quad_t strtoq(const char *, char **, int);
303 u_quad_t strtouq(const char *, char **, int);
304 void tprintf(struct proc *p, int pri, const char *, ...) __printflike(3, 4);
305 void vtprintf(struct proc *, int, const char *, __va_list) __printflike(3, 0);
306 void hexdump(const void *ptr, int length, const char *hdr, int flags);
307 #define HD_COLUMN_MASK 0xff
308 #define HD_DELIM_MASK 0xff00
309 #define HD_OMIT_COUNT (1 << 16)
310 #define HD_OMIT_HEX (1 << 17)
311 #define HD_OMIT_CHARS (1 << 18)
312
313 #define ovbcopy(f, t, l) bcopy((f), (t), (l))
314 void bcopy(const void * _Nonnull from, void * _Nonnull to, size_t len);
315 #define bcopy(from, to, len) __builtin_memmove((to), (from), (len))
316 void bzero(void * _Nonnull buf, size_t len);
317 #define bzero(buf, len) __builtin_memset((buf), 0, (len))
318 void explicit_bzero(void * _Nonnull, size_t);
319 int bcmp(const void *b1, const void *b2, size_t len);
320 #define bcmp(b1, b2, len) __builtin_memcmp((b1), (b2), (len))
321
322 void *memset(void * _Nonnull buf, int c, size_t len);
323 #define memset(buf, c, len) __builtin_memset((buf), (c), (len))
324 void *memcpy(void * _Nonnull to, const void * _Nonnull from, size_t len);
325 #define memcpy(to, from, len) __builtin_memcpy((to), (from), (len))
326 void *memmove(void * _Nonnull dest, const void * _Nonnull src, size_t n);
327 #define memmove(dest, src, n) __builtin_memmove((dest), (src), (n))
328 int memcmp(const void *b1, const void *b2, size_t len);
329 #define memcmp(b1, b2, len) __builtin_memcmp((b1), (b2), (len))
330
331 void *memset_early(void * _Nonnull buf, int c, size_t len);
332 #define bzero_early(buf, len) memset_early((buf), 0, (len))
333 void *memcpy_early(void * _Nonnull to, const void * _Nonnull from, size_t len);
334 void *memmove_early(void * _Nonnull dest, const void * _Nonnull src, size_t n);
335 #define bcopy_early(from, to, len) memmove_early((to), (from), (len))
336
337 int copystr(const void * _Nonnull __restrict kfaddr,
338 void * _Nonnull __restrict kdaddr, size_t len,
339 size_t * __restrict lencopied);
340 int copyinstr(const void * __restrict udaddr,
341 void * _Nonnull __restrict kaddr, size_t len,
342 size_t * __restrict lencopied);
343 int copyin(const void * __restrict udaddr,
344 void * _Nonnull __restrict kaddr, size_t len);
345 int copyin_nofault(const void * __restrict udaddr,
346 void * _Nonnull __restrict kaddr, size_t len);
347 int copyout(const void * _Nonnull __restrict kaddr,
348 void * __restrict udaddr, size_t len);
349 int copyout_nofault(const void * _Nonnull __restrict kaddr,
350 void * __restrict udaddr, size_t len);
351
352 int fubyte(volatile const void *base);
353 long fuword(volatile const void *base);
354 int fuword16(volatile const void *base);
355 int32_t fuword32(volatile const void *base);
356 int64_t fuword64(volatile const void *base);
357 int fueword(volatile const void *base, long *val);
358 int fueword32(volatile const void *base, int32_t *val);
359 int fueword64(volatile const void *base, int64_t *val);
360 int subyte(volatile void *base, int byte);
361 int suword(volatile void *base, long word);
362 int suword16(volatile void *base, int word);
363 int suword32(volatile void *base, int32_t word);
364 int suword64(volatile void *base, int64_t word);
365 uint32_t casuword32(volatile uint32_t *base, uint32_t oldval, uint32_t newval);
366 u_long casuword(volatile u_long *p, u_long oldval, u_long newval);
367 int casueword32(volatile uint32_t *base, uint32_t oldval, uint32_t *oldvalp,
368 uint32_t newval);
369 int casueword(volatile u_long *p, u_long oldval, u_long *oldvalp,
370 u_long newval);
371
372 void realitexpire(void *);
373
374 int sysbeep(int hertz, int period);
375
376 void hardclock(int cnt, int usermode);
377 void hardclock_sync(int cpu);
378 void softclock(void *);
379 void statclock(int cnt, int usermode);
380 void profclock(int cnt, int usermode, uintfptr_t pc);
381
382 int hardclockintr(void);
383
384 void startprofclock(struct proc *);
385 void stopprofclock(struct proc *);
386 void cpu_startprofclock(void);
387 void cpu_stopprofclock(void);
388 void suspendclock(void);
389 void resumeclock(void);
390 sbintime_t cpu_idleclock(void);
391 void cpu_activeclock(void);
392 void cpu_new_callout(int cpu, sbintime_t bt, sbintime_t bt_opt);
393 void cpu_et_frequency(struct eventtimer *et, uint64_t newfreq);
394 extern int cpu_disable_c2_sleep;
395 extern int cpu_disable_c3_sleep;
396
397 char *kern_getenv(const char *name);
398 void freeenv(char *env);
399 int getenv_int(const char *name, int *data);
400 int getenv_uint(const char *name, unsigned int *data);
401 int getenv_long(const char *name, long *data);
402 int getenv_ulong(const char *name, unsigned long *data);
403 int getenv_string(const char *name, char *data, int size);
404 int getenv_int64(const char *name, int64_t *data);
405 int getenv_uint64(const char *name, uint64_t *data);
406 int getenv_quad(const char *name, quad_t *data);
407 int kern_setenv(const char *name, const char *value);
408 int kern_unsetenv(const char *name);
409 int testenv(const char *name);
410
411 int getenv_array(const char *name, void *data, int size, int *psize,
412 int type_size, bool allow_signed);
413 #define GETENV_UNSIGNED false /* negative numbers not allowed */
414 #define GETENV_SIGNED true /* negative numbers allowed */
415
416 typedef uint64_t (cpu_tick_f)(void);
417 void set_cputicker(cpu_tick_f *func, uint64_t freq, unsigned var);
418 extern cpu_tick_f *cpu_ticks;
419 uint64_t cpu_tickrate(void);
420 uint64_t cputick2usec(uint64_t tick);
421
422 #ifdef APM_FIXUP_CALLTODO
423 struct timeval;
424 void adjust_timeout_calltodo(struct timeval *time_change);
425 #endif /* APM_FIXUP_CALLTODO */
426
427 #include <sys/libkern.h>
428
429 /* Initialize the world */
430 void consinit(void);
431 void cpu_initclocks(void);
432 void cpu_initclocks_bsp(void);
433 void cpu_initclocks_ap(void);
434 void usrinfoinit(void);
435
436 /* Finalize the world */
437 void kern_reboot(int) __dead2;
438 void shutdown_nice(int);
439
440 /* Timeouts */
441 typedef void timeout_t(void *); /* timeout function type */
442 #define CALLOUT_HANDLE_INITIALIZER(handle) \
443 { NULL }
444
445 void callout_handle_init(struct callout_handle *);
446 struct callout_handle timeout(timeout_t *, void *, int);
447 void untimeout(timeout_t *, void *, struct callout_handle);
448
449 /* Stubs for obsolete functions that used to be for interrupt management */
450 static __inline intrmask_t splbio(void) { return 0; }
451 static __inline intrmask_t splcam(void) { return 0; }
452 static __inline intrmask_t splclock(void) { return 0; }
453 static __inline intrmask_t splhigh(void) { return 0; }
454 static __inline intrmask_t splimp(void) { return 0; }
455 static __inline intrmask_t splnet(void) { return 0; }
456 static __inline intrmask_t spltty(void) { return 0; }
457 static __inline void splx(intrmask_t ipl __unused) { return; }
458
459 /*
460 * Common `proc' functions are declared here so that proc.h can be included
461 * less often.
462 */
463 int _sleep(void * _Nonnull chan, struct lock_object *lock, int pri,
464 const char *wmesg, sbintime_t sbt, sbintime_t pr, int flags);
465 #define msleep(chan, mtx, pri, wmesg, timo) \
466 _sleep((chan), &(mtx)->lock_object, (pri), (wmesg), \
467 tick_sbt * (timo), 0, C_HARDCLOCK)
468 #define msleep_sbt(chan, mtx, pri, wmesg, bt, pr, flags) \
469 _sleep((chan), &(mtx)->lock_object, (pri), (wmesg), (bt), (pr), \
470 (flags))
471 int msleep_spin_sbt(void * _Nonnull chan, struct mtx *mtx,
472 const char *wmesg, sbintime_t sbt, sbintime_t pr, int flags);
473 #define msleep_spin(chan, mtx, wmesg, timo) \
474 msleep_spin_sbt((chan), (mtx), (wmesg), tick_sbt * (timo), \
475 0, C_HARDCLOCK)
476 int pause_sbt(const char *wmesg, sbintime_t sbt, sbintime_t pr,
477 int flags);
478 #define pause(wmesg, timo) \
479 pause_sbt((wmesg), tick_sbt * (timo), 0, C_HARDCLOCK)
480 #define pause_sig(wmesg, timo) \
481 pause_sbt((wmesg), tick_sbt * (timo), 0, C_HARDCLOCK | C_CATCH)
482 #define tsleep(chan, pri, wmesg, timo) \
483 _sleep((chan), NULL, (pri), (wmesg), tick_sbt * (timo), \
484 0, C_HARDCLOCK)
485 #define tsleep_sbt(chan, pri, wmesg, bt, pr, flags) \
486 _sleep((chan), NULL, (pri), (wmesg), (bt), (pr), (flags))
487 void wakeup(void * chan);
488 void wakeup_one(void * chan);
489 void wakeup_any(void * chan);
490
491 /*
492 * Common `struct cdev *' stuff are declared here to avoid #include poisoning
493 */
494
495 struct cdev;
496 dev_t dev2udev(struct cdev *x);
497 const char *devtoname(struct cdev *cdev);
498
499 #ifdef __LP64__
500 size_t devfs_iosize_max(void);
501 size_t iosize_max(void);
502 #endif
503
504 int poll_no_poll(int events);
505
506 /* XXX: Should be void nanodelay(u_int nsec); */
507 void DELAY(int usec);
508
509 /* Root mount holdback API */
510 struct root_hold_token {
511 int flags;
512 const char *who;
513 TAILQ_ENTRY(root_hold_token) list;
514 };
515
516 struct root_hold_token *root_mount_hold(const char *identifier);
517 void root_mount_hold_token(const char *identifier, struct root_hold_token *h);
518 void root_mount_rel(struct root_hold_token *h);
519 int root_mounted(void);
520
521
522 /*
523 * Unit number allocation API. (kern/subr_unit.c)
524 */
525 struct unrhdr;
526 struct unrhdr *new_unrhdr(int low, int high, struct mtx *mutex);
527 void init_unrhdr(struct unrhdr *uh, int low, int high, struct mtx *mutex);
528 void delete_unrhdr(struct unrhdr *uh);
529 void clear_unrhdr(struct unrhdr *uh);
530 void clean_unrhdr(struct unrhdr *uh);
531 void clean_unrhdrl(struct unrhdr *uh);
532 int alloc_unr(struct unrhdr *uh);
533 int alloc_unr_specific(struct unrhdr *uh, u_int item);
534 int alloc_unrl(struct unrhdr *uh);
535 void free_unr(struct unrhdr *uh, u_int item);
536
537 #ifndef __LP64__
538 #define UNR64_LOCKED
539 #endif
540
541 struct unrhdr64 {
542 uint64_t counter;
543 };
544
545 static __inline void
546 new_unrhdr64(struct unrhdr64 *unr64, uint64_t low)
547 {
548
549 unr64->counter = low;
550 }
551
552 #ifdef UNR64_LOCKED
553 uint64_t alloc_unr64(struct unrhdr64 *);
554 #else
555 static __inline uint64_t
556 alloc_unr64(struct unrhdr64 *unr64)
557 {
558
559 return (atomic_fetchadd_64(&unr64->counter, 1));
560 }
561 #endif
562
563 void intr_prof_stack_use(struct thread *td, struct trapframe *frame);
564
565 void counted_warning(unsigned *counter, const char *msg);
566
567 /*
568 * APIs to manage deprecation and obsolescence.
569 */
570 struct device;
571 void _gone_in(int major, const char *msg);
572 void _gone_in_dev(struct device *dev, int major, const char *msg);
573 #ifdef NO_OBSOLETE_CODE
574 #define __gone_ok(m, msg) \
575 _Static_assert(m < P_OSREL_MAJOR(__FreeBSD_version)), \
576 "Obsolete code" msg);
577 #else
578 #define __gone_ok(m, msg)
579 #endif
580 #define gone_in(major, msg) __gone_ok(major, msg) _gone_in(major, msg)
581 #define gone_in_dev(dev, major, msg) __gone_ok(major, msg) _gone_in_dev(dev, major, msg)
582 #define gone_by_fcp101_dev(dev) \
583 gone_in_dev((dev), 13, \
584 "see https://github.com/freebsd/fcp/blob/master/fcp-0101.md")
585
586 #ifdef _KERNEL
587 #if defined(INVARIANTS) || defined(WITNESS)
588 #define __diagused
589 #else
590 #define __diagused __unused
591 #endif
592
593 #endif /* _KERNEL */
594
595 __NULLABILITY_PRAGMA_POP
596
597 #endif /* !_SYS_SYSTM_H_ */
Cache object: 04ad9b4216cbef5080a14e6028e98d49
|