Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
7eb44573
Commit
7eb44573
authored
Feb 15, 2014
by
Serge Hallyn
Committed by
Stéphane Graber
Feb 14, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
re-open cgmanager socket after fork in daemonized start
Signed-off-by:
Serge Hallyn
<
serge.hallyn@ubuntu.com
>
Acked-by:
Stéphane Graber
<
stgraber@ubuntu.com
>
parent
1d167857
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
1 deletion
+14
-1
cgmanager.c
src/lxc/cgmanager.c
+3
-1
cgroup.c
src/lxc/cgroup.c
+8
-0
cgroup.h
src/lxc/cgroup.h
+2
-0
lxccontainer.c
src/lxc/lxccontainer.c
+1
-0
No files found.
src/lxc/cgmanager.c
View file @
7eb44573
...
@@ -114,7 +114,8 @@ static bool cgm_dbus_connect(void)
...
@@ -114,7 +114,8 @@ static bool cgm_dbus_connect(void)
static
void
cgm_dbus_disconnect
(
void
)
static
void
cgm_dbus_disconnect
(
void
)
{
{
nih_free
(
cgroup_manager
);
if
(
cgroup_manager
)
nih_free
(
cgroup_manager
);
cgroup_manager
=
NULL
;
cgroup_manager
=
NULL
;
}
}
...
@@ -886,5 +887,6 @@ static struct cgroup_ops cgmanager_ops = {
...
@@ -886,5 +887,6 @@ static struct cgroup_ops cgmanager_ops = {
.
attach
=
cgm_attach
,
.
attach
=
cgm_attach
,
.
mount_cgroup
=
cgm_mount_cgroup
,
.
mount_cgroup
=
cgm_mount_cgroup
,
.
nrtasks
=
cgm_get_nrtasks
,
.
nrtasks
=
cgm_get_nrtasks
,
.
disconnect
=
cgm_dbus_disconnect
,
};
};
#endif
#endif
src/lxc/cgroup.c
View file @
7eb44573
...
@@ -167,3 +167,11 @@ int lxc_cgroup_get(const char *filename, char *value, size_t len, const char *na
...
@@ -167,3 +167,11 @@ int lxc_cgroup_get(const char *filename, char *value, size_t len, const char *na
return
ops
->
get
(
filename
,
value
,
len
,
name
,
lxcpath
);
return
ops
->
get
(
filename
,
value
,
len
,
name
,
lxcpath
);
return
-
1
;
return
-
1
;
}
}
void
restart_cgroups
(
void
)
{
if
(
ops
&&
ops
->
disconnect
)
ops
->
disconnect
();
ops
=
NULL
;
cgroup_ops_init
();
}
src/lxc/cgroup.h
View file @
7eb44573
...
@@ -49,6 +49,7 @@ struct cgroup_ops {
...
@@ -49,6 +49,7 @@ struct cgroup_ops {
bool
(
*
attach
)(
const
char
*
name
,
const
char
*
lxcpath
,
pid_t
pid
);
bool
(
*
attach
)(
const
char
*
name
,
const
char
*
lxcpath
,
pid_t
pid
);
bool
(
*
mount_cgroup
)(
void
*
hdata
,
const
char
*
root
,
int
type
);
bool
(
*
mount_cgroup
)(
void
*
hdata
,
const
char
*
root
,
int
type
);
int
(
*
nrtasks
)(
void
*
hdata
);
int
(
*
nrtasks
)(
void
*
hdata
);
void
(
*
disconnect
)(
void
);
};
};
extern
bool
cgroup_attach
(
const
char
*
name
,
const
char
*
lxcpath
,
pid_t
pid
);
extern
bool
cgroup_attach
(
const
char
*
name
,
const
char
*
lxcpath
,
pid_t
pid
);
...
@@ -64,5 +65,6 @@ extern bool cgroup_create_legacy(struct lxc_handler *handler);
...
@@ -64,5 +65,6 @@ extern bool cgroup_create_legacy(struct lxc_handler *handler);
extern
int
cgroup_nrtasks
(
struct
lxc_handler
*
handler
);
extern
int
cgroup_nrtasks
(
struct
lxc_handler
*
handler
);
extern
const
char
*
cgroup_get_cgroup
(
struct
lxc_handler
*
handler
,
const
char
*
subsystem
);
extern
const
char
*
cgroup_get_cgroup
(
struct
lxc_handler
*
handler
,
const
char
*
subsystem
);
extern
bool
cgroup_unfreeze
(
struct
lxc_handler
*
handler
);
extern
bool
cgroup_unfreeze
(
struct
lxc_handler
*
handler
);
extern
void
restart_cgroups
(
void
);
#endif
#endif
src/lxc/lxccontainer.c
View file @
7eb44573
...
@@ -637,6 +637,7 @@ static bool lxcapi_start(struct lxc_container *c, int useinit, char * const argv
...
@@ -637,6 +637,7 @@ static bool lxcapi_start(struct lxc_container *c, int useinit, char * const argv
open
(
"/dev/null"
,
O_RDWR
);
open
(
"/dev/null"
,
O_RDWR
);
open
(
"/dev/null"
,
O_RDWR
);
open
(
"/dev/null"
,
O_RDWR
);
setsid
();
setsid
();
restart_cgroups
();
}
else
{
}
else
{
if
(
!
am_single_threaded
())
{
if
(
!
am_single_threaded
())
{
ERROR
(
"Cannot start non-daemonized container when threaded"
);
ERROR
(
"Cannot start non-daemonized container when threaded"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment