X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=util-vserver%2Flib%2Fvserver.h;h=283897acd317c0c662f26759adf5c6fdb97ec986;hb=ca07a4105556eae7e370fd619d4c8463d6214996;hp=e476f4d71c9c66849e729ff2dab833d6df7d618d;hpb=9cde6b2e1f86d390b0730cb5339eb4920d631886;p=util-vserver.git diff --git a/util-vserver/lib/vserver.h b/util-vserver/lib/vserver.h index e476f4d..283897a 100644 --- a/util-vserver/lib/vserver.h +++ b/util-vserver/lib/vserver.h @@ -23,7 +23,69 @@ #include #include -#define VC_NOCTX ((ctx_t)(-1)) +#ifndef VC_NOCTX +# define VC_NOCTX ((ctx_t)(-1)) +#endif + +#ifndef S_CTX_INFO_LOCK +# define S_CTX_INFO_LOCK 1 +#endif + +#ifndef S_CTX_INFO_SCHED +# define S_CTX_INFO_SCHED 2 +#endif + +#ifndef S_CTX_INFO_NPROC +# define S_CTX_INFO_NPROC 4 +#endif + +#ifndef S_CTX_INFO_PRIVATE +# define S_CTX_INFO_PRIVATE 8 +#endif + +#ifndef S_CTX_INFO_INIT +# define S_CTX_INFO_INIT 16 +#endif + +#ifndef S_CTX_INFO_HIDEINFO +# define S_CTX_INFO_HIDEINFO 32 +#endif + +#ifndef S_CTX_INFO_ULIMIT +# define S_CTX_INFO_ULIMIT 64 +#endif + +#define VC_CAP_CHOWN 0 +#define VC_CAP_DAC_OVERRIDE 1 +#define VC_CAP_DAC_READ_SEARCH 2 +#define VC_CAP_FOWNER 3 +#define VC_CAP_FSETID 4 +#define VC_CAP_KILL 5 +#define VC_CAP_SETGID 6 +#define VC_CAP_SETUID 7 +#define VC_CAP_SETPCAP 8 +#define VC_CAP_LINUX_IMMUTABLE 9 +#define VC_CAP_NET_BIND_SERVICE 10 +#define VC_CAP_NET_BROADCAST 11 +#define VC_CAP_NET_ADMIN 12 +#define VC_CAP_NET_RAW 13 +#define VC_CAP_IPC_LOCK 14 +#define VC_CAP_IPC_OWNER 15 +#define VC_CAP_SYS_MODULE 16 +#define VC_CAP_SYS_RAWIO 17 +#define VC_CAP_SYS_CHROOT 18 +#define VC_CAP_SYS_PTRACE 19 +#define VC_CAP_SYS_PACCT 20 +#define VC_CAP_SYS_ADMIN 21 +#define VC_CAP_SYS_BOOT 22 +#define VC_CAP_SYS_NICE 23 +#define VC_CAP_SYS_RESOURCE 24 +#define VC_CAP_SYS_TIME 25 +#define VC_CAP_SYS_TTY_CONFIG 26 +#define VC_CAP_MKNOD 27 +#define VC_CAP_LEASE 28 +#define VC_CAP_QUOTACTL 29 + #ifdef __cplusplus extern "C" { @@ -52,12 +114,34 @@ extern "C" { int vc_chrootsafe(char const *dir); - /** Returns the context of the given process. */ + /** Returns the context of the given process. pid==0 means the current process. */ ctx_t vc_X_getctx(pid_t pid); - /** Returns the context of the current process. */ -#define vc_X_getcctx (getctx(getpid())) - + /** Returns the pid of the 'init' process */ + pid_t vc_X_getinitpid(pid_t pid); + + + int vc_text2cap(char const *); + char const * vc_cap2text(int); + + + // The management part + +#define VC_LIMIT_VSERVER_NAME_LEN 1024 + + typedef enum { vcCFG_NONE, vcCFG_AUTO, + vcCFG_LEGACY, + vcCFG_RECENT_SHORT, + vcCFG_RECENT_FULL } vcCfgStyle; + + vcCfgStyle vc_getVserverCfgStyle(char const *id); + + // Resolves the name of the vserver. The result will be allocated and must + // be freed by the caller + char * vc_getVserverName(char const *id, vcCfgStyle style); + + char * vc_getVserverVdir(char const *id, vcCfgStyle style); + #ifdef __cplusplus } #endif