Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
iSulad
提交
de7e6125
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,发现更多精彩内容 >>
提交
de7e6125
编写于
6月 30, 2020
作者:
L
lifeng68
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refact: move container event handler to events
Signed-off-by:
N
lifeng68
<
lifeng68@huawei.com
>
上级
1e648e7b
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
29 addition
and
29 deletion
+29
-29
src/daemon/modules/container/container_unix.c
src/daemon/modules/container/container_unix.c
+2
-2
src/daemon/modules/container/container_unix.h
src/daemon/modules/container/container_unix.h
+1
-1
src/daemon/modules/events/collector.c
src/daemon/modules/events/collector.c
+1
-1
src/daemon/modules/events/container_events_handler.c
src/daemon/modules/events/container_events_handler.c
+14
-14
src/daemon/modules/events/container_events_handler.h
src/daemon/modules/events/container_events_handler.h
+11
-11
未找到文件。
src/daemon/modules/container/container_unix.c
浏览文件 @
de7e6125
...
...
@@ -112,7 +112,7 @@ container_t *container_new(const char *runtime, const char *rootpath, const char
goto
error_out
;
}
cont
->
handler
=
events_handler_new
();
cont
->
handler
=
container_
events_handler_new
();
if
(
cont
->
handler
==
NULL
)
{
ERROR
(
"Out of memory"
);
goto
error_out
;
...
...
@@ -163,7 +163,7 @@ void container_free(container_t *container)
restart_manager_unref
(
container
->
rm
);
events_handler_free
(
container
->
handler
);
container_
events_handler_free
(
container
->
handler
);
health_check_manager_free
(
container
->
health_check
);
...
...
src/daemon/modules/container/container_unix.h
浏览文件 @
de7e6125
...
...
@@ -47,7 +47,7 @@ typedef struct _container_t_ {
container_state_t
*
state
;
host_config
*
hostconfig
;
restart_manager_t
*
rm
;
events_handler_t
*
handler
;
container_
events_handler_t
*
handler
;
health_check_manager_t
*
health_check
;
/* log configs of container */
...
...
src/daemon/modules/events/collector.c
浏览文件 @
de7e6125
...
...
@@ -828,7 +828,7 @@ static int post_event_to_events_hander(const struct isulad_events_format *events
return
0
;
}
if
(
events_handler_post_events
(
events
))
{
if
(
container_
events_handler_post_events
(
events
))
{
ERROR
(
"Failed to post events to events handler:%s"
,
events
->
id
);
ret
=
-
1
;
goto
out
;
...
...
src/daemon/modules/
container
/container_events_handler.c
→
src/daemon/modules/
events
/container_events_handler.c
浏览文件 @
de7e6125
/******************************************************************************
* Copyright (c) Huawei Technologies Co., Ltd. 20
17-2019
. All rights reserved.
* Copyright (c) Huawei Technologies Co., Ltd. 20
20
. All rights reserved.
* iSulad licensed under the Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
...
...
@@ -8,9 +8,9 @@
* IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
* PURPOSE.
* See the Mulan PSL v2 for more details.
* Author:
tany
ifeng
* Create: 20
17-11
-22
* Description: provide container events handler
functions
* Author:
l
ifeng
* Create: 20
20-06
-22
* Description: provide container events handler
definition
******************************************************************************/
#include <stdlib.h>
#include <string.h>
...
...
@@ -31,7 +31,7 @@
#include "plugin.h"
/* events handler lock */
static
void
events_handler_lock
(
events_handler_t
*
handler
)
static
void
events_handler_lock
(
container_
events_handler_t
*
handler
)
{
if
(
pthread_mutex_lock
(
&
(
handler
->
mutex
))
!=
0
)
{
ERROR
(
"Failed to lock events handler"
);
...
...
@@ -39,7 +39,7 @@ static void events_handler_lock(events_handler_t *handler)
}
/* events handler unlock */
static
void
events_handler_unlock
(
events_handler_t
*
handler
)
static
void
events_handler_unlock
(
container_
events_handler_t
*
handler
)
{
if
(
pthread_mutex_unlock
(
&
(
handler
->
mutex
))
!=
0
)
{
ERROR
(
"Failed to unlock events handler"
);
...
...
@@ -47,7 +47,7 @@ static void events_handler_unlock(events_handler_t *handler)
}
/* events handler free */
void
events_handler_free
(
events_handler_t
*
handler
)
void
container_events_handler_free
(
container_
events_handler_t
*
handler
)
{
struct
isulad_events_format
*
event
=
NULL
;
struct
linked_list
*
it
=
NULL
;
...
...
@@ -71,12 +71,12 @@ void events_handler_free(events_handler_t *handler)
}
/* events handler new */
events_handler_t
*
events_handler_new
()
container_events_handler_t
*
container_
events_handler_new
()
{
int
ret
;
events_handler_t
*
handler
=
NULL
;
container_
events_handler_t
*
handler
=
NULL
;
handler
=
util_common_calloc_s
(
sizeof
(
events_handler_t
));
handler
=
util_common_calloc_s
(
sizeof
(
container_
events_handler_t
));
if
(
handler
==
NULL
)
{
ERROR
(
"Out of memory"
);
return
NULL
;
...
...
@@ -95,7 +95,7 @@ events_handler_t *events_handler_new()
return
handler
;
cleanup:
events_handler_free
(
handler
);
container_
events_handler_free
(
handler
);
return
NULL
;
}
...
...
@@ -191,7 +191,7 @@ out:
return
ret
;
}
static
int
handle_one
(
container_t
*
cont
,
events_handler_t
*
handler
)
static
int
handle_one
(
container_t
*
cont
,
container_
events_handler_t
*
handler
)
{
struct
linked_list
*
it
=
NULL
;
struct
isulad_events_format
*
events
=
NULL
;
...
...
@@ -231,7 +231,7 @@ static void *events_handler_thread(void *args)
int
ret
=
0
;
char
*
name
=
args
;
container_t
*
cont
=
NULL
;
events_handler_t
*
handler
=
NULL
;
container_
events_handler_t
*
handler
=
NULL
;
ret
=
pthread_detach
(
pthread_self
());
if
(
ret
!=
0
)
{
...
...
@@ -264,7 +264,7 @@ out:
}
/* events handler post events */
int
events_handler_post_events
(
const
struct
isulad_events_format
*
event
)
int
container_
events_handler_post_events
(
const
struct
isulad_events_format
*
event
)
{
int
ret
=
0
;
char
*
name
=
NULL
;
...
...
src/daemon/modules/
container
/container_events_handler.h
→
src/daemon/modules/
events
/container_events_handler.h
浏览文件 @
de7e6125
/******************************************************************************
* Copyright (c) Huawei Technologies Co., Ltd. 20
17-2019
. All rights reserved.
* Copyright (c) Huawei Technologies Co., Ltd. 20
20
. All rights reserved.
* iSulad licensed under the Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
...
...
@@ -8,12 +8,12 @@
* IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
* PURPOSE.
* See the Mulan PSL v2 for more details.
* Author:
tany
ifeng
* Create: 20
17-11
-22
* Author:
l
ifeng
* Create: 20
20-06
-22
* Description: provide container events handler definition
******************************************************************************/
#ifndef __EVENTS_HANDLER_H
#define __EVENTS_HANDLER_H
#ifndef __
CONTAINER_
EVENTS_HANDLER_H
#define __
CONTAINER_
EVENTS_HANDLER_H
#include <stdint.h>
#include <pthread.h>
...
...
@@ -21,17 +21,17 @@
#include "libisulad.h"
typedef
struct
_events_handler_t
{
typedef
struct
_
container_
events_handler_t
{
pthread_mutex_t
mutex
;
bool
init_mutex
;
struct
linked_list
events_list
;
bool
has_handler
;
}
events_handler_t
;
}
container_
events_handler_t
;
events_handler_t
*
events_handler_new
();
container_events_handler_t
*
container_
events_handler_new
();
void
events_handler_free
(
events_handler_t
*
handler
);
void
container_events_handler_free
(
container_
events_handler_t
*
handler
);
int
events_handler_post_events
(
const
struct
isulad_events_format
*
event
);
int
container_
events_handler_post_events
(
const
struct
isulad_events_format
*
event
);
#endif
/* __EVENTS_HANDLER_H */
#endif
/* __
CONTAINER_
EVENTS_HANDLER_H */
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录