X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=util-vserver%2Fensc_wrappers%2Fwrappers-vserver.hc;h=189c61c33e2cdff5e6ab00edd0d1ff0178e17291;hb=6557b6f84f9d2dbf04eab2f72e46cd171fecece5;hp=280a1147c3c11fafb563be5e9ebcdc93a7312787;hpb=c66b2f97361761b8a87058dc7a49ab59d4520556;p=util-vserver.git diff --git a/util-vserver/ensc_wrappers/wrappers-vserver.hc b/util-vserver/ensc_wrappers/wrappers-vserver.hc index 280a114..189c61c 100644 --- a/util-vserver/ensc_wrappers/wrappers-vserver.hc +++ b/util-vserver/ensc_wrappers/wrappers-vserver.hc @@ -20,9 +20,7 @@ # error wrappers_handler.hc can not be used in this way #endif -#include - -inline static UNUSED xid_t +inline static WRAPPER_DECL xid_t Evc_new_s_context(xid_t ctx, unsigned int remove_cap, unsigned int flags) { register xid_t res = vc_new_s_context(ctx,remove_cap,flags); @@ -30,10 +28,81 @@ Evc_new_s_context(xid_t ctx, unsigned int remove_cap, unsigned int flags) return res; } -inline static UNUSED xid_t +inline static WRAPPER_DECL xid_t Evc_get_task_xid(pid_t pid) { register xid_t res = vc_get_task_xid(pid); FatalErrnoError(res==VC_NOCTX, "vc_get_task_xid()"); return res; } + +inline static WRAPPER_DECL xid_t +Evc_ctx_create(xid_t xid) +{ + register xid_t res = vc_ctx_create(xid); + FatalErrnoError(res==VC_NOCTX, "vc_ctx_create()"); + return res; +} + +inline static WRAPPER_DECL void +Evc_ctx_migrate(xid_t xid) +{ + FatalErrnoError(vc_ctx_migrate(xid)==-1, "vc_ctx_migrate()"); +} + +inline static WRAPPER_DECL void +Evc_get_cflags(xid_t xid, struct vc_ctx_flags *flags) +{ + FatalErrnoError(vc_get_cflags(xid, flags)==-1, "vc_get_cflags()"); +} + +inline static WRAPPER_DECL void +Evc_set_cflags(xid_t xid, struct vc_ctx_flags const *flags) +{ + FatalErrnoError(vc_set_cflags(xid, flags)==-1, "vc_set_cflags()"); +} + +inline static WRAPPER_DECL void +Evc_set_vhi_name(xid_t xid, vc_uts_type type, + char const *val, size_t len) +{ + FatalErrnoError(vc_set_vhi_name(xid,type,val,len)==-1, "vc_set_vhi_name()"); +} + +inline static WRAPPER_DECL void +Evc_get_ccaps(xid_t xid, struct vc_ctx_caps *caps) +{ + FatalErrnoError(vc_get_ccaps(xid, caps)==-1, "vc_get_ccaps()"); +} + +inline static WRAPPER_DECL void +Evc_set_ccaps(xid_t xid, struct vc_ctx_caps const *caps) +{ + FatalErrnoError(vc_set_ccaps(xid, caps)==-1, "vc_set_ccaps()"); +} + +inline static WRAPPER_DECL xid_t +Evc_xidopt2xid(char const *id, bool honor_static) +{ + char const * err; + xid_t rc = vc_xidopt2xid(id, honor_static, &err); + if (__builtin_expect(rc==VC_NOCTX,0)) { + ENSC_DETAIL1(msg, "vc_xidopt2xid", id, 1); +#if 1 + FatalErrnoErrorFail(msg); +#else + { + size_t l1 = strlen(msg); + size_t l2 = strlen(err); + char buf[l1 + l2 + sizeof(": ")]; + memcpy(buf, msg, l1); + memcpy(buf+l1, ": ", 2); + memcpy(buf+l1+2, err, l2+1); + + FatalErrnoErrorFail(buf); + } +#endif + } + + return rc; +}