]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
confile: lxc.tty --> lxc.tty.max
authorChristian Brauner <christian.brauner@ubuntu.com>
Sun, 2 Jul 2017 10:37:33 +0000 (12:37 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Sun, 2 Jul 2017 12:40:07 +0000 (14:40 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
21 files changed:
config/templates/archlinux.common.conf.in
config/templates/common.conf.in
config/templates/openwrt.common.conf.in
config/templates/sabayon.common.conf.in
config/templates/voidlinux.common.conf.in
doc/lxc.container.conf.sgml.in
src/lxc/conf.h
src/lxc/confile.c
src/lxc/console.h
src/tests/console.c
src/tests/get_item.c
src/tests/lxc-test-checkpoint-restore
src/tests/parse_config_file.c
templates/lxc-altlinux.in
templates/lxc-archlinux.in
templates/lxc-busybox.in
templates/lxc-cirros.in
templates/lxc-debian.in
templates/lxc-gentoo.in
templates/lxc-openmandriva.in
templates/lxc-pld.in

index 7da478f81d8eb12cdbfe91632b5d7006cfb7d867..e8c8800c2f793b723cdcc85d85e079dd71572435 100644 (file)
@@ -2,7 +2,7 @@
 lxc.include = @LXCTEMPLATECONFIG@/common.conf
 
 # Allow for 6 tty devices by default
-lxc.tty = 6
+lxc.tty.max = 6
 
 # Set the halt/stop signals
 lxc.signal.halt=SIGRTMIN+4
index a0134848902f5ef86ecf3d70daa8b5abfd496bed..27925221d261c888110678289c5d3741c07af996 100644 (file)
@@ -7,7 +7,7 @@ lxc.tty.dir = lxc
 lxc.pts = 1024
 
 # Setup 4 tty devices
-lxc.tty = 4
+lxc.tty.max = 4
 
 # Drop some harmful capabilities
 lxc.cap.drop = mac_admin mac_override sys_time sys_module sys_rawio
index e9e4e51cccf255728cccec7013c15f6be4158257..8877c498e55b2b8175b944c9e53a63a6504a643d 100644 (file)
@@ -1,6 +1,6 @@
 # Default console settings
 lxc.tty.dir = lxc
-lxc.tty = 4
+lxc.tty.max = 4
 lxc.pts = 1024
 
 # Default capabilities
index 21e3148b16d590c93474ad1328d27a49aaaabcad..0251ab5c9b3aa21570ec6f94454b5097e17bddab 100644 (file)
@@ -7,7 +7,7 @@ lxc.mount.auto = cgroup:mixed proc:mixed sys:mixed
 lxc.pts = 1024
 
 # Setup 1 tty devices for lxc-console command
-lxc.tty = 1
+lxc.tty.max = 1
 
 # Needed for systemd distro
 lxc.autodev = 1
index 9e49fd7b80768a8ee42ed6ee53d7cfa11002a22b..c287b45c57afe0168df1c50a346857d4b3e2d159 100644 (file)
@@ -2,7 +2,7 @@
 lxc.include = @LXCTEMPLATECONFIG@/common.conf
 
 # Allow for 6 tty devices by default
-lxc.tty = 6
+lxc.tty.max = 6
 
 # Set $VIRTUALIZATION so runit doesn't try to mount filesystems or start udevd
 lxc.environment=VIRTUALIZATION=lxc
index 9a1b233c04041c8d832d258ed4e876c634499e05..076efc455d0199658324e72b7dc2940a0d3f1488 100644 (file)
@@ -718,7 +718,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
       <variablelist>
         <varlistentry>
           <term>
-            <option>lxc.tty</option>
+            <option>lxc.tty.max</option>
           </term>
           <listitem>
             <para>
@@ -747,7 +747,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
       <variablelist>
         <varlistentry>
           <term>
-            <option>lxc.devttydir</option>
+            <option>lxc.tty.dir</option>
           </term>
           <listitem>
             <para>
index a56f172c7ef8a0bec97d84b837e99607e42c3725..82da42e33e61997a60c27d0d5169f89aac957130 100644 (file)
@@ -330,7 +330,8 @@ struct lxc_conf {
        struct lxc_list caps;
        struct lxc_list keepcaps;
        struct lxc_tty_info tty_info;
-       char *pty_names; // comma-separated list of lxc.tty pty names
+       /* Comma-separated list of lxc.tty.max pty names. */
+       char *pty_names;
        struct lxc_console console;
        struct lxc_rootfs rootfs;
        char *ttydir;
index c218e032941cb6ff691387efbd9ea3396a68d53d..dc5a175a91e3e0ad012b53f3af2307c9416e11f1 100644 (file)
@@ -76,7 +76,7 @@ lxc_log_define(lxc_confile, lxc);
 
 lxc_config_define(personality);
 lxc_config_define(pts);
-lxc_config_define(tty);
+lxc_config_define(tty_max);
 lxc_config_define(tty_dir);
 lxc_config_define(apparmor_profile);
 lxc_config_define(apparmor_allow_incomplete);
@@ -137,13 +137,18 @@ 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.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 devttydir key
         */
        { "lxc.devttydir",                 set_config_tty_dir,                     get_config_tty_dir,                     clr_config_tty_dir,                   },
 
-       { "lxc.tty",                       set_config_tty,                         get_config_tty,                         clr_config_tty,                       },
+       /* REMOVE IN LXC 3.0
+          legacy tty key
+        */
+       { "lxc.tty",                       set_config_tty_max,                     get_config_tty_max,                     clr_config_tty_max,                   },
+
        { "lxc.apparmor.profile",          set_config_apparmor_profile,            get_config_apparmor_profile,            clr_config_apparmor_profile,          },
        { "lxc.apparmor.allow_incomplete", set_config_apparmor_allow_incomplete,   get_config_apparmor_allow_incomplete,   clr_config_apparmor_allow_incomplete, },
        { "lxc.selinux.context",           set_config_selinux_context,             get_config_selinux_context,             clr_config_selinux_context,           },
@@ -1313,8 +1318,8 @@ on_error:
        return -1;
 }
 
-static int set_config_tty(const char *key, const char *value,
-                         struct lxc_conf *lxc_conf, void *data)
+static int set_config_tty_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)) {
@@ -2795,8 +2800,8 @@ static int get_config_pts(const char *key, char *retv, int inlen,
        return lxc_get_conf_int(c, retv, inlen, c->pts);
 }
 
-static int get_config_tty(const char *key, char *retv, int inlen,
-                         struct lxc_conf *c, void *data)
+static int get_config_tty_max(const char *key, char *retv, int inlen,
+                             struct lxc_conf *c, void *data)
 {
        return lxc_get_conf_int(c, retv, inlen, c->tty);
 }
@@ -3368,8 +3373,8 @@ static inline int clr_config_pts(const char *key, struct lxc_conf *c,
        return 0;
 }
 
-static inline int clr_config_tty(const char *key, struct lxc_conf *c,
-                                void *data)
+static inline int clr_config_tty_max(const char *key, struct lxc_conf *c,
+                                    void *data)
 {
        c->tty = 0;
        return 0;
index fefdb19e2c962a436ab26550b00f02b7bb704b9c..2453d60d446132ac05addfa7604216d1bdbc9487 100644 (file)
@@ -110,7 +110,7 @@ extern int  lxc_console_mainloop_add(struct lxc_epoll_descr *, struct lxc_conf *
 extern void lxc_console_sigwinch(int sig);
 
 /*
- * Connect to one of the ptys given to the container via lxc.tty.
+ * Connect to one of the ptys given to the container via lxc.tty.max.
  * - allocates either the current controlling pty (default) or a user specified
  *   pty as peer pty for the containers tty
  * - sets up SIGWINCH handler, winsz, and new terminal settings
@@ -123,10 +123,10 @@ extern int  lxc_console(struct lxc_container *c, int ttynum,
                        int escape);
 
 /*
- * Allocate one of the ptys given to the container via lxc.tty. Returns an open
- * fd to the allocated pty.
+ * Allocate one of the ptys given to the container via lxc.tty.max. Returns an
+ * open fd to the allocated pty.
  * Set ttynum to -1 to allocate the first available pty, or to a value within
- * the range specified by lxc.tty to allocate a specific pty.
+ * the range specified by lxc.tty.max to allocate a specific pty.
  */
 extern int  lxc_console_getfd(struct lxc_container *c, int *ttynum,
                              int *masterfd);
index 351f47ae7198914fb4448f81809d6b6952b189dc..c47f25344b4fe084539d12bdb51fb718aa086fa6 100644 (file)
@@ -145,7 +145,7 @@ static int test_console(const char *lxcpath,
                goto out2;
        }
        c->load_config(c, NULL);
-       c->set_config_item(c, "lxc.tty", TTYCNT_STR);
+       c->set_config_item(c, "lxc.tty.max", TTYCNT_STR);
        c->save_config(c, NULL);
        c->want_daemonize(c, true);
        if (!c->startl(c, 0, NULL)) {
index b73b09c3d1d0d6dacb4ec7ad2c92365bf318c4fe..e0fd7b603789bc52af5329de0c160e19a4914355 100644 (file)
@@ -83,6 +83,11 @@ int main(int argc, char *argv[])
                goto out;
        }
        fprintf(stderr, "%d: get_config_item(lxc.network) returned %d %s\n", __LINE__, ret, v2);
+
+
+       /* REMOVE IN LXC 3.0
+          legacy lxc.tty key
+        */
        if (!c->set_config_item(c, "lxc.tty", "4")) {
                fprintf(stderr, "%d: failed to set tty\n", __LINE__);
                goto out;
index 09ec1e13192a8ce800042c771401f47caa408db2..27c83b4be4ee491da196f7cbae42a6eec4318600 100755 (executable)
@@ -32,7 +32,7 @@ lxc-create -t ubuntu -n $name || FAIL "creating container"
 cat >> "$(lxc-config lxc.lxcpath)/$name/config" <<EOF
 # hax for criu
 lxc.console.path = none
-lxc.tty = 0
+lxc.tty.max = 0
 lxc.cgroup.devices.deny = c 5:1 rwm
 EOF
 
index f3d47299471710291bc2322ad977d7953b4b18ca..21e630417d4e8ed2f10964d7bc0914ff37b66477 100644 (file)
@@ -307,13 +307,22 @@ int main(int argc, char *argv[])
                goto non_test_error;
        }
 
-       /* lxc.tty */
+       /* REMOVE IN LXC 3.0
+          legacy tty.max keys
+        */
        if (set_get_compare_clear_save_load(c, "lxc.tty", "4", tmpf, true) <
            0) {
                lxc_error("%s\n", "lxc.tty");
                goto non_test_error;
        }
 
+       /* lxc.tty.max */
+       if (set_get_compare_clear_save_load(c, "lxc.tty.max", "4", tmpf, true) <
+           0) {
+               lxc_error("%s\n", "lxc.tty.max");
+               goto non_test_error;
+       }
+
        /* REMOVE IN LXC 3.0
           legacy devttydir keys
         */
index eb134e39f775e98948e6a116976d8dbafc88998a..c39c575b7f876df8de2b2dd248d592f4ab0e1fda 100644 (file)
@@ -277,7 +277,7 @@ copy_configuration()
     grep -q "^lxc.rootfs.path" $config_path/config 2>/dev/null || echo "lxc.rootfs.path = $rootfs_path" >> $config_path/config
     cat <<EOF >> $config_path/config
 lxc.uts.name = $name
-lxc.tty = 4
+lxc.tty.max = 4
 lxc.pts = 1024
 lxc.cap.drop = sys_module mac_admin mac_override sys_time
 
index defea748a977cf01e9d3ce268ee4a83b84f59d01..d0ca12846cdff0c4f9486145777e02c2d98a24c3 100644 (file)
@@ -121,7 +121,7 @@ systemctl enable systemd-resolved
 ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
 EOF
     # enable getty on active ttys
-    local nttys=$(cat "${config_path}/config" ${shared_config} ${common_config} | grep "^lxc.tty" | head -n1 | cut -d= -f2 | tr -d "[:blank:]")
+    local nttys=$(cat "${config_path}/config" ${shared_config} ${common_config} | grep "^lxc.tty.max" | head -n1 | cut -d= -f2 | tr -d "[:blank:]")
     local devttydir=$(cat "${config_path}/config" ${shared_config} ${common_config} | grep "^lxc.tty.dir" | head -n1 | cut -d= -f2 | tr -d "[:blank:]")
     local devtty=""
     # bind getty instances to /dev/<devttydir>/tty* if lxc.tty.dir is set
index e93c9e59d56236e1a0d1886a0d21bb07aabad74e..36572df5d333a700da22805eee60ad12d33b0ed2 100644 (file)
@@ -344,7 +344,7 @@ cat <<EOF >> $path/config
 lxc.signal.halt = SIGUSR1
 lxc.rebootsignal = SIGTERM
 lxc.uts.name = $name
-lxc.tty = 1
+lxc.tty.max = 1
 lxc.pts = 1
 lxc.cap.drop = sys_module mac_admin mac_override sys_time
 
index c5e864c24c45e53b70ae2c7f4dbfdb40f734d7d7..a5a8c5e9f0650adfbab9129d19fda449c0ce411f 100644 (file)
@@ -120,7 +120,7 @@ cat >> "$path/config" <<EOF
 
 lxc.rootfs.path = $rootfs
 
-lxc.tty = 4
+lxc.tty.max = 4
 lxc.pts = 1024
 
 lxc.uts.name = $name
index b82faa3b8c66caf66e9609467d304b5d93eaacea..22c6bb1ba0246d8d1d295728968b3c33cafe2046 100644 (file)
@@ -265,7 +265,7 @@ configure_debian_systemd()
     chroot "${rootfs}" ln -s /dev/null /etc/systemd/system/systemd-udevd.service
     chroot "${rootfs}" ln -s /lib/systemd/system/multi-user.target /etc/systemd/system/default.target
     # Setup getty service on the ttys we are going to allow in the
-    # default config.  Number should match lxc.tty
+    # default config.  Number should match lxc.tty.max
     ( cd "${rootfs}/etc/systemd/system/getty.target.wants"
         for i in $(seq 1 "$num_tty") ; do ln -sf ../getty\@.service getty@tty"${i}".service; done )
 
@@ -514,7 +514,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.tty = $num_tty
+lxc.tty.max = $num_tty
 lxc.uts.name = $hostname
 lxc.arch = $arch
 lxc.pts=1023
@@ -795,8 +795,8 @@ if [ -z "$rootfs" ]; then
 fi
 
 # determine the number of ttys - default is 4
-if grep -q '^lxc.tty' "$config" 2> /dev/null ; then
-    num_tty=$(awk -F= '/^lxc.tty[ \t]+=/{ print $2 }' "$config")
+if grep -q '^lxc.tty.max' "$config" 2> /dev/null ; then
+    num_tty=$(awk -F= '/^lxc.tty.max[ \t]+=/{ print $2 }' "$config")
 else
     num_tty=4
 fi
index e16366603cf22a8fd1c16781fb38ba36f67513e3..9b84283e7ad29c45f393bd147c0bfb290e730a59 100644 (file)
@@ -706,7 +706,7 @@ ${conf_arch_line}
 
 # set the hostname
 lxc.uts.name = ${name}
-lxc.tty = ${tty}
+lxc.tty.max = ${tty}
 
 ${conf_rootfs_line}
 ${portage_mount}
index daf4bc08ae8470ad3a5a2a9281d1dc555f0e9789..a552165436ff5031963e6b813b5a137fda4dee3e 100644 (file)
@@ -229,7 +229,7 @@ copy_configuration()
     grep -q "^lxc.rootfs.path" $config_path/config 2>/dev/null || echo "lxc.rootfs.path = $rootfs_path" >> $config_path/config
     cat <<EOF >> $config_path/config
 lxc.uts.name = $name
-lxc.tty = 4
+lxc.tty.max = 4
 lxc.pts = 1024
 lxc.cap.drop = sys_module mac_admin mac_override sys_time
 lxc.mount.auto = cgroup:mixed proc:mixed sys:mixed
index 3f994a92b595cec21a4ee29ef645a3f252c2e0fd..49a8149aa898d2a0c591367b8856965de24b48ac 100644 (file)
@@ -138,7 +138,7 @@ configure_pld_systemd()
        > ${rootfs_path}/etc/systemd/system/getty@.service
 
        # Setup getty service on the 4 ttys we are going to allow in the
-       # default config. Number should match lxc.tty
+       # default config. Number should match lxc.tty.max
        for i in 1 2 3 4; do
                ln -sf ../getty@.service ${rootfs_path}/etc/systemd/system/getty.target.wants/getty@tty${i}.service
        done
@@ -239,7 +239,7 @@ copy_configuration()
 # Most of below settings should be taken as defaults  from
 # lxc.include = /usr/share/lxc/config/common.conf
 lxc.uts.name = $utsname
-lxc.tty = 4
+lxc.tty.max = 4
 lxc.pts = 1024
 # Consider if below line is right for systemd container
 lxc.mount.fstab = $config_path/fstab