Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
2e187bcb
L
libvirt
项目概览
openeuler
/
libvirt
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
libvirt
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2e187bcb
编写于
2月 26, 2009
作者:
D
Daniel P. Berrange
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add support for a exec callback in virExecWithHook
上级
66780313
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
55 addition
and
10 deletion
+55
-10
ChangeLog
ChangeLog
+6
-0
src/libvirt_private.syms
src/libvirt_private.syms
+1
-0
src/util.c
src/util.c
+33
-10
src/util.h
src/util.h
+15
-0
未找到文件。
ChangeLog
浏览文件 @
2e187bcb
Thu Feb 26 16:01:04 GMT 2009 Daniel P. Berrange <berrange@redhat.com>
* src/libvirt_private.syms, src/util.c, src/util.h: Add new
virExecWithHook function to allow passing of a callback to run
between fork() & exec()
Thu Feb 26 17:13:09 CET 2009 Daniel Veillard <veillard@redhat.com>
* Makefile.am configure.in examples/hellolibvirt/Makefile.am
...
...
src/libvirt_private.syms
浏览文件 @
2e187bcb
...
...
@@ -294,6 +294,7 @@ virEnumToString;
virEventAddHandle;
virEventRemoveHandle;
virExec;
virExecWithHook;
virSetCloseExec;
virSetNonBlock;
virFormatMacAddr;
...
...
src/util.c
浏览文件 @
2e187bcb
...
...
@@ -202,7 +202,10 @@ __virExec(virConnectPtr conn,
const
fd_set
*
keepfd
,
pid_t
*
retpid
,
int
infd
,
int
*
outfd
,
int
*
errfd
,
int
flags
)
{
int
flags
,
virExecHook
hook
,
void
*
data
)
{
pid_t
pid
;
int
null
,
i
,
openmax
;
int
pipeout
[
2
]
=
{
-
1
,
-
1
};
...
...
@@ -416,6 +419,9 @@ __virExec(virConnectPtr conn,
childerr
!=
childout
)
close
(
childerr
);
if
(
hook
)
(
hook
)(
data
);
if
(
envp
)
execve
(
argv
[
0
],
(
char
**
)
argv
,
(
char
**
)
envp
);
else
...
...
@@ -450,13 +456,16 @@ __virExec(virConnectPtr conn,
}
int
virExec
(
virConnectPtr
conn
,
const
char
*
const
*
argv
,
const
char
*
const
*
envp
,
const
fd_set
*
keepfd
,
pid_t
*
retpid
,
int
infd
,
int
*
outfd
,
int
*
errfd
,
int
flags
)
{
virExecWithHook
(
virConnectPtr
conn
,
const
char
*
const
*
argv
,
const
char
*
const
*
envp
,
const
fd_set
*
keepfd
,
pid_t
*
retpid
,
int
infd
,
int
*
outfd
,
int
*
errfd
,
int
flags
,
virExecHook
hook
,
void
*
data
)
{
char
*
argv_str
;
if
((
argv_str
=
virArgvToString
(
argv
))
==
NULL
)
{
...
...
@@ -467,7 +476,21 @@ virExec(virConnectPtr conn,
VIR_FREE
(
argv_str
);
return
__virExec
(
conn
,
argv
,
envp
,
keepfd
,
retpid
,
infd
,
outfd
,
errfd
,
flags
);
flags
,
hook
,
data
);
}
int
virExec
(
virConnectPtr
conn
,
const
char
*
const
*
argv
,
const
char
*
const
*
envp
,
const
fd_set
*
keepfd
,
pid_t
*
retpid
,
int
infd
,
int
*
outfd
,
int
*
errfd
,
int
flags
)
{
return
virExecWithHook
(
conn
,
argv
,
envp
,
keepfd
,
retpid
,
infd
,
outfd
,
errfd
,
flags
,
NULL
,
NULL
);
}
static
int
...
...
@@ -585,7 +608,7 @@ virRun(virConnectPtr conn,
if
((
execret
=
__virExec
(
conn
,
argv
,
NULL
,
NULL
,
&
childpid
,
-
1
,
&
outfd
,
&
errfd
,
VIR_EXEC_NONE
))
<
0
)
{
VIR_EXEC_NONE
,
NULL
,
NULL
))
<
0
)
{
ret
=
execret
;
goto
error
;
}
...
...
src/util.h
浏览文件 @
2e187bcb
...
...
@@ -41,6 +41,21 @@ enum {
int
virSetNonBlock
(
int
fd
);
int
virSetCloseExec
(
int
fd
);
/* This will execute in the context of the first child
* after fork() but before execve() */
typedef
int
(
*
virExecHook
)(
void
*
data
);
int
virExecWithHook
(
virConnectPtr
conn
,
const
char
*
const
*
argv
,
const
char
*
const
*
envp
,
const
fd_set
*
keepfd
,
int
*
retpid
,
int
infd
,
int
*
outfd
,
int
*
errfd
,
int
flags
,
virExecHook
hook
,
void
*
data
);
int
virExec
(
virConnectPtr
conn
,
const
char
*
const
*
argv
,
const
char
*
const
*
envp
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录