if (loader_context->GetPid() > 0) {
CPUBoostController::DoBoost(loader_context->GetPid(),
CPUBoostController::Level::Strong, 10000);
+ _W("Send result: %d", loader_context->GetPid());
request->SendResult(loader_context->GetPid());
}
hydra_context->Prepare();
}
} else if (context->GetPid() > 0) {
+ if (context->RefCount() != 0) {
+ _W("Except. type(%d), loader_name(%s), pid(%d)",
+ context->GetType(), context->GetLoaderName().c_str(),
+ context->GetPid());
+ continue;
+ }
+
context->Dispose();
context->Prepare();
}
#include <utility>
+#include <util.hh>
+
#include "launchpad-process-pool/launchpad_args.hh"
#include "launchpad-process-pool/log_private.hh"
snprintf(args[0], length, "/usr/bin/%s <%s>", kProcessPool, name_.c_str());
close(pipe_fd_[1]);
+ std::vector<int> except_fds { pipe_fd_[0] };
+ Util::CloseAllFds(except_fds);
int ret = WaitForRequest(std::make_unique<Socket>(pipe_fd_[0]));
exit(ret);
}
#include <tzplatform_config.h>
#include <unistd.h>
+#include <algorithm>
#include <filesystem>
#include <fstream>
#include <memory>
return "";
}
-void Util::CloseAllFds() {
+void Util::CloseAllFds(const std::vector<int>& except_fds) {
int aul_fd = -1;
const char* aul_listen_fd = getenv("AUL_LISTEN_FD");
if (aul_listen_fd != nullptr)
if (fd < 3 || fd == aul_fd)
continue;
+ auto found = std::find_if(except_fds.begin(), except_fds.end(),
+ [&](int except_fd) {
+ return except_fd == fd;
+ });
+ if (found != except_fds.end())
+ continue;
+
fds.push_back(fd);
}
} catch (const fs::filesystem_error& e) {
#include <tzplatform_config.h>
#include <string>
+#include <vector>
#include <app_info.hh>
#include <types.hh>
static int MountResourceDirectories(const AppInfo* app_info);
static int WaitTepMount(const AppInfo* app_info);
static std::string GetLibDirectory(const std::string& app_path);
- static void CloseAllFds();
+ static void CloseAllFds(const std::vector<int>& except_fds = {});
static int PrepareAppSocket();
static int PrepareAppIdFile(const AppInfo* app_info);
static int SendCmdToAmd(enum AmdCmd cmd);