]> git.proxmox.com Git - mirror_lxc.git/commit - src/lxc/start.c
console API improvements
authorDwight Engen <dwight.engen@oracle.com>
Wed, 12 Jun 2013 15:09:16 +0000 (08:09 -0700)
committerSerge Hallyn <serge.hallyn@ubuntu.com>
Wed, 12 Jun 2013 20:53:08 +0000 (15:53 -0500)
commitb515981702133b9aaea1aff378493f054c14d46c
treec952a8452939958cab10bb62cf78f5899a870c5a
parent5d4d3ebb13705d1e102429c75fc06932f81816dd
console API improvements

Add a higher level console API that opens a tty/console and runs the
mainloop as well. Rename existing API to console_getfd(). Use these in
the python binding.

Allow attaching a console peer after container bootup, including if the
container was launched with -d. This is made possible by allocation of a
"proxy" pty as the peer when the console is attached to.

Improve handling of SIGWINCH, the pty size will be correctly set at the
beginning of a session and future changes when using the lxc_console() API
will be propagated to it as well.

Refactor some common code between lxc_console.c and console.c. The variable
wait4q (renamed to saw_escape) was static, making the mainloop callback not
safe across threads. This wasn't a problem when the callback was in the
non-threaded lxc-console, but now that it is internal to console.c, we have
to take care of it. This is now contained in a per-tty state structure.

Don't attempt to open /dev/null as the console peer since /dev/null cannot
be added to the mainloop (epoll_ctl() fails with EPERM). This isn't needed
to get the console setup (and the log to work) since the case of not having
a peer at console init time has to be handled to allow for attaching to it
later.

Move signalfd libc wrapper/replacement to utils.h.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
18 files changed:
doc/lxc-console.sgml.in
src/lxc/commands.c
src/lxc/commands.h
src/lxc/conf.c
src/lxc/conf.h
src/lxc/console.c
src/lxc/console.h
src/lxc/lxc.h
src/lxc/lxc_console.c
src/lxc/lxccontainer.c
src/lxc/lxccontainer.h
src/lxc/start.c
src/lxc/utils.h
src/python-lxc/examples/pyconsole-vte.py [new file with mode: 0755]
src/python-lxc/examples/pyconsole.py [new file with mode: 0755]
src/python-lxc/lxc.c
src/python-lxc/lxc/__init__.py
src/tests/console.c