Main Page | Modules | Data Structures | File List | Data Fields | Globals

vserver.h File Reference

The public interface of the the libvserver library. More...

#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#include <sys/types.h>

Include dependency graph for vserver.h:

Go to the source code of this file.

Defines

#define VC_NOCTX   ((xid_t)(-1))
#define VC_NOXID   ((xid_t)(-1))
#define VC_DYNAMIC_XID   ((xid_t)(-1))
#define VC_SAMECTX   ((xid_t)(-2))
#define VC_NONID   ((nid_t)(-1))
#define VC_DYNAMIC_NID   ((nid_t)(-1))
#define VC_LIM_INFINITY   (~0ULL)
#define VC_LIM_KEEP   (~1ULL)
#define S_CTX_INFO_LOCK   1
#define S_CTX_INFO_SCHED   2
#define S_CTX_INFO_NPROC   4
#define S_CTX_INFO_PRIVATE   8
#define S_CTX_INFO_INIT   16
#define S_CTX_INFO_HIDEINFO   32
#define S_CTX_INFO_ULIMIT   64
#define S_CTX_INFO_NAMESPACE   128
#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
#define VC_IMMUTABLE_FILE_FL   0x0000010lu
#define VC_IMMUTABLE_LINK_FL   0x0008000lu
#define VC_IMMUTABLE_ALL   (VC_IMMUTABLE_LINK_FL|VC_IMMUTABLE_FILE_FL)
#define VC_IATTR_XID   0x01000000u
#define VC_IATTR_ADMIN   0x00000001u
#define VC_IATTR_WATCH   0x00000002u
#define VC_IATTR_HIDE   0x00000004u
#define VC_IATTR_FLAGS   0x00000007u
#define VC_IATTR_BARRIER   0x00010000u
#define VC_IATTR_IUNLINK   0x00020000u
#define VC_IATTR_IMMUTABLE   0x00040000u
#define VC_VXF_INFO_LOCK   0x00000001ull
#define VC_VXF_INFO_NPROC   0x00000004ull
#define VC_VXF_INFO_PRIVATE   0x00000008ull
#define VC_VXF_INFO_INIT   0x00000010ull
#define VC_VXF_INFO_HIDEINFO   0x00000020ull
#define VC_VXF_INFO_ULIMIT   0x00000040ull
#define VC_VXF_INFO_NAMESPACE   0x00000080ull
#define VC_VXF_SCHED_HARD   0x00000100ull
#define VC_VXF_SCHED_PRIO   0x00000200ull
#define VC_VXF_SCHED_PAUSE   0x00000400ull
#define VC_VXF_VIRT_MEM   0x00010000ull
#define VC_VXF_VIRT_UPTIME   0x00020000ull
#define VC_VXF_VIRT_CPU   0x00040000ull
#define VC_VXF_VIRT_LOAD   0x00080000ull
#define VC_VXF_HIDE_MOUNT   0x01000000ull
#define VC_VXF_HIDE_NETIF   0x02000000ull
#define VC_VXF_STATE_SETUP   (1ULL<<32)
#define VC_VXF_STATE_INIT   (1ULL<<33)
#define VC_VXF_FORK_RSS   (1ULL<<48)
#define VC_VXF_PROLIFIC   (1ULL<<49)
#define VC_VXF_IGNEG_NICE   (1ULL<<52)
#define VC_VXC_SET_UTSNAME   0x00000001ull
#define VC_VXC_SET_RLIMIT   0x00000002ull
#define VC_VXC_RAW_ICMP   0x00000100ull
#define VC_VXC_SECURE_MOUNT   0x00010000ull
#define VC_VXC_SECURE_REMOUNT   0x00020000ull
#define VC_VXSM_FILL_RATE   0x0001
#define VC_VXSM_INTERVAL   0x0002
#define VC_VXSM_TOKENS   0x0010
#define VC_VXSM_TOKENS_MIN   0x0020
#define VC_VXSM_TOKENS_MAX   0x0040
#define VC_VXSM_PRIO_BIAS   0x0100
#define VC_LIMIT_VSERVER_NAME_LEN   1024
#define vcSKEL_INTERFACES   1u
#define vcSKEL_PKGMGMT   2u
#define vcSKEL_FILESYSTEM   4u

Typedefs

typedef an_unsigned_integer_type xid_t
typedef an_unsigned_integer_type nid_t
typedef uint_least64_t vc_limit_t
 The type which is used for a single limit value.

Enumerations

