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
758437c5
Commit
758437c5
authored
Oct 09, 2009
by
Michel Normand
Committed by
Daniel Lezcano
Oct 09, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
place nscgroup path in lxc_handler
this also avoid to call two times get_cgroup_mount Signed-off-by:
Michel Normand
<
normand@fr.ibm.com
>
Signed-off-by:
Daniel Lezcano
<
dlezcano@fr.ibm.com
>
parent
52e35957
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
15 deletions
+11
-15
cgroup.c
src/lxc/cgroup.c
+5
-12
cgroup.h
src/lxc/cgroup.h
+3
-2
start.c
src/lxc/start.c
+2
-1
start.h
src/lxc/start.h
+1
-0
No files found.
src/lxc/cgroup.c
View file @
758437c5
...
...
@@ -81,10 +81,10 @@ out:
return
err
;
}
int
lxc_rename_nsgroup
(
const
char
*
name
,
pid_t
pid
)
int
lxc_rename_nsgroup
(
const
char
*
name
,
struct
lxc_handler
*
handler
)
{
char
oldname
[
MAXPATHLEN
];
char
newname
[
MAXPATHLEN
]
;
char
*
newname
=
handler
->
nsgroup
;
char
cgroup
[
MAXPATHLEN
];
int
ret
;
...
...
@@ -93,7 +93,7 @@ int lxc_rename_nsgroup(const char *name, pid_t pid)
return
-
1
;
}
snprintf
(
oldname
,
MAXPATHLEN
,
"%s/%d"
,
cgroup
,
pid
);
snprintf
(
oldname
,
MAXPATHLEN
,
"%s/%d"
,
cgroup
,
handler
->
pid
);
snprintf
(
newname
,
MAXPATHLEN
,
"%s/%s"
,
cgroup
,
name
);
/* there is a previous cgroup, assume it is empty, otherwise
...
...
@@ -113,23 +113,16 @@ int lxc_rename_nsgroup(const char *name, pid_t pid)
else
DEBUG
(
"'%s' renamed to '%s'"
,
oldname
,
newname
);
return
ret
;
}
int
lxc_link_nsgroup
(
const
char
*
name
)
int
lxc_link_nsgroup
(
const
char
*
name
,
const
char
*
nsgroup
)
{
char
lxc
[
MAXPATHLEN
];
char
nsgroup
[
MAXPATHLEN
];
char
cgroup
[
MAXPATHLEN
];
int
ret
;
if
(
get_cgroup_mount
(
MTAB
,
cgroup
))
{
ERROR
(
"cgroup is not mounted"
);
return
-
1
;
}
snprintf
(
lxc
,
MAXPATHLEN
,
LXCPATH
"/%s/nsgroup"
,
name
);
snprintf
(
nsgroup
,
MAXPATHLEN
,
"%s/%s"
,
cgroup
,
name
);
unlink
(
lxc
);
ret
=
symlink
(
nsgroup
,
lxc
);
...
...
src/lxc/cgroup.h
View file @
758437c5
...
...
@@ -25,9 +25,10 @@
#define MAXPRIOLEN 24
struct
lxc_handler
;
int
lxc_get_cgroup_mount
(
const
char
*
mtab
,
char
*
mnt
);
int
lxc_rename_nsgroup
(
const
char
*
name
,
pid_t
pid
);
int
lxc_link_nsgroup
(
const
char
*
name
);
int
lxc_rename_nsgroup
(
const
char
*
name
,
struct
lxc_handler
*
handler
);
int
lxc_link_nsgroup
(
const
char
*
name
,
const
char
*
nsgroup
);
int
lxc_unlink_nsgroup
(
const
char
*
name
);
#endif
src/lxc/start.c
View file @
758437c5
...
...
@@ -424,7 +424,8 @@ int lxc_spawn(const char *name, struct lxc_handler *handler, char *const argv[])
goto
out_abort
;
}
if
(
lxc_rename_nsgroup
(
name
,
handler
->
pid
)
||
lxc_link_nsgroup
(
name
))
if
(
lxc_rename_nsgroup
(
name
,
handler
)
||
lxc_link_nsgroup
(
name
,
handler
->
nsgroup
))
goto
out_abort
;
/* Create the network configuration */
...
...
src/lxc/start.h
View file @
758437c5
...
...
@@ -29,6 +29,7 @@ struct lxc_handler {
int
sigfd
;
int
lock
;
char
tty
[
MAXPATHLEN
];
char
nsgroup
[
MAXPATHLEN
];
sigset_t
oldmask
;
struct
lxc_tty_info
tty_info
;
};
...
...
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