[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Minios-devel] [UNIKRAFT/MUSL PATCH V2 2/5] Update __stdout_write to allow flushing on stdout



Hi Gaulthier,

I think this is a reasonable solution to the problem. Hopefully, we can remove it when ioctl systemcall support is there. Do you know if stderr is handled separately and do we need a similar patch for it?

Thanks,

Simon

Reviewed-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>

On 03.03.20 11:23, gaulthier.gain@xxxxxxxxx wrote:
From: gaulthier gain <gaulthier.gain@xxxxxxxxx>

This patch fixes the issue where printing on stdout does nothing
since stdout was not flushed. In that case, we found that the problem
was related to __stdout_write. Indeed f->lbf must be set to '\n' for
line-buffered mode nevertheless, the condition "(!(f->flags & F_SVB)
&& __syscall(SYS_ioctl, f->fd, TIOCGWINSZ, &wsz))" fails on Unikraft.
The variable f->lbf is thus reset to -1 which prevents a correct
display on stdout. With this patch, we "force" f->lbf to be set in
line-buffered mode.

Signed-off-by: gaulthier gain <gaulthier.gain@xxxxxxxxx>
---
  ...09-update__stdout_write_for_flushing.patch | 25 +++++++++++++++++++
  1 file changed, 25 insertions(+)
  create mode 100644 patches/0009-update__stdout_write_for_flushing.patch

diff --git a/patches/0009-update__stdout_write_for_flushing.patch 
b/patches/0009-update__stdout_write_for_flushing.patch
new file mode 100644
index 0000000..2653104
--- /dev/null
+++ b/patches/0009-update__stdout_write_for_flushing.patch
@@ -0,0 +1,25 @@
+From 235b3d8240fbc99782f2fb8449786f519fcb3bde Mon Sep 17 00:00:00 2001
+From: gaulthier gain <gaulthier.gain@xxxxxxxxx>
+Date: Fri, 28 Feb 2020 17:05:28 +0000
+Subject: [UNIKRAFT/MUSL] Update __stdout_write to allow flushing on stdout
+
+Signed-off-by: gaulthier gain <gaulthier.gain@xxxxxxxxx>
+---
+ src/stdio/__stdout_write.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/stdio/__stdout_write.c b/src/stdio/__stdout_write.c
+index dd1ec60..f9c9489 100644
+--- a/src/stdio/__stdout_write.c
++++ b/src/stdio/__stdout_write.c
+@@ -6,6 +6,6 @@ size_t __stdout_write(FILE *f, const unsigned char *buf, 
size_t len)
+       struct winsize wsz;
+       f->write = __stdio_write;
+       if (!(f->flags & F_SVB) && __syscall(SYS_ioctl, f->fd, TIOCGWINSZ, 
&wsz))
+-              f->lbf = -1;
++              f->lbf = '\n';
+       return __stdio_write(f, buf, len);
+ }
+--
+2.17.1
+
--
2.17.1

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.