- fixed some statements which would fail with 'set -e'
[util-vserver.git] / util-vserver / lib / vserver.h
index ebad12c..283897a 100644 (file)
 #  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" {
@@ -83,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()         (vc_X_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