X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=util-vserver%2Flib%2Fvserver.h;h=65798e76d22e986b0b85616a6cb255b2e115bce7;hb=2c35446314f8bcfb383b435e6a2a5d0919d627a9;hp=46c2b1a638747c2e198811010a2b38a5eb31f6cd;hpb=141fdc407352b5fddffc9be77128e374c38a8454;p=util-vserver.git diff --git a/util-vserver/lib/vserver.h b/util-vserver/lib/vserver.h index 46c2b1a..65798e7 100644 --- a/util-vserver/lib/vserver.h +++ b/util-vserver/lib/vserver.h @@ -21,6 +21,11 @@ #include #include +#include + +#define VC_NOCTX ((ctx_t)(-1)) +#define VC_LIM_INFINITY (~0ULL) +#define VC_LIM_KEEP (~1ULL) #ifdef __cplusplus extern "C" { @@ -31,11 +36,48 @@ extern "C" { uint32_t mask; }; - int vc_get_version(int cat); + /** 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); + + /* rlimit related functions */ + typedef uint64_t vc_limit_t; + + + struct vc_rlimit + { + vc_limit_t min; + vc_limit_t soft; + vc_limit_t hard; + }; + + struct vc_rlimit_mask { + uint32_t min; + uint32_t soft; + uint32_t hard; + }; + + int vc_get_rlimit(ctx_t ctx, int resource, struct vc_rlimit *lim); + int vc_set_rlimit(ctx_t ctx, int resource, struct vc_rlimit const *lim); + int vc_get_rlimit_mask(ctx_t ctx, struct vc_rlimit_mask *lim); + + /** Returns the context of the given process. pid==0 means the current process. */ + ctx_t vc_X_getctx(pid_t pid); + #ifdef __cplusplus } #endif