[kaffe] kwrite usage
Alexander Boettcher
ab764283 at os.inf.tu-dresden.de
Thu Aug 26 10:00:47 PDT 2004
Hi,
is it useful/possible to use "kwrite" instead of "write" in the
kaffe/kaffevm/debug.c ? (see diff).
I use it when stderr(2) is not opened or another filedescriptor is used
for the output. Then the implementation of the syscall interface can
change the behavior.
I use it for Kaffe with our DROPS. Kaffe now runs as a native
application, ;-) , on our microkernel Fiasco and the L4 environment.
(http://wwwos.inf.tu-dresden.de/drops). I plan to update my cvs state
of kaffe (february) with the current one and therefore I submit this
proposal/patch, which could be useful for you (and for me ;-) ).
Thx,
Alexander Böttcher.
-------------- next part --------------
Index: debug.c
===================================================================
RCS file: /cvs/kaffe/kaffe/kaffe/kaffevm/debug.c,v
retrieving revision 1.55
diff -u -r1.55 debug.c
--- debug.c 2 Aug 2004 10:44:56 -0000 1.55
+++ debug.c 26 Aug 2004 16:26:46 -0000
@@ -36,6 +36,7 @@
#include "gtypes.h"
#include "gc.h"
#include "debug.h"
+#include "jsyscall.h"
/* Default debugging mask to use (if debug is enabled) */
#define DEFAULT_DEBUG_MASK DBG_NONE
@@ -388,6 +389,7 @@
int n;
int max;
va_list args;
+ ssize_t w = 0;
va_start(args, fmt);
if (!debugBuffer)
@@ -417,9 +419,10 @@
*/
max = 0;
while (max < n) {
- int w = write(2,
- debugBuffer + max,
- (size_t)(n - max));
+ KWRITE(2,
+ debugBuffer + max,
+ (size_t)n - max,&w);
+
if (w >= 0)
/* ignore errors */
max += w;
More information about the kaffe
mailing list