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 #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 
00229 #define VC_VXSM_V3_MASK                 0x0173
00230 
00231 
00232 // the network flags
00233 #define VC_NXF_INFO_LOCK                0x00000001ull
00234 #define VC_NXF_INFO_PRIVATE             0x00000008ull
00235 
00236 #define VC_NXF_SINGLE_IP                0x00000100ull
00237 
00238 #define VC_NXF_HIDE_NETIF               0x02000000ull
00239 
00240 #define VC_NXF_STATE_SETUP              (1ULL<<32)
00241 #define VC_NXF_STATE_ADMIN              (1ULL<<34)
00242 
00243 #define VC_NXF_SC_HELPER                (1ULL<<36)
00244 #define VC_NXF_PERSISTENT               (1ULL<<38)
00245 
00246 
00247 // the vserver specific limits
00248 #define VC_VLIMIT_NSOCK                 16
00249 #define VC_VLIMIT_OPENFD                17
00250 #define VC_VLIMIT_ANON                  18
00251 #define VC_VLIMIT_SHMEM                 19
00252 #define VC_VLIMIT_SEMARY                20
00253 #define VC_VLIMIT_NSEMS                 21
00254 #define VC_VLIMIT_DENTRY                22
00255 #define VC_VLIMIT_MAPPED                23
00256 
00257 
00258 // the VCI bit values
00259 #define VC_VCI_NO_DYNAMIC               (1 << 0)
00260 #define VC_VCI_SPACES                   (1 << 10)
00261 
00262 
00263 #ifndef CLONE_NEWNS
00264 #  define CLONE_NEWNS                   0x00020000
00265 #endif
00266 #ifndef CLONE_NEWUTS
00267 #  define CLONE_NEWUTS                  0x04000000
00268 #endif
00269 #ifndef CLONE_NEWIPC
00270 #  define CLONE_NEWIPC                  0x08000000
00271 #endif
00272 
00273 
00274 
00275 #define VC_BAD_PERSONALITY              ((uint_least32_t)(-1))
00276 
00277 
00287 #ifdef IS_DOXYGEN
00288 typedef an_unsigned_integer_type        xid_t;
00289 typedef an_unsigned_integer_type        nid_t;
00290 #endif
00291 
00292 #ifdef __cplusplus
00293 extern "C" {
00294 #endif
00295 
00296   struct vc_ip_mask_pair {
00297       uint32_t  ip;
00298       uint32_t  mask;
00299   };
00300 
00313   int   vc_syscall(uint32_t cmd, xid_t xid, void *data);
00314 
00319   int   vc_get_version();
00320 
00325   int   vc_get_vci();
00326   
00344   xid_t vc_new_s_context(xid_t ctx, unsigned int remove_cap, unsigned int flags);
00345 
00349   int   vc_set_ipv4root(uint32_t  bcast, size_t nb,
00350                         struct vc_ip_mask_pair const *ips) VC_ATTR_NONNULL((3));
00351 
00358   size_t        vc_get_nb_ipv4root() VC_ATTR_CONST VC_ATTR_PURE;
00359 
00371   xid_t vc_ctx_create(xid_t xid);
00372 
00378   int   vc_ctx_migrate(xid_t xid);
00379 
00381   struct vc_ctx_stat {
00382       uint_least32_t    usecnt; 
00383       uint_least32_t    tasks;  
00384   };
00385 
00393   int   vc_ctx_stat(xid_t xid, struct vc_ctx_stat /*@out@*/ *stat) VC_ATTR_NONNULL((2));
00394 
00396   struct vc_virt_stat {
00397       uint_least64_t    offset;
00398       uint_least32_t    uptime;
00399       uint_least32_t    nr_threads;
00400       uint_least32_t    nr_running;
00401       uint_least32_t    nr_uninterruptible;
00402       uint_least32_t    nr_onhold;
00403       uint_least32_t    nr_forks;
00404       uint_least32_t    load[3];
00405   };
00406 
00414   int   vc_virt_stat(xid_t xid, struct vc_virt_stat /*@out@*/ *stat) VC_ATTR_NONNULL((2));
00415   
00416     /* rlimit related functions */
00417   
00427   typedef uint_least64_t        vc_limit_t;
00428 
00432   struct vc_rlimit {
00433       vc_limit_t        min;    
00434       vc_limit_t        soft;   
00435       vc_limit_t        hard;   
00436   };
00437 
00439   struct  vc_rlimit_mask {
00440       uint_least32_t    min;    
00441       uint_least32_t    soft;   
00442       uint_least32_t    hard;   
00443   };
00444 
00446   struct  vc_rlimit_stat {
00447       uint_least32_t    hits;    
00448       uint_least64_t    value;   
00449       uint_least64_t    minimum; 
00450       uint_least64_t    maximum; 
00451   };
00452 
00461   int   vc_get_rlimit(xid_t xid, int resource,
00462                       struct vc_rlimit       /*@out@*/ *lim) VC_ATTR_NONNULL((3));
00471   int   vc_set_rlimit(xid_t xid, int resource,
00472                       struct vc_rlimit const /*@in@*/  *lim) VC_ATTR_NONNULL((3));
00473   int   vc_get_rlimit_mask(xid_t xid,
00474                            struct vc_rlimit_mask *lim)       VC_ATTR_NONNULL((2));
00483   int   vc_rlimit_stat(xid_t xid, int resource,
00484                        struct vc_rlimit_stat /*@out@*/ *stat) VC_ATTR_NONNULL((3));
00491   int   vc_reset_minmax(xid_t xid);
00511   bool  vc_parseLimit(char const /*@in@*/ *str, vc_limit_t /*@out@*/ *res)      VC_ATTR_NONNULL((1,2));
00512 
00513 
00520   int   vc_ctx_kill(xid_t ctx, pid_t pid, int sig);
00521 
00522 
00523   struct vc_nx_info {
00524       nid_t     nid;
00525   };
00526 
00527   nid_t         vc_get_task_nid(pid_t pid);
00528   int           vc_get_nx_info(nid_t nid, struct vc_nx_info *) VC_ATTR_NONNULL((2));
00529 
00530   typedef enum { vcNET_IPV4=1,      vcNET_IPV6=2,
00531                  vcNET_IPV4B=0x101, vcNET_IPV6B=0x102,
00532                  vcNET_ANY=~0 }         vc_net_nx_type;
00533 
00534   struct vc_net_nx {
00535       vc_net_nx_type    type;
00536       size_t            count;
00537       uint32_t          ip[4];
00538       uint32_t          mask[4];
00539   };
00540 
00541   nid_t         vc_net_create(nid_t nid);
00542   int           vc_net_migrate(nid_t nid);
00543 
00544   int           vc_net_add(nid_t nid, struct vc_net_nx const *info);
00545   int           vc_net_remove(nid_t nid, struct vc_net_nx const *info);
00546 
00547   struct vc_net_flags {
00548       uint_least64_t    flagword;
00549       uint_least64_t    mask;
00550   };
00551   
00552   int           vc_get_nflags(nid_t, struct vc_net_flags *);
00553   int           vc_set_nflags(nid_t, struct vc_net_flags const *);
00554 
00555   
00556   struct vc_net_caps {
00557       uint_least64_t    ncaps;
00558       uint_least64_t    cmask;
00559   };
00560 
00561   int           vc_get_ncaps(nid_t, struct vc_net_caps *);
00562   int           vc_set_ncaps(nid_t, struct vc_net_caps const *);
00563 
00564 
00565   
00566 
00567   int           vc_set_iattr(char const *filename, xid_t xid,
00568                              uint_least32_t flags, uint_least32_t mask) VC_ATTR_NONNULL((1));
00569 
00596   int           vc_get_iattr(char const *filename, xid_t * /*@null@*/ xid,
00597                              uint_least32_t * /*@null@*/ flags,
00598                              uint_least32_t * /*@null@*/ mask) VC_ATTR_NONNULL((1));
00599 
00600   struct vc_vx_info {
00601       xid_t     xid;
00602       pid_t     initpid;
00603   };
00604   
00612   xid_t         vc_get_task_xid(pid_t pid);
00613   int           vc_get_vx_info(xid_t xid, struct vc_vx_info *info) VC_ATTR_NONNULL((2));
00614 
00615 
00616   typedef enum { vcVHI_CONTEXT, vcVHI_SYSNAME, vcVHI_NODENAME,
00617                  vcVHI_RELEASE, vcVHI_VERSION, vcVHI_MACHINE,
00618                  vcVHI_DOMAINNAME }             vc_uts_type;
00619   
00620   int           vc_set_vhi_name(xid_t xid, vc_uts_type type,
00621                                 char const *val, size_t len) VC_ATTR_NONNULL((3));
00622   int           vc_get_vhi_name(xid_t xid, vc_uts_type type,
00623                                 char *val, size_t len)       VC_ATTR_NONNULL((3));
00624 
00626   bool          vc_is_dynamic_xid(xid_t xid);
00627 
00628   int           vc_enter_namespace(xid_t xid, uint_least64_t mask);
00629   int           vc_set_namespace(xid_t xid, uint_least64_t mask);
00630   int           vc_cleanup_namespace();
00631   uint_least64_t vc_get_space_mask();
00632 
00633   
00636   struct  vc_ctx_flags {
00638       uint_least64_t    flagword;
00642       uint_least64_t    mask;
00643   };
00644 
00646   struct  vc_ctx_caps {
00648       uint_least64_t    bcaps;
00652       uint_least64_t    bmask;
00654       uint_least64_t    ccaps;
00658       uint_least64_t    cmask;
00659   };
00660 
00664   struct vc_err_listparser {
00665       char const        *ptr;           
00666       size_t            len;            
00667   };
00668  
00669   int                   vc_get_cflags(xid_t xid, struct vc_ctx_flags *)       VC_ATTR_NONNULL((2));
00670   int                   vc_set_cflags(xid_t xid, struct vc_ctx_flags const *) VC_ATTR_NONNULL((2));
00671 
00672   int                   vc_get_ccaps(xid_t xid, struct vc_ctx_caps *);
00673   int                   vc_set_ccaps(xid_t xid, struct vc_ctx_caps const *);
00674 
00685   uint_least64_t        vc_text2bcap(char const *str, size_t len);
00686 
00701   char const *  vc_lobcap2text(uint_least64_t *val) VC_ATTR_NONNULL((1));
00702 
00730   int                   vc_list2bcap(char const *str, size_t len,
00731                                      struct vc_err_listparser *err,
00732                                      struct vc_ctx_caps *cap) VC_ATTR_NONNULL((1,4));
00733 
00734   uint_least64_t        vc_text2ccap(char const *, size_t len);
00735   char const *          vc_loccap2text(uint_least64_t *);
00736   int                   vc_list2ccap(char const *, size_t len,
00737                                      struct vc_err_listparser *err,
00738                                      struct vc_ctx_caps *);
00739 
00740   int                   vc_list2cflag(char const *, size_t len,
00741                                      struct vc_err_listparser *err,
00742                                      struct vc_ctx_flags *flags);
00743   uint_least64_t        vc_text2cflag(char const *, size_t len);
00744   char const *          vc_locflag2text(uint_least64_t *);
00745   
00746   uint_least32_t        vc_list2cflag_compat(char const *, size_t len,
00747                                             struct vc_err_listparser *err);
00748   uint_least32_t        vc_text2cflag_compat(char const *, size_t len);
00749   char const *          vc_hicflag2text_compat(uint_least32_t);
00750 
00751   int                   vc_text2cap(char const *);
00752   char const *          vc_cap2text(unsigned int);
00753 
00754   
00755   int                   vc_list2nflag(char const *, size_t len,
00756                                      struct vc_err_listparser *err,
00757                                      struct vc_net_flags *flags);
00758   uint_least64_t        vc_text2nflag(char const *, size_t len);
00759   char const *          vc_lonflag2text(uint_least64_t *);
00760 
00761   uint_least64_t        vc_text2ncap(char const *, size_t len);
00762   char const *          vc_loncap2text(uint_least64_t *);
00763   int                   vc_list2ncap(char const *, size_t len,
00764                                      struct vc_err_listparser *err,
00765                                      struct vc_net_caps *);
00766 
00767   uint_least64_t                vc_get_insecurebcaps() VC_ATTR_CONST;
00768   inline static uint_least64_t  vc_get_insecureccaps() {
00769     return ~(VC_VXC_SET_UTSNAME|VC_VXC_RAW_ICMP);
00770   }
00771   
00772   inline static int     vc_setfilecontext(char const *filename, xid_t xid) {
00773     return vc_set_iattr(filename, xid, 0, VC_IATTR_XID);
00774   }
00775 
00776 
00777   uint_least32_t        vc_text2personalityflag(char const *str,
00778                                                 size_t len) VC_ATTR_NONNULL((1));
00779 
00780   char const *          vc_lopersonality2text(uint_least32_t *) VC_ATTR_NONNULL((1));
00781   
00782   int                   vc_list2personalityflag(char const /*@in@*/ *,
00783                                                 size_t len,
00784                                                 uint_least32_t /*@out@*/ *personality,
00785                                                 struct vc_err_listparser /*@out@*/ *err) VC_ATTR_NONNULL((1,3));
00786 
00787   uint_least32_t        vc_str2personalitytype(char const /*@in@*/*,
00788                                                size_t len) VC_ATTR_NONNULL((1));
00789   
00803   xid_t         vc_getfilecontext(char const *filename) VC_ATTR_NONNULL((1));
00804 
00805 
00806   struct vc_set_sched {
00807       uint_least32_t    set_mask;
00808       int_least32_t     fill_rate;
00809       int_least32_t     interval;
00810       int_least32_t     fill_rate2;
00811       int_least32_t     interval2;
00812       int_least32_t     tokens;
00813       int_least32_t     tokens_min;
00814       int_least32_t     tokens_max;
00815       int_least32_t     priority_bias;
00816       int_least32_t     cpu_id;
00817       int_least32_t     bucket_id;
00818   };
00819 
00820   int           vc_set_sched(xid_t xid, struct vc_set_sched const *);
00821 
00822 
00823   struct vc_ctx_dlimit {
00824       uint_least32_t    space_used;
00825       uint_least32_t    space_total;
00826       uint_least32_t    inodes_used;
00827       uint_least32_t    inodes_total;
00828       uint_least32_t    reserved;
00829   };
00830   
00831 
00833   int           vc_add_dlimit(char const *filename, xid_t xid,
00834                               uint_least32_t flags) VC_ATTR_NONNULL((1));
00836   int           vc_rem_dlimit(char const *filename, xid_t xid,
00837                               uint_least32_t flags) VC_ATTR_NONNULL((1));
00838 
00840   int           vc_set_dlimit(char const *filename, xid_t xid,
00841                               uint_least32_t flags,
00842                               struct vc_ctx_dlimit const *limits) VC_ATTR_NONNULL((1,4));
00844   int           vc_get_dlimit(char const *filename, xid_t xid,
00845                               uint_least32_t flags,
00846                               struct vc_ctx_dlimit *limits) VC_ATTR_NONNULL((1));
00847 
00851   int           vc_wait_exit(xid_t xid);
00852     
00853   typedef enum { vcFEATURE_VKILL,  vcFEATURE_IATTR,   vcFEATURE_RLIMIT,
00854                  vcFEATURE_COMPAT, vcFEATURE_MIGRATE, vcFEATURE_NAMESPACE,
00855                  vcFEATURE_SCHED,  vcFEATURE_VINFO,   vcFEATURE_VHI,
00856                  vcFEATURE_VSHELPER0, vcFEATURE_VSHELPER, vcFEATURE_VWAIT,
00857                  vcFEATURE_VNET }
00858     vcFeatureSet;
00859 
00860   bool          vc_isSupported(vcFeatureSet) VC_ATTR_CONST;
00861   bool          vc_isSupportedString(char const *);
00862 
00863   
00864   typedef enum { vcTYPE_INVALID, vcTYPE_MAIN, vcTYPE_WATCH,
00865                  vcTYPE_STATIC, vcTYPE_DYNAMIC }
00866     vcXidType;
00867   
00868   vcXidType     vc_getXIDType(xid_t xid) VC_ATTR_CONST;
00869 
00870   /* The management part */
00871 
00872 #define VC_LIMIT_VSERVER_NAME_LEN       1024
00873   
00874   typedef enum { vcCFG_NONE, vcCFG_AUTO,
00875                  vcCFG_LEGACY,
00876                  vcCFG_RECENT_SHORT,
00877                  vcCFG_RECENT_FULL }            vcCfgStyle;
00878 
00879 
00881   xid_t         vc_xidopt2xid(char const *, bool honor_static, char const **err_info);
00883   nid_t         vc_nidopt2nid(char const *, bool honor_static, char const **err_info);
00884 
00885   vcCfgStyle    vc_getVserverCfgStyle(char const *id);
00886   
00889   char *        vc_getVserverName(char const *id, vcCfgStyle style);
00890 
00895   char *        vc_getVserverCfgDir(char const *id, vcCfgStyle style);
00896 
00900   char *        vc_getVserverAppDir(char const *id, vcCfgStyle style, char const *app);
00901 
00904   char *        vc_getVserverVdir(char const *id, vcCfgStyle style, bool physical);
00905 
00913   xid_t         vc_getVserverCtx(char const *id, vcCfgStyle style,
00914                                  bool honor_static, bool /*@null@*/ *is_running);
00915 
00920   char *        vc_getVserverByCtx(xid_t ctx, /*@null@*/vcCfgStyle *style,
00921                                    /*@null@*/char const *revdir);
00922 
00923   int           vc_compareVserverById(char const *lhs, vcCfgStyle lhs_style,
00924                                       char const *rhs, vcCfgStyle rhs_style);
00925  
00926 #define vcSKEL_INTERFACES       1u
00927 #define vcSKEL_PKGMGMT          2u
00928 #define vcSKEL_FILESYSTEM       4u
00929 
00932   int           vc_createSkeleton(char const *id, vcCfgStyle style, int flags);
00933 
00934 
00935 #ifdef __cplusplus
00936 }
00937 #endif
00938 
00939 #undef VC_ATTR_PURE
00940 #undef VC_ATTR_ALWAYSINLINE
00941 #undef VC_ATTR_NORETURN
00942 #undef VC_ATTR_UNUSED
00943 #undef VC_ATTR_NONNULL
00944 
00945 #endif

Generated on Fri Apr 20 12:37:43 2007 for util-vserver (libvserver) by  doxygen 1.5.2