LVE userland API
currently LVE userland API consist two files lve-ctl.h and liblve.a for static linking.
Check ability
- int lve_is_available(void);
return 1 if lve is available
0 otherwise.
Admin functions
- int lve_set_default(uint32_t cpu, uint32_t io);
set default parameters for newly created light weight virtual environments.
args:
cpu - default CPU power
io - default IO priority
return codes:
0 OK, otherwise is error.
- int lve_create(uint32_t ve_id);
create custom configured virtual environment
args:
ve_id = id associated with new created LVE
- int lve_destroy(uint32_t ve_id);
destroy configured virtual environment
args:
ve_id = id associated with LVE
- int lve_setup(uint32_t ve_id, int32_t cpu, int32_t io)
adjust parameters for virtual environment
args:
ve_id = id associated with LVE
cpu - CPU power, -1 if don't adjust
io - IO priority, -1 if don't set
application functions
- int lve_instance_init(struct liblve *lve);
create lve library instance
args
libvlve - pointer to allocated memory to store per instance info
or NULL to return how many memory need for per
instance structure.
return codes:
> 0, size of lve instance structure, if liblve == NULL.
0 = if instance is correctly init.
< 0, if any error is hit
- int lve_instance_destroy(struct liblve *lve)
destroy lve library instance
args:
lve = fully init liblve instance
- int lve_enter(struct liblve *lve, uint32_t ve_id,uint32_t uid, uint32_t gid, uint32_t *cookie);
enter into virtual environment (puts current process in LVE)
args:
lve = pointer to fully init lve library instance.
ve_id = id associated with LVE
uid =user id to switch, -1 if switch not need.(NOT USED, should always be -1)
gid =group id to switch, -1 if switch not need.(NOT USED, should always be -1)
cookie = pointer to cookie, which returned if task correctly migrated
in LVE and used to leave from this LVEreturn codes:
0 = none error,
all less zero is errors:
-EPERM - don't have permission to call, or called from outside root VE
-ENOMEM - don't have memory to allocate new VE
-EFAULT - cookie is bad pointer
- int lve_leave(struct liblve *lve, uint32_t *cookie);
leave from virtual environment, if fatal error is occurred task will be killed.
arguments:
lve = pointer to fully init lve library instance.
cookie - pointer to cookie returned from lve_enter.
return codes:
0 = none error, all less zero is errors:
-ESRCH = task not in virtual environment
