FreeBSD kernel kern code
kern_shutdown.c File Reference
#include <sys/cdefs.h>
#include "opt_ddb.h"
#include "opt_ekcd.h"
#include "opt_kdb.h"
#include "opt_panic.h"
#include "opt_printf.h"
#include "opt_sched.h"
#include "opt_watchdog.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bio.h>
#include <sys/boottrace.h>
#include <sys/buf.h>
#include <sys/conf.h>
#include <sys/compressor.h>
#include <sys/cons.h>
#include <sys/disk.h>
#include <sys/eventhandler.h>
#include <sys/filedesc.h>
#include <sys/jail.h>
#include <sys/kdb.h>
#include <sys/kernel.h>
#include <sys/kerneldump.h>
#include <sys/kthread.h>
#include <sys/ktr.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/mount.h>
#include <sys/priv.h>
#include <sys/proc.h>
#include <sys/reboot.h>
#include <sys/resourcevar.h>
#include <sys/rwlock.h>
#include <sys/sbuf.h>
#include <sys/sched.h>
#include <sys/smp.h>
#include <sys/sysctl.h>
#include <sys/sysproto.h>
#include <sys/taskqueue.h>
#include <sys/vnode.h>
#include <sys/watchdog.h>
#include <crypto/chacha20/chacha.h>
#include <crypto/rijndael/rijndael-api-fst.h>
#include <crypto/sha2/sha256.h>
#include <ddb/ddb.h>
#include <machine/cpu.h>
#include <machine/dump.h>
#include <machine/pcb.h>
#include <machine/smp.h>
#include <security/mac/mac_framework.h>
#include <vm/vm.h>
#include <vm/vm_object.h>
#include <vm/vm_page.h>
#include <vm/vm_pager.h>
#include <vm/swap_pager.h>
#include <sys/signalvar.h>
#include <machine/stdarg.h>

Go to the source code of this file.

Data Structures

struct  kerneldumpcomp
 

Macros

#define PANIC_REBOOT_WAIT_TIME   15 /* default to 15 seconds */
 
#define POWEROFF_DELAY   5000
 
#define SIZEOF_METADATA   (64 * 1024)
 

Functions

 __FBSDID ("$FreeBSD$")
 
static MALLOC_DEFINE (M_DUMPER, "dumper", "dumper block buffer")
 
 SYSCTL_INT (_kern, OID_AUTO, panic_reboot_wait_time, CTLFLAG_RWTUN, &panic_reboot_wait_time, 0, "Seconds to wait before rebooting after a panic")
 
 SYSCTL_INT (_kern, OID_AUTO, sync_on_panic, CTLFLAG_RWTUN, &sync_on_panic, 0, "Do a sync before rebooting from a panic")
 
 SYSCTL_BOOL (_kern, OID_AUTO, poweroff_on_panic, CTLFLAG_RWTUN, &poweroff_on_panic, 0, "Do a power off instead of a reboot on a panic")
 
 SYSCTL_BOOL (_kern, OID_AUTO, powercycle_on_panic, CTLFLAG_RWTUN, &powercycle_on_panic, 0, "Do a power cycle instead of a reboot on a panic")
 
static SYSCTL_NODE (_kern, OID_AUTO, shutdown, CTLFLAG_RW|CTLFLAG_MPSAFE, 0, "Shutdown environment")
 
 SYSCTL_INT (_kern_shutdown, OID_AUTO, show_busybufs, CTLFLAG_RW, &show_busybufs, 0, "Show busy buffers during shutdown")
 
 SYSCTL_INT (_kern, OID_AUTO, suspend_blocked, CTLFLAG_RW, &suspend_blocked, 0, "Block suspend due to a pending shutdown")
 
static struct kerneldumpcompkerneldumpcomp_create (struct dumperinfo *di, uint8_t compression)
 
static void kerneldumpcomp_destroy (struct dumperinfo *di)
 
static int kerneldumpcomp_write_cb (void *base, size_t len, off_t off, void *arg)
 
 SYSCTL_INT (_kern, OID_AUTO, kerneldump_gzlevel, CTLFLAG_RWTUN, &kerneldump_gzlevel, 0, "Kernel crash dump compression level")
 
 MTX_SYSINIT (dumper_configs, &dumpconf_list_lk, "dumper config list", MTX_DEF)
 
