Commit 248d1a835700 ("Add printx to userspace (XCC)") moved the void
trace_printf() from one header to another. But it turns out that 'void'
was wrong. It conflicted with glibc's parlib-compat helper, which expected
an int. The old code didn't notice since parlib/ros_debug.h wasn't
included by glibc's parlib-compat.c, but parlib/stdio.h is.
Signed-off-by: Barret Rhoden <[email protected]>
---
Merged to master at c1257c0d0110..95f45ef968ee (from, to]
You can see the entire diff with 'git diff' or at
https://github.com/brho/akaros/compare/c1257c0d0110...95f45ef968ee
user/parlib/debug.c | 8 +++++---
user/parlib/include/parlib/stdio.h | 2 +-
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/user/parlib/debug.c b/user/parlib/debug.c
index 46a96d33cfdb..08c79a312943 100644
--- a/user/parlib/debug.c
+++ b/user/parlib/debug.c
@@ -96,7 +96,7 @@ static void trace_init(void *arg)
perror("Unable to open kptrace!\n");
}
-void trace_printf(const char *fmt, ...)
+int trace_printf(const char *fmt, ...)
{
va_list args;
char buf[128];
@@ -105,7 +105,7 @@ void trace_printf(const char *fmt, ...)
parlib_run_once(&once, trace_init, NULL);
if (kptrace < 0)
- return;
+ return 0;
amt = snprintf(buf, sizeof(buf), "PID %d: ", getpid());
/* amt could be > sizeof, if we truncated. */
amt = MIN(amt, sizeof(buf));
@@ -113,5 +113,7 @@ void trace_printf(const char *fmt, ...)
/* amt == sizeof is OK here */
amt += vsnprintf(buf + amt, sizeof(buf) - amt, fmt, args);
va_end(args);
- write(kptrace, buf, MIN(amt, sizeof(buf)));
+ amt = MIN(amt, sizeof(buf));
+ write(kptrace, buf, amt);
+ return amt;
}
diff --git a/user/parlib/include/parlib/stdio.h
b/user/parlib/include/parlib/stdio.h
index 7c37351dfca0..c2b6f10f2e9b 100644
--- a/user/parlib/include/parlib/stdio.h
+++ b/user/parlib/include/parlib/stdio.h
@@ -116,7 +116,7 @@ do {
\
debug_fprintf(stderr, __VA_ARGS__);
\
} while (0);
-void trace_printf(const char *fmt, ...);
+int trace_printf(const char *fmt, ...);
#define trace_printx(...)
\
do {
\
--
2.15.0.531.g2ccb3012c9-goog
--
You received this message because you are subscribed to the Google Groups
"Akaros" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/d/optout.