3 // Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; version 2 of the License.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 #ifndef H_ENSC_IN_WRAPPERS_H
20 # error wrappers_handler.hc can not be used in this way
23 #if defined(VC_ENABLE_API_COMPAT) || defined(VC_ENABLE_API_LEGACY)
25 inline static WRAPPER_DECL xid_t
26 Evc_new_s_context(xid_t ctx, unsigned int remove_cap, unsigned int flags)
28 register xid_t res = vc_new_s_context(ctx,remove_cap,flags);
29 FatalErrnoError(res==VC_NOCTX, "vc_new_s_context()");
35 inline static WRAPPER_DECL xid_t
36 Evc_get_task_xid(pid_t pid)
38 register xid_t res = vc_get_task_xid(pid);
39 FatalErrnoError(res==VC_NOCTX, "vc_get_task_xid()");
43 inline static WRAPPER_DECL nid_t
44 Evc_get_task_nid(pid_t pid)
46 register nid_t res = vc_get_task_nid(pid);
47 FatalErrnoError(res==VC_NOCTX, "vc_get_task_nid()");
51 inline static WRAPPER_DECL xid_t
52 Evc_ctx_create(xid_t xid, struct vc_ctx_flags *flags)
54 register xid_t res = vc_ctx_create(xid, flags);
55 FatalErrnoError(res==VC_NOCTX, "vc_ctx_create()");
59 inline static WRAPPER_DECL nid_t
60 Evc_net_create(nid_t nid)
62 register nid_t res = vc_net_create(nid);
63 FatalErrnoError(res==VC_NOCTX, "vc_net_create()");
67 inline static WRAPPER_DECL tag_t
68 Evc_tag_create(tag_t tag)
70 register tag_t res = vc_tag_create(tag);
71 FatalErrnoError(res==VC_NOCTX, "vc_tag_create()");
75 inline static WRAPPER_DECL void
76 Evc_ctx_migrate(xid_t xid, uint_least64_t flags)
78 FatalErrnoError(vc_ctx_migrate(xid, flags)==-1, "vc_ctx_migrate()");
81 inline static WRAPPER_DECL void
82 Evc_net_migrate(nid_t nid)
84 FatalErrnoError(vc_net_migrate(nid)==-1, "vc_net_migrate()");
87 inline static WRAPPER_DECL void
88 Evc_tag_migrate(tag_t tag)
90 FatalErrnoError(vc_tag_migrate(tag)==-1, "vc_tag_migrate()");
93 inline static WRAPPER_DECL void
94 Evc_get_cflags(xid_t xid, struct vc_ctx_flags *flags)
96 FatalErrnoError(vc_get_cflags(xid, flags)==-1, "vc_get_cflags()");
99 inline static WRAPPER_DECL void
100 Evc_set_cflags(xid_t xid, struct vc_ctx_flags const *flags)
102 FatalErrnoError(vc_set_cflags(xid, flags)==-1, "vc_set_cflags()");
105 inline static WRAPPER_DECL void
106 Evc_get_nflags(nid_t nid, struct vc_net_flags *flags)
108 FatalErrnoError(vc_get_nflags(nid, flags)==-1, "vc_get_nflags()");
111 inline static WRAPPER_DECL void
112 Evc_set_nflags(nid_t nid, struct vc_net_flags const *flags)
114 FatalErrnoError(vc_set_nflags(nid, flags)==-1, "vc_set_nflags()");
117 inline static WRAPPER_DECL void
118 Evc_set_vhi_name(xid_t xid, vc_uts_type type,
119 char const *val, size_t len)
121 FatalErrnoError(vc_set_vhi_name(xid,type,val,len)==-1, "vc_set_vhi_name()");
124 inline static WRAPPER_DECL void
125 Evc_get_ccaps(xid_t xid, struct vc_ctx_caps *caps)
127 FatalErrnoError(vc_get_ccaps(xid, caps)==-1, "vc_get_ccaps()");
130 inline static WRAPPER_DECL void
131 Evc_set_ccaps(xid_t xid, struct vc_ctx_caps const *caps)
133 FatalErrnoError(vc_set_ccaps(xid, caps)==-1, "vc_set_ccaps()");
136 inline static WRAPPER_DECL void
137 Evc_get_ncaps(nid_t nid, struct vc_net_caps *caps)
139 FatalErrnoError(vc_get_ncaps(nid, caps)==-1, "vc_get_ncaps()");
142 inline static WRAPPER_DECL void
143 Evc_set_ncaps(nid_t nid, struct vc_net_caps const *caps)
145 FatalErrnoError(vc_set_ncaps(nid, caps)==-1, "vc_set_ncaps()");
148 inline static WRAPPER_DECL void
149 Evc_set_namespace(xid_t xid, uint_least64_t mask)
151 FatalErrnoError(vc_set_namespace(xid, mask)==-1, "vc_set_namespace()");
154 inline static WRAPPER_DECL void
155 Evc_enter_namespace(xid_t xid, uint_least64_t mask)
157 FatalErrnoError(vc_enter_namespace(xid, mask)==-1, "vc_enter_namespace()");
160 inline static WRAPPER_DECL xid_t
161 Evc_xidopt2xid(char const *id, bool honor_static)
164 xid_t rc = vc_xidopt2xid(id, honor_static, &err);
165 if (__builtin_expect(rc==VC_NOCTX,0)) {
166 ENSC_DETAIL1(msg, "vc_xidopt2xid", id, 1);
168 FatalErrnoErrorFail(msg);
171 size_t l1 = strlen(msg);
172 size_t l2 = strlen(err);
173 char buf[l1 + l2 + sizeof(": ")];
174 memcpy(buf, msg, l1);
175 memcpy(buf+l1, ": ", 2);
176 memcpy(buf+l1+2, err, l2+1);
178 FatalErrnoErrorFail(buf);
186 inline static WRAPPER_DECL nid_t
187 Evc_nidopt2nid(char const *id, bool honor_static)
190 nid_t rc = vc_nidopt2nid(id, honor_static, &err);
191 if (__builtin_expect(rc==VC_NOCTX,0)) {
192 ENSC_DETAIL1(msg, "vc_nidopt2nid", id, 1);
193 FatalErrnoErrorFail(msg);
198 inline static WRAPPER_DECL tag_t
199 Evc_tagopt2tag(char const *id, bool honor_static)
202 tag_t rc = vc_tagopt2tag(id, honor_static, &err);
203 if (__builtin_expect(rc==VC_NOCTX,0)) {
204 ENSC_DETAIL1(msg, "vc_tagopt2tag", id, 1);
205 FatalErrnoErrorFail(msg);