Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
printk.c File Reference
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/tty.h>
#include <linux/tty_driver.h>
#include <linux/console.h>
#include <linux/init.h>
#include <linux/jiffies.h>
#include <linux/nmi.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/smp.h>
#include <linux/security.h>
#include <linux/bootmem.h>
#include <linux/memblock.h>
#include <linux/syscalls.h>
#include <linux/kexec.h>
#include <linux/kdb.h>
#include <linux/ratelimit.h>
#include <linux/kmsg_dump.h>
#include <linux/syslog.h>
#include <linux/cpu.h>
#include <linux/notifier.h>
#include <linux/rculist.h>
#include <linux/poll.h>
#include <asm/uaccess.h>
#include <trace/events/printk.h>

Go to the source code of this file.

Data Structures

struct  console_cmdline
 
struct  log
 
struct  cont
 

Macros

#define CREATE_TRACE_POINTS
 
#define DEFAULT_MESSAGE_LOGLEVEL   CONFIG_DEFAULT_MESSAGE_LOGLEVEL
 
#define MINIMUM_CONSOLE_LOGLEVEL   1 /* Minimum loglevel we let people use */
 
#define DEFAULT_CONSOLE_LOGLEVEL   7 /* anything MORE serious than KERN_DEBUG */
 
#define MAX_CMDLINECONSOLES   8
 
#define LOG_LINE_MAX   0
 
#define PREFIX_MAX   0
 
#define LOG_LINE_MAX   0
 

Enumerations

enum  log_flags { LOG_NOCONS = 1, LOG_NEWLINE = 2, LOG_PREFIX = 4, LOG_CONT = 8 }
 

Functions

void asmlinkage __attribute__ ((weak))
 
 DECLARE_WAIT_QUEUE_HEAD (log_wait)
 
 EXPORT_SYMBOL (oops_in_progress)
 
 EXPORT_SYMBOL_GPL (console_drivers)
 
 EXPORT_SYMBOL (console_set_on_cmdline)
 
 __setup ("console=", console_setup)
 

Variables

int console_printk [4]
 
int oops_in_progress
 
struct consoleconsole_drivers
 
int console_set_on_cmdline
 

: device name

add_preferred_console - add a device to the list of preferred consoles.

: device index : options for this console

The last preferred console added will be used for kernel messages and stdin/out/err for init. Normally this is used by console_setup above to handle user-supplied console arguments; however it can also be used by arch-specific code either to override the user or more commonly to provide a default console (ie from PROM variables) when the user has not supplied one.

#define PRINTK_BUF_SIZE   512
 
#define PRINTK_PENDING_WAKEUP   0x01
 
#define PRINTK_PENDING_SCHED   0x02
 
bool console_suspend_enabled = 1
 
int add_preferred_console (char *name, int idx, char *options)
 
int update_console_cmdline (char *name, int idx, char *name_new, int idx_new, char *options)
 
 EXPORT_SYMBOL (console_suspend_enabled)
 
 __setup ("no_console_suspend", console_suspend_disable)
 
 module_param_named (console_suspend, console_suspend_enabled, bool, S_IRUGO|S_IWUSR)
 
 MODULE_PARM_DESC (console_suspend,"suspend console during suspend"" and hibernate operations")
 
void suspend_console (void)
 
void resume_console (void)
 
void console_lock (void)
 
 EXPORT_SYMBOL (console_lock)
 
int console_trylock (void)
 
 EXPORT_SYMBOL (console_trylock)
 
int is_console_locked (void)
 
void printk_tick (void)
 
int printk_needs_cpu (int cpu)
 
void wake_up_klogd (void)
 
void console_unlock (void)
 
 EXPORT_SYMBOL (console_unlock)
 
void __sched console_conditional_schedule (void)
 
 EXPORT_SYMBOL (console_conditional_schedule)
 
void console_unblank (void)
 
struct tty_driverconsole_device (int *index)
 
void console_stop (struct console *console)
 
 EXPORT_SYMBOL (console_stop)
 
void console_start (struct console *console)
 
 EXPORT_SYMBOL (console_start)
 
 early_param ("keep_bootcon", keep_bootcon_setup)
 
void register_console (struct console *newcon)
 
 EXPORT_SYMBOL (register_console)
 
int unregister_console (struct console *console)
 
 EXPORT_SYMBOL (unregister_console)
 
 late_initcall (printk_late_init)
 

Macro Definition Documentation

#define CREATE_TRACE_POINTS

Definition at line 48 of file printk.c.

#define DEFAULT_CONSOLE_LOGLEVEL   7 /* anything MORE serious than KERN_DEBUG */

Definition at line 63 of file printk.c.

#define DEFAULT_MESSAGE_LOGLEVEL   CONFIG_DEFAULT_MESSAGE_LOGLEVEL

Definition at line 59 of file printk.c.

#define LOG_LINE_MAX   0

Definition at line 1692 of file printk.c.

#define LOG_LINE_MAX   0