static TAILQ_HEAD (dumpconflist, dumperinfo)
 
static void poweroff_wait (void *, int)
 
static void shutdown_halt (void *junk, int howto)
 
static void shutdown_panic (void *junk, int howto)
 
static void shutdown_reset (void *junk, int howto)
 
static int kern_reroot (void)
 
static void shutdown_conf (void *unused)
 
 SYSINIT (shutdown_conf, SI_SUB_INTRINSIC, SI_ORDER_ANY, shutdown_conf, NULL)
 
static void reroot_conf (void *unused)
 
 SYSINIT (reroot_conf, SI_SUB_DEVFS, SI_ORDER_ANY, reroot_conf, NULL)
 
int sys_reboot (struct thread *td, struct reboot_args *uap)
 
static void shutdown_nice_task_fn (void *arg, int pending __unused)
 
void shutdown_nice (int howto)
 
static void print_uptime (void)
 
int doadump (boolean_t textdump)
 
static void reboottrace (int howto)
 
void kern_reboot (int howto)
 
void panic (const char *fmt,...)
 
void vpanic (const char *fmt, va_list ap)
 
 SYSCTL_INT (_kern_shutdown, OID_AUTO, poweroff_delay, CTLFLAG_RW, &poweroff_delay, 0, "Delay before poweroff to write disk caches (msec)")
 
 SYSCTL_INT (_kern_shutdown, OID_AUTO, kproc_shutdown_wait, CTLFLAG_RW, &kproc_shutdown_wait, 0, "Max wait time (sec) to stop for each process")
 
void kproc_shutdown (void *arg, int howto)
 
void kthread_shutdown (void *arg, int howto)
 
static int dumpdevname_sysctl_handler (SYSCTL_HANDLER_ARGS)
 
 SYSCTL_PROC (_kern_shutdown, OID_AUTO, dumpdevname, CTLTYPE_STRING|CTLFLAG_RD|CTLFLAG_MPSAFE, &dumper_configs, 0, dumpdevname_sysctl_handler, "A", "Device(s) for kernel dumps")
 
static int _dump_append (struct dumperinfo *di, void *virtual, vm_offset_t physical, size_t length)
 
static void free_single_dumper (struct dumperinfo *di)
 
int dumper_insert (const struct dumperinfo *di_template, const char *devname, const struct diocskerneldump_arg *kda)
 
static bool dumper_config_match (const struct dumperinfo *di, const char *devname, const struct diocskerneldump_arg *kda)
 
int dumper_remove (const char *devname, const struct diocskerneldump_arg *kda)
 
static int dump_check_bounds (struct dumperinfo *di, off_t offset, size_t length)
 
static int dump_write_headers (struct dumperinfo *di, struct kerneldumpheader *kdh)
 
int dump_start (struct dumperinfo *di, struct kerneldumpheader *kdh)
 
int dump_append (struct dumperinfo *di, void *virtual, vm_offset_t physical, size_t length)
 
int dump_write (struct dumperinfo *di, void *virtual, vm_offset_t physical, off_t offset, size_t length)
 
int dump_finish (struct dumperinfo *di, struct kerneldumpheader *kdh)
 
void dump_init_header (const struct dumperinfo *di, struct kerneldumpheader *kdh, const char *magic, uint32_t archver, uint64_t dumplen)
 

Variables

static int panic_reboot_wait_time = PANIC_REBOOT_WAIT_TIME
 
static int sync_on_panic = 0
 
static bool poweroff_on_panic = 0
 
static bool powercycle_on_panic = 0
 
static int show_busybufs
 
int suspend_blocked = 0
 
static int kerneldump_gzlevel = 6
 
const char * panicstr
 
bool __read_frequently panicked
 
int __read_mostly dumping
 
int rebooting
 
static struct mtx dumpconf_list_lk
 
static struct task shutdown_nice_task
 
static int poweroff_delay = POWEROFF_DELAY
 
static int kproc_shutdown_wait = 60
 

Macro Definition Documentation

◆ PANIC_REBOOT_WAIT_TIME

#define PANIC_REBOOT_WAIT_TIME   15 /* default to 15 seconds */

Definition at line 108 of file kern_shutdown.c.

◆ POWEROFF_DELAY

#define POWEROFF_DELAY   5000

Definition at line 976 of file kern_shutdown.c.

