]> git.proxmox.com Git - qemu.git/commitdiff
win32: Set unbuffered stdout
authorStefan Weil <weil@mail.berlios.de>
Thu, 7 Oct 2010 16:55:48 +0000 (18:55 +0200)
committerBlue Swirl <blauwirbel@gmail.com>
Sat, 9 Oct 2010 08:20:39 +0000 (08:20 +0000)
Win32 does not support line-buffering, but it allows
unbuffered output.

Unbuffered output is a good approximation. For typical output
statements which usually end with '\n', it's even identical.

Buffered output is unusable for program traces because of
its large delay.

Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
os-win32.c
qemu-os-win32.h

index dd46bf459db4a150d2866468fa2c9bc1adb8a885..3c6f50fa9470ded15dc8a8380bdc154dd76d8733 100644 (file)
@@ -221,6 +221,12 @@ char *os_find_datadir(const char *argv0)
     return NULL;
 }
 
+void os_set_line_buffering(void)
+{
+    setbuf(stdout, NULL);
+    setbuf(stderr, NULL);
+}
+
 /*
  * Parse OS specific command line options.
  * return 0 if option handled, -1 otherwise
index 2ff9f45a6c725c2f9c624036c6def98a1eb4d51d..c63778d2fc4225cef2a4150cdaf5fc711d45b3d1 100644 (file)
@@ -45,8 +45,7 @@ void os_host_main_loop_wait(int *timeout);
 static inline void os_setup_signal_handling(void) {}
 static inline void os_daemonize(void) {}
 static inline void os_setup_post(void) {}
-/* Win32 doesn't support line-buffering and requires size >= 2 */
-static inline void os_set_line_buffering(void) {}
+void os_set_line_buffering(void);
 static inline void os_set_proc_name(const char *dummy) {}
 
 #if !defined(EPROTONOSUPPORT)