patch-2.3.47 linux/drivers/char/console.c

Next file: linux/drivers/char/ftape/zftape/zftape-init.c
Previous file: linux/drivers/char/Makefile
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.46/linux/drivers/char/console.c linux/drivers/char/console.c
@@ -1816,6 +1816,8 @@
 	unsigned long draw_from = 0, draw_to = 0;
 	struct vt_struct *vt = (struct vt_struct *)tty->driver_data;
 	u16 himask, charmask;
+	const unsigned char *orig_buf = NULL;
+	int orig_count;
 
 	currcons = vt->vc_num;
 	if (!vc_cons_allocated(currcons)) {
@@ -1828,9 +1830,13 @@
 	    return 0;
 	}
 
-	down(&con_buf_sem);
+	orig_buf = buf;
+	orig_count = count;
 
 	if (from_user) {
+		down(&con_buf_sem);
+
+again:
 		if (count > CON_BUF_SIZE)
 			count = CON_BUF_SIZE;
 		if (copy_from_user(con_buf, buf, count)) {
@@ -1969,7 +1975,21 @@
 	spin_unlock_irq(&console_lock);
 
 out:
-	up(&con_buf_sem);
+	if (from_user) {
+		/* If the user requested something larger than
+		 * the CON_BUF_SIZE, and the tty is not stopped,
+		 * keep going.
+		 */
+		if ((orig_count > CON_BUF_SIZE) && !tty->stopped) {
+			orig_count -= CON_BUF_SIZE;
+			orig_buf += CON_BUF_SIZE;
+			count = orig_count;
+			buf = orig_buf;
+			goto again;
+		}
+
+		up(&con_buf_sem);
+	}
 
 	return n;
 #undef FLUSH
@@ -2911,6 +2931,7 @@
 EXPORT_SYMBOL(video_scan_lines);
 EXPORT_SYMBOL(vc_resize);
 EXPORT_SYMBOL(fg_console);
+EXPORT_SYMBOL(console_blank_hook);
 
 #ifndef VT_SINGLE_DRIVER
 EXPORT_SYMBOL(take_over_console);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)