◆ SIZEOF_METADATA

#define SIZEOF_METADATA   (64 * 1024)

Definition at line 1593 of file kern_shutdown.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ _dump_append()

static int _dump_append ( struct dumperinfo *  di,
void *  virtual,
vm_offset_t  physical,
size_t  length 
)
static

Definition at line 1673 of file kern_shutdown.c.

References dump_write().

Referenced by dump_append(), dump_finish(), and kerneldumpcomp_write_cb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ doadump()

int doadump ( boolean_t  textdump)

Definition at line 394 of file kern_shutdown.c.

References coredump(), and dumping.

Referenced by kern_reboot().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dump_append()

int dump_append ( struct dumperinfo *  di,
void *  virtual,
vm_offset_t  physical,
size_t  length 
)

Definition at line 1696 of file kern_shutdown.c.

References _dump_append(), buf, and compressor_write().

Referenced by dumpsys_buf_flush(), dumpsys_buf_seek(), dumpsys_buf_write(), and dumpsys_cb_dumpdata().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dump_check_bounds()

static int dump_check_bounds ( struct dumperinfo *  di,
off_t  offset,
size_t  length 
)
static

Definition at line 1406 of file kern_shutdown.c.

References printf().

Referenced by dump_write().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dump_finish()

int dump_finish ( struct dumperinfo *  di,
struct kerneldumpheader *  kdh 
)

Definition at line 1734 of file kern_shutdown.c.

References _dump_append(), compressor_flush(), compressor_reset(), dump_write(), and dump_write_headers().

Referenced by dumpsys_generic().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dump_init_header()

void dump_init_header ( const struct dumperinfo *  di,
struct kerneldumpheader *  kdh,
const char *  magic,
uint32_t  archver,
uint64_t  dumplen 
)

Definition at line 1771 of file kern_shutdown.c.

References panicstr, prison0, and time_second.

Referenced by dumpsys_generic().

Here is the caller graph for this function:

◆ dump_start()

int dump_start ( struct dumperinfo *  di,
struct kerneldumpheader *  kdh 
)

Definition at line 1616 of file kern_shutdown.c.

References SIZEOF_METADATA.

Referenced by dumpsys_generic().

Here is the caller graph for this function:

◆ dump_write()

int dump_write ( struct dumperinfo *  di,
void *  virtual,
vm_offset_t  physical,
off_t  offset,
size_t  length 
)

Definition at line 1716 of file kern_shutdown.c.

References dump_check_bounds().

Referenced by _dump_append(), dump_finish(), and dump_write_headers().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dump_write_headers()

static int dump_write_headers ( struct dumperinfo *  di,
struct kerneldumpheader *  kdh 
)
static

Definition at line 1532 of file kern_shutdown.c.

References buf, and dump_write().

Referenced by dump_finish().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dumpdevname_sysctl_handler()

static int dumpdevname_sysctl_handler ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 1044 of file kern_shutdown.c.

References buf, dumpconf_list_lk, sbuf_cat(), sbuf_delete(), sbuf_finish(), sbuf_new_for_sysctl(), sbuf_putc(), and sysctl_wire_old_buffer().

Here is the call graph for this function:

◆ dumper_config_match()

static bool dumper_config_match ( const struct dumperinfo *  di,
const char *  devname,
const struct diocskerneldump_arg *  kda 
)
static

Definition at line 1334 of file kern_shutdown.c.

Referenced by dumper_remove().

Here is the caller graph for this function:

◆ dumper_insert()

int dumper_insert ( const struct dumperinfo *  di_template,
const char *  devname,
const struct diocskerneldump_arg *  kda 
)

Definition at line 1236 of file kern_shutdown.c.

References dumpconf_list_lk, free_single_dumper(), kerneldumpcomp_create(), malloc(), and priv_check().

Here is the call graph for this function:

◆ dumper_remove()

int dumper_remove ( const char *  devname,
const struct diocskerneldump_arg *  kda 
)

Definition at line 1372 of file kern_shutdown.c.

References dumpconf_list_lk, dumper_config_match(), free_single_dumper(), and priv_check().

Here is the call graph for this function:

◆ free_single_dumper()

static void free_single_dumper ( struct dumperinfo *  di)
static

Definition at line 1218 of file kern_shutdown.c.

