Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
lcr
提交
d85cb764
L
lcr
项目概览
openeuler
/
lcr
通知
3
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
lcr
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d85cb764
编写于
1月 06, 2020
作者:
L
LiFeng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
lcr: inernal change
Signed-off-by:
N
LiFeng
<
lifeng68@huawei.com
>
上级
0fdbb009
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
110 addition
and
4 deletion
+110
-4
CMakeLists.txt
CMakeLists.txt
+1
-1
lcr.spec
lcr.spec
+2
-2
src/lcrcontainer.c
src/lcrcontainer.c
+100
-0
src/lcrcontainer.h
src/lcrcontainer.h
+5
-1
src/lcrcontainer_execute.c
src/lcrcontainer_execute.c
+2
-0
未找到文件。
CMakeLists.txt
浏览文件 @
d85cb764
...
@@ -5,7 +5,7 @@ include(cmake/set_build_flags.cmake)
...
@@ -5,7 +5,7 @@ include(cmake/set_build_flags.cmake)
option
(
VERSION
"set lcr version"
ON
)
option
(
VERSION
"set lcr version"
ON
)
if
(
VERSION STREQUAL
"ON"
)
if
(
VERSION STREQUAL
"ON"
)
set
(
LCR_VERSION
"1.0.1
7
"
)
set
(
LCR_VERSION
"1.0.1
8
"
)
endif
()
endif
()
option
(
DEBUG
"set lcr gcc option"
ON
)
option
(
DEBUG
"set lcr gcc option"
ON
)
...
...
lcr.spec
浏览文件 @
d85cb764
%global _version 1.0.1
7
%global _version 1.0.1
8
%global _release 20
191222.223702.gita44996d6
%global _release 20
200105.223545.git6259bd3e
Name: lcr
Name: lcr
Version: %{_version}
Version: %{_version}
Release: %{_release}
Release: %{_release}
...
...
src/lcrcontainer.c
浏览文件 @
d85cb764
...
@@ -1592,6 +1592,106 @@ out:
...
@@ -1592,6 +1592,106 @@ out:
return
bret
;
return
bret
;
}
}
bool
lcr_resize
(
const
char
*
name
,
const
char
*
lcrpath
,
unsigned
int
height
,
unsigned
int
width
)
{
struct
lxc_container
*
c
=
NULL
;
const
char
*
tmp_path
=
lcrpath
?
lcrpath
:
LCRPATH
;
bool
bret
=
true
;
clear_error_message
(
&
g_lcr_error
);
if
(
name
==
NULL
)
{
ERROR
(
"Missing container name"
);
return
false
;
}
engine_set_log_prefix
(
name
);
c
=
lxc_container_new
(
name
,
tmp_path
);
if
(
c
==
NULL
)
{
ERROR
(
"Failed to pause container"
);
engine_free_log_prefix
();
return
false
;
}
if
(
!
is_container_exists
(
c
))
{
ERROR
(
"No such container"
);
bret
=
false
;
goto
out_put
;
}
if
(
!
is_container_can_control
(
c
))
{
ERROR
(
"Insufficent privleges to contol"
);
bret
=
false
;
goto
out_put
;
}
if
(
!
lcr_check_container_running
(
c
,
name
))
{
bret
=
false
;
goto
out_put
;
}
if
(
!
c
->
set_terminal_winch
(
c
,
height
,
width
))
{
ERROR
(
"Failed to pause"
);
bret
=
false
;
goto
out_put
;
}
out_put:
lxc_container_put
(
c
);
engine_free_log_prefix
();
return
bret
;
}
bool
lcr_exec_resize
(
const
char
*
name
,
const
char
*
lcrpath
,
const
char
*
suffix
,
unsigned
int
height
,
unsigned
int
width
)
{
struct
lxc_container
*
c
=
NULL
;
const
char
*
tmp_path
=
lcrpath
?
lcrpath
:
LCRPATH
;
bool
bret
=
true
;
clear_error_message
(
&
g_lcr_error
);
if
(
name
==
NULL
)
{
ERROR
(
"Missing container name"
);
return
false
;
}
engine_set_log_prefix
(
name
);
c
=
lxc_container_new
(
name
,
tmp_path
);
if
(
c
==
NULL
)
{
ERROR
(
"Failed to pause container"
);
engine_free_log_prefix
();
return
false
;
}
if
(
!
is_container_exists
(
c
))
{
ERROR
(
"No such container"
);
bret
=
false
;
goto
out_put
;
}
if
(
!
is_container_can_control
(
c
))
{
ERROR
(
"Insufficent privleges to contol"
);
bret
=
false
;
goto
out_put
;
}
if
(
!
lcr_check_container_running
(
c
,
name
))
{
bret
=
false
;
goto
out_put
;
}
if
(
!
c
->
set_exec_terminal_winch
(
c
,
suffix
,
height
,
width
))
{
ERROR
(
"Failed to resize exec terminal"
);
bret
=
false
;
goto
out_put
;
}
out_put:
lxc_container_put
(
c
);
engine_free_log_prefix
();
return
bret
;
}
bool
lcr_console
(
const
char
*
name
,
const
char
*
lcrpath
,
const
char
*
in_fifo
,
const
char
*
out_fifo
,
const
char
*
err_fifo
)
bool
lcr_console
(
const
char
*
name
,
const
char
*
lcrpath
,
const
char
*
in_fifo
,
const
char
*
out_fifo
,
const
char
*
err_fifo
)
{
{
struct
lxc_container
*
c
=
NULL
;
struct
lxc_container
*
c
=
NULL
;
...
...
src/lcrcontainer.h
浏览文件 @
d85cb764
...
@@ -274,6 +274,8 @@ struct lcr_exec_request {
...
@@ -274,6 +274,8 @@ struct lcr_exec_request {
size_t
args_len
;
size_t
args_len
;
int64_t
timeout
;
int64_t
timeout
;
const
char
*
suffix
;
};
};
/*
/*
* Execute process inside a container
* Execute process inside a container
...
@@ -289,7 +291,9 @@ void lcr_free_errmsg();
...
@@ -289,7 +291,9 @@ void lcr_free_errmsg();
bool
lcr_get_container_pids
(
const
char
*
name
,
const
char
*
lcrpath
,
pid_t
**
pids
,
size_t
*
pids_len
);
bool
lcr_get_container_pids
(
const
char
*
name
,
const
char
*
lcrpath
,
pid_t
**
pids
,
size_t
*
pids_len
);
bool
translate_spec
(
const
struct
lxc_container
*
c
,
const
char
*
oci_json_data
,
const
char
*
container_rootfs
);
bool
translate_spec
(
const
struct
lxc_container
*
c
,
const
char
*
oci_json_data
,
const
char
*
container_rootfs
);
bool
lcr_resize
(
const
char
*
name
,
const
char
*
lcrpath
,
unsigned
int
height
,
unsigned
int
width
);
bool
lcr_exec_resize
(
const
char
*
name
,
const
char
*
lcrpath
,
const
char
*
suffix
,
unsigned
int
height
,
unsigned
int
width
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
src/lcrcontainer_execute.c
浏览文件 @
d85cb764
...
@@ -943,6 +943,8 @@ static void execute_lxc_attach(const char *name, const char *path, const struct
...
@@ -943,6 +943,8 @@ static void execute_lxc_attach(const char *name, const char *path, const struct
add_array_elem
(
params
,
args_len
,
&
i
,
request
->
user
);
add_array_elem
(
params
,
args_len
,
&
i
,
request
->
user
);
}
}
add_array_kv
(
params
,
args_len
,
&
i
,
"--suffix"
,
request
->
suffix
);
add_array_elem
(
params
,
args_len
,
&
i
,
"--"
);
add_array_elem
(
params
,
args_len
,
&
i
,
"--"
);
for
(
j
=
0
;
j
<
request
->
args_len
;
j
++
)
{
for
(
j
=
0
;
j
<
request
->
args_len
;
j
++
)
{
add_array_elem
(
params
,
args_len
,
&
i
,
request
->
args
[
j
]);
add_array_elem
(
params
,
args_len
,
&
i
,
request
->
args
[
j
]);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录