patch-2.1.73 linux/kernel/printk.c
Next file: linux/kernel/signal.c
Previous file: linux/kernel/ksyms.c
Back to the patch index
Back to the overall index
- Lines: 29
- Date:
Thu Dec 18 11:30:57 1997
- Orig file:
v2.1.72/linux/kernel/printk.c
- Orig date:
Wed Dec 10 11:12:46 1997
diff -u --recursive --new-file v2.1.72/linux/kernel/printk.c linux/kernel/printk.c
@@ -109,7 +109,7 @@
*/
asmlinkage int sys_syslog(int type, char * buf, int len)
{
- unsigned long i, j, count;
+ unsigned long i, j, count, flags;
int do_clear = 0;
char c;
int error = -EPERM;
@@ -170,12 +170,19 @@
error = verify_area(VERIFY_WRITE,buf,len);
if (error)
goto out;
+ /*
+ * The logged_chars, log_start, and log_size values may
+ * change from an interrupt, so we disable interrupts.
+ */
+ __save_flags(flags);
+ __cli();
count = len;
if (count > LOG_BUF_LEN)
count = LOG_BUF_LEN;
if (count > logged_chars)
count = logged_chars;
j = log_start + log_size - count;
+ __restore_flags(flags);
for (i = 0; i < count; i++) {
c = *((char *) log_buf+(j++ & (LOG_BUF_LEN-1)));
__put_user(c, buf++);
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov