Sat Aug 27 21:14:15 2011 UTC ()
Add a thunk_atexit() so ucontext() ends can be dealt with as they should


(reinoud)
diff -r1.17 -r1.18 src/sys/arch/usermode/include/thunk.h
diff -r1.19 -r1.20 src/sys/arch/usermode/usermode/thunk.c

cvs diff -r1.17 -r1.18 src/sys/arch/usermode/include/thunk.h (expand / switch to unified diff)

--- src/sys/arch/usermode/include/thunk.h 2011/08/25 11:06:29 1.17
+++ src/sys/arch/usermode/include/thunk.h 2011/08/27 21:14:15 1.18
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: thunk.h,v 1.17 2011/08/25 11:06:29 jmcneill Exp $ */ 1/* $NetBSD: thunk.h,v 1.18 2011/08/27 21:14:15 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.
@@ -67,26 +67,27 @@ void thunk_putchar(int); @@ -67,26 +67,27 @@ void thunk_putchar(int);
67 67
68int thunk_execv(const char *, char * const []); 68int thunk_execv(const char *, char * const []);
69 69
70int thunk_open(const char *, int, mode_t); 70int thunk_open(const char *, int, mode_t);
71int thunk_fstat_getsize(int, ssize_t *, ssize_t *); 71int thunk_fstat_getsize(int, ssize_t *, ssize_t *);
72ssize_t thunk_pread(int, void *, size_t, off_t); 72ssize_t thunk_pread(int, void *, size_t, off_t);
73ssize_t thunk_pwrite(int, const void *, size_t, off_t); 73ssize_t thunk_pwrite(int, const void *, size_t, off_t);
74int thunk_fsync(int); 74int thunk_fsync(int);
75int thunk_mkstemp(char *); 75int thunk_mkstemp(char *);
76int thunk_unlink(const char *); 76int thunk_unlink(const char *);
77 77
78int thunk_sigaction(int, const struct sigaction *, struct sigaction *); 78int thunk_sigaction(int, const struct sigaction *, struct sigaction *);
79void thunk_signal(int, void (*)(int)); 79void thunk_signal(int, void (*)(int));
 80int thunk_atexit(void (*function)(void));
80 81
81int thunk_aio_read(struct aiocb *); 82int thunk_aio_read(struct aiocb *);
82int thunk_aio_write(struct aiocb *); 83int thunk_aio_write(struct aiocb *);
83int thunk_aio_error(const struct aiocb *); 84int thunk_aio_error(const struct aiocb *);
84int thunk_aio_return(struct aiocb *); 85int thunk_aio_return(struct aiocb *);
85 86
86void * thunk_malloc(size_t len); 87void * thunk_malloc(size_t len);
87void thunk_free(void *addr); 88void thunk_free(void *addr);
88void * thunk_sbrk(intptr_t len); 89void * thunk_sbrk(intptr_t len);
89void * thunk_mmap(void *addr, size_t len, int prot, int flags, int fd, off_t offset); 90void * thunk_mmap(void *addr, size_t len, int prot, int flags, int fd, off_t offset);
90int thunk_munmap(void *addr, size_t len); 91int thunk_munmap(void *addr, size_t len);
91int thunk_mprotect(void *addr, size_t len, int prot); 92int thunk_mprotect(void *addr, size_t len, int prot);
92 93

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

--- src/sys/arch/usermode/usermode/thunk.c 2011/08/25 11:06:29 1.19
+++ src/sys/arch/usermode/usermode/thunk.c 2011/08/27 21:14:15 1.20
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: thunk.c,v 1.19 2011/08/25 11:06:29 jmcneill Exp $ */ 1/* $NetBSD: thunk.c,v 1.20 2011/08/27 21:14:15 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.19 2011/08/25 11:06:29 jmcneill Exp $"); 30__RCSID("$NetBSD: thunk.c,v 1.20 2011/08/27 21:14:15 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>
@@ -255,26 +255,32 @@ thunk_unlink(const char *path) @@ -255,26 +255,32 @@ thunk_unlink(const char *path)
255int 255int
256thunk_sigaction(int sig, const struct sigaction *act, struct sigaction *oact) 256thunk_sigaction(int sig, const struct sigaction *act, struct sigaction *oact)
257{ 257{
258 return sigaction(sig, act, oact); 258 return sigaction(sig, act, oact);
259} 259}
260 260
261void 261void
262thunk_signal(int sig, void (*func)(int)) 262thunk_signal(int sig, void (*func)(int))
263{ 263{
264 signal(sig, func); 264 signal(sig, func);
265} 265}
266 266
267int 267int
 268thunk_atexit(void (*function)(void))
 269{
 270 return atexit(function);
 271}
 272
 273int
268thunk_aio_read(struct aiocb *aiocbp) 274thunk_aio_read(struct aiocb *aiocbp)
269{ 275{
270 return aio_read(aiocbp); 276 return aio_read(aiocbp);
271} 277}
272 278
273int 279int
274thunk_aio_write(struct aiocb *aiocbp) 280thunk_aio_write(struct aiocb *aiocbp)
275{ 281{
276 return aio_write(aiocbp); 282 return aio_write(aiocbp);
277} 283}
278 284
279int 285int
280thunk_aio_error(const struct aiocb *aiocbp) 286thunk_aio_error(const struct aiocb *aiocbp)