References kerneldumpcomp_destroy(), and zfree().

Referenced by dumper_insert(), and dumper_remove().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kern_reboot()

void kern_reboot ( int  howto)

Definition at line 458 of file kern_shutdown.c.

References boottrace_dump_console(), bufshutdown(), cngrab(), doadump(), dumping, Giant, initproc, kdb_active, print_uptime(), rebooting, reboottrace(), sched_bind(), show_busybufs, and shutdown_trace.

Referenced by shutdown_nice(), sys_reboot(), vfs_mountroot_parse(), and vpanic().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kern_reroot()

static int kern_reroot ( void  )
static

Definition at line 545 of file kern_shutdown.c.

References initproc, mountcheckdirs(), mountlist, mountlist_mtx, rootdevmp, rootvnode, vfs_busy(), vfs_mountroot(), vfs_ref(), vfs_rel(), vfs_unbusy(), and vfs_unmountall().

Referenced by sys_reboot().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kerneldumpcomp_create()

static struct kerneldumpcomp * kerneldumpcomp_create ( struct dumperinfo *  di,
uint8_t  compression 
)
static

Definition at line 1173 of file kern_shutdown.c.

References compressor_init(), free(), kerneldumpcomp::kdc_buf, kerneldumpcomp::kdc_format, kerneldumpcomp::kdc_stream, kerneldump_gzlevel, kerneldumpcomp_write_cb(), and malloc().

Referenced by dumper_insert().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kerneldumpcomp_destroy()

static void kerneldumpcomp_destroy ( struct dumperinfo *  di)
static

Definition at line 1202 of file kern_shutdown.c.

References compressor_fini(), free(), kerneldumpcomp::kdc_buf, kerneldumpcomp::kdc_stream, and zfree().

Referenced by free_single_dumper().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kerneldumpcomp_write_cb()

static int kerneldumpcomp_write_cb ( void *  base,
size_t  len,
off_t  off,
void *  arg 
)
static

Definition at line 1496 of file kern_shutdown.c.

References _dump_append().

Referenced by kerneldumpcomp_create().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kproc_shutdown()

void kproc_shutdown ( void *  arg,
int  howto 
)

Definition at line 1004 of file kern_shutdown.c.

References hz, kproc_shutdown_wait, kproc_suspend(), panicstr, and printf().

Referenced by syncer_shutdown(), and vnlru_proc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kthread_shutdown()

void kthread_shutdown ( void *  arg,
int  howto 
)

Definition at line 1024 of file kern_shutdown.c.

References hz, kproc_shutdown_wait, kthread_suspend(), panicstr, and printf().

Here is the call graph for this function:

◆ MALLOC_DEFINE()

static MALLOC_DEFINE ( M_DUMPER  ,
"dumper"  ,
"dumper block buffer"   
)
static

◆ MTX_SYSINIT()

MTX_SYSINIT ( dumper_configs  ,
dumpconf_list_lk,
"dumper config list"  ,
MTX_DEF   
)

◆ panic()

void panic ( const char *  fmt,
  ... 
)

Definition at line 884 of file kern_shutdown.c.

References vpanic().

