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
36b86299
Commit
36b86299
authored
Dec 17, 2010
by
Daniel Lezcano
Committed by
Daniel Lezcano
Dec 17, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
encapsulate the ns_cgroup
Create a single API to create a cgroup which will switch to the old ns_cgroup automatically. Signed-off-by:
Daniel Lezcano
<
dlezcano@fr.ibm.com
>
parent
b234e44f
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
5 deletions
+15
-5
cgroup.c
src/lxc/cgroup.c
+10
-0
cgroup.h
src/lxc/cgroup.h
+2
-2
lxc_unshare.c
src/lxc/lxc_unshare.c
+1
-1
start.c
src/lxc/start.c
+2
-2
No files found.
src/lxc/cgroup.c
View file @
36b86299
...
@@ -142,6 +142,16 @@ int lxc_unlink_nsgroup(const char *name)
...
@@ -142,6 +142,16 @@ int lxc_unlink_nsgroup(const char *name)
return
ret
;
return
ret
;
}
}
int
lxc_cgroup_create
(
const
char
*
name
,
pid_t
pid
)
{
return
lxc_rename_nsgroup
(
name
,
pid
);
}
int
lxc_cgroup_destroy
(
const
char
*
name
)
{
return
lxc_unlink_nsgroup
(
name
);
}
int
lxc_cgroup_path_get
(
char
**
path
,
const
char
*
name
)
int
lxc_cgroup_path_get
(
char
**
path
,
const
char
*
name
)
{
{
char
cgroup
[
MAXPATHLEN
];
char
cgroup
[
MAXPATHLEN
];
...
...
src/lxc/cgroup.h
View file @
36b86299
...
@@ -26,8 +26,8 @@
...
@@ -26,8 +26,8 @@
#define MAXPRIOLEN 24
#define MAXPRIOLEN 24
struct
lxc_handler
;
struct
lxc_handler
;
int
lxc_
rename_nsgroup
(
const
char
*
name
,
pid_t
pid
);
int
lxc_
cgroup_create
(
const
char
*
name
,
pid_t
pid
);
int
lxc_
unlink_nsgroup
(
const
char
*
name
);
int
lxc_
cgroup_destroy
(
const
char
*
name
);
int
lxc_cgroup_path_get
(
char
**
path
,
const
char
*
name
);
int
lxc_cgroup_path_get
(
char
**
path
,
const
char
*
name
);
int
lxc_cgroup_nrtasks
(
const
char
*
name
);
int
lxc_cgroup_nrtasks
(
const
char
*
name
);
#endif
#endif
src/lxc/lxc_unshare.c
View file @
36b86299
...
@@ -214,7 +214,7 @@ int main(int argc, char *argv[])
...
@@ -214,7 +214,7 @@ int main(int argc, char *argv[])
ERROR
(
"pid_name: failed to allocate memory"
);
ERROR
(
"pid_name: failed to allocate memory"
);
return
-
1
;
return
-
1
;
}
}
lxc_
unlink_nsgroup
(
pid_name
);
lxc_
cgroup_destroy
(
pid_name
);
free
(
pid_name
);
free
(
pid_name
);
return
lxc_error_set_and_log
(
pid
,
status
);
return
lxc_error_set_and_log
(
pid
,
status
);
...
...
src/lxc/start.c
View file @
36b86299
...
@@ -506,7 +506,7 @@ int lxc_spawn(struct lxc_handler *handler)
...
@@ -506,7 +506,7 @@ int lxc_spawn(struct lxc_handler *handler)
if
(
lxc_sync_wait_child
(
handler
,
LXC_SYNC_CONFIGURE
))
if
(
lxc_sync_wait_child
(
handler
,
LXC_SYNC_CONFIGURE
))
failed_before_rename
=
1
;
failed_before_rename
=
1
;
if
(
lxc_
rename_nsgroup
(
name
,
handler
->
pid
))
if
(
lxc_
cgroup_create
(
name
,
handler
->
pid
))
goto
out_delete_net
;
goto
out_delete_net
;
if
(
failed_before_rename
)
if
(
failed_before_rename
)
...
@@ -585,7 +585,7 @@ int __lxc_start(const char *name, struct lxc_conf *conf,
...
@@ -585,7 +585,7 @@ int __lxc_start(const char *name, struct lxc_conf *conf,
out_fini:
out_fini:
LXC_TTY_DEL_HANDLER
(
SIGQUIT
);
LXC_TTY_DEL_HANDLER
(
SIGQUIT
);
LXC_TTY_DEL_HANDLER
(
SIGINT
);
LXC_TTY_DEL_HANDLER
(
SIGINT
);
lxc_
unlink_nsgroup
(
name
);
lxc_
cgroup_destroy
(
name
);
lxc_fini
(
name
,
handler
);
lxc_fini
(
name
,
handler
);
return
err
;
return
err
;
...
...
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