Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
inclavare-containers
提交
af5043a0
I
inclavare-containers
项目概览
openanolis
/
inclavare-containers
通知
4
Star
7
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
5
列表
看板
标记
里程碑
合并请求
0
分析
仓库
DevOps
项目成员
Pages
I
inclavare-containers
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
5
Issue
5
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
af5043a0
编写于
7月 27, 2020
作者:
J
jiazhiguang
提交者:
jia zhang
7月 27, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update the variable names of occlum process settings
上级
47579ba0
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
39 addition
and
21 deletion
+39
-21
shim/runtime/carrier/constants/constants.go
shim/runtime/carrier/constants/constants.go
+2
-1
shim/runtime/carrier/occlum/config.go
shim/runtime/carrier/occlum/config.go
+36
-20
shim/runtime/carrier/occlum/occlum.go
shim/runtime/carrier/occlum/occlum.go
+1
-0
未找到文件。
shim/runtime/carrier/constants/constants.go
浏览文件 @
af5043a0
...
...
@@ -162,7 +162,7 @@ function buildUnsignedEnclave(){
/bin/cp -f ${occlum_config_path} Occlum.json
fi
# set occlum entrypoint
sed -i "s#/bin#${entry_point}#g" Occlum.json
#
sed -i "s#/bin#${entry_point}#g" Occlum.json
# generate the configuration file Enclave.xml that used by enclave from Occlum.json
/opt/occlum/build/bin/gen_enclave_conf -i Occlum.json -o Enclave.xml
# build occlum image
...
...
@@ -179,6 +179,7 @@ function buildUnsignedEnclave(){
mkdir -p ${rootfs}/${work_dir} || true
/bin/cp -fr .occlum ${rootfs}/${work_dir}
/bin/cp -f Enclave.xml ${rootfs}/${work_dir}
/bin/cp -f Occlum.json ${rootfs}/${work_dir}
popd
}
...
...
shim/runtime/carrier/occlum/config.go
浏览文件 @
af5043a0
...
...
@@ -8,16 +8,18 @@ import (
)
const
(
EnvUserSpaceSize
=
"OCCLUM_USER_SPACE_SIZE"
EnvKernelSpaceHeapSize
=
"OCCLUM_KERNEL_SPACE_HEAP_SIZE"
EnvKernelSpaceStackSize
=
"OCCLUM_KERNEL_SPACE_STACK_SIZE"
EnvMaxNumOfThreads
=
"OCCLUM_MAX_NUM_OF_THREADS"
EnvDefaultStackSize
=
"OCCLUM_DEFAULT_STACK_SIZE"
EnvDefaultHeapSize
=
"OCCLUM_DEFAULT_HEAP_SIZE"
EnvDefaultMmapSize
=
"OCCLUM_DEFAULT_MMAP_SIZE"
EnvProductId
=
"OCCLUM_PRODUCT_ID"
EnvVersionNumber
=
"OCCLUM_VERSION_NUMBER"
EnvDebuggable
=
"OCCLUM_DEBUGGABLE"
UserSpaceSize
=
"OCCLUM_USER_SPACE_SIZE"
KernelSpaceHeapSize
=
"OCCLUM_KERNEL_SPACE_HEAP_SIZE"
KernelSpaceStackSize
=
"OCCLUM_KERNEL_SPACE_STACK_SIZE"
MaxNumOfThreads
=
"OCCLUM_MAX_NUM_OF_THREADS"
ProcessDefaultStackSize
=
"OCCLUM_PROCESS_DEFAULT_STACK_SIZE"
ProcessDefaultHeapSize
=
"OCCLUM_PROCESS_DEFAULT_HEAP_SIZE"
ProcessDefaultMmapSize
=
"OCCLUM_PROCESS_DEFAULT_MMAP_SIZE"
ProductId
=
"OCCLUM_PRODUCT_ID"
VersionNumber
=
"OCCLUM_VERSION_NUMBER"
Debuggable
=
"OCCLUM_DEBUGGABLE"
DefalutEnv
=
"OCCLUM_DEFAULT_ENV"
UntrustedEnv
=
"OCCLUM_UNTRUSTED_ENV"
)
type
OcclumConfig
struct
{
...
...
@@ -69,56 +71,70 @@ func (c *OcclumConfig) ApplyEnvs(envs []string) {
k
:=
items
[
0
]
v
:=
items
[
1
]
switch
k
{
case
Env
UserSpaceSize
:
case
UserSpaceSize
:
c
.
ResourceLimits
.
UserSpaceSize
=
v
break
case
Env
KernelSpaceHeapSize
:
case
KernelSpaceHeapSize
:
c
.
ResourceLimits
.
KernelSpaceHeapSize
=
v
break
case
Env
KernelSpaceStackSize
:
case
KernelSpaceStackSize
:
c
.
ResourceLimits
.
KernelSpaceStackSize
=
v
break
case
Env
MaxNumOfThreads
:
case
MaxNumOfThreads
:
i
,
err
:=
strconv
.
ParseInt
(
v
,
10
,
64
)
if
err
!=
nil
{
logrus
.
Error
(
"ApplyEnvs: parse environment variable %s failed. error: %++v"
,
k
,
err
)
}
c
.
ResourceLimits
.
MaxNumOfThreads
=
i
break
case
Env
DefaultStackSize
:
case
Process
DefaultStackSize
:
c
.
Process
.
DefaultStackSize
=
v
break
case
Env
DefaultHeapSize
:
case
Process
DefaultHeapSize
:
c
.
Process
.
DefaultHeapSize
=
v
break
case
Env
DefaultMmapSize
:
case
Process
DefaultMmapSize
:
c
.
Process
.
DefaultMmapSize
=
v
break
case
Env
ProductId
:
case
ProductId
:
i
,
err
:=
strconv
.
ParseInt
(
v
,
10
,
64
)
if
err
!=
nil
{
logrus
.
Error
(
"ApplyEnvs: parse environment variable %s failed. error: %++v"
,
k
,
err
)
}
c
.
Metadata
.
ProductId
=
i
break
case
Env
VersionNumber
:
case
VersionNumber
:
i
,
err
:=
strconv
.
ParseInt
(
v
,
10
,
64
)
if
err
!=
nil
{
logrus
.
Error
(
"ApplyEnvs: parse environment variable %s failed. error: %++v"
,
k
,
err
)
}
c
.
Metadata
.
VersionNumber
=
i
break
case
Env
Debuggable
:
case
Debuggable
:
i
,
err
:=
strconv
.
ParseBool
(
v
)
if
err
!=
nil
{
logrus
.
Error
(
"ApplyEnvs: parse environment variable %s failed. error: %++v"
,
k
,
err
)
}
c
.
Metadata
.
Debuggable
=
i
break
case
DefalutEnv
:
if
len
(
v
)
>
0
{
c
.
Env
.
Default
=
strings
.
Split
(
v
,
","
)
}
break
case
UntrustedEnv
:
if
len
(
v
)
>
0
{
c
.
Env
.
Untrusted
=
strings
.
Split
(
v
,
","
)
}
break
}
}
}
func
(
c
*
OcclumConfig
)
ApplyEntrypoints
(
entrypoints
[]
string
)
{
c
.
EntryPoints
=
entrypoints
}
func
GetDefaultOcclumConfig
()
*
OcclumConfig
{
return
&
OcclumConfig
{
ResourceLimits
:
ResourceLimits
{
...
...
shim/runtime/carrier/occlum/occlum.go
浏览文件 @
af5043a0
...
...
@@ -359,6 +359,7 @@ func (o *occlum) saveOcclumConfig(path string) error {
}
cfg
:=
GetDefaultOcclumConfig
()
cfg
.
ApplyEnvs
(
o
.
spec
.
Process
.
Env
)
cfg
.
ApplyEntrypoints
([]
string
{
o
.
entryPoints
[
0
]})
bytes
,
err
:=
json
.
Marshal
(
cfg
)
if
err
!=
nil
{
return
err
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录