diff options
author | Hwankyu Jhun <h.jhun@samsung.com> | 2024-01-08 13:21:11 +0900 |
---|---|---|
committer | Hwankyu Jhun <h.jhun@samsung.com> | 2024-01-08 13:21:11 +0900 |
commit | 29086ece9e18efc76b9d729bf53b9295a045f4c3 (patch) | |
tree | cc03eb72c3937d8acb61b7a40a607d86af1013fb | |
parent | 478fb2dadec7fa08b778f07bcc1d0fffa8fd1343 (diff) | |
download | launchpad-29086ece9e18efc76b9d729bf53b9295a045f4c3.tar.gz launchpad-29086ece9e18efc76b9d729bf53b9295a045f4c3.tar.bz2 launchpad-29086ece9e18efc76b9d729bf53b9295a045f4c3.zip |
Remove MCJ file for dotnet apps
The pal layer of coreclr creates the temporary file. If the process is
terminated by SIGKILL, the file is not deleted normally.
To prevent SMACK issue, the launchpad-process-pool removes the MCJ file.
Change-Id: I63eac7ee30008195ff9dcd5572b7c3222d83501b
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
-rw-r--r-- | src/launchpad-process-pool/signal_manager.cc | 21 | ||||
-rw-r--r-- | src/launchpad-process-pool/signal_manager.hh | 7 |
2 files changed, 22 insertions, 6 deletions
diff --git a/src/launchpad-process-pool/signal_manager.cc b/src/launchpad-process-pool/signal_manager.cc index 51fb638..124537e 100644 --- a/src/launchpad-process-pool/signal_manager.cc +++ b/src/launchpad-process-pool/signal_manager.cc @@ -53,17 +53,17 @@ class GarbageCollector : public launchpad::Worker::Job { } } - void DoAtFork() { - _W("pid: %d", pid_); + void DoAtFork() { + _W("pid: %d", pid_); try { std::string path = "/run/aul/apps/" + std::to_string(getuid()) + "/" + - std::to_string(pid_); + std::to_string(pid_); DeleteSocketPath(fs::path(path)); DeleteUnusedFiles(); } catch (const std::filesystem::filesystem_error& e) { _E("Exception occurs. error(%s:%d)", e.what(), e.code().value()); } - } + } private: void DeleteSocketPath(const fs::path& path) { @@ -87,6 +87,19 @@ class GarbageCollector : public launchpad::Worker::Job { } void DeleteUnusedFiles() { + DeleteMCJFile(); + DeleteTmpFiles(); + } + + void DeleteMCJFile() { + std::string path = "/tmp/.dotnet/mcj/MCJ.TMP." + std::to_string(pid_); + if (access(path.c_str(), F_OK) == 0) { + _W("Remove file: %s", path.c_str()); + fs::remove(path); + } + } + + void DeleteTmpFiles() { std::vector<std::string> files = { "clr-debug-pipe-" + std::to_string(pid_) + "-", "dotnet-diagnostic-" + std::to_string(pid_) + "-" diff --git a/src/launchpad-process-pool/signal_manager.hh b/src/launchpad-process-pool/signal_manager.hh index 66acf22..c535ee2 100644 --- a/src/launchpad-process-pool/signal_manager.hh +++ b/src/launchpad-process-pool/signal_manager.hh @@ -60,8 +60,11 @@ class SignalManager : public SigchldEvent::IEvent, SignalAction(int signo, struct sigaction action) : signo_(signo), action_(action) {} - int GetSigno() const { return signo_; }; - struct sigaction GetSigaction() const { return action_; }; + int GetSigno() const { return signo_; } + + struct sigaction GetSigaction() const { + return action_; + } private: int signo_; |