Add PAL version api
This commit is contained in:
parent
f9486bf7a9
commit
0bb1cbfbb5
@ -5,6 +5,18 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Occlum PAL API version number
|
||||
*/
|
||||
#define OCCLUM_PAL_VERSION 1
|
||||
|
||||
/*
|
||||
* @brief Get version of Occlum PAL API
|
||||
*
|
||||
* @retval If > 0, then success; otherwise, it is an invalid version.
|
||||
*/
|
||||
int occlum_pal_get_version(void);
|
||||
|
||||
/*
|
||||
* Occlum PAL attributes
|
||||
*/
|
||||
|
@ -1,5 +1,6 @@
|
||||
{
|
||||
global:
|
||||
occlum_pal_get_version;
|
||||
occlum_pal_init;
|
||||
occlum_pal_exec;
|
||||
occlum_pal_destroy;
|
||||
|
@ -6,6 +6,10 @@
|
||||
#include "pal_syscall.h"
|
||||
#include "errno2str.h"
|
||||
|
||||
int occlum_pal_get_version(void) {
|
||||
return OCCLUM_PAL_VERSION;
|
||||
}
|
||||
|
||||
int occlum_pal_init(const struct occlum_pal_attr* attr) {
|
||||
errno = 0;
|
||||
|
||||
|
@ -26,6 +26,12 @@ int main(int argc, char* argv[]) {
|
||||
const char* cmd_path = (const char*) argv[1];
|
||||
const char** cmd_args = (const char**) &argv[2];
|
||||
|
||||
// Check Occlum PAL version
|
||||
int pal_version = occlum_pal_get_version();
|
||||
if (pal_version <= 0) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
// Init Occlum PAL
|
||||
struct occlum_pal_attr attr = OCCLUM_PAL_ATTR_INITVAL;
|
||||
attr.instance_dir = get_instance_dir();
|
||||
|
Loading…
Reference in New Issue
Block a user