Skip to content

Commit

Permalink
confile: lxc.pts --> lxc.pty.max
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed Jul 2, 2017
1 parent fe1c588 commit 232763d
Show file tree
Hide file tree
Showing 13 changed files with 34 additions and 20 deletions.
2 changes: 1 addition & 1 deletion config/templates/common.conf.in
Expand Up @@ -4,7 +4,7 @@
lxc.tty.dir = lxc

# Allow for 1024 pseudo terminals
lxc.pts = 1024
lxc.pty.max = 1024

# Setup 4 tty devices
lxc.tty.max = 4
Expand Down
2 changes: 1 addition & 1 deletion config/templates/openwrt.common.conf.in
@@ -1,7 +1,7 @@
# Default console settings
lxc.tty.dir = lxc
lxc.tty.max = 4
lxc.pts = 1024
lxc.pty.max = 1024

# Default capabilities
lxc.cap.drop = mac_admin
Expand Down
2 changes: 1 addition & 1 deletion config/templates/sabayon.common.conf.in
Expand Up @@ -4,7 +4,7 @@
lxc.mount.auto = cgroup:mixed proc:mixed sys:mixed

# Allow for 1024 pseudo terminals
lxc.pts = 1024
lxc.pty.max = 1024

# Setup 1 tty devices for lxc-console command
lxc.tty.max = 1
Expand Down
2 changes: 1 addition & 1 deletion doc/lxc.container.conf.sgml.in
Expand Up @@ -650,7 +650,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
<variablelist>
<varlistentry>
<term>
<option>lxc.pts</option>
<option>lxc.pty.max</option>
</term>
<listitem>
<para>
Expand Down
21 changes: 13 additions & 8 deletions src/lxc/confile.c
Expand Up @@ -75,7 +75,7 @@ lxc_log_define(lxc_confile, lxc);


lxc_config_define(personality);
lxc_config_define(pts);
lxc_config_define(pty_max);
lxc_config_define(tty_max);
lxc_config_define(tty_dir);
lxc_config_define(apparmor_profile);
Expand Down Expand Up @@ -135,10 +135,15 @@ lxc_config_define(prlimit);