Referenced by __lockmgr_args(), __rw_downgrade_int(), __stack_chk_fail(), _bus_dmamap_load_ccb(), _busdma_dflt_lock(), _callout_stop_safe(), _fdrop(), _lockmgr_disown(), _mtx_lock_indefinite_check(), acl_posix1e_acl_to_mode(), add_bounce_page(), aio_proc_rundown(), allocbuf(), assert_lockmgr(), ast(), bp_unmapped_get_kva(), bq_insert(), bqrelse(), brelse(), buf_daemon(), buf_free(), buf_vlist_add(), bufbdflush(), bufobj_invalbuf(), bufqueue(), bus_set_pass(), busdma_bufalloc_alloc_uncacheable(), busdma_bufalloc_findzone(), busdma_lock_mutex(), cache_fplookup_parse(), cache_fplookup_partial_setup(), cache_fplookup_trailingslash(), cache_symlink_resolve(), calc_remaining(), callout_reset_sbt_on(), clone_create(), cluster_rbuild(), cluster_wbuild(), config_intrhook_disestablish_locked(), cpu_initclocks_bsp(), create_init(), crossmp_vop_lock1(), devclass_delete_device(), device_probe_child(), devmap_add_entry(), domain_init(), epoch_alloc(), exec_sysvec_init(), exec_unregister(), exit1(), fail_point_eval_nontrivial(), filt_mqdetach(), filt_timertouch(), filt_usertouch(), free(), getblkx(), gone_panic(), grouptask_block(), grouptask_unblock(), grouptaskqueue_enqueue(), idle_setup(), intr_activate_irq(), intr_deactivate_irq(), intr_event_describe_handler(), intr_event_remove_handler(), intr_is_per_cpu(), intr_map_copy_map_data(), intr_map_get_map_data(), intr_map_irq(), intr_pic_deregister(), intr_unmap_irq(), isrc_release_counters(), ithread_create(), kdb_panic(), kdb_switch(), kdb_sysctl_panic(), kdb_sysctl_panic_str(), kern_getsockopt(), kern_mknodat(), kern_msgrcv(), kern_msgsnd(), kern_setsockopt(), kmeminit(), kobj_init(), kproc_create(), kproc_start(), kthread_add(), kthread_start(), kthread_suspend_check(), lf_clearlock(), lf_findoverlap(), link_elf_init(), linker_kldload_unbusy(), linker_preload(), lock_lockmgr(), lockmgr_xlock_hard(), m_dispose_extcontrolm(), make_dev_alias_v(), make_dev_sv(), malloc_init(), malloc_usable_size(), mallocarray(), mallocarray_domainset(), mb_reserve(), modlist_newmodule(), module_register_init(), module_release(), mqfs_allocv(), mqfs_create(), mqfs_readdir(), msg_freehdr(), msginit(), msq_remove(), null_fetch_syscall_args(), null_set_syscall_retval(), pctrie_insert(), pctrie_node_store(), pctrie_remove(), physmem_exclude_region(), physmem_init_kernel_globals(), pmap_mapdev(), proc_fini(), propagate_priority(), regions_to_avail(), resource_list_add(), resource_list_delete(), resource_list_free(), resource_list_release(), resource_list_reserve(), resource_list_unreserve(), rman_adjust_resource(), rman_init(), root_mount_hold_token(), root_setup_intr(), round_freq(), sbappendaddr_locked(), selrecord(), semexit_myhook(), set_rootvnode(), setrunnable(), sigdeferstop_impl(), sleepq_set_timeout_sbt(), softclock_call_cc(), soo_aio_queue(), soopt_mcopyin(), soupcall_clear(), soupcall_set(), start_busdma_swi(), start_init(), start_softclock(), start_softintr(), stats_v1_vsd_tdgst_add(), sx_downgrade_int(), sys_semop(), sysctl_ctx_free(), sysctl_register_oid(), sysinit_add(), taskqgroup_detach(), taskqgroup_find(), tdsendsignal(), thread_dtor(), thread_exit(), thread_suspend_check(), threadinit(), ttydevsw_deffree(), ttydevsw_defoutwakeup(), uipc_attach(), unlock_lockmgr(), unp_connect2(), unp_pcblist(), ureadc(), userret(), vfs_allocate_syncvnode(), vfs_cache_root_fallback(), vfs_lookup(), vfs_mount_alloc(), vfs_mount_destroy(), vfs_mountroot_parse(), vfs_mountroot_shuffle(), vfs_op_enter(), vfs_op_exit_locked(), vfs_relookup(), vfs_unbusy_pages(), vfs_vmio_invalidate(), vfs_vmio_iodone(), vgonel(), vmem_size(), vmem_xalloc(), vn_fallocate(), vn_finished_secondary_write(), vn_fspacectl(), vn_fsync_buf(), vn_io_fault_doio(), vop_panic(), watchdog_fire(), witness_destroy(), witness_init(), and zfree().

Here is the call graph for this function:

◆ poweroff_wait()

static void poweroff_wait ( void *  junk,
int  howto 
)
static

Definition at line 984 of file kern_shutdown.c.

References poweroff_delay.

Referenced by shutdown_conf().

Here is the caller graph for this function:

◆ print_uptime()

static void print_uptime ( void  )
static

Definition at line 367 of file kern_shutdown.c.

References getnanouptime(), printf(), and ts.

Referenced by kern_reboot().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reboottrace()

static void reboottrace ( int  howto)
static

Definition at line 434 of file kern_shutdown.c.

Referenced by kern_reboot().

