xref: /netbsd-src/sys/rump/include/rump/rump_syscalls_compat.h (revision 2946c93ec2ce4acabc1ff38773dc997be782bcf0)
1 /*	$NetBSD: rump_syscalls_compat.h,v 1.13 2013/08/15 21:29:04 pooka Exp $	*/
2 
3 /*-
4  * Copyright (c) 2010, 2011 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 #ifdef _KERNEL
29 #error rump_syscalls_compat is not for kernel consumers
30 #endif
31 
32 #ifndef _RUMP_RUMP_SYSCALLS_COMPAT_H_
33 #define _RUMP_RUMP_SYSCALLS_COMPAT_H_
34 
35 /* should have a smaller hammer here */
36 #ifndef RUMP_HOST_NOT_POSIX
37 #include <sys/types.h> /* typedefs */
38 #include <sys/select.h> /* typedefs */
39 #include <sys/socket.h> /* typedefs */
40 
41 #include <signal.h> /* typedefs */
42 #endif
43 
44 #ifdef __NetBSD__
45 #include <sys/cdefs.h>
46 #include <sys/param.h>
47 
48 /* time_t change */
49 #if !__NetBSD_Prereq__(5,99,7)
50 #define RUMP_SYS_RENAME_STAT rump___sysimpl_stat30
51 #define RUMP_SYS_RENAME_FSTAT rump___sysimpl_fstat30
52 #define RUMP_SYS_RENAME_LSTAT rump___sysimpl_lstat30
53 
54 #define RUMP_SYS_RENAME_POLLTS rump___sysimpl_pollts
55 #define RUMP_SYS_RENAME_SELECT rump___sysimpl_select
56 #define RUMP_SYS_RENAME_PSELECT rump___sysimpl_pselect
57 #define RUMP_SYS_RENAME_KEVENT rump___sysimpl_kevent
58 
59 #define RUMP_SYS_RENAME_UTIMES rump___sysimpl_utimes
60 #define RUMP_SYS_RENAME_FUTIMES rump___sysimpl_futimes
61 #define RUMP_SYS_RENAME_LUTIMES rump___sysimpl_lutimes
62 
63 #define RUMP_SYS_RENAME_MKNOD rump___sysimpl_mknod
64 #define RUMP_SYS_RENAME_FHSTAT rump___sysimpl_fhstat40
65 #endif /* __NetBSD_Prereq(5,99,7) */
66 
67 #else /* !__NetBSD__ */
68 
69 #ifndef __RENAME
70 #ifdef __ELF__
71 #define __RUMPSTRINGIFY(x) #x
72 #else
73 #define __RUMPSTRINGIFY(x) "_"#x
74 #endif /* __ELF__ */
75 #define __RENAME(x) __asm(__RUMPSTRINGIFY(x))
76 #endif /* __RENAME */
77 
78 #endif /* __NetBSD__ */
79 
80 #endif /* _RUMP_RUMP_SYSCALLS_COMPAT_H_ */
81