namespaces: refactor CreatePidNs

Pull out the pid namespace logic out of cros_sdk so other utilities can
easily utilize it.  The code isn't specific to cros_sdk at all as is.

To facilitate this, start a new process_util module and move the helpers
GetExitStatus and ExitAsStatus helpers there.

Once we're done shuffling code around, start some unittests.  There are
no unittests for CreatePidNs though because it requires root access, and
it often wants newer kernels.  Will have to figure this out eventually.

BUG=None
TEST=`./cbuildbot/run_tests` passes
TEST=`cros_sdk` still launches in a unique pid namespace

Change-Id: I3d69d7fea8906f401b65cf544047e401b3a8017c
Reviewed-on: https://chromium-review.googlesource.com/226960
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
diff --git a/scripts/parallel_emerge.py b/scripts/parallel_emerge.py
index dc4676e..6287c8f 100644
--- a/scripts/parallel_emerge.py
+++ b/scripts/parallel_emerge.py
@@ -37,7 +37,7 @@
 import traceback
 
 from chromite.lib import cros_build_lib
-from chromite.lib import osutils
+from chromite.lib import process_util
 from chromite.lib import proctitle
 
 # If PORTAGE_USERNAME isn't specified, scrape it from the $HOME variable. On
@@ -1399,7 +1399,7 @@
         try:
           # Wait for the process to exit. When it does, exit with the return
           # value of the subprocess.
-          os._exit(osutils.GetExitStatus(os.waitpid(pid, 0)[1]))
+          os._exit(process_util.GetExitStatus(os.waitpid(pid, 0)[1]))
         except OSError as ex:
           if ex.errno == errno.EINTR:
             continue