Loading [MathJax]/jax/output/HTML-CSS/config.js
libzypp
17.37.18
Toggle main menu visibility
Main Page
Related Pages
Topics
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Variables
_
a
c
g
h
i
l
m
n
o
p
r
t
w
y
z
Typedefs
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Enumerations
Enumerator
a
b
c
d
e
f
h
i
l
n
o
p
q
r
s
t
u
z
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
~
Variables
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
y
z
Typedefs
a
b
c
d
e
f
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
z
Enumerations
a
b
c
e
f
i
k
m
o
p
r
s
t
v
Enumerator
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
w
y
Related Symbols
a
b
d
e
h
m
n
o
r
s
t
z
Files
File List
File Members
All
_
a
b
c
d
e
f
g
i
l
m
n
o
p
r
s
t
u
w
x
z
Functions
Variables
Typedefs
Macros
_
a
c
d
e
f
i
l
m
n
o
p
r
s
t
u
w
x
z
libzypp
Welcome to libzypp
[Dropped in Code 15] Code 12 Application Metadata
Code Pitfalls - Frequently made mistakes
Environment Variables
Testing for provided features.
Hardware (modalias) dependencies
Code 12 Pattern Packages
Extending ZYpp: Plugins and Hooks
Repository Variables
Services
Solver - Vendor protection
Writing and tunning testcases
Libzypp and threads
User data as transaction id
Todo List
Deprecated List
Topics
Namespaces
Classes
Files
File List
doc
zypp
zypp-core
base
fs
ng
parser
rpc
ui
url
AutoDispose.h
ByteArray.h
ByteCount.cc
ByteCount.h
CheckSum.cc
CheckSum.h
ContentType.h
Date.cc
Date.h
Digest.cc
Digest.h
ExternalProgram.cc
ExternalProgram.h
Globals.h
kvmap.h
ManagedFile.h
MirroredOrigin.cc
MirroredOrigin.h
onmedialocation.cc
onmedialocation.h
Pathname.cc
Pathname.h
ShutdownLock.cc
ShutdownLock_p.h
TriBool.h
Url.cc
Url.h
UserData.h
zypp-curl
zypp-media
zypp-tui
File Members
ShutdownLock.cc
Go to the documentation of this file.
1
#include "
ShutdownLock_p.h
"
2
3
#include <
zypp-core/base/LogTools.h
>
4
#include <
zypp-core/ExternalProgram.h
>
5
#include <iostream>
6
#include <signal.h>
7
8
zypp::ShutdownLock::ShutdownLock
(
const
std::string &who,
const
std::string &reason)
9
{
10
try
{
11
MIL
<<
"Try to acquire an inhibitor lock..."
<< endl;
12
std::string whoStr =
str::form
(
"--who=%s"
, who.c_str());
13
std::string whyStr =
str::form
(
"--why=%s"
, reason.c_str());
14
15
const
char
* argv[] =
16
{
17
"/usr/bin/systemd-inhibit"
,
18
"--what=sleep:shutdown:idle"
,
19
whoStr.c_str(),
20
"--mode=block"
,
21
whyStr.c_str(),
22
"/usr/bin/cat"
,
23
NULL
24
};
25
_prog
=
shared_ptr<ExternalProgramWithSeperatePgid>
(
new
ExternalProgramWithSeperatePgid
( argv,
ExternalProgram::Discard_Stderr
) );
26
}
catch
(...) {
27
}
28
}
8
zypp::ShutdownLock::ShutdownLock
(
const
std::string &who,
const
std::string &reason) {
…
}
29
30
zypp::ShutdownLock::~ShutdownLock
()
31
{
32
if
(
_prog
) {
33
MIL
<<
"Terminate inhibitor lock: pid "
<<
_prog
->getpid() << endl;
34
_prog
->kill( SIGTERM );
35
if
( !
_prog
->waitForExit( 10 * 1000 ) ) {
36
// do a real kill if the app does not close in 10 seconds
37
WAR
<<
"systemd-inhibit did not respond to SIGTERM, killing it"
<< std::endl;
38
_prog
->kill();
39
}
else
{
40
_prog
->close();
41
}
42
}
43
}
30
zypp::ShutdownLock::~ShutdownLock
() {
…
}
ExternalProgram.h
LogTools.h
MIL
#define MIL
Definition
Logger.h:100
WAR
#define WAR
Definition
Logger.h:101
ShutdownLock_p.h
shared_ptr
zypp::ExternalProgramWithSeperatePgid
ExternalProgram extended to change the progress group ID after forking.
Definition
ExternalProgram.h:312
zypp::ExternalProgram::Discard_Stderr
@ Discard_Stderr
Definition
ExternalProgram.h:76
zypp::ShutdownLock::~ShutdownLock
~ShutdownLock()
Definition
ShutdownLock.cc:30
zypp::ShutdownLock::_prog
shared_ptr< ExternalProgramWithSeperatePgid > _prog
Definition
ShutdownLock_p.h:38
zypp::ShutdownLock::ShutdownLock
ShutdownLock(const std::string &who, const std::string &reason)
Definition
ShutdownLock.cc:8
zypp::str::form
std::string form(const char *format,...) __attribute__((format(printf
Printf style construction of std::string.
Definition
String.cc:39
zypp-core
ShutdownLock.cc
Generated by
1.14.0