| 1 | /*	$NetBSD: rump_syscallshotgun.h,v 1.1 2016/01/31 23:14:34 pooka Exp $	*/ | 
| 2 |  | 
| 3 | /* | 
| 4 |  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved. | 
| 5 |  * | 
| 6 |  * Redistribution and use in source and binary forms, with or without | 
| 7 |  * modification, are permitted provided that the following conditions | 
| 8 |  * are met: | 
| 9 |  * 1. Redistributions of source code must retain the above copyright | 
| 10 |  *    notice, this list of conditions and the following disclaimer. | 
| 11 |  * 2. Redistributions in binary form must reproduce the above copyright | 
| 12 |  *    notice, this list of conditions and the following disclaimer in the | 
| 13 |  *    documentation and/or other materials provided with the distribution. | 
| 14 |  * | 
| 15 |  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS | 
| 16 |  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 
| 17 |  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 
| 18 |  * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | 
| 19 |  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 
| 20 |  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | 
| 21 |  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 
| 22 |  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 
| 23 |  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 
| 24 |  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 
| 25 |  * SUCH DAMAGE. | 
| 26 |  */ | 
| 27 |  | 
| 28 | /* | 
| 29 |  * "shotgun approach to rump syscalls", as stated in the original | 
| 30 |  * commit message | 
| 31 |  */ | 
| 32 |  | 
| 33 | #ifndef _RUMP_RUMP_SYSCALLSHOTGUN_H_ | 
| 34 | #define _RUMP_RUMP_SYSCALLSHOTGUN_H_ | 
| 35 |  | 
| 36 | #ifdef RUMP_SYS_NETWORKING | 
| 37 | #include <sys/socket.h> | 
| 38 | #define socket(a,b,c) rump_sys_socket(a,b,c) | 
| 39 | #define accept(a,b,c) rump_sys_accept(a,b,c) | 
| 40 | #define bind(a,b,c) rump_sys_bind(a,b,c) | 
| 41 | #define connect(a,b,c) rump_sys_connect(a,b,c) | 
| 42 | #define getpeername(a,b,c) rump_sys_getpeername(a,b,c) | 
| 43 | #define getsockname(a,b,c) rump_sys_getsockname(a,b,c) | 
| 44 | #define listen(a,b) rump_sys_listen(a,b) | 
| 45 | #define recvfrom(a,b,c,d,e,f) rump_sys_recvfrom(a,b,c,d,e,f) | 
| 46 | #define recvmsg(a,b,c) rump_sys_recvmsg(a,b,c) | 
| 47 | #define sendto(a,b,c,d,e,f) rump_sys_sendto(a,b,c,d,e,f) | 
| 48 | #define sendmsg(a,b,c) rump_sys_sendmsg(a,b,c) | 
| 49 | #define getsockopt(a,b,c,d,e) rump_sys_getsockopt(a,b,c,d,e) | 
| 50 | #define setsockopt(a,b,c,d,e) rump_sys_setsockopt(a,b,c,d,e) | 
| 51 | #define shutdown(a,b) rump_sys_shutdown(a,b) | 
| 52 | #endif /* RUMP_SYS_NETWORKING */ | 
| 53 |  | 
| 54 | #ifdef RUMP_SYS_IOCTL | 
| 55 | #include <sys/ioctl.h> | 
| 56 | #define ioctl(...) rump_sys_ioctl(__VA_ARGS__) | 
| 57 | #define fcntl(...) rump_sys_fcntl(__VA_ARGS__) | 
| 58 | #endif /* RUMP_SYS_IOCTL */ | 
| 59 |  | 
| 60 | #ifdef RUMP_SYS_CLOSE | 
| 61 | #include <fcntl.h> | 
| 62 | #define close(a) rump_sys_close(a) | 
| 63 | #endif /* RUMP_SYS_CLOSE */ | 
| 64 |  | 
| 65 | #ifdef RUMP_SYS_OPEN | 
| 66 | #include <fcntl.h> | 
| 67 | #define open(...) rump_sys_open(__VA_ARGS__) | 
| 68 | #endif /* RUMP_SYS_OPEN */ | 
| 69 |  | 
| 70 | #ifdef RUMP_SYS_READWRITE | 
| 71 | #include <fcntl.h> | 
| 72 | #define read(a,b,c) rump_sys_read(a,b,c) | 
| 73 | #define readv(a,b,c) rump_sys_readv(a,b,c) | 
| 74 | #define pread(a,b,c,d) rump_sys_pread(a,b,c,d) | 
| 75 | #define preadv(a,b,c,d) rump_sys_preadv(a,b,c,d) | 
| 76 | #define write(a,b,c) rump_sys_write(a,b,c) | 
| 77 | #define writev(a,b,c) rump_sys_writev(a,b,c) | 
| 78 | #define pwrite(a,b,c,d) rump_sys_pwrite(a,b,c,d) | 
| 79 | #define pwritev(a,b,c,d) rump_sys_pwritev(a,b,c,d) | 
| 80 | #endif /* RUMP_SYS_READWRITE */ | 
| 81 |  | 
| 82 | #ifdef RUMP_SYS_FILEOPS | 
| 83 | #include <stdlib.h> | 
| 84 | #include <unistd.h> | 
| 85 | #define mkdir(a,b) rump_sys_mkdir(a,b) | 
| 86 | #define rmdir(a) rump_sys_rmdir(a) | 
| 87 | #define link(a,b) rump_sys_link(a,b) | 
| 88 | #define symlink(a,b) rump_sys_symlink(a,b) | 
| 89 | #define unlink(a) rump_sys_unlink(a) | 
| 90 | #define readlink(a,b,c) rump_sys_readlink(a,b,c) | 
| 91 | #define chdir(a) rump_sys_chdir(a) | 
| 92 | #define fsync(a) rump_sys_fsync(a) | 
| 93 | #define sync() rump_sys_sync() | 
| 94 | #define chown(a,b,c) rump_sys_chown(a,b,c) | 
| 95 | #define fchown(a,b,c) rump_sys_fchown(a,b,c) | 
| 96 | #define lchown(a,b,c) rump_sys_lchown(a,b,c) | 
| 97 | #define lseek(a,b,c) rump_sys_lseek(a,b,c) | 
| 98 | #define mknod(a,b,c) rump_sys_mknod(a,b,c) | 
| 99 | #define rename(a,b) rump_sys_rename(a,b) | 
| 100 | #define truncate(a,b) rump_sys_truncate(a,b) | 
| 101 | #define ftruncate(a,b) rump_sys_ftruncate(a,b) | 
| 102 | #define umask(a) rump_sys_umask(a) | 
| 103 | #define getdents(a,b,c) rump_sys_getdents(a,b,c) | 
| 104 | #endif /* RUMP_SYS_FILEOPS */ | 
| 105 |  | 
| 106 | #ifdef RUMP_SYS_STAT | 
| 107 | #include <sys/stat.h> | 
| 108 | #define stat(a,b) rump_sys_stat(a,b) | 
| 109 | #define fstat(a,b) rump_sys_fstat(a,b) | 
| 110 | #define lstat(a,b) rump_sys_lstat(a,b) | 
| 111 | #endif /* RUMP_SYS_STAT */ | 
| 112 |  | 
| 113 | #ifdef RUMP_SYS_PROCOPS | 
| 114 | #include <unistd.h> | 
| 115 | #define getpid() rump_sys_getpid() | 
| 116 | #endif /* RUMP_SYS_PROCOPS */ | 
| 117 |  | 
| 118 | #endif /* _RUMP_RUMP_SYSCALLSHOTGUN_H_ */ | 
| 119 |  |