Tue Aug 23 18:36:08 2011 UTC ()
Use write(1,..) and not putchar()


(reinoud)
diff -r1.15 -r1.16 src/sys/arch/usermode/usermode/thunk.c

cvs diff -r1.15 -r1.16 src/sys/arch/usermode/usermode/thunk.c (expand / switch to unified diff)

--- src/sys/arch/usermode/usermode/thunk.c 2011/08/23 17:12:32 1.15
+++ src/sys/arch/usermode/usermode/thunk.c 2011/08/23 18:36:08 1.16
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: thunk.c,v 1.15 2011/08/23 17:12:32 jmcneill Exp $ */ 1/* $NetBSD: thunk.c,v 1.16 2011/08/23 18:36:08 reinoud Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2011 Jared D. McNeill <jmcneill@invisible.ca> 4 * Copyright (c) 2011 Jared D. McNeill <jmcneill@invisible.ca>
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -17,27 +17,27 @@ @@ -17,27 +17,27 @@
17 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE. 26 * POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29#include <sys/cdefs.h> 29#include <sys/cdefs.h>
30__RCSID("$NetBSD: thunk.c,v 1.15 2011/08/23 17:12:32 jmcneill Exp $"); 30__RCSID("$NetBSD: thunk.c,v 1.16 2011/08/23 18:36:08 reinoud Exp $");
31 31
32#include <sys/types.h> 32#include <sys/types.h>
33#include <sys/ansi.h> 33#include <sys/ansi.h>
34 34
35#include <aio.h> 35#include <aio.h>
36#include <assert.h> 36#include <assert.h>
37#include <fcntl.h> 37#include <fcntl.h>
38#include <stdarg.h> 38#include <stdarg.h>
39#include <stdint.h> 39#include <stdint.h>
40#include <stdio.h> 40#include <stdio.h>
41#include <stdlib.h> 41#include <stdlib.h>
42#include <signal.h> 42#include <signal.h>
43#include <time.h> 43#include <time.h>
@@ -178,28 +178,28 @@ thunk_swapcontext(ucontext_t *oucp, ucon @@ -178,28 +178,28 @@ thunk_swapcontext(ucontext_t *oucp, ucon
178{ 178{
179 return swapcontext(oucp, ucp); 179 return swapcontext(oucp, ucp);
180} 180}
181 181
182int 182int
183thunk_getchar(void) 183thunk_getchar(void)
184{ 184{
185 return getchar(); 185 return getchar();
186} 186}
187 187
188void 188void
189thunk_putchar(int c) 189thunk_putchar(int c)
190{ 190{
191 putchar(c); 191 char wc = (char) c;
192 fflush(stdout); 192 write(1, &wc, 1);
193} 193}
194 194
195int 195int
196thunk_execv(const char *path, char * const argv[]) 196thunk_execv(const char *path, char * const argv[])
197{ 197{
198 return execv(path, argv); 198 return execv(path, argv);
199} 199}
200 200
201int 201int
202thunk_open(const char *path, int flags, mode_t mode) 202thunk_open(const char *path, int flags, mode_t mode)
203{ 203{
204 return open(path, flags, mode); 204 return open(path, flags, mode);
205} 205}