util-vserver (libvserver)  0.30.216-pre3126
Data Structures | Macros | Typedefs | Enumerations | Functions
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 <sched.h>
#include <netinet/in.h>
Include dependency graph for vserver.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  vc_ip_mask_pair
 
struct  vc_ctx_flags
 Flags of process-contexts. More...
 
struct  vc_ctx_stat
 Statistics about a context. More...
 
struct  vc_virt_stat
 Contains further statistics about a context. More...
 
struct  vc_ctx_caps
 Capabilities of process-contexts. More...
 
struct  vc_vx_info
 
struct  vc_rlimit_mask
 Masks describing the supported limits. More...
 
struct  vc_rlimit
 The limits of a resources. More...
 
struct  vc_rlimit_stat
 Statistics for a resource limit. More...
 
struct  vc_nx_info
 
struct  vc_net_addr
 
struct  vc_net_flags
 
struct  vc_net_caps
 
struct  vc_ctx_dlimit
 
struct  vc_set_sched
 
struct  vc_sched_info
 
struct  vc_umask
 Namespaces allowed to unshare. More...
 
struct  vc_err_listparser
 Information about parsing errors. More...
 

Macros

#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 VC_CDLIM_UNSET   (0U)
 
#define VC_CDLIM_INFINITY   (~0U)
 
#define VC_CDLIM_KEEP   (~1U)
 
#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_AUDIT_WRITE   29
 
#define VC_CAP_AUDIT_CONTROL   30
 
#define VC_CAP_SETFCAP   31
 
#define VC_CAP_MAC_OVERRIDE   32
 
#define VC_CAP_MAC_ADMIN   33
 
#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_WRITE   0x00000008u
 
#define VC_IATTR_FLAGS   0x0000000fu
 
#define VC_IATTR_BARRIER   0x00010000u
 
#define VC_IATTR_IUNLINK   0x00020000u
 
#define VC_IATTR_IMMUTABLE   0x00040000u
 
#define VC_IATTR_COW   0x00080000u
 
#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_VIRT_TIME   0x00100000ull
 
#define VC_VXF_HIDE_MOUNT   0x01000000ull
 
#define VC_VXF_HIDE_NETIF   0x02000000ull
 
#define VC_VXF_HIDE_VINFO   0x04000000ull
 
#define VC_VXF_STATE_SETUP   (1ULL<<32)
 
#define VC_VXF_STATE_INIT   (1ULL<<33)
 
#define VC_VXF_STATE_ADMIN   (1ULL<<34)
 
#define VC_VXF_SC_HELPER   (1ULL<<36)
 
#define VC_VXF_REBOOT_KILL   (1ULL<<37)
 
#define VC_VXF_PERSISTENT   (1ULL<<38)
 
#define VC_VXF_FORK_RSS   (1ULL<<48)
 
#define VC_VXF_PROLIFIC   (1ULL<<49)
 
#define VC_VXF_IGNEG_NICE   (1ULL<<52)
 
#define VC_VXF_IGNEG_IONICE   (1ULL<<53)
 
#define VC_VXC_SET_UTSNAME   0x00000001ull
 
#define VC_VXC_SET_RLIMIT   0x00000002ull
 
#define VC_VXC_FS_SECURITY   0x00000004ull
 
#define VC_VXC_FS_TRUSTED   0x00000008ull
 
#define VC_VXC_TIOCSTI   0x00000010ull
 
#define VC_VXC_RAW_ICMP   0x00000100ull
 
#define VC_VXC_SYSLOG   0x00001000ull
 
#define VC_VXC_OOM_ADJUST   0x00002000ull
 
#define VC_VXC_AUDIT_CONTROL   0x00004000ull
 
#define VC_VXC_SECURE_MOUNT   0x00010000ull
 
#define VC_VXC_SECURE_REMOUNT   0x00020000ull
 
#define VC_VXC_BINARY_MOUNT   0x00040000ull
 
