055cc407fc
open_init_pty uses select() to handle all the file descriptors. There is a very high CPU usage due to select() always returning immediately with the fd is available for write. This uses a ring buffer and only calls select on the read/write fds that have data that needs to be read/written which eliminates the high CPU usage. This also correctly returns the exit code from the child process. This was originally from debian where they have been carrying it as a patch for a long time. Then we got a bug report in gentoo which this also happens to fix. The original debian patch had the ring buffer written in C++ so I modified the class into a struct and some static methods so it is C-only at the request of Steve Lawrence. Debian bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=474956 Gentoo bug: https://bugs.gentoo.org/show_bug.cgi?id=532616 Signed-off-by: Jason Zaman <jason@perfinion.com> Tested-by: Laurent Bigonville <bigon@bigon.be> |
||
---|---|---|
.. | ||
Makefile | ||
open_init_pty.8 | ||
open_init_pty.c | ||
run_init.8 | ||
run_init.c | ||
run_init.pamd |