Definition at line 1692 of file printk.c.

#define MAX_CMDLINECONSOLES   8

Definition at line 118 of file printk.c.

#define MINIMUM_CONSOLE_LOGLEVEL   1 /* Minimum loglevel we let people use */

Definition at line 62 of file printk.c.

#define PREFIX_MAX   0

Definition at line 1691 of file printk.c.

#define PRINTK_BUF_SIZE   512

Definition at line 1950 of file printk.c.

#define PRINTK_PENDING_SCHED   0x02

Definition at line 1953 of file printk.c.

#define PRINTK_PENDING_WAKEUP   0x01

Definition at line 1952 of file printk.c.

Enumeration Type Documentation

enum log_flags
Enumerator:
LOG_NOCONS 
LOG_NEWLINE 
LOG_PREFIX 
LOG_CONT 

Definition at line 196 of file printk.c.

Function Documentation

void asmlinkage __attribute__ ( (weak)  )
read

Definition at line 54 of file printk.c.

__setup ( )
__setup ( "no_console_suspend"  ,
console_suspend_disable   
)
int add_preferred_console ( char name,
int  idx,
char options 
)

Definition at line 1814 of file printk.c.

void __sched console_conditional_schedule ( void  )

console_conditional_schedule - yield the CPU if required

If the console code is currently allowed to sleep, and if this CPU should yield the CPU to another task, do so here.

Must be called within console_lock();.

Definition at line 2134 of file printk.c.

struct tty_driver* console_device ( int index)
read

Definition at line 2166 of file printk.c.

void console_lock ( void  )

console_lock - lock the console system for exclusive use.

Acquires a lock which guarantees that the caller has exclusive access to the console system and the console_drivers list.

Can sleep, returns nothing.

Definition at line 1909 of file printk.c.

void console_start ( struct console console)

Definition at line 2196 of file printk.c.

void console_stop ( struct console console)

Definition at line 2188 of file printk.c.

int console_trylock ( void  )

console_trylock - try to lock the console system for exclusive use.

Tried to acquire a lock which guarantees that the caller has exclusive access to the console system and the console_drivers list.

returns 1 on success, and 0 on failure to acquire the lock.

Definition at line 1928 of file printk.c.

void console_unblank ( void  )

Definition at line 2141 of file printk.c.

void console_unlock ( void  )

console_unlock - unlock the console system

Releases the console_lock which the caller holds on the console system and the console driver list.

While the console_lock was held, console output may have been buffered by printk(). If this is the case, console_unlock(); emits the output prior to releasing the lock.

If there is output waiting, we wake /dev/kmsg and syslog() users.

console_unlock(); may be called from any context.

Definition at line 2027 of file printk.c.

DECLARE_WAIT_QUEUE_HEAD ( log_wait  )
early_param ( "keep_bootcon"  ,
keep_bootcon_setup   
)
EXPORT_SYMBOL ( oops_in_progress  )
EXPORT_SYMBOL ( console_set_on_cmdline  )
EXPORT_SYMBOL ( console_suspend_enabled  )
EXPORT_SYMBOL ( console_lock  )
EXPORT_SYMBOL ( console_trylock  )
EXPORT_SYMBOL ( console_unlock  )
EXPORT_SYMBOL ( console_conditional_schedule  )
EXPORT_SYMBOL ( console_stop  )
EXPORT_SYMBOL ( console_start  )
EXPORT_SYMBOL ( register_console  )
EXPORT_SYMBOL ( unregister_console  )
EXPORT_SYMBOL_GPL ( console_drivers  )
int is_console_locked ( void  )

Definition at line 1942 of file printk.c.

late_initcall ( printk_late_init  )
module_param_named ( console_suspend  ,
console_suspend_enabled  ,
bool  ,
S_IRUGO S_IWUSR 
)
MODULE_PARM_DESC ( console_suspend  ,
"suspend console during suspend"" and hibernate operations"   
)
int printk_needs_cpu ( int  cpu)

Definition at line 1971 of file printk.c.

void printk_tick ( void  )

Definition at line 1958 of file printk.c.

void register_console ( struct console newcon)

Definition at line 2235 of file printk.c.

void resume_console ( void  )

Definition at line 1867 of file printk.c.

void suspend_console ( void  )

suspend_console - suspend the console subsystem

This disables printk() while we go into suspend states

Definition at line 1857 of file printk.c.

int unregister_console ( struct console console)

Definition at line 2390 of file printk.c.

int update_console_cmdline ( char name,
int  idx,
char name_new,
int  idx_new,
char options 
)

Definition at line 1819 of file printk.c.

void wake_up_klogd ( void  )

Definition at line 1978 of file printk.c.

Variable Documentation

struct console* console_drivers

Definition at line 87 of file printk.c.

int console_printk[4]
int console_set_on_cmdline

Definition at line 123 of file printk.c.

bool console_suspend_enabled = 1

Definition at line 1838 of file printk.c.

int oops_in_progress

Definition at line 78 of file printk.c.