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
7b992a3e
Unverified
Commit
7b992a3e
authored
May 31, 2017
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
confile: add getter for lxc.arch
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
713046e3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
26 deletions
+31
-26
confile.c
src/lxc/confile.c
+31
-26
No files found.
src/lxc/confile.c
View file @
7b992a3e
...
...
@@ -65,6 +65,7 @@
lxc_log_define
(
lxc_confile
,
lxc
);
static
int
set_config_personality
(
const
char
*
,
const
char
*
,
struct
lxc_conf
*
);
static
int
get_config_personality
(
struct
lxc_container
*
,
const
char
*
,
char
*
,
int
);
static
int
set_config_pts
(
const
char
*
,
const
char
*
,
struct
lxc_conf
*
);
static
int
set_config_tty
(
const
char
*
,
const
char
*
,
struct
lxc_conf
*
);
static
int
set_config_ttydir
(
const
char
*
,
const
char
*
,
struct
lxc_conf
*
);
...
...
@@ -126,8 +127,7 @@ static int set_config_no_new_privs(const char *, const char *, struct lxc_conf *
static
int
set_config_limit
(
const
char
*
,
const
char
*
,
struct
lxc_conf
*
);
static
struct
lxc_config_t
config
[]
=
{
{
"lxc.arch"
,
set_config_personality
,
NULL
,
NULL
},
{
"lxc.arch"
,
set_config_personality
,
get_config_personality
,
NULL
},
{
"lxc.pts"
,
set_config_pts
,
NULL
,
NULL
},
{
"lxc.tty"
,
set_config_tty
,
NULL
,
NULL
},
{
"lxc.devttydir"
,
set_config_ttydir
,
NULL
,
NULL
},
...
...
@@ -2578,28 +2578,6 @@ static int lxc_get_conf_int(struct lxc_conf *c, char *retv, int inlen, int v)
return
snprintf
(
retv
,
inlen
,
"%d"
,
v
);
}
static
int
lxc_get_arch_entry
(
struct
lxc_conf
*
c
,
char
*
retv
,
int
inlen
)
{
int
fulllen
=
0
;
if
(
!
retv
)
inlen
=
0
;
else
memset
(
retv
,
0
,
inlen
);
#if HAVE_SYS_PERSONALITY_H
int
len
=
0
;
switch
(
c
->
personality
)
{
case
PER_LINUX32
:
strprint
(
retv
,
inlen
,
"i686"
);
break
;
case
PER_LINUX
:
strprint
(
retv
,
inlen
,
"x86_64"
);
break
;
default:
break
;
}
#endif
return
fulllen
;
}
/*
* If you ask for a specific cgroup value, i.e. lxc.cgroup.devices.list,
* then just the value(s) will be printed. Since there still could be
...
...
@@ -3031,8 +3009,6 @@ int lxc_get_config_item(struct lxc_conf *c, const char *key, char *retv,
return
lxc_get_conf_int
(
c
,
retv
,
inlen
,
c
->
pts
);
else
if
(
strcmp
(
key
,
"lxc.devttydir"
)
==
0
)
v
=
c
->
ttydir
;
else
if
(
strcmp
(
key
,
"lxc.arch"
)
==
0
)
return
lxc_get_arch_entry
(
c
,
retv
,
inlen
);
else
if
(
strcmp
(
key
,
"lxc.aa_profile"
)
==
0
)
v
=
c
->
lsm_aa_profile
;
else
if
(
strcmp
(
key
,
"lxc.aa_allow_incomplete"
)
==
0
)
...
...
@@ -3688,3 +3664,32 @@ static int set_config_no_new_privs(const char *key, const char *value,
return
0
;
}
/* Callbacks to get configuration items. */
static
int
get_config_personality
(
struct
lxc_container
*
c
,
const
char
*
key
,
char
*
retv
,
int
inlen
)
{
int
fulllen
=
0
;
if
(
!
retv
)
inlen
=
0
;
else
memset
(
retv
,
0
,
inlen
);
#if HAVE_SYS_PERSONALITY_H
int
len
=
0
;
switch
(
c
->
lxc_conf
->
personality
)
{
case
PER_LINUX32
:
strprint
(
retv
,
inlen
,
"i686"
);
break
;
case
PER_LINUX
:
strprint
(
retv
,
inlen
,
"x86_64"
);
break
;
default:
break
;
}
#endif
return
fulllen
;
}
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