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:
| |
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 | |
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 |
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.
xid | The new context; special values are:
|
errno
will be set appropriately. int vc_ctx_migrate | ( | xid_t | xid, | |
uint_least64_t | flags | |||
) |
Moves the current process into the specified context.
xid | The new context | |
flags | The flags, see VC_VXM_* |
int vc_ctx_stat | ( | xid_t | xid, | |
struct vc_ctx_stat * | stat | |||
) |
Get some statistics about a context.
xid | The context to get stats about | |
stat | Where to store the result |
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
.
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. |
Returns the limits of resource.
xid | The id of the context | |
resource | The resource which will be queried | |
lim | The result which will be filled with the limits |
xid_t vc_get_task_xid | ( | pid_t | pid | ) |
Returns the context of the given process.
pid | the process-id whose xid shall be determined; pid==0 means the current process. |
pid
or -1 on errors vc_vci_t vc_get_vci | ( | ) |
Returns the kernel configuration bits.
int vc_get_version | ( | ) |
Returns the version of the current 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.
filename | The file to check |
errno
will be 0 in the latter case Moves current process into a context
Puts current process into context ctx, removes the capabilities given in remove_cap and sets flags.
ctx | The new context; special values for are
| |
remove_cap | The linux capabilities which will be removed. | |
flags | Special flags which will be set. |
errno
will be set appropriatelyint vc_reset_minmax | ( | xid_t | xid | ) |
Resets the minimum and maximum observed values of all resources.
xid | The id of the context |
int vc_rlimit_stat | ( | xid_t | xid, | |
int | resource, | |||
struct vc_rlimit_stat * | stat | |||
) |
Returns the current stats of resource.
xid | The id of the context | |
resource | The resource which will be queried | |
stat | The result which will be filled with the stats |
int vc_set_ipv4root | ( | uint32_t | bcast, | |
size_t | nb, | |||
struct vc_ip_mask_pair const * | ips | |||
) |
Sets the ipv4root information.
Sets the limits of resource.
xid | The id of the context | |
resource | The resource which will be queried | |
lim | The new limits |
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).
cmd | the command to be executed | |
xid | the xid on which the cmd shall be applied | |
data | additional arguments; depends on cmd |
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.
xid | The context to get stats about | |
stat | Where to store the result |