Here is the caller graph for this function:

◆ reroot_conf()

static void reroot_conf ( void *  unused)
static

Definition at line 280 of file kern_shutdown.c.

References make_dev_p(), and printf().

Here is the call graph for this function:

◆ shutdown_conf()

static void shutdown_conf ( void *  unused)
static

Definition at line 260 of file kern_shutdown.c.

References poweroff_wait(), shutdown_halt(), shutdown_panic(), and shutdown_reset().

Here is the call graph for this function:

◆ shutdown_halt()

static void shutdown_halt ( void *  junk,
int  howto 
)
static

Definition at line 641 of file kern_shutdown.c.

References cngetc(), and printf().

Referenced by shutdown_conf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ shutdown_nice()

void shutdown_nice ( int  howto)

Definition at line 350 of file kern_shutdown.c.

References initproc, kern_reboot(), shutdown_nice_task, and taskqueue_enqueue().

Referenced by kdb_reboot().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ shutdown_nice_task_fn()

static void shutdown_nice_task_fn ( void *  arg,
int pending  __unused 
)
static

Definition at line 320 of file kern_shutdown.c.

References initproc, and kern_psignal().

Here is the call graph for this function:

◆ shutdown_panic()

static void shutdown_panic ( void *  junk,
int  howto 
)
static

Definition at line 666 of file kern_shutdown.c.

References cncheckc(), cngetc(), panic_reboot_wait_time, and printf().

Referenced by shutdown_conf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ shutdown_reset()

static void shutdown_reset ( void *  junk,
int  howto 
)
static

Definition at line 699 of file kern_shutdown.c.

References printf().

Referenced by shutdown_conf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sys_reboot()

int sys_reboot ( struct thread *  td,
struct reboot_args *  uap 
)

Definition at line 300 of file kern_shutdown.c.

References kern_reboot(), kern_reroot(), and priv_check().

Here is the call graph for this function:

◆ SYSCTL_BOOL() [1/2]

SYSCTL_BOOL ( _kern  ,
OID_AUTO  ,
powercycle_on_panic  ,
CTLFLAG_RWTUN  ,
powercycle_on_panic,
,
"Do a power cycle instead of a reboot on a panic  
)

◆ SYSCTL_BOOL() [2/2]

SYSCTL_BOOL ( _kern  ,
OID_AUTO  ,
poweroff_on_panic  ,
CTLFLAG_RWTUN  ,
poweroff_on_panic,
,
"Do a power off instead of a reboot on a panic  
)

◆ SYSCTL_INT() [1/7]

SYSCTL_INT ( _kern  ,
OID_AUTO  ,
kerneldump_gzlevel  ,
CTLFLAG_RWTUN  ,
kerneldump_gzlevel,
,
"Kernel crash dump compression level  
)

◆ SYSCTL_INT() [2/7]

SYSCTL_INT ( _kern  ,
OID_AUTO  ,
panic_reboot_wait_time  ,
CTLFLAG_RWTUN  ,
panic_reboot_wait_time,
,
"Seconds to wait before rebooting after a panic  
)

◆ SYSCTL_INT() [3/7]

SYSCTL_INT ( _kern  ,
OID_AUTO  ,
suspend_blocked  ,
CTLFLAG_RW  ,
suspend_blocked,
,
"Block suspend due to a pending shutdown  
)

◆ SYSCTL_INT() [4/7]

SYSCTL_INT ( _kern  ,
OID_AUTO  ,
sync_on_panic  ,
CTLFLAG_RWTUN  ,
sync_on_panic,
,
"Do a sync before rebooting from a panic  
)

◆ SYSCTL_INT() [5/7]

SYSCTL_INT ( _kern_shutdown  ,
OID_AUTO  ,
kproc_shutdown_wait  ,
CTLFLAG_RW  ,
kproc_shutdown_wait,
,
"Max wait time (sec) to stop for each process"   
)

◆ SYSCTL_INT() [6/7]

SYSCTL_INT ( _kern_shutdown  ,
OID_AUTO  ,
poweroff_delay  ,
CTLFLAG_RW  ,
poweroff_delay,
,
"Delay before poweroff to write disk caches (msec)"   
)

◆ SYSCTL_INT() [7/7]

