Skip to contentSkip to conversation

RFC: lossless printk, version 2

uml-devel Werner Almesberger 1 participant 1 message Apr 2, 2004 User-mode Linux (UML)

lore
Share & tools
lore
#0 lore raw

Second, cleaner version. The changes:

- retry on EINTR
- instead of trying to die, disable console permanently on any error but EINTR and EAGAIN
- prints "nice" message on error
- removed duplicate console_user.o in Makefile
- moved lossless_stdio_console_write prototype from stdio_console.c to stdio_console.h

Thanks to all who have sent comments !

- Werner

Signature · 3 lines
  _________________________________________________________________________
 / Werner Almesberger, Buenos Aires, Argentina     [email protected] /
/_http://www.almesberger.net/____________________________________________/
arch/um/Kconfig_char +8 -0
@@ -5,6 +5,14 @@
 	bool
 	default y
 
+config LOSSLESS_STDIO_CONSOLE
+	bool "Lossless standard output console"
+	depends on STDIO_CONSOLE
+	help
+	When console output goes to standard output, retry write operations
+	that would block. This is particularly useful when recording the
+	output of a UML system in a file.
+
 config SSL
 	bool "Virtual serial line"
 	help
arch/um/drivers/Makefile +1 -0
@@ -41,6 +41,7 @@
 obj-$(CONFIG_UML_WATCHDOG) += harddog.o
 obj-$(CONFIG_BLK_DEV_COW) += cow_kern.o
 obj-$(CONFIG_BLK_DEV_COW_COMMON) += cow_user.o
+obj-$(CONFIG_LOSSLESS_STDIO_CONSOLE) += console_user.o
 
 obj-y += stdio_console.o $(CHAN_OBJS)
 
arch/um/drivers/stdio_console.h +3 -0
@@ -7,6 +7,9 @@
 #define __STDIO_CONSOLE_H
 
 extern void save_console_flags(void);
+
+void lossless_stdio_console_write(const char *string,unsigned len);
+
 #endif
 
 /*
arch/um/drivers/stdio_console.c +4 -0
@@ -194,6 +194,9 @@
 static void console_write(struct console *console, const char *string, 
 			  unsigned len)
 {
+#ifdef CONFIG_LOSSLESS_STDIO_CONSOLE
+	lossless_stdio_console_write(string,len);
+#else
 	struct line *line = &vts[console->index];
 
 	if(con_init_done)
@@ -201,6 +204,7 @@
 	console_write_chan(&line->chan_list, string, len);
 	if(con_init_done)
 		up(&line->sem);
+#endif
 }
 
 static struct tty_driver *console_device(struct console *c, int *index)
arch/um/drivers/console_user.c new file +62 -0

62 lines not on this page · raw message