static struct lxc_config_t config[] = {
{ "lxc.arch", set_config_personality, get_config_personality, clr_config_personality, },
{ "lxc.pts", set_config_pts, get_config_pts, clr_config_pts, },
{ "lxc.pty.max", set_config_pty_max, get_config_pty_max, clr_config_pty_max, },
{ "lxc.tty.dir", set_config_tty_dir, get_config_tty_dir, clr_config_tty_dir, },
{ "lxc.tty.max", set_config_tty_max, get_config_tty_max, clr_config_tty_max, },

/* REMOVE IN LXC 3.0
legacy pts key
*/
{ "lxc.pts", set_config_pty_max, get_config_pty_max, clr_config_pty_max, },

/* REMOVE IN LXC 3.0
legacy devttydir key
*/
Expand Down Expand Up @@ -1162,8 +1167,8 @@ static int set_config_personality(const char *key, const char *value,
return 0;
}

static int set_config_pts(const char *key, const char *value,
struct lxc_conf *lxc_conf, void *data)
static int set_config_pty_max(const char *key, const char *value,
struct lxc_conf *lxc_conf, void *data)
{
/* Set config value to default. */
if (lxc_config_value_empty(value)) {
Expand Down Expand Up @@ -2794,8 +2799,8 @@ static int get_config_personality(const char *key, char *retv, int inlen,
return fulllen;
}

static int get_config_pts(const char *key, char *retv, int inlen,
struct lxc_conf *c, void *data)
static int get_config_pty_max(const char *key, char *retv, int inlen,
struct lxc_conf *c, void *data)
{
return lxc_get_conf_int(c, retv, inlen, c->pts);
}
Expand Down Expand Up @@ -3366,8 +3371,8 @@ static inline int clr_config_personality(const char *key, struct lxc_conf *c,
return 0;
}

static inline int clr_config_pts(const char *key, struct lxc_conf *c,
void *data)
static inline int clr_config_pty_max(const char *key, struct lxc_conf *c,
void *data)
{
c->pts = 0;
return 0;
Expand Down
11 changes: 10 additions & 1 deletion src/tests/parse_config_file.c
Expand Up @@ -300,13 +300,22 @@ int main(int argc, char *argv[])
goto non_test_error;
}

/* lxc.pts */
/* REMOVE IN LXC 3.0
legacy ps keys
*/
if (set_get_compare_clear_save_load(c, "lxc.pts", "1000", tmpf, true) <
0) {
lxc_error("%s\n", "lxc.pts");
goto non_test_error;
}

/* lxc.pty.max */
if (set_get_compare_clear_save_load(c, "lxc.pty.max", "1000", tmpf, true) <
0) {
lxc_error("%s\n", "lxc.pty.max");
goto non_test_error;
}

/* REMOVE IN LXC 3.0
legacy tty.max keys
*/
Expand Down
2 changes: 1 addition & 1 deletion templates/lxc-altlinux.in
Expand Up @@ -278,7 +278,7 @@ copy_configuration()
cat <<EOF >> $config_path/config
lxc.uts.name = $name
lxc.tty.max = 4
lxc.pts = 1024
lxc.pty.max = 1024
lxc.cap.drop = sys_module mac_admin mac_override sys_time
# When using LXC with apparmor, uncomment the next line to run unconfined:
Expand Down
2 changes: 1 addition & 1 deletion templates/lxc-busybox.in
Expand Up @@ -345,7 +345,7 @@ lxc.signal.halt = SIGUSR1
lxc.rebootsignal = SIGTERM
lxc.uts.name = $name
lxc.tty.max = 1
lxc.pts = 1
lxc.pty.max = 1
lxc.cap.drop = sys_module mac_admin mac_override sys_time
# When using LXC with apparmor, uncomment the next line to run unconfined:
Expand Down
2 changes: 1 addition & 1 deletion templates/lxc-cirros.in
Expand Up @@ -121,7 +121,7 @@ cat >> "$path/config" <<EOF
lxc.rootfs.path = $rootfs
lxc.tty.max = 4
lxc.pts = 1024
lxc.pty.max = 1024
lxc.uts.name = $name
lxc.arch = $arch
Expand Down
2 changes: 1 addition & 1 deletion templates/lxc-debian.in
Expand Up @@ -517,7 +517,7 @@ copy_configuration()
lxc.tty.max = $num_tty
lxc.uts.name = $hostname
lxc.arch = $arch
lxc.pts=1023
lxc.pty.max = 1024
EOF

if [ $? -ne 0 ]; then
Expand Down
2 changes: 1 addition & 1 deletion templates/lxc-openmandriva.in
Expand Up @@ -230,7 +230,7 @@ copy_configuration()
cat <<EOF >> $config_path/config
lxc.uts.name = $name
lxc.tty.max = 4
lxc.pts = 1024
lxc.pty.max = 1024
lxc.cap.drop = sys_module mac_admin mac_override sys_time
lxc.mount.auto = cgroup:mixed proc:mixed sys:mixed
Expand Down
2 changes: 1 addition & 1 deletion templates/lxc-pld.in
Expand Up @@ -240,7 +240,7 @@ copy_configuration()
# lxc.include = /usr/share/lxc/config/common.conf
lxc.uts.name = $utsname
lxc.tty.max = 4
lxc.pts = 1024
lxc.pty.max = 1024
# Consider if below line is right for systemd container
lxc.mount.fstab = $config_path/fstab
lxc.cap.drop = sys_module mac_admin mac_override sys_time
Expand Down
2 changes: 1 addition & 1 deletion templates/lxc-sshd.in
Expand Up @@ -130,7 +130,7 @@ copy_configuration()
grep -q "^lxc.rootfs.path" $path/config 2>/dev/null || echo "lxc.rootfs.path = $rootfs" >> $path/config
cat <<EOF >> $path/config
lxc.uts.name = $name
lxc.pts = 1024
lxc.pty.max = 1024
lxc.cap.drop = sys_module mac_admin mac_override sys_time
# When using LXC with apparmor, uncomment the next line to run unconfined:
Expand Down

0 comments on commit 232763d

Please sign in to comment.