FreeBSD kernel kern code
kern_cons.c File Reference
#include <sys/cdefs.h>
#include "opt_ddb.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/conf.h>
#include <sys/cons.h>
#include <sys/fcntl.h>
#include <sys/kdb.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/msgbuf.h>
#include <sys/namei.h>
#include <sys/priv.h>
#include <sys/proc.h>
#include <sys/queue.h>
#include <sys/reboot.h>
#include <sys/sysctl.h>
#include <sys/sbuf.h>
#include <sys/tty.h>
#include <sys/uio.h>
#include <sys/vnode.h>
#include <ddb/ddb.h>
#include <machine/cpu.h>
#include <machine/clock.h>
Include dependency graph for kern_cons.c:

Go to the source code of this file.

Data Structures

struct  cn_device
 

Macros

#define CNDEVPATHMAX   32
 
#define CNDEVTAB_SIZE   4
 

Functions

 __FBSDID ("$BSDSUniX$")
 
static MALLOC_DEFINE (M_TTYCONS,"tty console","tty console handling")
 
static STAILQ_HEAD (cn_device)
 
void cninit_finish ()
 
int cnadd (struct consdev *cn)
 
void cnremove (struct consdev *cn)
 
void cnselect (struct consdev *cn)
 
void cnavailable (struct consdev *cn, int available)
 
int cnunavailable (void)
 
static int sysctl_kern_console (SYSCTL_HANDLER_ARGS)
 
 SYSCTL_PROC (_kern, OID_AUTO, console, CTLTYPE_STRING|CTLFLAG_RW, 0, 0, sysctl_kern_console,"A","Console device control")
 
static int sysctl_kern_consmute (SYSCTL_HANDLER_ARGS)
 
 SYSCTL_PROC (_kern, OID_AUTO, consmute, CTLTYPE_INT|CTLFLAG_RW, 0, sizeof(cn_mute), sysctl_kern_consmute,"I","State of the console muting")
 
void cngrab ()
 
void cnungrab ()
 
int cngetc (void)
 
int cncheckc (void)
 
void cngets (char *cp, size_t size, int visible)
 
void cnputc (int c)
 
void cnputs (char *p)
 
 SYSCTL_INT (_kern, OID_AUTO, consmsgbuf_size, CTLFLAG_RW,&consmsgbuf_size, 0,"Console tty buffer size")
 
void constty_set (struct tty *tp)
 
void constty_clear (void)
 
 SYSCTL_INT (_kern, OID_AUTO, constty_wakeups_per_second, CTLFLAG_RW,&constty_wakeups_per_second, 0,"Times per second to check for pending console tty messages")
 
static void constty_timeout (void *arg)
 
static void cn_drvinit (void *unused)
 
 SYSINIT (cndev, SI_SUB_DRIVERS, SI_ORDER_MIDDLE, cn_drvinit, NULL)
 
int sysbeep (int pitch __unused, int period __unused)
 

Variables

static struct cn_device cn_devtab [CNDEVTAB_SIZE]
 
static int consmsgbuf_size = 8192
 
static int constty_wakeups_per_second = 5
 

Macro Definition Documentation

#define CNDEVPATHMAX   32

Definition at line 79 of file kern_cons.c.

Referenced by sysctl_kern_console().

#define CNDEVTAB_SIZE   4

Definition at line 80 of file kern_cons.c.

Referenced by cnadd(), cnavailable(), and cnremove().

Function Documentation

__FBSDID ( "$BSDSUniX$"  )
static void cn_drvinit ( void *  unused)
static

Definition at line 593 of file kern_cons.c.

References mtx_init().

Here is the call graph for this function:

int cnadd ( struct consdev *  cn)

Definition at line 168 of file kern_cons.c.

References cn_devtab, cnavailable(), CNDEVTAB_SIZE, printf(), and ttyconsdev_select().

Referenced by STAILQ_HEAD(), sysctl_kern_console(), and termcn_cnregister().

Here is the call graph for this function:

Here is the caller graph for this function:

void cnavailable ( struct consdev *  cn,
int  available 
)

Definition at line 249 of file kern_cons.c.

References cn_devtab, and CNDEVTAB_SIZE.

Referenced by cnadd().

Here is the caller graph for this function:

int cncheckc ( void  )

Definition at line 394 of file kern_cons.c.

References kdb_active.

Referenced by cngetc(), and shutdown_panic().

Here is the caller graph for this function:

int cngetc ( void  )

Definition at line 380 of file kern_cons.c.

References cncheckc().

Referenced by cngets(), cnputc(), shutdown_halt(), and shutdown_panic().

Here is the call graph for this function:

Here is the caller graph for this function:

void cngets ( char *  cp,
size_t  size,
int  visible 
)

Definition at line 414 of file kern_cons.c.

References cngetc(), cngrab(), cnputc(), cnputs(), and cnungrab().

Referenced by parse_dir_ask().

Here is the call graph for this function:

Here is the caller graph for this function:

