[lxc-devel] fixing restoring of tty mode after lxc-start
Michael Tokarev
mjt at tls.msk.ru
Fri Nov 20 22:42:03 UTC 2009
Hello.
While trying to fix the tty mode after lxc-start, I come across
lxc_close_all_inherited_fd() routine. Which closes all fds which
were inherited when lxc-start started.
It's called this way:
lxc_start.c:main():
lxc_start():
lxc_spawn();
lxc_close_all_inherited_fd()
lxc_poll()
The question is why lxc_close_all_inherited() is needed here.
And why it is ever needed _outside_ of the container to start
with.
This call to close_all_inherited_fd() is the reason why tty
modes are not restored after lxc-start: because stdin is now
closed and hence nothing to restore.
It looks like the whole inherited_fd thing is only needed in
lxc_init helper binary, there's no need to use it anywhere else.
And even there it can be avoided, by iterating over /proc/self/fd
and closing them on the way.
But maybe there's some other for this housekeeping somewhere, so
I'm asking.
Thanks!
/mjt
More information about the lxc-devel
mailing list