1 | /* $NetBSD: rump.h,v 1.70 2017/05/11 18:16:00 christos Exp $ */ |
2 | |
3 | /* |
4 | * Copyright (c) 2007-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 | #ifndef _RUMP_RUMP_H_ |
29 | #define _RUMP_RUMP_H_ |
30 | |
31 | /* |
32 | * NOTE: do not #include anything from <sys> here. Otherwise this |
33 | * has no chance of working on non-NetBSD platforms. |
34 | */ |
35 | |
36 | struct mount; |
37 | struct vnode; |
38 | struct vattr; |
39 | struct componentname; |
40 | struct vfsops; |
41 | struct fid; |
42 | struct statvfs; |
43 | struct stat; |
44 | struct kauth_cred; |
45 | struct lwp; |
46 | struct modinfo; |
47 | struct uio; |
48 | |
49 | #if !defined(RUMP_REGISTER_T) |
50 | # define RUMP_REGISTER_T long |
51 | # if !defined(_KERNEL) && !defined(_KMEMUSER) && \ |
52 | !defined(_KERNTYPES) && !defined(_STANDALONE) |
53 | typedef RUMP_REGISTER_T register_t; |
54 | # endif |
55 | #endif |
56 | |
57 | #include <rump/rumpdefs.h> |
58 | |
59 | /* rumpkern */ |
60 | enum rump_uiorw { RUMPUIO_READ, RUMPUIO_WRITE }; |
61 | |
62 | enum rump_sigmodel { |
63 | RUMP_SIGMODEL_PANIC, |
64 | RUMP_SIGMODEL_IGNORE, |
65 | RUMP_SIGMODEL__HOST_NOTANYMORE, |
66 | RUMP_SIGMODEL_RAISE, |
67 | RUMP_SIGMODEL_RECORD |
68 | }; |
69 | |
70 | /* flags to rump_lwproc_rfork */ |
71 | #define RUMP_RFFDG 0x01 |
72 | #define RUMP_RFCFDG 0x02 |
73 | /* slightly-easier-to-parse aliases for the above */ |
74 | #define RUMP_RFFD_SHARE 0x00 /* lossage */ |
75 | #define RUMP_RFFD_COPY RUMP_RFFDG |
76 | #define RUMP_RFFD_CLEAR RUMP_RFCFDG |
77 | |
78 | /* rumpvfs */ |
79 | #define RUMPCN_FREECRED 0x02 |
80 | #define RUMP_ETFS_SIZE_ENDOFF ((uint64_t)-1) |
81 | enum rump_etfs_type { |
82 | RUMP_ETFS_REG, |
83 | RUMP_ETFS_BLK, |
84 | RUMP_ETFS_CHR, |
85 | RUMP_ETFS_DIR, /* only the registered directory */ |
86 | RUMP_ETFS_DIR_SUBDIRS /* dir + subdirectories (recursive) */ |
87 | }; |
88 | |
89 | /* um, what's the point ?-) */ |
90 | #ifdef _BEGIN_DECLS |
91 | _BEGIN_DECLS |
92 | #endif |
93 | |
94 | int rump_getversion(void); |
95 | int rump_pub_getversion(void); /* compat */ |
96 | int rump_nativeabi_p(void); |
97 | |
98 | int rump_boot_gethowto(void); |
99 | void rump_boot_sethowto(int); |
100 | void rump_boot_setsigmodel(enum rump_sigmodel); |
101 | |
102 | struct rump_boot_etfs { |
103 | /* client initializes */ |
104 | const char *eb_key; |
105 | const char *eb_hostpath; |
106 | enum rump_etfs_type eb_type; |
107 | uint64_t eb_begin; |
108 | uint64_t eb_size; |
109 | |
110 | /* rump kernel initializes */ |
111 | struct rump_boot_etfs *_eb_next; |
112 | int eb_status; |
113 | }; |
114 | void rump_boot_etfs_register(struct rump_boot_etfs *); |
115 | |
116 | void rump_schedule(void); |
117 | void rump_unschedule(void); |
118 | |
119 | void rump_printevcnts(void); |
120 | |
121 | int rump_daemonize_begin(void); |
122 | int rump_init(void); |
123 | int rump_init_server(const char *); |
124 | int rump_daemonize_done(int); |
125 | #define RUMP_DAEMONIZE_SUCCESS 0 |
126 | |
127 | #ifndef _KERNEL |
128 | #include <rump/rumpkern_if_pub.h> |
129 | #include <rump/rumpvfs_if_pub.h> |
130 | #include <rump/rumpnet_if_pub.h> |
131 | #endif |
132 | |
133 | #ifdef _END_DECLS |
134 | _END_DECLS |
135 | #endif |
136 | |
137 | /* |
138 | * Include macros prehistorically provided by this header. |
139 | * The inclusion might go away some year. Include the header directly |
140 | * if you want it to keep working for you. |
141 | */ |
142 | #include <rump/rump_syscallshotgun.h> |
143 | |
144 | #endif /* _RUMP_RUMP_H_ */ |
145 | |