summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2012-04-01 05:45:17 +0200
committerKay Sievers <kay.sievers@vrfy.org>2012-04-01 05:45:17 +0200
commit73f9750cb65a8aade25fcc0903b7194d92de63b6 (patch)
treea569add8b7490ae2cb7ce20dc53061d0cdd14d48
parent6937eff19fe7dd0c708122dbf59825e41453d06b (diff)
downloadpatches-73f9750cb65a8aade25fcc0903b7194d92de63b6.tar.gz
printk: fix seek()
-rw-r--r--printk.patch65
1 files changed, 34 insertions, 31 deletions
diff --git a/printk.patch b/printk.patch
index 2f252bd..c79f40e 100644
--- a/printk.patch
+++ b/printk.patch
@@ -98,8 +98,8 @@ Signed-off-by: Kay Sievers <kay@vrfy.org>
drivers/base/core.c | 49 +
drivers/char/mem.c | 40 -
include/linux/printk.h | 13
- kernel/printk.c | 1381 +++++++++++++++++++++++++++++++++----------------
- 4 files changed, 1014 insertions(+), 469 deletions(-)
+ kernel/printk.c | 1384 +++++++++++++++++++++++++++++++++----------------
+ 4 files changed, 1017 insertions(+), 469 deletions(-)
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -303,7 +303,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org>
* If exclusive_console is non-NULL then only this console is to be printed to.
*/
static struct console *exclusive_console;
-@@ -146,12 +127,536 @@ EXPORT_SYMBOL(console_set_on_cmdline);
+@@ -146,12 +127,539 @@ EXPORT_SYMBOL(console_set_on_cmdline);
static int console_may_schedule;
#ifdef CONFIG_PRINTK
@@ -752,8 +752,12 @@ Signed-off-by: Kay Sievers <kay@vrfy.org>
+ user->idx = log_first_idx;
+ user->seq = log_first_seq;
+ break;
-+ case SEEK_CUR:
-+ /* the first record after the last 'clear' */
++ case SEEK_DATA:
++ /*
++ * The first record after the last SYSLOG_ACTION_CLEAR,
++ * like issued by 'dmesg -c'. Reading /dev/kmsg itself
++ * changes no global state, and does not clear anything.
++ */
+ user->idx = clear_idx;
+ user->seq = clear_seq;
+ break;
@@ -837,13 +841,12 @@ Signed-off-by: Kay Sievers <kay@vrfy.org>
+ .aio_write = devkmsg_writev,
+ .llseek = devkmsg_llseek,
+ .poll = devkmsg_poll,
-+ .llseek = noop_llseek,
+ .release = devkmsg_release,
+};
#ifdef CONFIG_KEXEC
/*
-@@ -165,9 +670,9 @@ static int saved_console_loglevel = -1;
+@@ -165,9 +673,9 @@ static int saved_console_loglevel = -1;
void log_buf_kexec_setup(void)
{
VMCOREINFO_SYMBOL(log_buf);
@@ -855,7 +858,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org>
}
#endif
-@@ -191,7 +696,6 @@ early_param("log_buf_len", log_buf_len_s
+@@ -191,7 +699,6 @@ early_param("log_buf_len", log_buf_len_s
void __init setup_log_buf(int early)
{
unsigned long flags;
@@ -863,7 +866,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org>
char *new_log_buf;
int free;
-@@ -219,20 +723,8 @@ void __init setup_log_buf(int early)
+@@ -219,20 +726,8 @@ void __init setup_log_buf(int early)
log_buf_len = new_log_buf_len;
log_buf = new_log_buf;
new_log_buf_len = 0;
@@ -886,7 +889,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org>
raw_spin_unlock_irqrestore(&logbuf_lock, flags);
pr_info("log_buf_len: %d\n", log_buf_len);
-@@ -332,11 +824,165 @@ static int check_syslog_permissions(int
+@@ -332,11 +827,165 @@ static int check_syslog_permissions(int
return 0;
}
@@ -1055,7 +1058,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org>
int error;
error = check_syslog_permissions(type, from_file);
-@@ -364,28 +1010,14 @@ int do_syslog(int type, char __user *buf
+@@ -364,28 +1013,14 @@ int do_syslog(int type, char __user *buf
goto out;
}
error = wait_event_interruptible(log_wait,
@@ -1087,7 +1090,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org>
/* FALL THRU */
/* Read last kernel messages */
case SYSLOG_ACTION_READ_ALL:
-@@ -399,52 +1031,11 @@ int do_syslog(int type, char __user *buf
+@@ -399,52 +1034,11 @@ int do_syslog(int type, char __user *buf
error = -EFAULT;
goto out;
}
@@ -1142,7 +1145,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org>
/* Disable logging to console */
case SYSLOG_ACTION_CONSOLE_OFF:
if (saved_console_loglevel == -1)
-@@ -472,7 +1063,33 @@ int do_syslog(int type, char __user *buf
+@@ -472,7 +1066,33 @@ int do_syslog(int type, char __user *buf
break;
/* Number of chars in the log buffer */
case SYSLOG_ACTION_SIZE_UNREAD:
@@ -1177,7 +1180,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org>
break;
/* Size of the log buffer */
case SYSLOG_ACTION_SIZE_BUFFER:
-@@ -501,29 +1118,11 @@ void kdb_syslog_data(char *syslog_data[4
+@@ -501,29 +1121,11 @@ void kdb_syslog_data(char *syslog_data[4
{
syslog_data[0] = log_buf;
syslog_data[1] = log_buf + log_buf_len;
@@ -1209,7 +1212,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org>
static bool __read_mostly ignore_loglevel;
static int __init ignore_loglevel_setup(char *str)
-@@ -540,142 +1139,33 @@ MODULE_PARM_DESC(ignore_loglevel, "ignor
+@@ -540,142 +1142,33 @@ MODULE_PARM_DESC(ignore_loglevel, "ignor
"print all kernel messages to the console.");
/*
@@ -1371,7 +1374,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org>
}
/*
-@@ -700,16 +1190,6 @@ static void zap_locks(void)
+@@ -700,16 +1193,6 @@ static void zap_locks(void)
sema_init(&console_sem, 1);
}
@@ -1388,7 +1391,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org>
/* Check if we have any console registered that can be called early in boot. */
static int have_callable_console(void)
{
-@@ -722,51 +1202,6 @@ static int have_callable_console(void)
+@@ -722,51 +1205,6 @@ static int have_callable_console(void)
return 0;
}
@@ -1440,7 +1443,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org>
/*
* Can we actually use the console at this time on this cpu?
*
-@@ -810,17 +1245,12 @@ static int console_trylock_for_printk(un
+@@ -810,17 +1248,12 @@ static int console_trylock_for_printk(un
retval = 0;
}
}
@@ -1459,7 +1462,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org>
int printk_delay_msec __read_mostly;
-@@ -836,15 +1266,22 @@ static inline void printk_delay(void)
+@@ -836,15 +1269,22 @@ static inline void printk_delay(void)
}
}
@@ -1489,7 +1492,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org>
boot_delay_msec();
printk_delay();
-@@ -856,7 +1293,7 @@ asmlinkage int vprintk(const char *fmt,
+@@ -856,7 +1296,7 @@ asmlinkage int vprintk(const char *fmt,
/*
* Ouch, printk recursed into itself!
*/
@@ -1498,7 +1501,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org>
/*
* If a crash is occurring during printk() on this CPU,
* then try to get the crash message out but make sure
-@@ -873,97 +1310,92 @@ asmlinkage int vprintk(const char *fmt,
+@@ -873,97 +1313,92 @@ asmlinkage int vprintk(const char *fmt,
lockdep_off();
raw_spin_lock(&logbuf_lock);
@@ -1667,7 +1670,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org>
*/
if (console_trylock_for_printk(this_cpu))
console_unlock();
-@@ -974,12 +1406,73 @@ out_restore_irqs:
+@@ -974,12 +1409,73 @@ out_restore_irqs:
return printed_len;
}
@@ -1743,7 +1746,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org>
{
}
-@@ -1217,7 +1710,7 @@ int is_console_locked(void)
+@@ -1217,7 +1713,7 @@ int is_console_locked(void)
}
/*
@@ -1752,7 +1755,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org>
*/
#define PRINTK_BUF_SIZE 512
-@@ -1253,6 +1746,10 @@ void wake_up_klogd(void)
+@@ -1253,6 +1749,10 @@ void wake_up_klogd(void)
this_cpu_or(printk_pending, PRINTK_PENDING_WAKEUP);
}
@@ -1763,7 +1766,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org>
/**
* console_unlock - unlock the console system
*
-@@ -1263,15 +1760,16 @@ void wake_up_klogd(void)
+@@ -1263,15 +1763,16 @@ void wake_up_klogd(void)
* by printk(). If this is the case, console_unlock(); emits
* the output prior to releasing the lock.
*
@@ -1783,7 +1786,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org>
if (console_suspended) {
up(&console_sem);
-@@ -1281,17 +1779,41 @@ void console_unlock(void)
+@@ -1281,17 +1782,41 @@ void console_unlock(void)
console_may_schedule = 0;
again:
@@ -1833,7 +1836,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org>
start_critical_timings();
local_irq_restore(flags);
}
-@@ -1312,8 +1834,7 @@ again:
+@@ -1312,8 +1837,7 @@ again:
* flush, no worries.
*/
raw_spin_lock(&logbuf_lock);
@@ -1843,7 +1846,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org>
raw_spin_unlock_irqrestore(&logbuf_lock, flags);
if (retry && console_trylock())
-@@ -1549,7 +2070,8 @@ void register_console(struct console *ne
+@@ -1549,7 +2073,8 @@ void register_console(struct console *ne
* for us.
*/
raw_spin_lock_irqsave(&logbuf_lock, flags);
@@ -1853,7 +1856,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org>
raw_spin_unlock_irqrestore(&logbuf_lock, flags);
/*
* We're about to replay the log buffer. Only do this to the
-@@ -1758,6 +2280,9 @@ int kmsg_dump_unregister(struct kmsg_dum
+@@ -1758,6 +2283,9 @@ int kmsg_dump_unregister(struct kmsg_dum
}
EXPORT_SYMBOL_GPL(kmsg_dump_unregister);
@@ -1863,7 +1866,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org>
/**
* kmsg_dump - dump kernel log to kernel message dumpers.
* @reason: the reason (oops, panic etc) for dumping
-@@ -1767,8 +2292,7 @@ EXPORT_SYMBOL_GPL(kmsg_dump_unregister);
+@@ -1767,8 +2295,7 @@ EXPORT_SYMBOL_GPL(kmsg_dump_unregister);
*/
void kmsg_dump(enum kmsg_dump_reason reason)
{
@@ -1873,7 +1876,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org>
struct kmsg_dumper *dumper;
const char *s1, *s2;
unsigned long l1, l2;
-@@ -1780,24 +2304,27 @@ void kmsg_dump(enum kmsg_dump_reason rea
+@@ -1780,24 +2307,27 @@ void kmsg_dump(enum kmsg_dump_reason rea
/* Theoretically, the log could move on after we do this, but
there's not a lot we can do about that. The new messages
will overwrite the start of what we dump. */