#define VC_VXC_DEV_MOUNT   0x00080000ull
 
#define VC_VXC_QUOTA_CTL   0x00100000ull
 
#define VC_VXC_ADMIN_MAPPER   0x00200000ull
 
#define VC_VXC_ADMIN_CLOOP   0x00400000ull
 
#define VC_VXC_KTHREAD   0x01000000ull
 
#define VC_VXC_NAMESPACE   0x02000000ull
 
#define VC_VXSM_FILL_RATE   0x0001
 
#define VC_VXSM_INTERVAL   0x0002
 
#define VC_VXSM_FILL_RATE2   0x0004
 
#define VC_VXSM_INTERVAL2   0x0008
 
#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_VXSM_CPU_ID   0x1000
 
#define VC_VXSM_BUCKET_ID   0x2000
 
#define VC_VXSM_IDLE_TIME   0x0200
 
#define VC_VXSM_FORCE   0x0400
 
#define VC_VXSM_MSEC   0x4000
 
#define VC_VXSM_V3_MASK   0x0173
 
#define VC_NXF_INFO_LOCK   0x00000001ull
 
#define VC_NXF_INFO_PRIVATE   0x00000008ull
 
#define VC_NXF_SINGLE_IP   0x00000100ull
 
#define VC_NXF_LBACK_REMAP   0x00000200ull
 
#define VC_NXF_LBACK_ALLOW   0x00000400ull
 
#define VC_NXF_HIDE_NETIF   0x02000000ull
 
#define VC_NXF_HIDE_LBACK   0x04000000ull
 
#define VC_NXF_STATE_SETUP   (1ULL<<32)
 
#define VC_NXF_STATE_ADMIN   (1ULL<<34)
 
#define VC_NXF_SC_HELPER   (1ULL<<36)
 
#define VC_NXF_PERSISTENT   (1ULL<<38)
 
#define VC_NXC_TUN_CREATE   0x00000001ull
 
#define VC_NXC_RAW_ICMP   0x00000100ull
 
#define VC_VLIMIT_NSOCK   16
 
#define VC_VLIMIT_OPENFD   17
 
#define VC_VLIMIT_ANON   18
 
#define VC_VLIMIT_SHMEM   19
 
#define VC_VLIMIT_SEMARY   20
 
#define VC_VLIMIT_NSEMS   21
 
#define VC_VLIMIT_DENTRY   22
 
#define VC_VLIMIT_MAPPED   23
 
#define VC_VCI_NO_DYNAMIC   (1 << 0)
 
#define VC_VCI_PROC_SECURE   (1 << 4)
 
#define VC_VCI_HARDCPU   (1 << 5)
 
#define VC_VCI_IDLELIMIT   (1 << 6)
 
#define VC_VCI_IDLETIME   (1 << 7)
 
#define VC_VCI_COWBL   (1 << 8)
 
#define VC_VCI_FULLCOWBL   (1 << 9)
 
#define VC_VCI_SPACES   (1 << 10)
 
#define VC_VCI_NETV2   (1 << 11)
 
#define VC_VCI_MEMCG   (1 << 12)
 
#define VC_VCI_DEBUG   (1 << 16)
 
#define VC_VCI_HISTORY   (1 << 20)
 
#define VC_VCI_TAGGED   (1 << 24)
 
#define VC_VCI_PPTAG   (1 << 28)
 
#define VC_DATTR_CREATE   0x00000001
 
#define VC_DATTR_OPEN   0x00000002
 
#define VC_DATTR_REMAP   0x00000010
 
#define VC_VXM_SET_INIT   0x00000001
 
#define VC_VXM_SET_REAPER   0x00000002
 
#define VC_NXA_TYPE_IPV4   0x0001
 
#define VC_NXA_TYPE_IPV6   0x0002
 
#define VC_NXA_TYPE_NONE   0x0000
 
