qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] win32: Set unbuffered stdout
@ 2010-10-07 16:55 Stefan Weil
  2010-10-09  9:43 ` [Qemu-devel] " Blue Swirl
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Weil @ 2010-10-07 16:55 UTC (permalink / raw)
  To: QEMU Developers; +Cc: Blue Swirl

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>
---
 os-win32.c      |    6 ++++++
 qemu-os-win32.h |    3 +--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/os-win32.c b/os-win32.c
index dd46bf4..3c6f50f 100644
--- a/os-win32.c
+++ b/os-win32.c
@@ -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
diff --git a/qemu-os-win32.h b/qemu-os-win32.h
index 2ff9f45..c63778d 100644
--- a/qemu-os-win32.h
+++ b/qemu-os-win32.h
@@ -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)
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [Qemu-devel] Re: [PATCH] win32: Set unbuffered stdout
  2010-10-07 16:55 [Qemu-devel] [PATCH] win32: Set unbuffered stdout Stefan Weil
@ 2010-10-09  9:43 ` Blue Swirl
  0 siblings, 0 replies; 2+ messages in thread
From: Blue Swirl @ 2010-10-09  9:43 UTC (permalink / raw)
  To: Stefan Weil; +Cc: QEMU Developers

Thanks, applied.

On Thu, Oct 7, 2010 at 4:55 PM, Stefan Weil <weil@mail.berlios.de> wrote:
> 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>
> ---
>  os-win32.c      |    6 ++++++
>  qemu-os-win32.h |    3 +--
>  2 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/os-win32.c b/os-win32.c
> index dd46bf4..3c6f50f 100644
> --- a/os-win32.c
> +++ b/os-win32.c
> @@ -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
> diff --git a/qemu-os-win32.h b/qemu-os-win32.h
> index 2ff9f45..c63778d 100644
> --- a/qemu-os-win32.h
> +++ b/qemu-os-win32.h
> @@ -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)
> --
> 1.7.1
>
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-10-09  9:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-07 16:55 [Qemu-devel] [PATCH] win32: Set unbuffered stdout Stefan Weil
2010-10-09  9:43 ` [Qemu-devel] " Blue Swirl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).