selinux/policycoreutils/run_init
Jason Zaman 055cc407fc run_init: Use a ring buffer in open_init_pty
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>
2015-03-30 10:53:41 -04:00
..
Makefile policycoreutils: Create correct man directory for run_init manpages 2013-10-16 15:02:57 -04:00
open_init_pty.8 policycoreutils: open_init_tty man page typos 2011-08-03 18:02:36 -04:00
open_init_pty.c run_init: Use a ring buffer in open_init_pty 2015-03-30 10:53:41 -04:00
run_init.8 policycoreutils: run_init: clarification of the usage in the manual page 2011-08-15 11:25:24 -04:00
run_init.c run_init: fix open_init_pty avaibility check 2015-03-30 10:51:58 -04:00
run_init.pamd Give people who use run_init or newrole an indicator to make it not ask for passwords 2013-10-24 13:58:39 -04:00