Syscall wrappers


Functions

int vc_syscall (uint32_t cmd, xid_t xid, void *data)
 The generic vserver syscall

This function executes the generic vserver syscall. It uses the correct syscallnumber (which may differ between the different architectures).

int vc_get_version ()
 Returns the version of the current kernel API.
vc_vci_t vc_get_vci ()
 Returns the kernel configuration bits.
xid_t vc_new_s_context (xid_t ctx, unsigned int remove_cap, unsigned int flags)
 Moves current process into a context

Puts current process into context ctx, removes the capabilities given in remove_cap and sets flags.

int vc_set_ipv4root (uint32_t bcast, size_t nb, struct vc_ip_mask_pair const *ips)
 Sets the ipv4root information.
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.

int vc_ctx_migrate (xid_t xid, uint_least64_t flags)
 Moves the current process into the specified context.
int vc_ctx_stat (xid_t xid, struct vc_ctx_stat *stat)
 Get some statistics about a context.
int vc_virt_stat (xid_t xid, struct vc_virt_stat *stat)
 Get more statistics about a context.
int vc_ctx_kill (xid_t ctx, pid_t pid, int sig)
 Sends a signal to a context/pid

Special values for pid are:

  • -1 which means every process in ctx except the init-process
  • 0 which means every process in ctx inclusive the init-process.

xid_t vc_get_task_xid (pid_t pid)
 Returns the context of the given process.
int vc_wait_exit (xid_t xid)
 Waits for the end of a 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_rlimit_stat (xid_t xid, int resource, struct vc_rlimit_stat *stat)
 Returns the current stats of resource.
int vc_reset_minmax (xid_t xid)
 Resets the minimum and maximum observed values of all resources.
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.

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.


Detailed Description

Functions which are calling the vserver syscall directly.

Function Documentation

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.

Parameters:
xid The new context; special values are:
  • VC_DYNAMIC_XID which means to create a dynamic context
Returns:
the xid of the created context, or VC_NOCTX on errors. errno will be set appropriately.

int vc_ctx_migrate ( xid_t  xid,
uint_least64_t  flags 
)

Moves the current process into the specified context.

Parameters:
xid The new context
flags The flags, see VC_VXM_*
Returns:
0 on success, -1 on errors

int vc_ctx_stat ( xid_t  xid,
struct vc_ctx_stat stat 
)

Get some statistics about a context.

Parameters:
xid The context to get stats about
stat Where to store the result
Returns:
0 on success, -1 on errors.

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.

E.g. to receive the assigned context, the VC_IATTR_XID bit must be set in mask, and xid must point to valid memory.

Possible flags are VC_IATTR_ADMIN, VC_IATTR_WATCH , VC_IATTR_HIDE, VC_IATTR_BARRIER, VC_IATTR_IUNLINK and VC_IATTR_IMMUTABLE.

Parameters:
filename The name of the file whose attributes shall be determined.
xid When non-zero and the VC_IATTR_XID bit is set in mask, the assigned context of filename will be stored there.
flags When non-zero, a bitmask of current attributes will be stored there. These attributes must be requested explicitly by setting the appropriate bit in mask
mask Points to a bitmask which tells which attributes shall be determined. On return, it will masquerade the attributes which were determined.
Precondition:
mask!=0 && !((*mask&VC_IATTR_XID) && xid==0) && !((*mask&~VC_IATTR_XID) && flags==0)

int vc_get_rlimit ( xid_t  xid,
int  resource,
struct vc_rlimit lim 
)

Returns the limits of resource.

Parameters:
xid The id of the context
resource The resource which will be queried
lim The result which will be filled with the limits
Returns:
0 on success, and -1 on errors.

xid_t vc_get_task_xid ( pid_t  pid  ) 

Returns the context of the given process.

Parameters:
pid the process-id whose xid shall be determined; pid==0 means the current process.
Returns:
the xid of process pid or -1 on errors

vc_vci_t vc_get_vci (  ) 

Returns the kernel configuration bits.

Returns:
The kernel configuration bits

int vc_get_version (  ) 

Returns the version of the current kernel API.

Returns:
The versionnumber of the kernel API

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.

WARNING: this function can modify errno although no error happened.

Parameters:
filename The file to check
Returns:
The assigned context, or VC_NOCTX when an error occured or no such assignment exists. errno will be 0 in the latter case

xid_t vc_new_s_context ( xid_t  ctx,
unsigned int  remove_cap,
unsigned int  flags 
)

Moves current process into a context

Puts current process into context ctx, removes the capabilities given in remove_cap and sets flags.

Parameters:
ctx The new context; special values for are
  • VC_SAMECTX which means the current context (just for changing caps and flags)
  • VC_DYNAMIC_XID which means the next free context; this value can be used by ordinary users also
remove_cap The linux capabilities which will be removed.
flags Special flags which will be set.
Returns:
The new context-id, or VC_NOCTX on errors; errno will be set appropriately
See http://vserver.13thfloor.at/Stuff/Logic.txt for details

int vc_reset_minmax ( xid_t  xid  ) 

Resets the minimum and maximum observed values of all resources.

Parameters:
xid The id of the context
Returns:
0 on success, and -1 on errors.

int vc_rlimit_stat ( xid_t  xid,
int  resource,
struct vc_rlimit_stat stat 
)

Returns the current stats of resource.

Parameters:
xid The id of the context
resource The resource which will be queried
stat The result which will be filled with the stats
Returns:
0 on success, and -1 on errors.

int vc_set_ipv4root ( uint32_t  bcast,
size_t  nb,
struct vc_ip_mask_pair const *  ips 
)

Sets the ipv4root information.

Precondition:
nb < NB_IPV4ROOT && ips != 0

int vc_set_rlimit ( xid_t  xid,
int  resource,
struct vc_rlimit const *  lim 
)

Sets the limits of resource.

Parameters:
xid The id of the context
resource The resource which will be queried
lim The new limits
Returns:
0 on success, and -1 on errors.

int vc_syscall ( uint32_t  cmd,
xid_t  xid,
void *  data 
)

The generic vserver syscall

This function executes the generic vserver syscall. It uses the correct syscallnumber (which may differ between the different architectures).

Parameters:
cmd the command to be executed
xid the xid on which the cmd shall be applied
data additional arguments; depends on cmd
Returns:
depends on cmd; usually, -1 stands for an error

int vc_virt_stat ( xid_t  xid,
struct vc_virt_stat stat 
)

Get more statistics about a context.

Parameters:
xid The context to get stats about
stat Where to store the result
Returns:
0 on success, -1 on errors.


Generated on Wed Oct 14 02:53:28 2009 for util-vserver (libvserver) by  doxygen 1.5.9