[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 4/7] Add support for multiple consoles in LXC



On Wed, Nov 02, 2011 at 02:46:50PM -0600, Eric Blake wrote:
> On 10/20/2011 08:47 AM, Daniel P. Berrange wrote:
> >From: "Daniel P. Berrange"<berrange redhat com>
> >
> >Currently the LXC controller only supports setup of a single
> >text console. This is wired up to the container init's stdio,
> >as well as /dev/console and /dev/tty1. Extending support for
> >multiple consoles, means wiring up additional PTYs to /dev/tty2,
> >/dev/tty3, etc, etc. The LXC controller is passed multiple open
> >file handles, one for each console requested.
> >
> >* src/lxc/lxc_container.c, src/lxc/lxc_container.h: Wire up
> >   all the /dev/ttyN links required to symlink to /dev/pts/NN
> >* src/lxc/lxc_container.h: Open more container side /dev/pts/NN
> >   devices, and adapt event loop to handle I/O from all consoles
> >* src/lxc/lxc_driver.c: Setup multiple host side PTYs
> >---
> >  src/lxc/lxc_container.c  |   81 +++++++++++++++---------
> >  src/lxc/lxc_container.h  |    3 +-
> >  src/lxc/lxc_controller.c |  160 +++++++++++++++++++++++++++++-----------------
> >  src/lxc/lxc_driver.c     |   62 +++++++++++-------
> >  4 files changed, 191 insertions(+), 115 deletions(-)
> >
> 
> >@@ -891,10 +900,9 @@ cleanup:
> >      virMutexDestroy(&lock);
> >      signal(SIGCHLD, SIG_DFL);
> >  cleanup2:
> >-    VIR_FORCE_CLOSE(console.hostFd);
> >-    VIR_FORCE_CLOSE(console.contFd);
> >      VIR_FORCE_CLOSE(monitor.serverFd);
> >      VIR_FORCE_CLOSE(monitor.clientFd);
> >+    VIR_FREE(consoles);
> 
> The old code was closing all fds; should the new code be iterating
> over consoles and freeing both fd members per consoles[i]?

These FDs were actually passed into this method, so I decided it
was better practice for the caller to close them instead, since
it opened them.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]