#define VC_NXA_TYPE_ANY   0x00FF
 
#define VC_NXA_TYPE_ADDR   0x0010
 
#define VC_NXA_TYPE_MASK   0x0020
 
#define VC_NXA_TYPE_RANGE   0x0040
 
#define VC_NXA_MOD_BCAST   0x0100
 
#define VC_NXA_MOD_LBACK   0x0200
 
#define CLONE_NEWNS   0x00020000
 
#define CLONE_NEWUTS   0x04000000
 
#define CLONE_NEWIPC   0x08000000
 
#define CLONE_NEWUSER   0x10000000
 
#define CLONE_NEWPID   0x20000000
 
#define CLONE_NEWNET   0x40000000
 
#define VC_BAD_PERSONALITY   ((uint_least32_t)(-1))
 
#define vna_v4_ip   s.ip.v4
 
#define vna_v4_ip2   s.ip2.v4
 
#define vna_v4_mask   s.mask.v4
 
#define vna_v6_ip   s.ip.v6
 
#define vna_v6_ip2   s.ip2.v6
 
#define vna_v6_mask   s.mask.v6
 
#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 an_unsigned_integer_type tag_t
 
typedef uint64_t vc_vci_t
 
typedef uint_least64_t vc_limit_t
 The type which is used for a single limit value. More...
 

Enumerations

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, vcFEATURE_VWAIT,
  vcFEATURE_VNET, vcFEATURE_VSTAT, vcFEATURE_PPTAG, vcFEATURE_PIDSPACE,
  vcFEATURE_SPACES, vcFEATURE_PERSISTENT, vcFEATURE_PIVOT_ROOT, vcFEATURE_MEMCG,
  vcFEATURE_DYNAMIC, vcFEATURE_BME
}
 
enum  vcXidType {
  vcTYPE_INVALID, vcTYPE_MAIN, vcTYPE_WATCH, vcTYPE_STATIC,
  vcTYPE_DYNAMIC
}
 
enum  vcCfgStyle {
  vcCFG_NONE, vcCFG_AUTO, vcCFG_LEGACY, vcCFG_RECENT_SHORT,
  vcCFG_RECENT_FULL
}
 
enum  vcCtxType { vcCTX_XID = 1, vcCTX_NID, vcCTX_TAG }
 

Functions

int vc_syscall (uint32_t cmd, xid_t xid, void *data)
 The generic vserver syscallThis function executes the generic vserver syscall. It uses the correct syscallnumber (which may differ between the different architectures). More...
 
int vc_get_version ()
 Returns the version of the current kernel API. More...
 
vc_vci_t vc_get_vci ()
 Returns the kernel configuration bits. More...
 
int vc_get_kernel ()
 
xid_t vc_new_s_context (xid_t ctx, unsigned int remove_cap, unsigned int flags)
 Moves current process into a contextPuts current process into context ctx, removes the capabilities given in remove_cap and sets flags. More...
 
int vc_set_ipv4root (uint32_t bcast, size_t nb, struct vc_ip_mask_pair const *ips)
 Sets the ipv4root information. More...
 
size_t vc_get_nb_ipv4root () VC_ATTR_CONST
 Returns the value of NB_IPV4ROOT.This function returns the value of NB_IPV4ROOT which was used when the library was built, but not the value which is used by the currently running kernel.
 
xid_t vc_ctx_create (xid_t xid, struct vc_ctx_flags *flags)
 Creates a context without starting it.This functions initializes a new context. When already in a freshly created context, this old context will be discarded. More...
 
int vc_ctx_migrate (xid_t xid, uint_least64_t flags)
 Moves the current process into the specified context. More...
 
int vc_ctx_stat (xid_t xid, struct vc_ctx_stat *stat)
 Get some statistics about a context. More...
 
int vc_virt_stat (xid_t xid, struct vc_virt_stat *stat)
 Get more statistics about a context. More...
 
