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

Syscall wrappers


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.
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_ctx_kill (xid_t ctx, pid_t pid, int sig)
 Sends a signal to a context/pid.
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.
xid_t vc_getfilecontext (char const *filename)
 Returns the context of filename.

Detailed Description

Functions which are calling the vserver syscall directly.

Function Documentation

xid_t vc_ctx_create xid_t  xid  ) 
 

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_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

int vc_ctx_migrate xid_t  xid  ) 
 

Moves the current process into the specified context.

Parameters:
xid The new context
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

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_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


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