SYSCTL_INT ( _kern_shutdown  ,
OID_AUTO  ,
show_busybufs  ,
CTLFLAG_RW  ,
show_busybufs,
,
"Show busy buffers during shutdown  
)

◆ SYSCTL_NODE()

static SYSCTL_NODE ( _kern  ,
OID_AUTO  ,
shutdown  ,
CTLFLAG_RW|  CTLFLAG_MPSAFE,
,
"Shutdown environment"   
)
static

◆ SYSCTL_PROC()

SYSCTL_PROC ( _kern_shutdown  ,
OID_AUTO  ,
dumpdevname  ,
CTLTYPE_STRING|CTLFLAG_RD|  CTLFLAG_MPSAFE,
dumper_configs,
,
dumpdevname_sysctl_handler  ,
"A"  ,
"Device(s) for kernel dumps"   
)

◆ SYSINIT() [1/2]

SYSINIT ( reroot_conf  ,
SI_SUB_DEVFS  ,
SI_ORDER_ANY  ,
reroot_conf  ,
NULL   
)

◆ SYSINIT() [2/2]

SYSINIT ( shutdown_conf  ,
SI_SUB_INTRINSIC  ,
SI_ORDER_ANY  ,
shutdown_conf  ,
NULL   
)

◆ TAILQ_HEAD()

static TAILQ_HEAD ( dumpconflist  ,
dumperinfo   
)
static

Definition at line 240 of file kern_shutdown.c.

◆ vpanic()

void vpanic ( const char *  fmt,
va_list  ap 
)

Definition at line 893 of file kern_shutdown.c.

References all_cpus, buf, cngrab(), kdb_active, kdb_backtrace(), kdb_enter(), kern_reboot(), panicked, panicstr, powercycle_on_panic, poweroff_on_panic, printf(), sync_on_panic, time_second, vprintf(), and vsnprintf().

Referenced by panic(), and Report().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ dumpconf_list_lk

struct mtx dumpconf_list_lk
static

Definition at line 236 of file kern_shutdown.c.

Referenced by dumpdevname_sysctl_handler(), dumper_insert(), and dumper_remove().

◆ dumping

int __read_mostly dumping

Definition at line 230 of file kern_shutdown.c.

Referenced by biodone(), doadump(), and kern_reboot().

◆ kerneldump_gzlevel

int kerneldump_gzlevel = 6
static

Definition at line 218 of file kern_shutdown.c.

Referenced by kerneldumpcomp_create().

◆ kproc_shutdown_wait

int kproc_shutdown_wait = 60
static

Definition at line 999 of file kern_shutdown.c.

Referenced by kproc_shutdown(), and kthread_shutdown().

◆ panic_reboot_wait_time

int panic_reboot_wait_time = PANIC_REBOOT_WAIT_TIME
static

Definition at line 110 of file kern_shutdown.c.

Referenced by shutdown_panic().

◆ panicked

bool __read_frequently panicked

Definition at line 228 of file kern_shutdown.c.

Referenced by vpanic().

◆ panicstr

◆ powercycle_on_panic

bool powercycle_on_panic = 0
static

Definition at line 163 of file kern_shutdown.c.

Referenced by vpanic().

◆ poweroff_delay

int poweroff_delay = POWEROFF_DELAY
static

Definition at line 978 of file kern_shutdown.c.

Referenced by poweroff_wait().

◆ poweroff_on_panic

bool poweroff_on_panic = 0
static

Definition at line 159 of file kern_shutdown.c.

Referenced by vpanic().

◆ rebooting

int rebooting

Definition at line 231 of file kern_shutdown.c.

Referenced by boottrace(), boottrace_dump_console(), exit1(), and kern_reboot().

◆ show_busybufs

int show_busybufs
static

Definition at line 171 of file kern_shutdown.c.

Referenced by bufshutdown(), and kern_reboot().

◆ shutdown_nice_task

struct task shutdown_nice_task
static
Initial value:
= TASK_INITIALIZER(0,
static void shutdown_nice_task_fn(void *arg, int pending __unused)

Definition at line 343 of file kern_shutdown.c.

Referenced by shutdown_nice().

◆ suspend_blocked

int suspend_blocked = 0

Definition at line 179 of file kern_shutdown.c.

◆ sync_on_panic

int sync_on_panic = 0
static

Definition at line 155 of file kern_shutdown.c.

Referenced by vpanic().