void cngrab ( )

Definition at line 351 of file kern_cons.c.

References kdb_active.

Referenced by cngets(), cnputc(), kdb_trap(), kern_reboot(), and panic().

Here is the caller graph for this function:

void cninit_finish ( )

Definition at line 161 of file kern_cons.c.

void cnputc ( int  c)

Definition at line 463 of file kern_cons.c.

References cngetc(), cngrab(), cnungrab(), and kdb_active.

Referenced by cngets(), cnputs(), constty_clear(), putbuf(), and putchar().

Here is the call graph for this function:

Here is the caller graph for this function:

void cnputs ( char *  p)

Definition at line 494 of file kern_cons.c.

References cnputc().

Referenced by _vprintf(), cngets(), and putbuf().

Here is the call graph for this function:

Here is the caller graph for this function:

void cnremove ( struct consdev *  cn)

Definition at line 199 of file kern_cons.c.

References cn_devtab, CNDEVTAB_SIZE, and ttyconsdev_select().

Referenced by STAILQ_HEAD(), and sysctl_kern_console().

Here is the call graph for this function:

Here is the caller graph for this function:

void cnselect ( struct consdev *  cn)

Definition at line 232 of file kern_cons.c.

References ttyconsdev_select().

Referenced by STAILQ_HEAD(), and sysctl_kern_console().

Here is the call graph for this function:

Here is the caller graph for this function:

int cnunavailable ( void  )

Definition at line 269 of file kern_cons.c.

void cnungrab ( )

Definition at line 364 of file kern_cons.c.

References kdb_active.

Referenced by cngets(), cnputc(), and kdb_trap().

Here is the caller graph for this function:

void constty_clear ( void  )

Definition at line 545 of file kern_cons.c.

References cnputc(), free(), and msgbuf_getchar().

Referenced by constty_timeout(), tty_generic_ioctl(), and ttydev_leave().

Here is the call graph for this function:

Here is the caller graph for this function:

void constty_set ( struct tty *  tp)

Definition at line 526 of file kern_cons.c.

References callout_init(), consmsgbuf_size, constty_timeout(), malloc(), and msgbuf_init().

Referenced by tty_generic_ioctl().

Here is the call graph for this function:

Here is the caller graph for this function:

static void constty_timeout ( void *  arg)
static

Definition at line 566 of file kern_cons.c.

References constty_clear(), hz, msgbuf_getchar(), and tty_putchar().

Referenced by constty_set().

Here is the call graph for this function:

Here is the caller graph for this function:

static MALLOC_DEFINE ( M_TTYCONS  ,
"tty console"  ,
"tty console handling"   
)
static
static STAILQ_HEAD ( cn_device  )
static

Definition at line 82 of file kern_cons.c.

References boothowto, cnadd(), cnremove(), and cnselect().

Here is the call graph for this function:

int sysbeep ( int pitch  __unused,
int period  __unused 
)

Definition at line 643 of file kern_cons.c.

SYSCTL_INT ( _kern  ,
OID_AUTO  ,
consmsgbuf_size  ,
CTLFLAG_RW  ,
consmsgbuf_size,
,
"Console tty buffer size"   
)
SYSCTL_INT ( _kern  ,
OID_AUTO  ,
constty_wakeups_per_second  ,
CTLFLAG_RW  ,
constty_wakeups_per_second,
,
"Times per second to check for pending console tty messages"   
)
static int sysctl_kern_consmute ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 336 of file kern_cons.c.

References sysctl_handle_int().

Here is the call graph for this function:

static int sysctl_kern_console ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 279 of file kern_cons.c.

References cnadd(), CNDEVPATHMAX, cnremove(), cnselect(), sbuf_clear(), sbuf_data(), sbuf_delete(), sbuf_finish(), sbuf_len(), sbuf_new(), sbuf_printf(), and sysctl_handle_string().

Here is the call graph for this function:

SYSCTL_PROC ( _kern  ,
OID_AUTO  ,
console  ,
CTLTYPE_STRING|  CTLFLAG_RW,
,
,
sysctl_kern_console  ,
"A"  ,
"Console device control"   
)
SYSCTL_PROC ( _kern  ,
OID_AUTO  ,
consmute  ,
CTLTYPE_INT|  CTLFLAG_RW,
,
sizeof(cn_mute)  ,
sysctl_kern_consmute  ,
"I"  ,
"State of the console muting"   
)
SYSINIT ( cndev  ,
SI_SUB_DRIVERS  ,
SI_ORDER_MIDDLE  ,
cn_drvinit  ,
NULL   
)

Variable Documentation

struct cn_device cn_devtab[CNDEVTAB_SIZE]
static

Definition at line 81 of file kern_cons.c.

Referenced by cnadd(), cnavailable(), and cnremove().

int consmsgbuf_size = 8192
static

Definition at line 518 of file kern_cons.c.

Referenced by constty_set().

int constty_wakeups_per_second = 5
static

Definition at line 560 of file kern_cons.c.