int vc_ctx_kill (xid_t ctx, pid_t pid, int sig)
 Sends a signal to a context/pidSpecial values for pid are: More...
 
int vc_get_cflags (xid_t xid, struct vc_ctx_flags *)
 
int vc_set_cflags (xid_t xid, struct vc_ctx_flagsconst *)
 
int vc_get_ccaps (xid_t xid, struct vc_ctx_caps *)
 
int vc_set_ccaps (xid_t xid, struct vc_ctx_caps const *)
 
int vc_get_vx_info (xid_t xid, struct vc_vx_info *info)
 
xid_t vc_get_task_xid (pid_t pid)
 Returns the context of the given process. More...
 
int vc_wait_exit (xid_t xid)
 Waits for the end of a context.
 
int vc_get_rlimit_mask (xid_t xid, struct vc_rlimit_mask *lim)
 Returns the limits supported by the kernel.
 
int vc_get_rlimit (xid_t xid, int resource, struct vc_rlimit *lim)
 Returns the limits of resource. More...
 
int vc_set_rlimit (xid_t xid, int resource, struct vc_rlimit const *lim)
 Sets the limits of resource. More...
 
int vc_rlimit_stat (xid_t xid, int resource, struct vc_rlimit_stat *stat)
 Returns the current stats of resource. More...
 
int vc_reset_minmax (xid_t xid)
 Resets the minimum and maximum observed values of all resources. More...
 
bool vc_parseLimit (char const *str, vc_limit_t *res)
 Parses a string describing a limitThis function parses str and interprets special words like "inf" or suffixes. Valid suffixes are. More...
 
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_addr const *info)
 
int vc_net_remove (nid_t nid, struct vc_net_addr 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_fset_iattr (int fd, 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.This function returns the VC_IATTR_XXX flags and about the assigned context of a file. To request an information, the appropriate bit in mask must be set and the corresponding parameter (xid or flags) must not be NULL. More...
 
int vc_fget_iattr (int fd, xid_t *xid, uint_least32_t *flags, uint_least32_t *mask)
 
xid_t vc_getfilecontext (char const *filename)
 Returns the context of filename This function calls vc_get_iattr() with appropriate arguments to determine the context of filename. In error-case or when no context is assigned, VC_NOCTX will be returned. To differ between both cases, errno must be examined. More...
 
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)
 
int vc_enter_namespace (xid_t xid, uint_least64_t mask, uint32_t index)
 
int vc_set_namespace (xid_t xid, uint_least64_t mask, uint32_t index)
 
int vc_cleanup_namespace (void)
 
uint_least64_t vc_get_space_mask (void)
 
uint_least64_t vc_get_space_default (void)
 
int vc_add_dlimit (char const *filename, xid_t xid, uint_least32_t flags)
 
int vc_rem_dlimit (char const *filename, xid_t xid, uint_least32_t flags)
 
int vc_set_dlimit (char const *filename, xid_t xid, uint_least32_t flags, struct vc_ctx_dlimit const *limits)
 
int vc_get_dlimit (char const *filename, xid_t xid, uint_least32_t flags, struct vc_ctx_dlimit *limits)
 
tag_t vc_get_task_tag (pid_t pid)
 
int vc_tag_create (tag_t tag)
 
int vc_tag_migrate (tag_t tag)
 
int vc_set_sched (xid_t xid, struct vc_set_sched const *)
 
int vc_get_sched (xid_t xid, struct vc_set_sched *)
 
int vc_sched_info (xid_t xid, struct vc_sched_info *info)
 
int vc_set_mapping (xid_t xid, const char *device, const char *target, uint32_t flags)
 
int vc_unset_mapping (xid_t xid, const char *device, const char *target, uint32_t flags)
 
int vc_get_badness (xid_t xid, int64_t *badness)
 
int vc_set_badness (xid_t xid, int64_t badness)
 
int vc_get_umask (xid_t xid, struct vc_umask *umask)
 
int vc_set_umask (xid_t xid, struct vc_umask const *umask)
 
uint_least64_t vc_text2bcap (char const *str, size_t len)
 Converts a single string into bcapability. More...
 
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. More...
 
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-bitmaskSyntax of str:

LIST   <- ELEM  | ELEM ',' LIST
ELEM   <- '~' ELEM | MASK | NAME
MASK   <- NUMBER | '^' NUMBER
NUMBER <- 0[0-7]* | [1-9][0-9]* | 0x[0-9,a-f]+
NAME   <- <literal name> | "all" | "any" | "none"

. More...

 
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 *)
 
