vserver.h

Go to the documentation of this file.
00001 /* $Id: vserver.h 2501 2007-02-20 17:33:35Z dhozac $
00002 
00003 *  Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
00004 *   
00005 *  This program is free software; you can redistribute it and/or modify
00006 *  it under the terms of the GNU General Public License as published by
00007 *  the Free Software Foundation; either version 2, or (at your option)
00008 *  any later version.
00009 *   
00010 *  This program is distributed in the hope that it will be useful,
00011 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 *  GNU General Public License for more details.
00014 *   
00015 *  You should have received a copy of the GNU General Public License
00016 *  along with this program; if not, write to the Free Software
00017 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00018 */
00019 
00024 #ifndef H_VSERVER_SYSCALL_H
00025 #define H_VSERVER_SYSCALL_H
00026 
00027 #include <stdint.h>
00028 #include <stdlib.h>
00029 #include <stdbool.h>
00030 #include <sys/types.h>
00031 #include <sched.h>
00032 
00033 #ifndef IS_DOXYGEN
00034 #if defined(__GNUC__)
00035 #  define VC_ATTR_UNUSED                __attribute__((__unused__))
00036 #  define VC_ATTR_NORETURN              __attribute__((__noreturn__))
00037 #  define VC_ATTR_CONST                 __attribute__((__const__))
00038 #  define VC_ATTR_DEPRECATED            __attribute__((__deprecated__))
00039 #  if __GNUC__*0x10000 + __GNUC_MINOR__*0x100 + __GNUC_PATCHLEVEL__ >= 0x30300
00040 #    define VC_ATTR_NONNULL(ARGS)       __attribute__((__nonnull__ ARGS))
00041 #    define VC_ATTR_ALWAYSINLINE        __attribute__((__always_inline__))
00042 #  else
00043 #    define VC_ATTR_NONNULL(ARGS)
00044 #    define VC_ATTR_ALWAYSINLINE
00045 #  endif
00046 #  if __GNUC__*0x10000 + __GNUC_MINOR__*0x100 + __GNUC_PATCHLEVEL__ >= 0x30303
00047 #    define VC_ATTR_PURE                __attribute__((__pure__))
00048 #  else
00049 #    define VC_ATTR_PURE
00050 #  endif
00051 #else
00052 #  define VC_ATTR_NONNULL(ARGS)
00053 #  define VC_ATTR_UNUSED
00054 #  define VC_ATTR_NORETURN
00055 #  define VC_ATTR_ALWAYSINLINE
00056 #  define VC_ATTR_DEPRECATED
00057 #  define VC_ATTR_PURE
00058 #  define VC_ATTR_CONST
00059 #endif
00060 #endif  // IS_DOXYGEN
00061 
00063 #define VC_NOCTX                ((xid_t)(-1))
00064 #define VC_NOXID                ((xid_t)(-1))
00065 
00066 #define VC_DYNAMIC_XID          ((xid_t)(-1))
00067 
00068 #define VC_SAMECTX              ((xid_t)(-2))
00069 
00070 #define VC_NONID                ((nid_t)(-1))
00071 #define VC_DYNAMIC_NID          ((nid_t)(-1))
00072 
00073 #define VC_LIM_INFINITY         (~0ULL)
00074 #define VC_LIM_KEEP             (~1ULL)
00075 
00076 #define VC_CDLIM_UNSET          (0U)
00077 #define VC_CDLIM_INFINITY       (~0U)
00078 #define VC_CDLIM_KEEP           (~1U)
00079   
00080 #ifndef S_CTX_INFO_LOCK
00081 #  define S_CTX_INFO_LOCK       1
00082 #endif
00083 
00084 #ifndef S_CTX_INFO_SCHED
00085 #  define S_CTX_INFO_SCHED      2
00086 #endif
00087 
00088 #ifndef S_CTX_INFO_NPROC
00089 #  define S_CTX_INFO_NPROC      4
00090 #endif
00091 
00092 #ifndef S_CTX_INFO_PRIVATE
00093 #  define S_CTX_INFO_PRIVATE    8
00094 #endif
00095 
00096 #ifndef S_CTX_INFO_INIT
00097 #  define S_CTX_INFO_INIT       16
00098 #endif
00099 
00100 #ifndef S_CTX_INFO_HIDEINFO
00101 #  define S_CTX_INFO_HIDEINFO   32
00102 #endif
00103 
00104 #ifndef S_CTX_INFO_ULIMIT
00105 #  define S_CTX_INFO_ULIMIT     64
00106 #endif
00107 
00108 #ifndef S_CTX_INFO_NAMESPACE
00109 #  define S_CTX_INFO_NAMESPACE  128
00110 #endif
00111 
00112 #define VC_CAP_CHOWN                     0
00113 #define VC_CAP_DAC_OVERRIDE              1
00114 #define VC_CAP_DAC_READ_SEARCH           2
00115 #define VC_CAP_FOWNER                    3
00116 #define VC_CAP_FSETID                    4
00117 #define VC_CAP_KILL                      5
00118 #define VC_CAP_SETGID                    6
00119 #define VC_CAP_SETUID                    7
00120 #define VC_CAP_SETPCAP                   8
00121 #define VC_CAP_LINUX_IMMUTABLE           9
00122 #define VC_CAP_NET_BIND_SERVICE         10
00123 #define VC_CAP_NET_BROADCAST            11
00124 #define VC_CAP_NET_ADMIN                12
00125 #define VC_CAP_NET_RAW                  13
00126 #define VC_CAP_IPC_LOCK                 14
00127 #define VC_CAP_IPC_OWNER                15
00128 #define VC_CAP_SYS_MODULE               16
00129 #define VC_CAP_SYS_RAWIO                17
00130 #define VC_CAP_SYS_CHROOT               18
00131 #define VC_CAP_SYS_PTRACE               19
00132 #define VC_CAP_SYS_PACCT                20
00133 #define VC_CAP_SYS_ADMIN                21
00134 #define VC_CAP_SYS_BOOT                 22
00135 #define VC_CAP_SYS_NICE                 23
00136 #define VC_CAP_SYS_RESOURCE             24
00137 #define VC_CAP_SYS_TIME                 25
00138 #define VC_CAP_SYS_TTY_CONFIG           26
00139 #define VC_CAP_MKNOD                    27
00140 #define VC_CAP_LEASE                    28
00141 #define VC_CAP_AUDIT_WRITE              29
00142 #define VC_CAP_AUDIT_CONTROL            30
00143 
00144 #define VC_IMMUTABLE_FILE_FL            0x0000010lu
00145 #define VC_IMMUTABLE_LINK_FL            0x0008000lu
00146 #define VC_IMMUTABLE_ALL                (VC_IMMUTABLE_LINK_FL|VC_IMMUTABLE_FILE_FL)
00147 
00148 #define VC_IATTR_XID                    0x01000000u
00149 
00150 #define VC_IATTR_ADMIN                  0x00000001u
00151 #define VC_IATTR_WATCH                  0x00000002u
00152 #define VC_IATTR_HIDE                   0x00000004u
00153 #define VC_IATTR_FLAGS                  0x00000007u
00154 
00155 #define VC_IATTR_BARRIER                0x00010000u
00156 #define VC_IATTR_IUNLINK                0x00020000u
00157 #define VC_IATTR_IMMUTABLE              0x00040000u
00158 
00159 
00160 // the flags
00161 #define VC_VXF_INFO_LOCK                0x00000001ull
00162 #define VC_VXF_INFO_NPROC               0x00000004ull
00163 #define VC_VXF_INFO_PRIVATE             0x00000008ull
00164 #define VC_VXF_INFO_INIT                0x00000010ull
00165 
00166 #define VC_VXF_INFO_HIDEINFO            0x00000020ull
00167 #define VC_VXF_INFO_ULIMIT              0x00000040ull
00168 #define VC_VXF_INFO_NAMESPACE           0x00000080ull
00169 
00170 #define VC_VXF_SCHED_HARD               0x00000100ull
00171 #define VC_VXF_SCHED_PRIO               0x00000200ull
00172 #define VC_VXF_SCHED_PAUSE              0x00000400ull
00173 
00174 #define VC_VXF_VIRT_MEM                 0x00010000ull
00175 #define VC_VXF_VIRT_UPTIME              0x00020000ull
00176 #define VC_VXF_VIRT_CPU                 0x00040000ull
00177 #define VC_VXF_VIRT_LOAD                0x00080000ull
00178 #define VC_VXF_VIRT_TIME                0x00100000ull
00179 
00180 #define VC_VXF_HIDE_MOUNT               0x01000000ull
00181 #define VC_VXF_HIDE_NETIF               0x02000000ull
00182 #define VC_VXF_HIDE_VINFO               0x04000000ull
00183 
00184 #define VC_VXF_STATE_SETUP              (1ULL<<32)
00185 #define VC_VXF_STATE_INIT               (1ULL<<33)
00186 #define VC_VXF_STATE_ADMIN              (1ULL<<34)
00187 
00188 #define VC_VXF_SC_HELPER                (1ULL<<36)
00189 #define VC_VXF_REBOOT_KILL              (1ULL<<37)
00190 #define VC_VXF_PERSISTENT               (1ULL<<38)
00191 
00192 #define VC_VXF_FORK_RSS                 (1ULL<<48)
00193 #define VC_VXF_PROLIFIC                 (1ULL<<49)
00194 
00195 #define VC_VXF_IGNEG_NICE               (1ULL<<52)
00196 
00197 
00198 // the ccapabilities
00199 #define VC_VXC_SET_UTSNAME              0x00000001ull
00200 #define VC_VXC_SET_RLIMIT               0x00000002ull
00201 
00202 #define VC_VXC_RAW_ICMP                 0x00000100ull
00203 #define VC_VXC_SYSLOG                   0x00001000ull
00204 
00205 #define VC_VXC_SECURE_MOUNT             0x00010000ull
00206 #define VC_VXC_SECURE_REMOUNT           0x00020000ull
00207 #define VC_VXC_BINARY_MOUNT             0x00040000ull
00208 
00209 #define VC_VXC_QUOTA_CTL                0x00100000ull
00210 #define VC_VXC_ADMIN_MAPPER             0x00200000ull
00211 #define VC_VXC_ADMIN_CLOOP              0x00400000ull
00212 
00213 
00214 // the scheduler flags
00215 #define VC_VXSM_FILL_RATE               0x0001
00216 #define VC_VXSM_INTERVAL                0x0002
00217 #define VC_VXSM_FILL_RATE2              0x0004
00218 #define VC_VXSM_INTERVAL2               0x0008
00219 #define VC_VXSM_TOKENS                  0x0010
00220 #define VC_VXSM_TOKENS_MIN              0x0020
00221 #define VC_VXSM_TOKENS_MAX              0x0040
00222 #define VC_VXSM_PRIO_BIAS               0x0100
00223 #define VC_VXSM_CPU_ID                  0x1000
00224 #define VC_VXSM_BUCKET_ID               0x2000
00225 
00226 #define VC_VXSM_IDLE_TIME               0x0200
00227 #define VC_VXSM_FORCE                   0x0400
00228 #define VC_VXSM_MSEC                    0x4000
00229 
00230 #define VC_VXSM_V3_MASK                 0x0173
00231 
00232 
00233 // the network flags
00234 #define VC_NXF_INFO_LOCK                0x00000001ull
00235 #define VC_NXF_INFO_PRIVATE             0x00000008ull
00236 
00237 #define VC_NXF_SINGLE_IP                0x00000100ull
00238 
00239 #define VC_NXF_HIDE_NETIF               0x02000000ull
00240 
00241 #define VC_NXF_STATE_SETUP              (1ULL<<32)
00242 #define VC_NXF_STATE_ADMIN              (1ULL<<34)
00243 
00244 #define VC_NXF_SC_HELPER                (1ULL<<36)
00245 #define VC_NXF_PERSISTENT               (1ULL<<38)
00246 
00247 
00248 // the vserver specific limits
00249 #define VC_VLIMIT_NSOCK                 16
00250 #define VC_VLIMIT_OPENFD                17
00251 #define VC_VLIMIT_ANON                  18
00252 #define VC_VLIMIT_SHMEM                 19
00253 #define VC_VLIMIT_SEMARY                20
00254 #define VC_VLIMIT_NSEMS                 21
00255 #define VC_VLIMIT_DENTRY                22
00256 #define VC_VLIMIT_MAPPED                23
00257 
00258 
00259 // the VCI bit values
00260 #define VC_VCI_NO_DYNAMIC               (1 << 0)
00261 #define VC_VCI_SPACES                   (1 << 10)
00262 
00263 
00264 // the device mapping flags
00265 #define VC_DATTR_CREATE                 0x00000001
00266 #define VC_DATTR_OPEN                   0x00000002
00267 
00268 #define VC_DATTR_REMAP                  0x00000010
00269 
00270 
00271 // the process context migration flags
00272 #define VC_VXM_SET_INIT                 0x00000001
00273 #define VC_VXM_SET_REAPER               0x00000002
00274 
00275 
00276 #ifndef CLONE_NEWNS
00277 #  define CLONE_NEWNS                   0x00020000
00278 #endif
00279 #ifndef CLONE_NEWUTS
00280 #  define CLONE_NEWUTS                  0x04000000
00281 #endif
00282 #ifndef CLONE_NEWIPC
00283 #  define CLONE_NEWIPC                  0x08000000
00284 #endif
00285 
00286 
00287 
00288 #define VC_BAD_PERSONALITY              ((uint_least32_t)(-1))
00289 
00290 
00300 #ifdef IS_DOXYGEN
00301 typedef an_unsigned_integer_type        xid_t;
00302 typedef an_unsigned_integer_type        nid_t;
00303 #endif
00304 
00305 #ifdef __cplusplus
00306 extern "C" {
00307 #endif
00308 
00321   int           vc_syscall(uint32_t cmd, xid_t xid, void *data);
00322 
00327   int           vc_get_version();
00328 
00333   int           vc_get_vci();
00334 
00352   xid_t         vc_new_s_context(xid_t ctx, unsigned int remove_cap, unsigned int flags);
00353 
00354   struct vc_ip_mask_pair {
00355       uint32_t  ip;
00356       uint32_t  mask;
00357   };
00358 
00362   int           vc_set_ipv4root(uint32_t  bcast, size_t nb,
00363                         struct vc_ip_mask_pair const *ips) VC_ATTR_NONNULL((3));
00364 
00371   size_t        vc_get_nb_ipv4root() VC_ATTR_CONST VC_ATTR_PURE;
00372 
00373     /* process context */
00376   struct  vc_ctx_flags {
00378       uint_least64_t    flagword;
00382       uint_least64_t    mask;
00383   };
00384 
00396   xid_t         vc_ctx_create(xid_t xid);
00397 
00404   int           vc_ctx_migrate(xid_t xid, uint_least64_t flags);
00405 
00407   struct vc_ctx_stat {
00408       uint_least32_t    usecnt; 
00409       uint_least32_t    tasks;  
00410   };
00411 
00419   int           vc_ctx_stat(xid_t xid, struct vc_ctx_stat /*@out@*/ *stat) VC_ATTR_NONNULL((2));
00420 
00422   struct vc_virt_stat {
00423       uint_least64_t    offset;
00424       uint_least64_t    uptime;
00425       uint_least32_t    nr_threads;
00426       uint_least32_t    nr_running;
00427       uint_least32_t    nr_uninterruptible;
00428       uint_least32_t    nr_onhold;
00429       uint_least32_t    nr_forks;
00430       uint_least32_t    load[3];
00431   };
00432 
00440   int           vc_virt_stat(xid_t xid, struct vc_virt_stat /*@out@*/ *stat) VC_ATTR_NONNULL((2));
00441 
00448   int           vc_ctx_kill(xid_t ctx, pid_t pid, int sig);
00449  
00450   int           vc_get_cflags(xid_t xid, struct vc_ctx_flags /*@out@*/ *)       VC_ATTR_NONNULL((2));
00451   int           vc_set_cflags(xid_t xid, struct vc_ctx_flags /*@in@*/ const *)  VC_ATTR_NONNULL((2));
00452 
00454   struct  vc_ctx_caps {
00456       uint_least64_t    bcaps;
00460       uint_least64_t    bmask;
00462       uint_least64_t    ccaps;
00466       uint_least64_t    cmask;
00467   };
00468 
00469   int           vc_get_ccaps(xid_t xid, struct vc_ctx_caps *);
00470   int           vc_set_ccaps(xid_t xid, struct vc_ctx_caps const *);
00471 
00472   struct vc_vx_info {
00473       xid_t     xid;
00474       pid_t     initpid;
00475   };
00476 
00477   int           vc_get_vx_info(xid_t xid, struct vc_vx_info *info) VC_ATTR_NONNULL((2));
00478   
00486   xid_t         vc_get_task_xid(pid_t pid);
00487 
00491   int           vc_wait_exit(xid_t xid);
00492   
00493     /* rlimit related functions */
00494   
00504   typedef uint_least64_t        vc_limit_t;
00505 
00507   struct  vc_rlimit_mask {
00508       uint_least32_t    min;    
00509       uint_least32_t    soft;   
00510       uint_least32_t    hard;   
00511   };
00512 
00514   int           vc_get_rlimit_mask(xid_t xid,
00515                            struct vc_rlimit_mask /*@out@*/ *lim) VC_ATTR_NONNULL((2));
00516 
00520   struct vc_rlimit {
00521       vc_limit_t        min;    
00522       vc_limit_t        soft;   
00523       vc_limit_t        hard;   
00524   };
00525 
00534   int           vc_get_rlimit(xid_t xid, int resource,
00535                       struct vc_rlimit       /*@out@*/ *lim) VC_ATTR_NONNULL((3));
00544   int           vc_set_rlimit(xid_t xid, int resource,
00545                       struct vc_rlimit const /*@in@*/  *lim) VC_ATTR_NONNULL((3));
00546 
00548   struct  vc_rlimit_stat {
00549       uint_least32_t    hits;    
00550       vc_limit_t        value;   
00551       vc_limit_t        minimum; 
00552       vc_limit_t        maximum; 
00553   };
00554 
00563   int           vc_rlimit_stat(xid_t xid, int resource,
00564                        struct vc_rlimit_stat /*@out@*/ *stat) VC_ATTR_NONNULL((3));
00565 
00572   int           vc_reset_minmax(xid_t xid);
00573 
00593   bool          vc_parseLimit(char const /*@in@*/ *str, vc_limit_t /*@out@*/ *res)      VC_ATTR_NONNULL((1,2));
00594 
00595 
00596     /* network context */
00597   struct vc_nx_info {
00598       nid_t     nid;
00599   };
00600 
00601   nid_t         vc_get_task_nid(pid_t pid);
00602   int           vc_get_nx_info(nid_t nid, struct vc_nx_info *) VC_ATTR_NONNULL((2));
00603 
00604   typedef enum { vcNET_IPV4=1,      vcNET_IPV6=2,
00605                  vcNET_IPV4B=0x101, vcNET_IPV6B=0x102,
00606                  vcNET_ANY=~0 }         vc_net_nx_type;
00607 
00608   struct vc_net_nx {
00609       vc_net_nx_type    type;
00610       size_t            count;
00611       uint32_t          ip[4];
00612       uint32_t          mask[4];
00613   };
00614 
00615   struct vc_net_flags {
00616       uint_least64_t    flagword;
00617       uint_least64_t    mask;
00618   };
00619 
00620   nid_t         vc_net_create(nid_t nid);
00621   int           vc_net_migrate(nid_t nid);
00622 
00623   int           vc_net_add(nid_t nid, struct vc_net_nx const *info);
00624   int           vc_net_remove(nid_t nid, struct vc_net_nx const *info);
00625 
00626   int           vc_get_nflags(nid_t, struct vc_net_flags *);
00627   int           vc_set_nflags(nid_t, struct vc_net_flags const *);
00628 
00629   struct vc_net_caps {
00630       uint_least64_t    ncaps;
00631       uint_least64_t    cmask;
00632   };
00633 
00634   int           vc_get_ncaps(nid_t, struct vc_net_caps *);
00635   int           vc_set_ncaps(nid_t, struct vc_net_caps const *);
00636 
00637 
00638     /* iattr related functions */
00639 
00640   int           vc_set_iattr(char const *filename, xid_t xid,
00641                              uint_least32_t flags, uint_least32_t mask) VC_ATTR_NONNULL((1));
00642 
00669   int           vc_get_iattr(char const *filename, xid_t * /*@null@*/ xid,
00670                              uint_least32_t * /*@null@*/ flags,
00671                              uint_least32_t * /*@null@*/ mask) VC_ATTR_NONNULL((1));
00672   
00686   xid_t         vc_getfilecontext(char const *filename) VC_ATTR_NONNULL((1));
00687 
00688 
00689     /* vhi related functions */
00690   typedef enum { vcVHI_CONTEXT, vcVHI_SYSNAME, vcVHI_NODENAME,
00691                  vcVHI_RELEASE, vcVHI_VERSION, vcVHI_MACHINE,
00692                  vcVHI_DOMAINNAME }             vc_uts_type;
00693   
00694   int           vc_set_vhi_name(xid_t xid, vc_uts_type type,
00695                                 char const *val, size_t len) VC_ATTR_NONNULL((3));
00696   int           vc_get_vhi_name(xid_t xid, vc_uts_type type,
00697                                 char *val, size_t len)       VC_ATTR_NONNULL((3));
00698 
00699     /* namespace related functions */
00700   int           vc_enter_namespace(xid_t xid, uint_least64_t mask);
00701   int           vc_set_namespace(xid_t xid, uint_least64_t mask);
00702   int           vc_cleanup_namespace();
00703   uint_least64_t vc_get_space_mask();
00704 
00705 
00706     /* disk limit related things */
00707   struct vc_ctx_dlimit {
00708       uint_least32_t    space_used;
00709       uint_least32_t    space_total;
00710       uint_least32_t    inodes_used;
00711       uint_least32_t    inodes_total;
00712       uint_least32_t    reserved;
00713   };
00714   
00715 
00717   int           vc_add_dlimit(char const *filename, xid_t xid,
00718                               uint_least32_t flags) VC_ATTR_NONNULL((1));
00720   int           vc_rem_dlimit(char const *filename, xid_t xid,
00721                               uint_least32_t flags) VC_ATTR_NONNULL((1));
00722 
00724   int           vc_set_dlimit(char const *filename, xid_t xid,
00725                               uint_least32_t flags,
00726                               struct vc_ctx_dlimit const *limits) VC_ATTR_NONNULL((1,4));
00728   int           vc_get_dlimit(char const *filename, xid_t xid,
00729                               uint_least32_t flags,
00730                               struct vc_ctx_dlimit *limits) VC_ATTR_NONNULL((1));
00731 
00732     /* scheduler related syscalls */
00733   struct vc_set_sched {
00734       uint_least32_t    set_mask;
00735       int_least32_t     fill_rate;
00736       int_least32_t     interval;
00737       int_least32_t     fill_rate2;
00738       int_least32_t     interval2;
00739       int_least32_t     tokens;
00740       int_least32_t     tokens_min;
00741       int_least32_t     tokens_max;
00742       int_least32_t     priority_bias;
00743       int_least32_t     cpu_id;
00744       int_least32_t     bucket_id;
00745   };
00746 
00747   int           vc_set_sched(xid_t xid, struct vc_set_sched const *) VC_ATTR_NONNULL((2));
00748 
00749   struct vc_sched_info {
00750       int_least32_t     cpu_id;
00751       int_least32_t     bucket_id;
00752       uint_least64_t    user_msec;
00753       uint_least64_t    sys_msec;
00754       uint_least64_t    hold_msec;
00755       uint_least32_t    token_usec;
00756       int_least32_t     vavavoom;
00757   };
00758 
00759   int           vc_sched_info(xid_t xid, struct vc_sched_info *info) VC_ATTR_NONNULL((2));
00760 
00761     /* misc. syscalls */
00762   int           vc_set_mapping(xid_t xid, const char *device, const char *target, uint32_t flags);
00763 
00764 
00768   struct vc_err_listparser {
00769       char const        *ptr;           
00770       size_t            len;            
00771   };
00772 
00783   uint_least64_t        vc_text2bcap(char const *str, size_t len);
00784 
00799   char const *  vc_lobcap2text(uint_least64_t *val) VC_ATTR_NONNULL((1));
00800 
00828   int                   vc_list2bcap(char const *str, size_t len,
00829                                      struct vc_err_listparser *err,
00830                                      struct vc_ctx_caps *cap) VC_ATTR_NONNULL((1,4));
00831 
00832   uint_least64_t        vc_text2ccap(char const *, size_t len);
00833   char const *          vc_loccap2text(uint_least64_t *);
00834   int                   vc_list2ccap(char const *, size_t len,
00835                                      struct vc_err_listparser *err,
00836                                      struct vc_ctx_caps *);
00837 
00838   int                   vc_list2cflag(char const *, size_t len,
00839                                      struct vc_err_listparser *err,
00840                                      struct vc_ctx_flags *flags);
00841   uint_least64_t        vc_text2cflag(char const *, size_t len);
00842   char const *          vc_locflag2text(uint_least64_t *);
00843   
00844   uint_least32_t        vc_list2cflag_compat(char const *, size_t len,
00845                                             struct vc_err_listparser *err);
00846   uint_least32_t        vc_text2cflag_compat(char const *, size_t len);
00847   char const *          vc_hicflag2text_compat(uint_least32_t);
00848 
00849   int                   vc_text2cap(char const *);
00850   char const *          vc_cap2text(unsigned int);
00851 
00852   
00853   int                   vc_list2nflag(char const *, size_t len,
00854                                      struct vc_err_listparser *err,
00855                                      struct vc_net_flags *flags);
00856   uint_least64_t        vc_text2nflag(char const *, size_t len);
00857   char const *          vc_lonflag2text(uint_least64_t *);
00858 
00859   uint_least64_t        vc_text2ncap(char const *, size_t len);
00860   char const *          vc_loncap2text(uint_least64_t *);
00861   int                   vc_list2ncap(char const *, size_t len,
00862                                      struct vc_err_listparser *err,
00863                                      struct vc_net_caps *);
00864 
00865   uint_least64_t                vc_get_insecurebcaps() VC_ATTR_CONST;
00866   inline static uint_least64_t  vc_get_insecureccaps() {
00867     return ~(VC_VXC_SET_UTSNAME|VC_VXC_RAW_ICMP);
00868   }
00869   
00870   inline static int     vc_setfilecontext(char const *filename, xid_t xid) {
00871     return vc_set_iattr(filename, xid, 0, VC_IATTR_XID);
00872   }
00873 
00874 
00875   uint_least32_t        vc_text2personalityflag(char const *str,
00876                                                 size_t len) VC_ATTR_NONNULL((1));
00877 
00878   char const *          vc_lopersonality2text(uint_least32_t *) VC_ATTR_NONNULL((1));
00879   
00880   int                   vc_list2personalityflag(char const /*@in@*/ *,
00881                                                 size_t len,
00882                                                 uint_least32_t /*@out@*/ *personality,
00883                                                 struct vc_err_listparser /*@out@*/ *err) VC_ATTR_NONNULL((1,3));
00884 
00885   uint_least32_t        vc_str2personalitytype(char const /*@in@*/*,
00886                                                size_t len) VC_ATTR_NONNULL((1));
00887 
00888     
00889   typedef enum { vcFEATURE_VKILL,  vcFEATURE_IATTR,   vcFEATURE_RLIMIT,
00890                  vcFEATURE_COMPAT, vcFEATURE_MIGRATE, vcFEATURE_NAMESPACE,
00891                  vcFEATURE_SCHED,  vcFEATURE_VINFO,   vcFEATURE_VHI,
00892                  vcFEATURE_VSHELPER0, vcFEATURE_VSHELPER, vcFEATURE_VWAIT,
00893                  vcFEATURE_VNET, vcFEATURE_VSTAT }
00894     vcFeatureSet;
00895 
00896   bool          vc_isSupported(vcFeatureSet) VC_ATTR_CONST;
00897   bool          vc_isSupportedString(char const *);
00898 
00899   
00900   typedef enum { vcTYPE_INVALID, vcTYPE_MAIN, vcTYPE_WATCH,
00901                  vcTYPE_STATIC, vcTYPE_DYNAMIC }
00902     vcXidType;
00903   
00904   vcXidType     vc_getXIDType(xid_t xid) VC_ATTR_CONST;
00905 
00907   bool          vc_is_dynamic_xid(xid_t xid);
00908 
00909 
00910   /* The management part */
00911 
00912 #define VC_LIMIT_VSERVER_NAME_LEN       1024
00913   
00914   typedef enum { vcCFG_NONE, vcCFG_AUTO,
00915                  vcCFG_LEGACY,
00916                  vcCFG_RECENT_SHORT,
00917                  vcCFG_RECENT_FULL }            vcCfgStyle;
00918 
00919 
00921   xid_t         vc_xidopt2xid(char const *, bool honor_static, char const **err_info);
00923   nid_t         vc_nidopt2nid(char const *, bool honor_static, char const **err_info);
00924 
00925   vcCfgStyle    vc_getVserverCfgStyle(char const *id);
00926   
00929   char *        vc_getVserverName(char const *id, vcCfgStyle style);
00930 
00935   char *        vc_getVserverCfgDir(char const *id, vcCfgStyle style);
00936 
00940   char *        vc_getVserverAppDir(char const *id, vcCfgStyle style, char const *app);
00941 
00944   char *        vc_getVserverVdir(char const *id, vcCfgStyle style, bool physical);
00945 
00953   xid_t         vc_getVserverCtx(char const *id, vcCfgStyle style,
00954                                  bool honor_static, bool /*@null@*/ *is_running);
00955 
00960   char *        vc_getVserverByCtx(xid_t ctx, /*@null@*/vcCfgStyle *style,
00961                                    /*@null@*/char const *revdir);
00962 
00963   int           vc_compareVserverById(char const *lhs, vcCfgStyle lhs_style,
00964                                       char const *rhs, vcCfgStyle rhs_style);
00965  
00966 #define vcSKEL_INTERFACES       1u
00967 #define vcSKEL_PKGMGMT          2u
00968 #define vcSKEL_FILESYSTEM       4u
00969 
00972   int           vc_createSkeleton(char const *id, vcCfgStyle style, int flags);
00973 
00974 
00975 #ifdef __cplusplus
00976 }
00977 #endif
00978 
00979 #undef VC_ATTR_PURE
00980 #undef VC_ATTR_ALWAYSINLINE
00981 #undef VC_ATTR_NORETURN
00982 #undef VC_ATTR_UNUSED
00983 #undef VC_ATTR_NONNULL
00984 
00985 #endif

Generated on Sat Jul 28 09:58:41 2007 for util-vserver (libvserver) by  doxygen 1.5.2