From: Francis Deslauriers Date: Thu, 28 Jun 2018 15:39:30 +0000 (-0400) Subject: run_as: adapt run_as implementation to support complex payloads X-Git-Tag: v2.11.0-rc1~82 X-Git-Url: https://git.lttng.org/?a=commitdiff_plain;h=fe9f7760c61d1248a062138fd059c84ec03967f6;hp=fe9f7760c61d1248a062138fd059c84ec03967f6;p=lttng-tools.git run_as: adapt run_as implementation to support complex payloads This commits changes 4 elements of the run_as implementation: 1. Allow for commands with complex return types, 2. Detect worker crashes and restart it, 3. Enable commands that take FD as input. 4. Define master-worker protocol In the past, run_as commands were simple and were all returning int values (e.g. open(), mkdir()). With the introduction of the future, more complex run_as commands such as the one to extract elf symbol offsets for the userspace-probe instrumentation, we need to allow arbitrary return types such as long and arrays. Creating a return type abstraction allows to add new return types. To implement this new abstraction, this commit adds the passing of the run_as_ret structure as parameter to the command functions that are responsible to set the errno and the return value according to their semantics. The run_as_ret struct now contains an union of return types. More complex run_as commands are more prone to crashes, we thus make the master process restart the worker process if it detects it has exited. Enable passing FD to worker process for commands that take file descriptor as input. Rework data and FD sending and receiving functions for both side of the master-worker control channel and add comments describing each steps of the protocol. Signed-off-by: Francis Deslauriers Signed-off-by: Jérémie Galarneau ---