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
68d18db8
Commit
68d18db8
authored
Aug 27, 2015
by
Patrick Toomey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for get_config_item and set_config_item
Signed-off-by:
Patrick Toomey
<
ptoomey3@biasedcoin.com
>
parent
62d00539
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
0 deletions
+30
-0
confile.c
src/lxc/confile.c
+4
-0
get_item.c
src/tests/get_item.c
+26
-0
No files found.
src/lxc/confile.c
View file @
68d18db8
...
...
@@ -2510,6 +2510,10 @@ int lxc_get_config_item(struct lxc_conf *c, const char *key, char *retv,
return
lxc_get_item_environment
(
c
,
retv
,
inlen
);
else
if
(
strcmp
(
key
,
"lxc.init_cmd"
)
==
0
)
v
=
c
->
init_cmd
;
else
if
(
strcmp
(
key
,
"lxc.init_uid"
)
==
0
)
return
lxc_get_conf_int
(
c
,
retv
,
inlen
,
c
->
init_uid
);
else
if
(
strcmp
(
key
,
"lxc.init_gid"
)
==
0
)
return
lxc_get_conf_int
(
c
,
retv
,
inlen
,
c
->
init_gid
);
else
return
-
1
;
if
(
!
v
)
...
...
src/tests/get_item.c
View file @
68d18db8
...
...
@@ -88,6 +88,32 @@ int main(int argc, char *argv[])
}
printf
(
"lxc.arch returned %d %s
\n
"
,
ret
,
v2
);
if
(
!
c
->
set_config_item
(
c
,
"lxc.init_uid"
,
"100"
))
{
fprintf
(
stderr
,
"%d: failed to set init_uid
\n
"
,
__LINE__
);
ret
=
1
;
goto
out
;
}
ret
=
c
->
get_config_item
(
c
,
"lxc.init_uid"
,
v2
,
255
);
if
(
ret
<
0
)
{
fprintf
(
stderr
,
"%d: get_config_item(lxc.init_uid) returned %d
\n
"
,
__LINE__
,
ret
);
ret
=
1
;
goto
out
;
}
printf
(
"lxc.init_uid returned %d %s
\n
"
,
ret
,
v2
);
if
(
!
c
->
set_config_item
(
c
,
"lxc.init_gid"
,
"100"
))
{
fprintf
(
stderr
,
"%d: failed to set init_gid
\n
"
,
__LINE__
);
ret
=
1
;
goto
out
;
}
ret
=
c
->
get_config_item
(
c
,
"lxc.init_gid"
,
v2
,
255
);
if
(
ret
<
0
)
{
fprintf
(
stderr
,
"%d: get_config_item(lxc.init_gid) returned %d
\n
"
,
__LINE__
,
ret
);
ret
=
1
;
goto
out
;
}
printf
(
"lxc.init_gid returned %d %s
\n
"
,
ret
,
v2
);
#define HNAME "hostname1"
// demonstrate proper usage:
char
*
alloced
;
...
...
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