libcamera: process: Fail loudly on isolate

Add an error debug message when disassociating part of a process
execution context using unshare fails.

As this is currently used to isolate a child process which is
immediately terminated silently if unshare fails, add a debug printout
and propagate up the error code to make the failure more visible.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
Jacopo Mondi 2019-07-19 09:24:37 +02:00
parent 9e6147d303
commit 119428fa1c

View file

@ -306,7 +306,15 @@ void Process::closeAllFdsExcept(const std::vector<int> &fds)
int Process::isolate() int Process::isolate()
{ {
return unshare(CLONE_NEWUSER | CLONE_NEWNET); int ret = unshare(CLONE_NEWUSER | CLONE_NEWNET);
if (ret) {
ret = -errno;
LOG(Process, Error) << "Failed to unshare execution context: "
<< strerror(-ret);
return ret;
}
return 0;
} }
/** /**