char const * vc_loumask2text (uint_least64_t *)
 
int vc_list2umask (char const *, size_t len, struct vc_err_listparser *err, struct vc_umask *)
 
int vc_list2cflag (char const *, size_t len, struct vc_err_listparser *err, struct vc_ctx_flags *flags)
 
uint_least64_t vc_text2umask (char const *str, size_t len)
 
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
 
uint_least32_t vc_text2personalityflag (char const *str, size_t len)
 
char const * vc_lopersonality2text (uint_least32_t *)
 
int vc_list2personalityflag (char const *, size_t len, uint_least32_t *personality, struct vc_err_listparser *err)
 
uint_least32_t vc_str2personalitytype (char const *, size_t len)
 
bool vc_isSupported (vcFeatureSet) VC_ATTR_CONST
 
bool vc_isSupportedString (char const *)
 
vcXidType vc_getXIDType (xid_t xid) VC_ATTR_CONST
 
bool vc_is_dynamic_xid (xid_t xid)
 
xid_t vc_xidopt2xid (char const *, bool honor_static, char const **err_info)
 
nid_t vc_nidopt2nid (char const *, bool honor_static, char const **err_info)
 
tag_t vc_tagopt2tag (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, vcCtxType type)
 
char * vc_getVserverByCtx (xid_t ctx, vcCfgStyle *style, char const *revdir)
 
int vc_compareVserverById (char const *lhs, vcCfgStyle lhs_style, char const *rhs, vcCfgStyle rhs_style)
 
void vc_exitLikeProcess (int pid, int ret)
 
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.

Macro Definition Documentation

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

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

Definition at line 67 of file vserver.h.

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

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

Definition at line 64 of file vserver.h.

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

the value which means the current ctx

Definition at line 69 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 568 of file vserver.h.

an_unsigned_integer_type xid_t

The identifier of a context.

Definition at line 361 of file vserver.h.

Function Documentation

int vc_add_dlimit ( char const *  filename,
xid_t  xid,
uint_least32_t  flags 
)

Add a disk limit to a file system.

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).

int vc_get_dlimit ( char const *  filename,
xid_t  xid,
uint_least32_t  flags,
struct vc_ctx_dlimit limits 
)

Get a disk limit.

tag_t vc_get_task_tag ( pid_t  pid)

Get the filesystem tag for a process.

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,
vcCtxType  type 
)

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

nid_t vc_nidopt2nid ( char const *  ,
bool  honor_static,
char const **  err_info 
)

Maps a nid given at '–nid' options to a nid_t

int vc_rem_dlimit ( char const *  filename,
xid_t  xid,
uint_least32_t  flags 
)

Remove a disk limit from a file system.

int vc_set_dlimit ( char const *  filename,
xid_t  xid,
uint_least32_t  flags,
struct vc_ctx_dlimit const *  limits 
)

Set a disk limit.

int vc_tag_create ( tag_t  tag)

Create a new filesystem tag space.

int vc_tag_migrate ( tag_t  tag)

Migrate to an existing filesystem tag space.

tag_t vc_tagopt2tag ( char const *  ,
bool  honor_static,
char const **  err_info 
)

Maps a tag given at '–tag' options to a tag_t

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

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