enum  vc_net_nx_type { vcNET_IPV4, vcNET_IPV6, vcNET_IPV4R, vcNET_IPV6R }
enum  vc_uts_type {
  vcVHI_CONTEXT, vcVHI_SYSNAME, vcVHI_NODENAME, vcVHI_RELEASE,
  vcVHI_VERSION, vcVHI_MACHINE, vcVHI_DOMAINNAME
}
enum  vcFeatureSet {
  vcFEATURE_VKILL, vcFEATURE_IATTR, vcFEATURE_RLIMIT, vcFEATURE_COMPAT,
  vcFEATURE_MIGRATE, vcFEATURE_NAMESPACE, vcFEATURE_SCHED, vcFEATURE_VINFO,
  vcFEATURE_VHI, vcFEATURE_VSHELPER0, vcFEATURE_VSHELPER
}
enum  vcCfgStyle {
  vcCFG_NONE, vcCFG_AUTO, vcCFG_LEGACY, vcCFG_RECENT_SHORT,
  vcCFG_RECENT_FULL
}

Functions

int vc_syscall (uint32_t cmd, xid_t xid, void *data)
 The generic vserver syscall.
int vc_get_version ()
 Returns the version of the current kernel API.
xid_t vc_new_s_context (xid_t ctx, unsigned int remove_cap, unsigned int flags)
 Moves current process into a context.
int vc_set_ipv4root (uint32_t bcast, size_t nb, struct vc_ip_mask_pair const *ips)
 Sets the ipv4root information.
size_t vc_get_nb_ipv4root () VC_ATTR_CONST
 Returns the value of NB_IPV4ROOT.
xid_t vc_ctx_create (xid_t xid)
 Creates a context without starting it.
int vc_ctx_migrate (xid_t xid)
 Moves the current process into the specified context.
int vc_get_rlimit (xid_t xid, int resource, struct vc_rlimit *lim)
 Returns the limits of resource.
int vc_set_rlimit (xid_t xid, int resource, struct vc_rlimit const *lim)
 Sets the limits of resource.
int vc_get_rlimit_mask (xid_t xid, struct vc_rlimit_mask *lim)
bool vc_parseLimit (char const *str, vc_limit_t *res)
 Parses a string describing a limit.
int vc_ctx_kill (xid_t ctx, pid_t pid, int sig)
 Sends a signal to a context/pid.
nid_t vc_get_task_nid (pid_t pid)
int vc_get_nx_info (nid_t nid, struct vc_nx_info *)
nid_t vc_net_create (nid_t nid)
int vc_net_migrate (nid_t nid)
int vc_net_add (nid_t nid, struct vc_net_nx const *info)
int vc_net_remove (nid_t nid, struct vc_net_nx const *info)
int vc_get_nflags (nid_t, struct vc_net_flags *)
int vc_set_nflags (nid_t, struct vc_net_flags const *)
int vc_get_ncaps (nid_t, struct vc_net_caps *)
int vc_set_ncaps (nid_t, struct vc_net_caps const *)
int vc_set_iattr (char const *filename, xid_t xid, uint_least32_t flags, uint_least32_t mask)
int vc_get_iattr (char const *filename, xid_t *xid, uint_least32_t *flags, uint_least32_t *mask)
 Returns information about attributes and assigned context of a file.
xid_t vc_get_task_xid (pid_t pid)
 Returns the context of the given process.
int vc_get_vx_info (xid_t xid, struct vc_vx_info *info)
int vc_set_vhi_name (xid_t xid, vc_uts_type type, char const *val, size_t len)
int vc_get_vhi_name (xid_t xid, vc_uts_type type, char *val, size_t len)
bool vc_is_dynamic_xid (xid_t xid)
int vc_enter_namespace (xid_t xid)
int vc_set_namespace ()
int vc_cleanup_namespace ()
int vc_get_cflags (xid_t xid, struct vc_ctx_flags *)
int vc_set_cflags (xid_t xid, struct vc_ctx_flags const *)
int vc_get_ccaps (xid_t xid, struct vc_ctx_caps *)
int vc_set_ccaps (xid_t xid, struct vc_ctx_caps const *)
uint_least64_t vc_text2bcap (char const *str, size_t len)
 Converts a single string into bcapability.
char const * vc_lobcap2text (uint_least64_t *val)
 Converts the lowest bit of a bcapability or the entire value (when possible) to a textual representation.
int vc_list2bcap (char const *str, size_t len, struct vc_err_listparser *err, struct vc_ctx_caps *cap)
 Converts a string into a bcapability-bitmask.
uint_least64_t vc_text2ccap (char const *, size_t len)
char const * vc_loccap2text (uint_least64_t *)
int vc_list2ccap (char const *, size_t len, struct vc_err_listparser *err, struct vc_ctx_caps *)
int vc_list2cflag (char const *, size_t len, struct vc_err_listparser *err, struct vc_ctx_flags *flags)
uint_least64_t vc_text2cflag (char const *, size_t len)
char const * vc_locflag2text (uint_least64_t *)
uint_least32_t vc_list2cflag_compat (char const *, size_t len, struct vc_err_listparser *err)
uint_least32_t vc_text2cflag_compat (char const *, size_t len)
char const * vc_hicflag2text_compat (uint_least32_t)
int vc_text2cap (char const *)
char const * vc_cap2text (unsigned int)
int vc_list2nflag (char const *, size_t len, struct vc_err_listparser *err, struct vc_net_flags *flags)
uint_least64_t vc_text2nflag (char const *, size_t len)
char const * vc_lonflag2text (uint_least64_t *)
uint_least64_t vc_text2ncap (char const *, size_t len)
char const * vc_loncap2text (uint_least64_t *)
int vc_list2ncap (char const *, size_t len, struct vc_err_listparser *err, struct vc_net_caps *)
uint_least64_t vc_get_insecurebcaps () VC_ATTR_CONST
xid_t vc_getfilecontext (char const *filename)
 Returns the context of filename.
