Fix the demo for the embedded mode
This commit is contained in:
parent
df71872f76
commit
ad077d644a
@ -42,8 +42,9 @@ int main(int argc, char* argv[]) {
|
|||||||
const char* total_bytes_str = argv[1];
|
const char* total_bytes_str = argv[1];
|
||||||
|
|
||||||
// Init Occlum PAL
|
// Init Occlum PAL
|
||||||
const char* occlum_instance_dir = ".occlum";
|
occlum_pal_attr_t pal_attr = OCCLUM_PAL_ATTR_INITVAL;
|
||||||
if (occlum_pal_init(occlum_instance_dir) < 0) {
|
pal_attr.instance_dir = ".occlum";
|
||||||
|
if (occlum_pal_init(&pal_attr) < 0) {
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ extern "C" {
|
|||||||
/*
|
/*
|
||||||
* Occlum PAL attributes
|
* Occlum PAL attributes
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct occlum_pal_attr {
|
||||||
// Occlum instance dir.
|
// Occlum instance dir.
|
||||||
//
|
//
|
||||||
// Specifies the path of an Occlum instance directory. Usually, this
|
// Specifies the path of an Occlum instance directory. Usually, this
|
||||||
@ -36,11 +36,11 @@ typedef struct {
|
|||||||
/*
|
/*
|
||||||
* The struct which consists of file descriptors of standard I/O
|
* The struct which consists of file descriptors of standard I/O
|
||||||
*/
|
*/
|
||||||
struct occlum_stdio_fds {
|
typedef struct occlum_stdio_fds {
|
||||||
int stdin_fd;
|
int stdin_fd;
|
||||||
int stdout_fd;
|
int stdout_fd;
|
||||||
int stderr_fd;
|
int stderr_fd;
|
||||||
};
|
} occlum_stdio_fds_t;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @brief Initialize an Occlum enclave
|
* @brief Initialize an Occlum enclave
|
||||||
@ -49,7 +49,7 @@ struct occlum_stdio_fds {
|
|||||||
*
|
*
|
||||||
* @retval If 0, then success; otherwise, check errno for the exact error type.
|
* @retval If 0, then success; otherwise, check errno for the exact error type.
|
||||||
*/
|
*/
|
||||||
int occlum_pal_init(occlum_pal_attr_t* attr);
|
int occlum_pal_init(const struct occlum_pal_attr* attr);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @brief Execute a command inside the Occlum enclave
|
* @brief Execute a command inside the Occlum enclave
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include "pal_log.h"
|
#include "pal_log.h"
|
||||||
#include "pal_syscall.h"
|
#include "pal_syscall.h"
|
||||||
|
|
||||||
int occlum_pal_init(occlum_pal_attr_t* attr) {
|
int occlum_pal_init(const struct occlum_pal_attr* attr) {
|
||||||
errno = 0;
|
errno = 0;
|
||||||
|
|
||||||
if (attr == NULL) {
|
if (attr == NULL) {
|
||||||
|
@ -25,7 +25,7 @@ int main(int argc, char* argv[]) {
|
|||||||
const char** cmd_args = (const char**) &argv[2];
|
const char** cmd_args = (const char**) &argv[2];
|
||||||
|
|
||||||
// Init Occlum PAL
|
// Init Occlum PAL
|
||||||
occlum_pal_attr_t attr = OCCLUM_PAL_ATTR_INITVAL;
|
struct occlum_pal_attr attr = OCCLUM_PAL_ATTR_INITVAL;
|
||||||
attr.instance_dir = get_instance_dir();
|
attr.instance_dir = get_instance_dir();
|
||||||
attr.log_level = getenv("OCCLUM_LOG_LEVEL");
|
attr.log_level = getenv("OCCLUM_LOG_LEVEL");
|
||||||
if (occlum_pal_init(&attr) < 0) {
|
if (occlum_pal_init(&attr) < 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user