mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-11-19 16:01:57 +09:00
[MG_Remote, MG_Test, ci] (P7): one raw-peer row per latch site and the D11 bounds against a --serve supervisor, each followed by a rendering next session (PH-1 (4), fuzz arm 2)
This commit is contained in:
@@ -218,6 +218,12 @@ namespace MobileGL::MG_Remote::Server {
|
||||
|
||||
MobileGLResult LaunchServer(const std::string& imagePath, const std::string& endpoint,
|
||||
LaunchedServer* out) {
|
||||
return LaunchServerWithArgs(imagePath, endpoint, {}, out);
|
||||
}
|
||||
|
||||
MobileGLResult LaunchServerWithArgs(const std::string& imagePath, const std::string& endpoint,
|
||||
const std::vector<std::string>& extraArgs,
|
||||
LaunchedServer* out) {
|
||||
if (out == nullptr || endpoint.empty()) {
|
||||
return MOBILEGL_ERR_INVALID_ARGUMENT;
|
||||
}
|
||||
@@ -240,9 +246,17 @@ namespace MobileGL::MG_Remote::Server {
|
||||
const std::string::size_type slash = image.find_last_of('/');
|
||||
ScrubbedEnv env =
|
||||
BuildChildEnv(slash == std::string::npos ? std::string() : image.substr(0, slash));
|
||||
std::string argv0 = image;
|
||||
std::string argv1 = endpoint;
|
||||
char* argv[] = {argv0.data(), argv1.data(), nullptr};
|
||||
// Built before the fork: the child may only make async-signal-safe calls until execve.
|
||||
std::vector<std::string> args;
|
||||
args.reserve(2 + extraArgs.size());
|
||||
args.push_back(image);
|
||||
args.push_back(endpoint);
|
||||
for (const std::string& arg : extraArgs) args.push_back(arg);
|
||||
std::vector<char*> argvStorage;
|
||||
argvStorage.reserve(args.size() + 1);
|
||||
for (std::string& arg : args) argvStorage.push_back(arg.data());
|
||||
argvStorage.push_back(nullptr);
|
||||
char** argv = argvStorage.data();
|
||||
|
||||
// A close-on-exec pipe so an execve that fails reports its errno back
|
||||
// instead of vanishing: the app process's stderr is /dev/null on Android
|
||||
@@ -339,6 +353,10 @@ namespace MobileGL::MG_Remote::Server {
|
||||
"(CONTRACT-P6 §2.6); there is no fork() to build a second process from");
|
||||
return MOBILEGL_ERR_UNSUPPORTED;
|
||||
}
|
||||
MobileGLResult LaunchServerWithArgs(const std::string& imagePath, const std::string& endpoint,
|
||||
const std::vector<std::string>&, LaunchedServer* out) {
|
||||
return LaunchServer(imagePath, endpoint, out);
|
||||
}
|
||||
MobileGLResult ReapServer(LaunchedServer&, std::uint32_t, int*) {
|
||||
return MOBILEGL_ERR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace MobileGL::MG_Remote::Server {
|
||||
|
||||
@@ -74,6 +75,14 @@ namespace MobileGL::MG_Remote::Server {
|
||||
MobileGLResult LaunchServer(const std::string& imagePath, const std::string& endpoint,
|
||||
LaunchedServer* out);
|
||||
|
||||
// The same launch with arguments after the endpoint - `--serve` for the fork-per-session
|
||||
// supervisor a TCP deployment runs (ServerMain.cpp). PH-1 (4)'s control needs exactly that
|
||||
// shape on a unit rig: a session that latches must leave a supervisor that serves the next
|
||||
// connection, and a single-session server exits with its only session.
|
||||
MobileGLResult LaunchServerWithArgs(const std::string& imagePath, const std::string& endpoint,
|
||||
const std::vector<std::string>& extraArgs,
|
||||
LaunchedServer* out);
|
||||
|
||||
// Waits for the child, up to `timeoutMs`. Returns MOBILEGL_ERR_TIMEOUT if it
|
||||
// is still running, in which case the caller decides whether to escalate -
|
||||
// this function never signals a child it did not have to.
|
||||
|
||||
Reference in New Issue
Block a user