X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=util-vserver%2Flib%2Fvserver.h;h=e776f09b4cab441fa73862d9d424329100fddef8;hb=1bce9c9ec082cbbacd7132a3b92d6898973c2f53;hp=5485446f1b1155ba5e818202fb6e991ba546ddde;hpb=da691fd4bad5e187b307b7fd86bf5fd61e47c3fc;p=util-vserver.git diff --git a/util-vserver/lib/vserver.h b/util-vserver/lib/vserver.h index 5485446..e776f09 100644 --- a/util-vserver/lib/vserver.h +++ b/util-vserver/lib/vserver.h @@ -19,19 +19,42 @@ #ifndef H_VSERVER_SYSCALL_H #define H_VSERVER_SYSCALL_H +#include +#include +#include + +#define VC_NOCTX ((ctx_t)(-1)) + #ifdef __cplusplus extern "C" { #endif -int call_new_s_context(int nbctx, int ctxs[], int remove_cap, int flags); -int call_set_ipv4root (unsigned long ip[], int nb, - unsigned long bcast, unsigned long mask[]); -int call_chrootsafe (const char *dir); -int has_chrootsafe(); -int call_set_ctxlimit (int res, long limit); + struct vc_ip_mask_pair { + uint32_t ip; + uint32_t mask; + }; + + /** Returns version of the given API-category */ + int vc_get_version(int category); + + /** Puts current process into context , removes the given caps and + * sets flags. + * Special values for ctx are + * - -2 which means the current context (just for changing caps and flags) + * - -1 which means the next free context; this value can be used by + * ordinary users also */ + int vc_new_s_context(ctx_t ctx, unsigned int remove_cap, unsigned int flags); + + /** Sets the ipv4root information. + * \precondition: nb<16 */ + int vc_set_ipv4root(uint32_t bcast, size_t nb, struct vc_ip_mask_pair const *ips); + + int vc_chrootsafe(char const *dir); -void vserver_init(); + /** Returns the context of the given process. pid==0 means the current process. */ + ctx_t vc_X_getctx(pid_t pid); + #ifdef __cplusplus } #endif