Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
8035f2e6
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看板
提交
8035f2e6
编写于
9月 07, 2014
作者:
M
Martin Kletzander
1
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove redundant pidfile path constructions
Signed-off-by:
N
Martin Kletzander
<
mkletzan@redhat.com
>
上级
3951d4a6
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
63 addition
and
77 deletion
+63
-77
daemon/libvirtd.c
daemon/libvirtd.c
+4
-37
src/libvirt_private.syms
src/libvirt_private.syms
+1
-0
src/locking/lock_daemon.c
src/locking/lock_daemon.c
+4
-38
src/util/virpidfile.c
src/util/virpidfile.c
+48
-1
src/util/virpidfile.h
src/util/virpidfile.h
+6
-1
未找到文件。
daemon/libvirtd.c
浏览文件 @
8035f2e6
...
@@ -250,41 +250,6 @@ static int daemonForkIntoBackground(const char *argv0)
...
@@ -250,41 +250,6 @@ static int daemonForkIntoBackground(const char *argv0)
}
}
static
int
daemonPidFilePath
(
bool
privileged
,
char
**
pidfile
)
{
if
(
privileged
)
{
if
(
VIR_STRDUP
(
*
pidfile
,
LOCALSTATEDIR
"/run/libvirtd.pid"
)
<
0
)
goto
error
;
}
else
{
char
*
rundir
=
NULL
;
mode_t
old_umask
;
if
(
!
(
rundir
=
virGetUserRuntimeDirectory
()))
goto
error
;
old_umask
=
umask
(
077
);
if
(
virFileMakePath
(
rundir
)
<
0
)
{
umask
(
old_umask
);
goto
error
;
}
umask
(
old_umask
);
if
(
virAsprintf
(
pidfile
,
"%s/libvirtd.pid"
,
rundir
)
<
0
)
{
VIR_FREE
(
rundir
);
goto
error
;
}
VIR_FREE
(
rundir
);
}
return
0
;
error:
return
-
1
;
}
static
int
static
int
daemonUnixSocketPaths
(
struct
daemonConfig
*
config
,
daemonUnixSocketPaths
(
struct
daemonConfig
*
config
,
bool
privileged
,
bool
privileged
,
...
@@ -1313,8 +1278,10 @@ int main(int argc, char **argv) {
...
@@ -1313,8 +1278,10 @@ int main(int argc, char **argv) {
}
}
if
(
!
pid_file
&&
if
(
!
pid_file
&&
daemonPidFilePath
(
privileged
,
virPidFileConstructPath
(
privileged
,
&
pid_file
)
<
0
)
{
LOCALSTATEDIR
,
"libvirtd"
,
&
pid_file
)
<
0
)
{
VIR_ERROR
(
_
(
"Can't determine pid file path."
));
VIR_ERROR
(
_
(
"Can't determine pid file path."
));
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
...
...
src/libvirt_private.syms
浏览文件 @
8035f2e6
...
@@ -1778,6 +1778,7 @@ virPCIIsVirtualFunction;
...
@@ -1778,6 +1778,7 @@ virPCIIsVirtualFunction;
virPidFileAcquire;
virPidFileAcquire;
virPidFileAcquirePath;
virPidFileAcquirePath;
virPidFileBuildPath;
virPidFileBuildPath;
virPidFileConstructPath;
virPidFileDelete;
virPidFileDelete;
virPidFileDeletePath;
virPidFileDeletePath;
virPidFileRead;
virPidFileRead;
...
...
src/locking/lock_daemon.c
浏览文件 @
8035f2e6
...
@@ -365,42 +365,6 @@ virLockDaemonForkIntoBackground(const char *argv0)
...
@@ -365,42 +365,6 @@ virLockDaemonForkIntoBackground(const char *argv0)
}
}
static
int
virLockDaemonPidFilePath
(
bool
privileged
,
char
**
pidfile
)
{
if
(
privileged
)
{
if
(
VIR_STRDUP
(
*
pidfile
,
LOCALSTATEDIR
"/run/virtlockd.pid"
)
<
0
)
goto
error
;
}
else
{
char
*
rundir
=
NULL
;
mode_t
old_umask
;
if
(
!
(
rundir
=
virGetUserRuntimeDirectory
()))
goto
error
;
old_umask
=
umask
(
077
);
if
(
virFileMakePath
(
rundir
)
<
0
)
{
umask
(
old_umask
);
goto
error
;
}
umask
(
old_umask
);
if
(
virAsprintf
(
pidfile
,
"%s/virtlockd.pid"
,
rundir
)
<
0
)
{
VIR_FREE
(
rundir
);
goto
error
;
}
VIR_FREE
(
rundir
);
}
return
0
;
error:
return
-
1
;
}
static
int
static
int
virLockDaemonUnixSocketPaths
(
bool
privileged
,
virLockDaemonUnixSocketPaths
(
bool
privileged
,
char
**
sockfile
)
char
**
sockfile
)
...
@@ -1283,8 +1247,10 @@ int main(int argc, char **argv) {
...
@@ -1283,8 +1247,10 @@ int main(int argc, char **argv) {
}
}
if
(
!
pid_file
&&
if
(
!
pid_file
&&
virLockDaemonPidFilePath
(
privileged
,
virPidFileConstructPath
(
privileged
,
&
pid_file
)
<
0
)
{
LOCALSTATEDIR
,
"virtlockd"
,
&
pid_file
)
<
0
)
{
VIR_ERROR
(
_
(
"Can't determine pid file path."
));
VIR_ERROR
(
_
(
"Can't determine pid file path."
));
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
...
...
src/util/virpidfile.c
浏览文件 @
8035f2e6
/*
/*
* virpidfile.c: manipulation of pidfiles
* virpidfile.c: manipulation of pidfiles
*
*
* Copyright (C) 2010-2012 Red Hat, Inc.
* Copyright (C) 2010-2012
, 2014
Red Hat, Inc.
* Copyright (C) 2006, 2007 Binary Karma
* Copyright (C) 2006, 2007 Binary Karma
* Copyright (C) 2006 Shuveb Hussain
* Copyright (C) 2006 Shuveb Hussain
*
*
...
@@ -521,3 +521,50 @@ int virPidFileRelease(const char *dir,
...
@@ -521,3 +521,50 @@ int virPidFileRelease(const char *dir,
VIR_FREE
(
pidfile
);
VIR_FREE
(
pidfile
);
return
rc
;
return
rc
;
}
}
int
virPidFileConstructPath
(
bool
privileged
,
const
char
*
statedir
,
const
char
*
progname
,
char
**
pidfile
)
{
if
(
privileged
)
{
/*
* This is here just to allow calling this function with
* statedir == NULL; of course only when !privileged.
*/
if
(
!
statedir
)
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"No statedir specified"
));
goto
cleanup
;
}
if
(
virAsprintf
(
pidfile
,
"%s/run/%s.pid"
,
statedir
,
progname
)
<
0
)
goto
cleanup
;
}
else
{
char
*
rundir
=
NULL
;
mode_t
old_umask
;
if
(
!
(
rundir
=
virGetUserRuntimeDirectory
()))
goto
error
;
old_umask
=
umask
(
077
);
if
(
virFileMakePath
(
rundir
)
<
0
)
{
umask
(
old_umask
);
goto
error
;
}
umask
(
old_umask
);
if
(
virAsprintf
(
pidfile
,
"%s/%s.pid"
,
rundir
,
progname
)
<
0
)
{
VIR_FREE
(
rundir
);
goto
error
;
}
VIR_FREE
(
rundir
);
}
return
0
;
error:
return
-
1
;
}
src/util/virpidfile.h
浏览文件 @
8035f2e6
/*
/*
* virpidfile.h: manipulation of pidfiles
* virpidfile.h: manipulation of pidfiles
*
*
* Copyright (C) 2010-2011 Red Hat, Inc.
* Copyright (C) 2010-2011
, 2014
Red Hat, Inc.
* Copyright (C) 2006, 2007 Binary Karma
* Copyright (C) 2006, 2007 Binary Karma
* Copyright (C) 2006 Shuveb Hussain
* Copyright (C) 2006 Shuveb Hussain
*
*
...
@@ -69,4 +69,9 @@ int virPidFileRelease(const char *dir,
...
@@ -69,4 +69,9 @@ int virPidFileRelease(const char *dir,
const
char
*
name
,
const
char
*
name
,
int
fd
);
int
fd
);
int
virPidFileConstructPath
(
bool
privileged
,
const
char
*
statedir
,
const
char
*
progname
,
char
**
pidfile
);
#endif
/* __VIR_PIDFILE_H__ */
#endif
/* __VIR_PIDFILE_H__ */
tester丶
🤺
@ssszwink
mentioned in commit
5ddbe251
·
9月 10, 2020
mentioned in commit
5ddbe251
mentioned in commit 5ddbe2511a5e07ad48fb2efe38746428656bf5c2
开关提交列表
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录