diff options
Diffstat (limited to 'kernel/printk.c')
-rw-r--r-- | kernel/printk.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/kernel/printk.c b/kernel/printk.c index e9be027bc930..13ced0f7828f 100644 --- a/kernel/printk.c +++ b/kernel/printk.c | |||
@@ -11,7 +11,7 @@ | |||
11 | * Ted Ts'o, 2/11/93. | 11 | * Ted Ts'o, 2/11/93. |
12 | * Modified for sysctl support, 1/8/97, Chris Horn. | 12 | * Modified for sysctl support, 1/8/97, Chris Horn. |
13 | * Fixed SMP synchronization, 08/08/99, Manfred Spraul | 13 | * Fixed SMP synchronization, 08/08/99, Manfred Spraul |
14 | * manfreds@colorfullife.com | 14 | * manfred@colorfullife.com |
15 | * Rewrote bits to get rid of console_lock | 15 | * Rewrote bits to get rid of console_lock |
16 | * 01Mar01 Andrew Morton <andrewm@uow.edu.au> | 16 | * 01Mar01 Andrew Morton <andrewm@uow.edu.au> |
17 | */ | 17 | */ |
@@ -491,7 +491,10 @@ __attribute__((weak)) unsigned long long printk_clock(void) | |||
491 | return sched_clock(); | 491 | return sched_clock(); |
492 | } | 492 | } |
493 | 493 | ||
494 | /* | 494 | /** |
495 | * printk - print a kernel message | ||
496 | * @fmt: format string | ||
497 | * | ||
495 | * This is printk. It can be called from any context. We want it to work. | 498 | * This is printk. It can be called from any context. We want it to work. |
496 | * | 499 | * |
497 | * We try to grab the console_sem. If we succeed, it's easy - we log the output and | 500 | * We try to grab the console_sem. If we succeed, it's easy - we log the output and |
@@ -503,6 +506,9 @@ __attribute__((weak)) unsigned long long printk_clock(void) | |||
503 | * One effect of this deferred printing is that code which calls printk() and | 506 | * One effect of this deferred printing is that code which calls printk() and |
504 | * then changes console_loglevel may break. This is because console_loglevel | 507 | * then changes console_loglevel may break. This is because console_loglevel |
505 | * is inspected when the actual printing occurs. | 508 | * is inspected when the actual printing occurs. |
509 | * | ||
510 | * See also: | ||
511 | * printf(3) | ||
506 | */ | 512 | */ |
507 | 513 | ||
508 | asmlinkage int printk(const char *fmt, ...) | 514 | asmlinkage int printk(const char *fmt, ...) |
@@ -563,7 +569,7 @@ asmlinkage int vprintk(const char *fmt, va_list args) | |||
563 | p[1] <= '7' && p[2] == '>') { | 569 | p[1] <= '7' && p[2] == '>') { |
564 | loglev_char = p[1]; | 570 | loglev_char = p[1]; |
565 | p += 3; | 571 | p += 3; |
566 | printed_len += 3; | 572 | printed_len -= 3; |
567 | } else { | 573 | } else { |
568 | loglev_char = default_message_loglevel | 574 | loglev_char = default_message_loglevel |
569 | + '0'; | 575 | + '0'; |
@@ -578,7 +584,7 @@ asmlinkage int vprintk(const char *fmt, va_list args) | |||
578 | 584 | ||
579 | for (tp = tbuf; tp < tbuf + tlen; tp++) | 585 | for (tp = tbuf; tp < tbuf + tlen; tp++) |
580 | emit_log_char(*tp); | 586 | emit_log_char(*tp); |
581 | printed_len += tlen - 3; | 587 | printed_len += tlen; |
582 | } else { | 588 | } else { |
583 | if (p[0] != '<' || p[1] < '0' || | 589 | if (p[0] != '<' || p[1] < '0' || |
584 | p[1] > '7' || p[2] != '>') { | 590 | p[1] > '7' || p[2] != '>') { |
@@ -586,8 +592,8 @@ asmlinkage int vprintk(const char *fmt, va_list args) | |||
586 | emit_log_char(default_message_loglevel | 592 | emit_log_char(default_message_loglevel |
587 | + '0'); | 593 | + '0'); |
588 | emit_log_char('>'); | 594 | emit_log_char('>'); |
595 | printed_len += 3; | ||
589 | } | 596 | } |
590 | printed_len += 3; | ||
591 | } | 597 | } |
592 | log_level_unknown = 0; | 598 | log_level_unknown = 0; |
593 | if (!*p) | 599 | if (!*p) |
@@ -655,6 +661,9 @@ static void call_console_drivers(unsigned long start, unsigned long end) | |||
655 | 661 | ||
656 | /** | 662 | /** |
657 | * add_preferred_console - add a device to the list of preferred consoles. | 663 | * add_preferred_console - add a device to the list of preferred consoles. |
664 | * @name: device name | ||
665 | * @idx: device index | ||
666 | * @options: options for this console | ||
658 | * | 667 | * |
659 | * The last preferred console added will be used for kernel messages | 668 | * The last preferred console added will be used for kernel messages |
660 | * and stdin/out/err for init. Normally this is used by console_setup | 669 | * and stdin/out/err for init. Normally this is used by console_setup |
@@ -764,7 +773,8 @@ void release_console_sem(void) | |||
764 | } | 773 | } |
765 | EXPORT_SYMBOL(release_console_sem); | 774 | EXPORT_SYMBOL(release_console_sem); |
766 | 775 | ||
767 | /** console_conditional_schedule - yield the CPU if required | 776 | /** |
777 | * console_conditional_schedule - yield the CPU if required | ||
768 | * | 778 | * |
769 | * If the console code is currently allowed to sleep, and | 779 | * If the console code is currently allowed to sleep, and |
770 | * if this CPU should yield the CPU to another task, do | 780 | * if this CPU should yield the CPU to another task, do |
@@ -946,7 +956,7 @@ int unregister_console(struct console *console) | |||
946 | if (console_drivers == console) { | 956 | if (console_drivers == console) { |
947 | console_drivers=console->next; | 957 | console_drivers=console->next; |
948 | res = 0; | 958 | res = 0; |
949 | } else { | 959 | } else if (console_drivers) { |
950 | for (a=console_drivers->next, b=console_drivers ; | 960 | for (a=console_drivers->next, b=console_drivers ; |
951 | a; b=a, a=b->next) { | 961 | a; b=a, a=b->next) { |
952 | if (a == console) { | 962 | if (a == console) { |
@@ -976,6 +986,8 @@ EXPORT_SYMBOL(unregister_console); | |||
976 | 986 | ||
977 | /** | 987 | /** |
978 | * tty_write_message - write a message to a certain tty, not just the console. | 988 | * tty_write_message - write a message to a certain tty, not just the console. |
989 | * @tty: the destination tty_struct | ||
990 | * @msg: the message to write | ||
979 | * | 991 | * |
980 | * This is used for messages that need to be redirected to a specific tty. | 992 | * This is used for messages that need to be redirected to a specific tty. |
981 | * We don't put it into the syslog queue right now maybe in the future if | 993 | * We don't put it into the syslog queue right now maybe in the future if |