Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
iSulad
提交
9c1e5cbd
I
iSulad
项目概览
openeuler
/
iSulad
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
I
iSulad
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9c1e5cbd
编写于
5月 23, 2020
作者:
O
openeuler-ci-bot
提交者:
Gitee
5月 23, 2020
浏览文件
操作
浏览文件
下载
差异文件
!368 dup_json_map_string_string instead by iSula-libutils
Merge pull request !368 from lifeng_isula/fix_dup_json_map
上级
4f64a1eb
6b22d45f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
9 addition
and
64 deletion
+9
-64
src/services/execution/execute/execution.c
src/services/execution/execute/execution.c
+2
-2
src/services/execution/execute/list.c
src/services/execution/execute/list.c
+7
-59
src/services/execution/execute/list.h
src/services/execution/execute/list.h
+0
-3
未找到文件。
src/services/execution/execute/execution.c
浏览文件 @
9c1e5cbd
...
...
@@ -1286,7 +1286,7 @@ static int kill_with_signal(container_t *cont, uint32_t signal)
ret
=
send_signal_to_process
(
cont
->
state
->
state
->
pid
,
cont
->
state
->
state
->
start_time
,
signal
);
if
(
ret
!=
0
)
{
ERROR
(
"Failed to send signal to container %s with signal %
d
"
,
id
,
signal
);
ERROR
(
"Failed to send signal to container %s with signal %
u
"
,
id
,
signal
);
}
if
(
signal
==
SIGKILL
&&
need_unpause
)
{
params
.
rootpath
=
cont
->
root_path
;
...
...
@@ -1298,7 +1298,7 @@ static int kill_with_signal(container_t *cont, uint32_t signal)
}
}
nret
=
snprintf
(
annotations
,
sizeof
(
annotations
),
"signal=%
d
"
,
signal
);
nret
=
snprintf
(
annotations
,
sizeof
(
annotations
),
"signal=%
u
"
,
signal
);
if
(
nret
<
0
||
(
size_t
)
nret
>=
sizeof
(
annotations
))
{
ERROR
(
"Failed to get signal string"
);
ret
=
-
1
;
...
...
src/services/execution/execute/list.c
浏览文件 @
9c1e5cbd
...
...
@@ -94,13 +94,7 @@ cleanup:
return
NULL
;
}
static
const
char
*
accepted_ps_filter_tags
[]
=
{
"id"
,
"label"
,
"name"
,
"status"
,
NULL
};
static
const
char
*
accepted_ps_filter_tags
[]
=
{
"id"
,
"label"
,
"name"
,
"status"
,
NULL
};
static
int
filter_by_name
(
const
struct
list_context
*
ctx
,
const
map_t
*
map_id_name
,
const
map_t
*
matches
,
bool
idsearch
)
{
...
...
@@ -139,7 +133,6 @@ out:
return
ret
;
}
static
int
append_ids
(
const
map_t
*
matches
,
char
***
filtered_ids
)
{
map_itor
*
itor
=
map_itor_new
(
matches
);
...
...
@@ -218,7 +211,6 @@ static char **filter_by_name_id_matches(const struct list_context *ctx, const ma
goto
cleanup
;
}
if
(
insert_matched_id
(
ids
,
matches
,
&
default_value
,
ids_len
)
!=
0
)
{
goto
cleanup
;
}
...
...
@@ -243,44 +235,6 @@ cleanup:
return
filtered_ids
;
}
int
dup_json_map_string_string
(
const
json_map_string_string
*
src
,
json_map_string_string
*
dest
)
{
int
ret
=
0
;
size_t
i
;
if
(
src
->
len
==
0
)
{
return
0
;
}
if
(
src
->
len
>
SIZE_MAX
/
sizeof
(
char
*
))
{
ERROR
(
"Container inspect container config is too much!"
);
ret
=
-
1
;
goto
out
;
}
dest
->
keys
=
util_common_calloc_s
(
src
->
len
*
sizeof
(
char
*
));
if
(
dest
->
keys
==
NULL
)
{
ERROR
(
"Out of memory"
);
ret
=
-
1
;
goto
out
;
}
dest
->
values
=
util_common_calloc_s
(
src
->
len
*
sizeof
(
char
*
));
if
(
dest
->
values
==
NULL
)
{
ERROR
(
"Out of memory"
);
free
(
dest
->
keys
);
dest
->
keys
=
NULL
;
ret
=
-
1
;
goto
out
;
}
for
(
i
=
0
;
i
<
src
->
len
;
i
++
)
{
dest
->
keys
[
i
]
=
util_strdup_s
(
src
->
keys
[
i
]
?
src
->
keys
[
i
]
:
""
);
dest
->
values
[
i
]
=
util_strdup_s
(
src
->
values
[
i
]
?
src
->
values
[
i
]
:
""
);
dest
->
len
++
;
}
out:
return
ret
;
}
char
*
container_get_health_state
(
const
container_config_v2_state
*
cont_state
)
{
if
(
cont_state
==
NULL
||
cont_state
->
health
==
NULL
||
cont_state
->
health
->
status
==
NULL
)
{
...
...
@@ -317,19 +271,16 @@ static int replace_labels(container_container *isuladinfo, json_map_string_strin
return
0
;
}
static
int
replace_annotations
(
const
container_config_v2_common_config
*
common_config
,
container_container
*
isuladinfo
)
static
int
replace_annotations
(
const
container_config_v2_common_config
*
common_config
,
container_container
*
isuladinfo
)
{
if
(
common_config
->
config
->
annotations
!=
NULL
&&
common_config
->
config
->
annotations
->
len
!=
0
)
{
if
(
common_config
->
config
->
annotations
!=
NULL
&&
common_config
->
config
->
annotations
->
len
!=
0
)
{
isuladinfo
->
annotations
=
util_common_calloc_s
(
sizeof
(
json_map_string_string
));
if
(
isuladinfo
->
annotations
==
NULL
)
{
ERROR
(
"Out of memory"
);
return
-
1
;
}
if
(
dup_json_map_string_string
(
common_config
->
config
->
annotations
,
isuladinfo
->
annotations
)
!=
0
)
{
if
(
dup_json_map_string_string
(
common_config
->
config
->
annotations
,
isuladinfo
->
annotations
)
!=
0
)
{
ERROR
(
"Failed to dup annotations"
);
return
-
1
;
}
...
...
@@ -410,7 +361,7 @@ static int container_info_match(const struct list_context *ctx, const map_t *map
cs
=
state_judge_status
(
cont_state
);
if
(
cs
==
CONTAINER_STATUS_CREATED
)
{
if
(
!
filters_args_match
(
ctx
->
ps_filters
,
"status"
,
"created"
)
&&
\
if
(
!
filters_args_match
(
ctx
->
ps_filters
,
"status"
,
"created"
)
&&
!
filters_args_match
(
ctx
->
ps_filters
,
"status"
,
"inited"
))
{
ret
=
-
1
;
goto
out
;
...
...
@@ -430,8 +381,7 @@ out:
return
ret
;
}
static
int
get_cnt_state
(
const
struct
list_context
*
ctx
,
const
container_config_v2_state
*
cont_state
,
const
char
*
name
)
static
int
get_cnt_state
(
const
struct
list_context
*
ctx
,
const
container_config_v2_state
*
cont_state
,
const
char
*
name
)
{
if
(
cont_state
==
NULL
)
{
ERROR
(
"Failed to read %s state"
,
name
);
...
...
@@ -568,8 +518,7 @@ static int do_add_filters(const char *filter_key, const json_map_string_bool *fi
if
(
strcmp
(
filter_key
,
"status"
)
==
0
)
{
if
(
!
is_valid_state_string
(
filter_value
->
keys
[
j
]))
{
ERROR
(
"Unrecognised filter value for status: %s"
,
filter_value
->
keys
[
j
]);
isulad_set_error_message
(
"Unrecognised filter value for status: %s"
,
filter_value
->
keys
[
j
]);
isulad_set_error_message
(
"Unrecognised filter value for status: %s"
,
filter_value
->
keys
[
j
]);
ret
=
-
1
;
goto
out
;
}
...
...
@@ -715,4 +664,3 @@ pack_response:
return
(
cc
==
ISULAD_SUCCESS
)
?
0
:
-
1
;
}
src/services/execution/execute/list.h
浏览文件 @
9c1e5cbd
...
...
@@ -22,8 +22,6 @@
extern
"C"
{
#endif
int
dup_json_map_string_string
(
const
json_map_string_string
*
src
,
json_map_string_string
*
dest
);
int
container_list_cb
(
const
container_list_request
*
request
,
container_list_response
**
response
);
#ifdef __cplusplus
...
...
@@ -31,4 +29,3 @@ int container_list_cb(const container_list_request *request, container_list_resp
#endif
#endif
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录