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
e409b214
Unverified
Commit
e409b214
authored
Dec 11, 2017
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
conf: lxc.sysctl coding style fixes
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
ed20740b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
18 deletions
+20
-18
lxc.container.conf.sgml.in
doc/lxc.container.conf.sgml.in
+1
-1
conf.c
src/lxc/conf.c
+3
-2
confile.c
src/lxc/confile.c
+16
-15
No files found.
doc/lxc.container.conf.sgml.in
View file @
e409b214
...
@@ -1403,7 +1403,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
...
@@ -1403,7 +1403,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
<para>
<para>
Specify the kernel parameters to be set. The parameters available
Specify the kernel parameters to be set. The parameters available
are those listed under /proc/sys/.
are those listed under /proc/sys/.
Note that not all sysctls are namespaced.Changing Non-namespaced
Note that not all sysctls are namespaced.
Changing Non-namespaced
sysctls will cause the system-wide setting to be modified.
sysctls will cause the system-wide setting to be modified.
<citerefentry>
<citerefentry>
<refentrytitle><command>sysctl</command></refentrytitle>
<refentrytitle><command>sysctl</command></refentrytitle>
...
...
src/lxc/conf.c
View file @
e409b214
...
@@ -3311,8 +3311,8 @@ int lxc_clear_cgroups(struct lxc_conf *c, const char *key)
...
@@ -3311,8 +3311,8 @@ int lxc_clear_cgroups(struct lxc_conf *c, const char *key)
if
(
strcmp
(
key
,
"lxc.cgroup"
)
==
0
)
if
(
strcmp
(
key
,
"lxc.cgroup"
)
==
0
)
all
=
true
;
all
=
true
;
else
if
(
strncmp
(
key
,
"lxc.cgroup."
,
sizeof
(
"lxc.cgroup."
)
-
1
)
==
0
)
else
if
(
strncmp
(
key
,
"lxc.cgroup."
,
sizeof
(
"lxc.cgroup."
)
-
1
)
==
0
)
k
=
key
+
sizeof
(
"lxc.cgroup."
)
-
1
;
k
=
key
+
sizeof
(
"lxc.cgroup."
)
-
1
;
else
else
return
-
1
;
return
-
1
;
...
@@ -3326,6 +3326,7 @@ int lxc_clear_cgroups(struct lxc_conf *c, const char *key)
...
@@ -3326,6 +3326,7 @@ int lxc_clear_cgroups(struct lxc_conf *c, const char *key)
free
(
cg
);
free
(
cg
);
free
(
it
);
free
(
it
);
}
}
return
0
;
return
0
;
}
}
...
...
src/lxc/confile.c
View file @
e409b214
...
@@ -1500,12 +1500,12 @@ static int set_config_sysctl(const char *key, const char *value,
...
@@ -1500,12 +1500,12 @@ static int set_config_sysctl(const char *key, const char *value,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
{
{
struct
lxc_list
*
iter
;
struct
lxc_list
*
iter
;
char
*
replace_value
=
NULL
;
struct
lxc_list
*
sysctl_list
=
NULL
;
struct
lxc_list
*
sysctl_list
=
NULL
;
struct
lxc_sysctl
*
sysctl_elem
=
NULL
;
struct
lxc_sysctl
*
sysctl_elem
=
NULL
;
char
*
replace_value
=
NULL
;
if
(
lxc_config_value_empty
(
value
))
if
(
lxc_config_value_empty
(
value
))
return
lxc_clear_sysctls
(
lxc_conf
,
key
);
return
clr_config_sysctl
(
key
,
lxc_conf
,
NULL
);
if
(
strncmp
(
key
,
"lxc.sysctl."
,
sizeof
(
"lxc.sysctl."
)
-
1
)
!=
0
)
if
(
strncmp
(
key
,
"lxc.sysctl."
,
sizeof
(
"lxc.sysctl."
)
-
1
)
!=
0
)
return
-
1
;
return
-
1
;
...
@@ -1515,14 +1515,17 @@ static int set_config_sysctl(const char *key, const char *value,
...
@@ -1515,14 +1515,17 @@ static int set_config_sysctl(const char *key, const char *value,
/* find existing list element */
/* find existing list element */
lxc_list_for_each
(
iter
,
&
lxc_conf
->
sysctls
)
{
lxc_list_for_each
(
iter
,
&
lxc_conf
->
sysctls
)
{
sysctl_elem
=
iter
->
elem
;
sysctl_elem
=
iter
->
elem
;
if
(
strcmp
(
key
,
sysctl_elem
->
key
)
==
0
)
{
replace_value
=
strdup
(
value
);
if
(
strcmp
(
key
,
sysctl_elem
->
key
)
!=
0
)
if
(
!
replace_value
)
continue
;
return
-
1
;
free
(
sysctl_elem
->
value
);
replace_value
=
strdup
(
value
);
sysctl_elem
->
value
=
replace_value
;
if
(
!
replace_value
)
return
0
;
return
-
1
;
}
free
(
sysctl_elem
->
value
);
sysctl_elem
->
value
=
replace_value
;
return
0
;
}
}
/* allocate list element */
/* allocate list element */
...
@@ -1557,8 +1560,6 @@ on_error:
...
@@ -1557,8 +1560,6 @@ on_error:
free
(
sysctl_elem
);
free
(
sysctl_elem
);
}
}
return
-
1
;
return
-
1
;
}
}
static
int
set_config_idmaps
(
const
char
*
key
,
const
char
*
value
,
static
int
set_config_idmaps
(
const
char
*
key
,
const
char
*
value
,
...
@@ -3376,9 +3377,9 @@ static int get_config_prlimit(const char *key, char *retv, int inlen,
...
@@ -3376,9 +3377,9 @@ static int get_config_prlimit(const char *key, char *retv, int inlen,
return
fulllen
;
return
fulllen
;
}
}
/* If you ask for a specific value, i.e. lxc.sysctl.net.ipv4.ip_forward, then
just the value
/* If you ask for a specific value, i.e. lxc.sysctl.net.ipv4.ip_forward, then
*
will be printed. If you ask for 'lxc.sysctl', then all sysctl entries will be
*
just the value will be printed. If you ask for 'lxc.sysctl', then all sysctl
* printed, in 'lxc.sysctl.key = value' format.
*
entries will be
printed, in 'lxc.sysctl.key = value' format.
*/
*/
static
int
get_config_sysctl
(
const
char
*
key
,
char
*
retv
,
int
inlen
,
static
int
get_config_sysctl
(
const
char
*
key
,
char
*
retv
,
int
inlen
,
struct
lxc_conf
*
c
,
void
*
data
)
struct
lxc_conf
*
c
,
void
*
data
)
...
...
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