int vc_set_sched (xid_t xid, struct vc_set_sched const *)
bool vc_isSupported (vcFeatureSet) VC_ATTR_CONST
bool vc_isSupportedString (char const *)
xid_t vc_xidopt2xid (char const *, bool honor_static, char const **err_info)
vcCfgStyle vc_getVserverCfgStyle (char const *id)
char * vc_getVserverName (char const *id, vcCfgStyle style)
char * vc_getVserverCfgDir (char const *id, vcCfgStyle style)
char * vc_getVserverAppDir (char const *id, vcCfgStyle style, char const *app)
char * vc_getVserverVdir (char const *id, vcCfgStyle style, bool physical)
xid_t vc_getVserverCtx (char const *id, vcCfgStyle style, bool honor_static, bool *is_running)
char * vc_getVserverByCtx (xid_t ctx, vcCfgStyle *style, char const *revdir)
int vc_createSkeleton (char const *id, vcCfgStyle style, int flags)


Detailed Description

The public interface of the the libvserver library.

Definition in file vserver.h.


Define Documentation

#define VC_DYNAMIC_XID   ((xid_t)(-1))
 

the value which means a random (the next free) ctx

Definition at line 65 of file vserver.h.

#define VC_NOCTX   ((xid_t)(-1))
 

the value which is returned in error-case (no ctx found)

Definition at line 62 of file vserver.h.

#define VC_SAMECTX   ((xid_t)(-2))
 

the value which means the current ctx

Definition at line 67 of file vserver.h.


Typedef Documentation

typedef uint_least64_t vc_limit_t
 

The type which is used for a single limit value.

Special values are

  • VC_LIM_INFINITY ... which is the infinite value
  • VC_LIM_KEEP ... which is used to mark values which shall not be modified by the vc_set_rlimit() operation.

Else, the interpretation of the value depends on the corresponding resource; it might be bytes, pages, seconds or litres of beer.

Definition at line 312 of file vserver.h.

an_unsigned_integer_type xid_t
 

The identifier of a context.

Definition at line 215 of file vserver.h.


Function Documentation

int vc_createSkeleton char const *  id,
vcCfgStyle  style,
int  flags
 

Create a basic configuration skeleton for a vserver plus toplevel directories for pkgmanagemt and filesystem (when requested).

char* vc_getVserverAppDir char const *  id,
vcCfgStyle  style,
char const *  app
 

Returns the path of the configuration directory for the given application. The result will be allocated and must be freed by the caller.

char* vc_getVserverByCtx xid_t  ctx,
vcCfgStyle *  style,
char const *  revdir
 

Resolves the cfg-path of the vserver owning the given ctx. 'revdir' will be used as the directory holding the mapping-links; when NULL, the default value will be assumed. The result will be allocated and must be freed by the caller.

char* vc_getVserverCfgDir char const *  id,
vcCfgStyle  style
 

Returns the path of the vserver configuration directory. When the given vserver does not exist, or when it does not have such a directory, NULL will be returned. Else, the result will be allocated and must be freed by the caller.

xid_t vc_getVserverCtx char const *  id,
vcCfgStyle  style,
bool  honor_static,
bool *  is_running
 

Returns the ctx of the given vserver. When vserver is not running and 'honor_static' is false, VC_NOCTX will be returned. Else, when 'honor_static' is true and a static assignment exists, those value will be returned. Else, the result will be VC_NOCTX.

When 'is_running' is not null, the status of the vserver will be assigned to this variable.

char* vc_getVserverName char const *  id,
vcCfgStyle  style
 

Resolves the name of the vserver. The result will be allocated and must be freed by the caller.

char* vc_getVserverVdir char const *  id,
vcCfgStyle  style,
bool  physical
 

Returns the path to the vserver root-directory. The result will be allocated and must be freed by the caller.

bool vc_is_dynamic_xid xid_t  xid  ) 
 

Returns true iff xid is a dynamic xid

xid_t vc_xidopt2xid char const *  ,
bool  honor_static,
char const **  err_info
 

Maps an xid given at '--xid' options to an xid_t


Generated on Fri Jan 28 17:47:54 2005 for util-vserver (libvserver) by  doxygen 1.4.1