X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=util-vserver%2Fensc_wrappers%2Fwrappers-vserver.hc;h=ceaee9cfdfa602729c71a6048ae5ad4e270999d1;hb=842a918cb9bcdd3b1c79dd980d2f9638b0cd6742;hp=05b9ad6fac394532e65ab36bfd0576ea809fb6bd;hpb=e76977fd9cc39acebfcde91ef2d92522d58062f2;p=util-vserver.git diff --git a/util-vserver/ensc_wrappers/wrappers-vserver.hc b/util-vserver/ensc_wrappers/wrappers-vserver.hc index 05b9ad6..ceaee9c 100644 --- a/util-vserver/ensc_wrappers/wrappers-vserver.hc +++ b/util-vserver/ensc_wrappers/wrappers-vserver.hc @@ -20,8 +20,6 @@ # error wrappers_handler.hc can not be used in this way #endif -#include - inline static WRAPPER_DECL xid_t Evc_new_s_context(xid_t ctx, unsigned int remove_cap, unsigned int flags) { @@ -39,27 +37,84 @@ Evc_get_task_xid(pid_t pid) } inline static WRAPPER_DECL xid_t -Evc_create_context(xid_t xid) +Evc_ctx_create(xid_t xid) { - register xid_t res = vc_create_context(xid); - FatalErrnoError(res==VC_NOCTX, "vc_create_context()"); + register xid_t res = vc_ctx_create(xid); + FatalErrnoError(res==VC_NOCTX, "vc_ctx_create()"); return res; } inline static WRAPPER_DECL void -Evc_migrate_context(xid_t xid) +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_migrate_context(xid)==-1, "vc_migrate_context()"); + FatalErrnoError(vc_set_cflags(xid, flags)==-1, "vc_set_cflags()"); } inline static WRAPPER_DECL void -Evc_get_flags(xid_t xid, struct vc_ctx_flags *flags) +Evc_set_vhi_name(xid_t xid, vc_uts_type type, + char const *val, size_t len) { - FatalErrnoError(vc_get_flags(xid, flags)!=-1, "vc_get_flags()"); + FatalErrnoError(vc_set_vhi_name(xid,type,val,len)==-1, "vc_set_vhi_name()"); } inline static WRAPPER_DECL void -Evc_set_flags(xid_t xid, struct vc_ctx_flags const *flags) +Evc_get_ccaps(xid_t xid, struct vc_ctx_caps *caps) { - FatalErrnoError(vc_set_flags(xid, flags)!=-1, "vc_set_flags()"); + 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 void +Evc_set_namespace() +{ + FatalErrnoError(vc_set_namespace()==-1, "vc_set_namespace()"); +} + +inline static WRAPPER_DECL void +Evc_enter_namespace(xid_t xid) +{ + FatalErrnoError(vc_enter_namespace(xid)==-1, "vc_enter_namespace()"); +} + +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; }