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
a04220de
Unverified
Commit
a04220de
authored
Oct 18, 2017
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
confile: add lxc.console.logsize
Closes #1857. Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
2ea479c9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
0 deletions
+63
-0
conf.h
src/lxc/conf.h
+1
-0
confile.c
src/lxc/confile.c
+62
-0
No files found.
src/lxc/conf.h
View file @
a04220de
...
@@ -152,6 +152,7 @@ struct lxc_console {
...
@@ -152,6 +152,7 @@ struct lxc_console {
char
name
[
MAXPATHLEN
];
char
name
[
MAXPATHLEN
];
struct
termios
*
tios
;
struct
termios
*
tios
;
struct
lxc_tty_state
*
tty_state
;
struct
lxc_tty_state
*
tty_state
;
uint64_t
log_size
;
};
};
/*
/*
...
...
src/lxc/confile.c
View file @
a04220de
...
@@ -83,6 +83,7 @@ lxc_config_define(cap_keep);
...
@@ -83,6 +83,7 @@ lxc_config_define(cap_keep);
lxc_config_define
(
cgroup_controller
);
lxc_config_define
(
cgroup_controller
);
lxc_config_define
(
cgroup_dir
);
lxc_config_define
(
cgroup_dir
);
lxc_config_define
(
console_logfile
);
lxc_config_define
(
console_logfile
);
lxc_config_define
(
console_logsize
);
lxc_config_define
(
console_path
);
lxc_config_define
(
console_path
);
lxc_config_define
(
environment
);
lxc_config_define
(
environment
);
lxc_config_define
(
ephemeral
);
lxc_config_define
(
ephemeral
);
...
@@ -148,6 +149,7 @@ static struct lxc_config_t config[] = {
...
@@ -148,6 +149,7 @@ static struct lxc_config_t config[] = {
{
"lxc.cgroup.dir"
,
false
,
set_config_cgroup_dir
,
get_config_cgroup_dir
,
clr_config_cgroup_dir
,
},
{
"lxc.cgroup.dir"
,
false
,
set_config_cgroup_dir
,
get_config_cgroup_dir
,
clr_config_cgroup_dir
,
},
{
"lxc.cgroup"
,
false
,
set_config_cgroup_controller
,
get_config_cgroup_controller
,
clr_config_cgroup_controller
,
},
{
"lxc.cgroup"
,
false
,
set_config_cgroup_controller
,
get_config_cgroup_controller
,
clr_config_cgroup_controller
,
},
{
"lxc.console.logfile"
,
false
,
set_config_console_logfile
,
get_config_console_logfile
,
clr_config_console_logfile
,
},
{
"lxc.console.logfile"
,
false
,
set_config_console_logfile
,
get_config_console_logfile
,
clr_config_console_logfile
,
},
{
"lxc.console.logsize"
,
false
,
set_config_console_logsize
,
get_config_console_logsize
,
clr_config_console_logsize
,
},
{
"lxc.console.path"
,
false
,
set_config_console_path
,
get_config_console_path
,
clr_config_console_path
,
},
{
"lxc.console.path"
,
false
,
set_config_console_path
,
get_config_console_path
,
clr_config_console_path
,
},
{
"lxc.environment"
,
false
,
set_config_environment
,
get_config_environment
,
clr_config_environment
,
},
{
"lxc.environment"
,
false
,
set_config_environment
,
get_config_environment
,
clr_config_environment
,
},
{
"lxc.ephemeral"
,
false
,
set_config_ephemeral
,
get_config_ephemeral
,
clr_config_ephemeral
,
},
{
"lxc.ephemeral"
,
false
,
set_config_ephemeral
,
get_config_ephemeral
,
clr_config_ephemeral
,
},
...
@@ -1790,6 +1792,53 @@ static int set_config_console_logfile(const char *key, const char *value,
...
@@ -1790,6 +1792,53 @@ static int set_config_console_logfile(const char *key, const char *value,
return
set_config_path_item
(
&
lxc_conf
->
console
.
log_path
,
value
);
return
set_config_path_item
(
&
lxc_conf
->
console
.
log_path
,
value
);
}
}
static
int
set_config_console_logsize
(
const
char
*
key
,
const
char
*
value
,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
{
int
ret
;
int64_t
size
;
uint64_t
logsize
,
pgsz
;
if
(
lxc_config_value_empty
(
value
))
{
lxc_conf
->
console
.
log_size
=
0
;
return
0
;
}
/* If the user specified "auto" the default log size is 2^17 = 128 Kib */
if
(
!
strcmp
(
value
,
"auto"
))
{
lxc_conf
->
console
.
log_size
=
1
<<
17
;
return
0
;
}
ret
=
parse_byte_size_string
(
value
,
&
size
);
if
(
ret
<
0
)
return
-
1
;
if
(
size
<
0
)
return
-
EINVAL
;
/* must be at least a page size */
pgsz
=
lxc_getpagesize
();
if
((
uint64_t
)
size
<
pgsz
)
{
NOTICE
(
"Requested ringbuffer size for the console is %"
PRId64
" but must be at least %"
PRId64
" bytes. Setting ringbuffer size to %"
PRId64
" bytes"
,
size
,
pgsz
,
pgsz
);
size
=
pgsz
;
}
logsize
=
lxc_find_next_power2
((
uint64_t
)
size
);
if
(
logsize
==
0
)
return
-
EINVAL
;
if
(
logsize
!=
size
)
NOTICE
(
"Passed size was not a power of 2. Rounding log size to "
"next power of two: %"
PRIu64
" bytes"
,
logsize
);
lxc_conf
->
console
.
log_size
=
logsize
;
return
0
;
}
int
append_unexp_config_line
(
const
char
*
line
,
struct
lxc_conf
*
conf
)
int
append_unexp_config_line
(
const
char
*
line
,
struct
lxc_conf
*
conf
)
{
{
size_t
len
=
conf
->
unexpanded_len
,
linelen
=
strlen
(
line
);
size_t
len
=
conf
->
unexpanded_len
,
linelen
=
strlen
(
line
);
...
@@ -3023,6 +3072,12 @@ static int get_config_console_logfile(const char *key, char *retv, int inlen,
...
@@ -3023,6 +3072,12 @@ static int get_config_console_logfile(const char *key, char *retv, int inlen,
return
lxc_get_conf_str
(
retv
,
inlen
,
c
->
console
.
log_path
);
return
lxc_get_conf_str
(
retv
,
inlen
,
c
->
console
.
log_path
);
}
}
static
int
get_config_console_logsize
(
const
char
*
key
,
char
*
retv
,
int
inlen
,
struct
lxc_conf
*
c
,
void
*
data
)
{
return
lxc_get_conf_uint64
(
c
,
retv
,
inlen
,
c
->
autodev
);
}
static
int
get_config_seccomp_profile
(
const
char
*
key
,
char
*
retv
,
int
inlen
,
static
int
get_config_seccomp_profile
(
const
char
*
key
,
char
*
retv
,
int
inlen
,
struct
lxc_conf
*
c
,
void
*
data
)
struct
lxc_conf
*
c
,
void
*
data
)
{
{
...
@@ -3405,6 +3460,13 @@ static inline int clr_config_console_logfile(const char *key,
...
@@ -3405,6 +3460,13 @@ static inline int clr_config_console_logfile(const char *key,
return
0
;
return
0
;
}
}
static
inline
int
clr_config_console_logsize
(
const
char
*
key
,
struct
lxc_conf
*
c
,
void
*
data
)
{
c
->
console
.
log_size
=
0
;
return
0
;
}
static
inline
int
clr_config_seccomp_profile
(
const
char
*
key
,
static
inline
int
clr_config_seccomp_profile
(
const
char
*
key
,
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