]> xenbits.xensource.com Git - unikraft/libs/musl.git/commitdiff
Update __stdout_write to allow flushing on stdout RELEASE-0.5
authorgaulthier gain <gaulthier.gain@uliege.be>
Tue, 3 Mar 2020 10:23:24 +0000 (10:23 +0000)
committerSimon Kuenzer <simon.kuenzer@neclab.eu>
Mon, 24 Aug 2020 10:05:49 +0000 (12:05 +0200)
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@uliege.be>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
patches/0009-update__stdout_write_for_flushing.patch [new file with mode: 0644]

diff --git a/patches/0009-update__stdout_write_for_flushing.patch b/patches/0009-update__stdout_write_for_flushing.patch
new file mode 100644 (file)
index 0000000..bda423f
--- /dev/null
@@ -0,0 +1,25 @@
+From 235b3d8240fbc99782f2fb8449786f519fcb3bde Mon Sep 17 00:00:00 2001
+From: gaulthier gain <gaulthier.gain@uliege.be>
+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@uliege.be>
+---
+ 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
+