vserver.h

Go to the documentation of this file.
00001 /* $Id: vserver.h 2415 2006-12-08 13:24:49Z 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 #include <vserver-compat.h>
00034 
00035 #ifndef IS_DOXYGEN
00036 #if defined(__GNUC__)
00037 #  define VC_ATTR_UNUSED                __attribute__((__unused__))
00038 #  define VC_ATTR_NORETURN              __attribute__((__noreturn__))
00039 #  define VC_ATTR_CONST                 __attribute__((__const__))
00040 #  define VC_ATTR_DEPRECATED            __attribute__((__deprecated__))
00041 #  if __GNUC__*0x10000 + __GNUC_MINOR__*0x100 + __GNUC_PATCHLEVEL__ >= 0x30300
00042 #    define VC_ATTR_NONNULL(ARGS)       __attribute__((__nonnull__ ARGS))
00043 #    define VC_ATTR_ALWAYSINLINE        __attribute__((__always_inline__))
00044 #  else
00045 #    define VC_ATTR_NONNULL(ARGS)
00046 #    define VC_ATTR_ALWAYSINLINE
00047 #  endif
00048 #  if __GNUC__*0x10000 + __GNUC_MINOR__*0x100 + __GNUC_PATCHLEVEL__ >= 0x30303
00049 #    define VC_ATTR_PURE                __attribute__((__pure__))
00050 #  else
00051 #    define VC_ATTR_PURE
00052 #  endif
00053 #else
00054 #  define VC_ATTR_NONNULL(ARGS)
00055 #  define VC_ATTR_UNUSED
00056 #  define VC_ATTR_NORETURN
00057 #  define VC_ATTR_ALWAYSINLINE
00058 #  define VC_ATTR_DEPRECATED
00059 #  define VC_ATTR_PURE
00060 #  define VC_ATTR_CONST
00061 #endif
00062 #endif  // IS_DOXYGEN
00063 
00065 #define VC_NOCTX                ((xid_t)(-1))
00066 #define VC_NOXID                ((xid_t)(-1))
00067 
00068 #define VC_DYNAMIC_XID          ((xid_t)(-1))
00069 
00070 #define VC_SAMECTX              ((xid_t)(-2))
00071 
00072 #define VC_NONID                ((nid_t)(-1))
00073 #define VC_DYNAMIC_NID          ((nid_t)(-1))
00074 
00075 #define VC_LIM_INFINITY         (~0ULL)
00076 #define VC_LIM_KEEP             (~1ULL)
00077 
00078 #define VC_CDLIM_UNSET          (0U)
00079 #define VC_CDLIM_INFINITY       (~0U)
00080 #define VC_CDLIM_KEEP           (~1U)
00081   
00082 #ifndef S_CTX_INFO_LOCK
00083 #  define S_CTX_INFO_LOCK       1
00084 #endif
00085 
00086 #ifndef S_CTX_INFO_SCHED
00087 #  define S_CTX_INFO_SCHED      2
00088 #endif
00089 
00090 #ifndef S_CTX_INFO_NPROC
00091 #  define S_CTX_INFO_NPROC      4
00092 #endif
00093 
00094 #ifndef S_CTX_INFO_PRIVATE
00095 #  define S_CTX_INFO_PRIVATE    8
00096 #endif
00097 
00098 #ifndef S_CTX_INFO_INIT
00099 #  define S_CTX_INFO_INIT       16
00100 #endif
00101 
00102 #ifndef S_CTX_INFO_HIDEINFO
00103 #  define S_CTX_INFO_HIDEINFO   32
00104 #endif
00105 
00106 #ifndef S_CTX_INFO_ULIMIT
00107 #  define S_CTX_INFO_ULIMIT     64
00108 #endif
00109 
00110 #ifndef S_CTX_INFO_NAMESPACE
00111 #  define S_CTX_INFO_NAMESPACE  128
00112 #endif
00113 
00114 #define VC_CAP_CHOWN                     0
00115 #define VC_CAP_DAC_OVERRIDE              1
00116 #define VC_CAP_DAC_READ_SEARCH           2
00117 #define VC_CAP_FOWNER                    3
00118 #define VC_CAP_FSETID                    4
00119 #define VC_CAP_KILL                      5
00120 #define VC_CAP_SETGID                    6
00121 #define VC_CAP_SETUID                    7
00122 #define VC_CAP_SETPCAP                   8
00123 #define VC_CAP_LINUX_IMMUTABLE           9
00124 #define VC_CAP_NET_BIND_SERVICE         10
00125 #define VC_CAP_NET_BROADCAST            11
00126 #define VC_CAP_NET_ADMIN                12
00127 #define VC_CAP_NET_RAW                  13
00128 #define VC_CAP_IPC_LOCK                 14
00129 #define VC_CAP_IPC_OWNER                15
00130 #define VC_CAP_SYS_MODULE               16
00131 #define VC_CAP_SYS_RAWIO                17
00132 #define VC_CAP_SYS_CHROOT               18
00133 #define VC_CAP_SYS_PTRACE               19
00134 #define VC_CAP_SYS_PACCT                20
00135 #define VC_CAP_SYS_ADMIN                21
00136 #define VC_CAP_SYS_BOOT                 22
00137 #define VC_CAP_SYS_NICE                 23
00138 #define VC_CAP_SYS_RESOURCE             24
00139 #define VC_CAP_SYS_TIME                 25
00140 #define VC_CAP_SYS_TTY_CONFIG           26
00141 #define VC_CAP_MKNOD                    27
00142 #define VC_CAP_LEASE                    28
00143 #define VC_CAP_AUDIT_WRITE              29
00144 #define VC_CAP_AUDIT_CONTROL            30
00145 
00146 #define VC_IMMUTABLE_FILE_FL            0x0000010lu
00147 #define VC_IMMUTABLE_LINK_FL            0x0008000lu
00148 #define VC_IMMUTABLE_ALL                (VC_IMMUTABLE_LINK_FL|VC_IMMUTABLE_FILE_FL)
00149 
00150 #define VC_IATTR_XID                    0x01000000u
00151 
00152 #define VC_IATTR_ADMIN                  0x00000001u
00153 #define VC_IATTR_WATCH                  0x00000002u
00154 #define VC_IATTR_HIDE                   0x00000004u
00155 #define VC_IATTR_FLAGS                  0x00000007u
00156 
00157 #define VC_IATTR_BARRIER                0x00010000u
00158 #define VC_IATTR_IUNLINK                0x00020000u
00159 #define VC_IATTR_IMMUTABLE              0x00040000u
00160 
00161 
00162 // the flags
00163 #define VC_VXF_INFO_LOCK                0x00000001ull
00164 #define VC_VXF_INFO_NPROC               0x00000004ull
00165 #define VC_VXF_INFO_PRIVATE             0x00000008ull
00166 #define VC_VXF_INFO_INIT                0x00000010ull
00167 
00168 #define VC_VXF_INFO_HIDEINFO            0x00000020ull
00169 #define VC_VXF_INFO_ULIMIT              0x00000040ull
00170 #define VC_VXF_INFO_NAMESPACE           0x00000080ull
00171 
00172 #define VC_VXF_SCHED_HARD               0x00000100ull
00173 #define VC_VXF_SCHED_PRIO               0x00000200ull
00174 #define VC_VXF_SCHED_PAUSE              0x00000400ull
00175 
00176 #define VC_VXF_VIRT_MEM                 0x00010000ull
00177 #define VC_VXF_VIRT_UPTIME              0x00020000ull
00178 #define VC_VXF_VIRT_CPU                 0x00040000ull
00179 #define VC_VXF_VIRT_LOAD                0x00080000ull
00180 #define VC_VXF_VIRT_TIME                0x00100000ull
00181 
00182 #define VC_VXF_HIDE_MOUNT               0x01000000ull
00183 #define VC_VXF_HIDE_NETIF               0x02000000ull
00184 #define VC_VXF_HIDE_VINFO               0x04000000ull
00185 
00186 #define VC_VXF_STATE_SETUP              (1ULL<<32)
00187 #define VC_VXF_STATE_INIT               (1ULL<<33)
00188 #define VC_VXF_STATE_ADMIN              (1ULL<<34)
00189 
00190 #define VC_VXF_SC_HELPER                (1ULL<<36)
00191 #define VC_VXF_REBOOT_KILL              (1ULL<<37)
00192 #define VC_VXF_PERSISTENT               (1ULL<<38)
00193 
00194 #define VC_VXF_FORK_RSS                 (1ULL<<48)
00195 #define VC_VXF_PROLIFIC                 (1ULL<<49)
00196 
00197 #define VC_VXF_IGNEG_NICE               (1ULL<<52)
00198 
00199 
00200 // the ccapabilities
00201 #define VC_VXC_SET_UTSNAME              0x00000001ull
00202 #define VC_VXC_SET_RLIMIT               0x00000002ull
00203 
00204 #define VC_VXC_RAW_ICMP                 0x00000100ull
00205 #define VC_VXC_SYSLOG                   0x00001000ull
00206 
00207 #define VC_VXC_SECURE_MOUNT             0x00010000ull
00208 #define VC_VXC_SECURE_REMOUNT           0x00020000ull
00209 #define VC_VXC_BINARY_MOUNT             0x00040000ull
00210 
00211 #define VC_VXC_QUOTA_CTL                0x00100000ull
00212 #define VC_VXC_ADMIN_MAPPER             0x00200000ull
00213 #define VC_VXC_ADMIN_CLOOP              0x00400000ull
00214 
00215 
00216 // the scheduler flags
00217 #define VC_VXSM_FILL_RATE               0x0001
00218 #define VC_VXSM_INTERVAL                0x0002
00219 #define VC_VXSM_FILL_RATE2              0x0004
00220 #define VC_VXSM_INTERVAL2               0x0008
00221 #define VC_VXSM_TOKENS                  0x0010
00222 #define VC_VXSM_TOKENS_MIN              0x0020
00223 #define VC_VXSM_TOKENS_MAX              0x0040
00224 #define VC_VXSM_PRIO_BIAS               0x0100
00225 #define VC_VXSM_CPU_ID                  0x1000
00226 #define VC_VXSM_BUCKET_ID               0x2000
00227 
00228 #define VC_VXSM_IDLE_TIME               0x0200
00229 #define VC_VXSM_FORCE                   0x0400
00230 
00231 #define VC_VXSM_V3_MASK                 0x0173
00232 
00233 
00234 // the network flags
00235 #define VC_NXF_INFO_LOCK                0x00000001ull
00236 #define VC_NXF_INFO_PRIVATE             0x00000008ull
00237 
00238 #define VC_NXF_SINGLE_IP                0x00000100ull
00239 
00240 #define VC_NXF_HIDE_NETIF               0x02000000ull
00241 
00242 #define VC_NXF_STATE_SETUP              (1ULL<<32)
00243 #define VC_NXF_STATE_ADMIN              (1ULL<<34)
00244 
00245 #define VC_NXF_SC_HELPER                (1ULL<<36)
00246 #define VC_NXF_PERSISTENT               (1ULL<<38)
00247 
00248 
00249 // the vserver specific limits
00250 #define VC_VLIMIT_NSOCK                 16
00251 #define VC_VLIMIT_OPENFD                17
00252 #define VC_VLIMIT_ANON                  18
00253 #define VC_VLIMIT_SHMEM                 19
00254 #define VC_VLIMIT_SEMARY                20
00255 #define VC_VLIMIT_NSEMS                 21
00256 #define VC_VLIMIT_DENTRY                22
00257 #define VC_VLIMIT_MAPPED                23
00258 
00259 
00260 // the VCI bit values
00261 #define VC_VCI_NO_DYNAMIC               (1 << 0)
00262 #define VC_VCI_SPACES                   (1 << 10)
00263 
00264 
00265 #ifndef CLONE_NEWNS
00266 #  define CLONE_NEWNS                   0x00020000
00267 #endif
00268 #ifndef CLONE_NEWUTS
00269 #  define CLONE_NEWUTS                  0x04000000
00270 #endif
00271 #ifndef CLONE_NEWIPC
00272 #  define CLONE_NEWIPC                  0x08000000
00273 #endif
00274 
00275 
00276 
00277 #define VC_BAD_PERSONALITY              ((uint_least32_t)(-1))
00278 
00279 
00289 #ifdef IS_DOXYGEN
00290 typedef an_unsigned_integer_type        xid_t;
00291 typedef an_unsigned_integer_type        nid_t;
00292 #endif
00293 
00294 #ifdef __cplusplus
00295 extern "C" {
00296 #endif
00297 
00298   struct vc_ip_mask_pair {
00299       uint32_t  ip;
00300       uint32_t  mask;
00301   };
00302 
00315   int   vc_syscall(uint32_t cmd, xid_t xid, void *data);
00316 
00321   int   vc_get_version();
00322 
00327   int   vc_get_vci();
00328   
00346   xid_t vc_new_s_context(xid_t ctx, unsigned int remove_cap, unsigned int flags);
00347 
00351   int   vc_set_ipv4root(uint32_t  bcast, size_t nb,
00352                         struct vc_ip_mask_pair const *ips) VC_ATTR_NONNULL((3));
00353 
00360   size_t        vc_get_nb_ipv4root() VC_ATTR_CONST VC_ATTR_PURE;
00361 
00373   xid_t vc_ctx_create(xid_t xid);
00374 
00380   int   vc_ctx_migrate(xid_t xid);
00381 
00383   struct vc_ctx_stat {
00384       uint_least32_t    usecnt; 
00385       uint_least32_t    tasks;  
00386   };
00387 
00395   int   vc_ctx_stat(xid_t xid, struct vc_ctx_stat /*@out@*/ *stat) VC_ATTR_NONNULL((2));
00396 
00398   struct vc_virt_stat {
00399       uint_least64_t    offset;
00400       uint_least32_t    uptime;
00401       uint_least32_t    nr_threads;
00402       uint_least32_t    nr_running;
00403       uint_least32_t    nr_uninterruptible;
00404       uint_least32_t    nr_onhold;
00405       uint_least32_t    nr_forks;
00406       uint_least32_t    load[3];
00407   };
00408 
00416   int   vc_virt_stat(xid_t xid, struct vc_virt_stat /*@out@*/ *stat) VC_ATTR_NONNULL((2));
00417   
00418     /* rlimit related functions */
00419   
00429   typedef uint_least64_t        vc_limit_t;
00430 
00434   struct vc_rlimit {
00435       vc_limit_t        min;    
00436       vc_limit_t        soft;   
00437       vc_limit_t        hard;   
00438   };
00439 
00441   struct  vc_rlimit_mask {
00442       uint_least32_t    min;    
00443       uint_least32_t    soft;   
00444       uint_least32_t    hard;   
00445   };
00446 
00448   struct  vc_rlimit_stat {
00449       uint_least32_t    hits;    
00450       uint_least64_t    value;   
00451       uint_least64_t    minimum; 
00452       uint_least64_t    maximum; 
00453   };
00454 
00463   int   vc_get_rlimit(xid_t xid, int resource,
00464                       struct vc_rlimit       /*@out@*/ *lim) VC_ATTR_NONNULL((3));
00473   int   vc_set_rlimit(xid_t xid, int resource,
00474                       struct vc_rlimit const /*@in@*/  *lim) VC_ATTR_NONNULL((3));
00475   int   vc_get_rlimit_mask(xid_t xid,
00476                            struct vc_rlimit_mask *lim)       VC_ATTR_NONNULL((2));
00485   int   vc_rlimit_stat(xid_t xid, int resource,
00486                        struct vc_rlimit_stat /*@out@*/ *stat) VC_ATTR_NONNULL((3));
00493   int   vc_reset_minmax(xid_t xid);
00513   bool  vc_parseLimit(char const /*@in@*/ *str, vc_limit_t /*@out@*/ *res)      VC_ATTR_NONNULL((1,2));
00514 
00515 
00522   int   vc_ctx_kill(xid_t ctx, pid_t pid, int sig);
00523 
00524 
00525   struct vc_nx_info {
00526       nid_t     nid;
00527   };
00528 
00529   nid_t         vc_get_task_nid(pid_t pid);
00530   int           vc_get_nx_info(nid_t nid, struct vc_nx_info *) VC_ATTR_NONNULL((2));
00531 
00532   typedef enum { vcNET_IPV4=1,      vcNET_IPV6=2,
00533                  vcNET_IPV4B=0x101, vcNET_IPV6B=0x102,
00534                  vcNET_ANY=~0 }         vc_net_nx_type;
00535 
00536   struct vc_net_nx {
00537       vc_net_nx_type    type;
00538       size_t            count;
00539       uint32_t          ip[4];
00540       uint32_t          mask[4];
00541   };
00542 
00543   nid_t         vc_net_create(nid_t nid);
00544   int           vc_net_migrate(nid_t nid);
00545 
00546   int           vc_net_add(nid_t nid, struct vc_net_nx const *info);
00547   int           vc_net_remove(nid_t nid, struct vc_net_nx const *info);
00548 
00549   struct vc_net_flags {
00550       uint_least64_t    flagword;
00551       uint_least64_t    mask;
00552   };
00553   
00554   int           vc_get_nflags(nid_t, struct vc_net_flags *);
00555   int           vc_set_nflags(nid_t, struct vc_net_flags const *);
00556 
00557   
00558   struct vc_net_caps {
00559       uint_least64_t    ncaps;
00560       uint_least64_t    cmask;
00561   };
00562 
00563   int           vc_get_ncaps(nid_t, struct vc_net_caps *);
00564   int           vc_set_ncaps(nid_t, struct vc_net_caps const *);
00565 
00566 
00567   
00568 
00569   int           vc_set_iattr(char const *filename, xid_t xid,
00570                              uint_least32_t flags, uint_least32_t mask) VC_ATTR_NONNULL((1));
00571 
00598   int           vc_get_iattr(char const *filename, xid_t * /*@null@*/ xid,
00599                              uint_least32_t * /*@null@*/ flags,
00600                              uint_least32_t * /*@null@*/ mask) VC_ATTR_NONNULL((1));
00601 
00602   struct vc_vx_info {
00603       xid_t     xid;
00604       pid_t     initpid;
00605   };
00606   
00614   xid_t         vc_get_task_xid(pid_t pid);
00615   int           vc_get_vx_info(xid_t xid, struct vc_vx_info *info) VC_ATTR_NONNULL((2));
00616 
00617 
00618   typedef enum { vcVHI_CONTEXT, vcVHI_SYSNAME, vcVHI_NODENAME,
00619                  vcVHI_RELEASE, vcVHI_VERSION, vcVHI_MACHINE,
00620                  vcVHI_DOMAINNAME }             vc_uts_type;
00621   
00622   int           vc_set_vhi_name(xid_t xid, vc_uts_type type,
00623                                 char const *val, size_t len) VC_ATTR_NONNULL((3));
00624   int           vc_get_vhi_name(xid_t xid, vc_uts_type type,
00625                                 char *val, size_t len)       VC_ATTR_NONNULL((3));
00626 
00628   bool          vc_is_dynamic_xid(xid_t xid);
00629 
00630   int           vc_enter_namespace(xid_t xid, uint_least64_t mask);
00631   int           vc_set_namespace(xid_t xid, uint_least64_t mask);
00632   int           vc_cleanup_namespace();
00633   uint_least64_t vc_get_space_mask();
00634 
00635   
00638   struct  vc_ctx_flags {
00640       uint_least64_t    flagword;
00644       uint_least64_t    mask;
00645   };
00646 
00648   struct  vc_ctx_caps {
00650       uint_least64_t    bcaps;
00654       uint_least64_t    bmask;
00656       uint_least64_t    ccaps;
00660       uint_least64_t    cmask;
00661   };
00662 
00666   struct vc_err_listparser {
00667       char const        *ptr;           
00668       size_t            len;            
00669   };
00670  
00671   int                   vc_get_cflags(xid_t xid, struct vc_ctx_flags *)       VC_ATTR_NONNULL((2));
00672   int                   vc_set_cflags(xid_t xid, struct vc_ctx_flags const *) VC_ATTR_NONNULL((2));
00673 
00674   int                   vc_get_ccaps(xid_t xid, struct vc_ctx_caps *);
00675   int                   vc_set_ccaps(xid_t xid, struct vc_ctx_caps const *);
00676 
00687   uint_least64_t        vc_text2bcap(char const *str, size_t len);
00688 
00703   char const *  vc_lobcap2text(uint_least64_t *val) VC_ATTR_NONNULL((1));
00704 
00732   int                   vc_list2bcap(char const *str, size_t len,
00733                                      struct vc_err_listparser *err,
00734                                      struct vc_ctx_caps *cap) VC_ATTR_NONNULL((1,4));
00735 
00736   uint_least64_t        vc_text2ccap(char const *, size_t len);
00737   char const *          vc_loccap2text(uint_least64_t *);
00738   int                   vc_list2ccap(char const *, size_t len,
00739                                      struct vc_err_listparser *err,
00740                                      struct vc_ctx_caps *);
00741 
00742   int                   vc_list2cflag(char const *, size_t len,
00743                                      struct vc_err_listparser *err,
00744                                      struct vc_ctx_flags *flags);
00745   uint_least64_t        vc_text2cflag(char const *, size_t len);
00746   char const *          vc_locflag2text(uint_least64_t *);
00747   
00748   uint_least32_t        vc_list2cflag_compat(char const *, size_t len,
00749                                             struct vc_err_listparser *err);
00750   uint_least32_t        vc_text2cflag_compat(char const *, size_t len);
00751   char const *          vc_hicflag2text_compat(uint_least32_t);
00752 
00753   int                   vc_text2cap(char const *);
00754   char const *          vc_cap2text(unsigned int);
00755 
00756   
00757   int                   vc_list2nflag(char const *, size_t len,
00758                                      struct vc_err_listparser *err,
00759                                      struct vc_net_flags *flags);
00760   uint_least64_t        vc_text2nflag(char const *, size_t len);
00761   char const *          vc_lonflag2text(uint_least64_t *);
00762 
00763   uint_least64_t        vc_text2ncap(char const *, size_t len);
00764   char const *          vc_loncap2text(uint_least64_t *);
00765   int                   vc_list2ncap(char const *, size_t len,
00766                                      struct vc_err_listparser *err,
00767                                      struct vc_net_caps *);
00768 
00769   uint_least64_t                vc_get_insecurebcaps() VC_ATTR_CONST;
00770   inline static uint_least64_t  vc_get_insecureccaps() {
00771     return ~(VC_VXC_SET_UTSNAME|VC_VXC_RAW_ICMP);
00772   }
00773   
00774   inline static int     vc_setfilecontext(char const *filename, xid_t xid) {
00775     return vc_set_iattr(filename, xid, 0, VC_IATTR_XID);
00776   }
00777 
00778 
00779   uint_least32_t        vc_text2personalityflag(char const *str,
00780                                                 size_t len) VC_ATTR_NONNULL((1));
00781 
00782   char const *          vc_lopersonality2text(uint_least32_t *) VC_ATTR_NONNULL((1));
00783   
00784   int                   vc_list2personalityflag(char const /*@in@*/ *,
00785                                                 size_t len,
00786                                                 uint_least32_t /*@out@*/ *personality,
00787                                                 struct vc_err_listparser /*@out@*/ *err) VC_ATTR_NONNULL((1,3));
00788 
00789   uint_least32_t        vc_str2personalitytype(char const /*@in@*/*,
00790                                                size_t len) VC_ATTR_NONNULL((1));
00791   
00805   xid_t         vc_getfilecontext(char const *filename) VC_ATTR_NONNULL((1));
00806 
00807 
00808   struct vc_set_sched {
00809       uint_least32_t    set_mask;
00810       int_least32_t     fill_rate;
00811       int_least32_t     interval;
00812       int_least32_t     fill_rate2;
00813       int_least32_t     interval2;
00814       int_least32_t     tokens;
00815       int_least32_t     tokens_min;
00816       int_least32_t     tokens_max;
00817       int_least32_t     priority_bias;
00818       int_least32_t     cpu_id;
00819       int_least32_t     bucket_id;
00820   };
00821 
00822   int           vc_set_sched(xid_t xid, struct vc_set_sched const *);
00823 
00824 
00825   struct vc_ctx_dlimit {
00826       uint_least32_t    space_used;
00827       uint_least32_t    space_total;
00828       uint_least32_t    inodes_used;
00829       uint_least32_t    inodes_total;
00830       uint_least32_t    reserved;
00831   };
00832   
00833 
00835   int           vc_add_dlimit(char const *filename, xid_t xid,
00836                               uint_least32_t flags) VC_ATTR_NONNULL((1));
00838   int           vc_rem_dlimit(char const *filename, xid_t xid,
00839                               uint_least32_t flags) VC_ATTR_NONNULL((1));
00840 
00842   int           vc_set_dlimit(char const *filename, xid_t xid,
00843                               uint_least32_t flags,
00844                               struct vc_ctx_dlimit const *limits) VC_ATTR_NONNULL((1,4));
00846   int           vc_get_dlimit(char const *filename, xid_t xid,
00847                               uint_least32_t flags,
00848                               struct vc_ctx_dlimit *limits) VC_ATTR_NONNULL((1));
00849 
00853   int           vc_wait_exit(xid_t xid);
00854     
00855   typedef enum { vcFEATURE_VKILL,  vcFEATURE_IATTR,   vcFEATURE_RLIMIT,
00856                  vcFEATURE_COMPAT, vcFEATURE_MIGRATE, vcFEATURE_NAMESPACE,
00857                  vcFEATURE_SCHED,  vcFEATURE_VINFO,   vcFEATURE_VHI,
00858                  vcFEATURE_VSHELPER0, vcFEATURE_VSHELPER, vcFEATURE_VWAIT,
00859                  vcFEATURE_VNET }
00860     vcFeatureSet;
00861 
00862   bool          vc_isSupported(vcFeatureSet) VC_ATTR_CONST;
00863   bool          vc_isSupportedString(char const *);
00864 
00865   
00866   typedef enum { vcTYPE_INVALID, vcTYPE_MAIN, vcTYPE_WATCH,
00867                  vcTYPE_STATIC, vcTYPE_DYNAMIC }
00868     vcXidType;
00869   
00870   vcXidType     vc_getXIDType(xid_t xid) VC_ATTR_CONST;
00871 
00872   /* The management part */
00873 
00874 #define VC_LIMIT_VSERVER_NAME_LEN       1024
00875   
00876   typedef enum { vcCFG_NONE, vcCFG_AUTO,
00877                  vcCFG_LEGACY,
00878                  vcCFG_RECENT_SHORT,
00879                  vcCFG_RECENT_FULL }            vcCfgStyle;
00880 
00881 
00883   xid_t         vc_xidopt2xid(char const *, bool honor_static, char const **err_info);
00885   nid_t         vc_nidopt2nid(char const *, bool honor_static, char const **err_info);
00886 
00887   vcCfgStyle    vc_getVserverCfgStyle(char const *id);
00888   
00891   char *        vc_getVserverName(char const *id, vcCfgStyle style);
00892 
00897   char *        vc_getVserverCfgDir(char const *id, vcCfgStyle style);
00898 
00902   char *        vc_getVserverAppDir(char const *id, vcCfgStyle style, char const *app);
00903 
00906   char *        vc_getVserverVdir(char const *id, vcCfgStyle style, bool physical);
00907 
00915   xid_t         vc_getVserverCtx(char const *id, vcCfgStyle style,
00916                                  bool honor_static, bool /*@null@*/ *is_running);
00917 
00922   char *        vc_getVserverByCtx(xid_t ctx, /*@null@*/vcCfgStyle *style,
00923                                    /*@null@*/char const *revdir);
00924 
00925   int           vc_compareVserverById(char const *lhs, vcCfgStyle lhs_style,
00926                                       char const *rhs, vcCfgStyle rhs_style);
00927  
00928 #define vcSKEL_INTERFACES       1u
00929 #define vcSKEL_PKGMGMT          2u
00930 #define vcSKEL_FILESYSTEM       4u
00931 
00934   int           vc_createSkeleton(char const *id, vcCfgStyle style, int flags);
00935 
00936 
00937 #ifdef __cplusplus
00938 }
00939 #endif
00940 
00941 #undef VC_ATTR_PURE
00942 #undef VC_ATTR_ALWAYSINLINE
00943 #undef VC_ATTR_NORETURN
00944 #undef VC_ATTR_UNUSED
00945 #undef VC_ATTR_NONNULL
00946 
00947 #endif

Generated on Tue Mar 6 22:37:44 2007 for util-vserver (libvserver) by  doxygen 1.5.1