/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2023 - 2025 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
_E("Dispose. type(%d), name(%s), pid(%d)", GetType(), GetLoaderName().c_str(),
GetPid());
+ DeleteReadyFile();
if (pid_ > 0) {
_D("Kill process(%d)", pid_);
if (kill(pid_, SIGKILL) != 0)
std::string path =
"/tmp/." + std::to_string(getuid()) + "-" + GetLoaderName() + ".ready";
std::filesystem::path file_path(path);
- if (std::filesystem::exists(file_path)) {
+ if (access(file_path.c_str(), F_OK) == 0) {
ready_file_created_ = true;
return;
}
ready_file_created_ = true;
}
+void LoaderContext::DeleteReadyFile() {
+ if (!ready_file_created_) return;
+
+ std::string path =
+ "/tmp/." + std::to_string(getuid()) + "-" + GetLoaderName() + ".ready";
+ std::filesystem::path file_path(path);
+ if (access(file_path.c_str(), F_OK) != 0) {
+ ready_file_created_ = false;
+ return;
+ }
+
+ std::error_code error;
+ std::filesystem::remove(file_path, error);
+ if (error) {
+ _E("Failed to remove the file. path(%s), error(%s)",
+ path.c_str(), error.message().c_str());
+ return;
+ }
+
+ _W("File(%s) deleted successfully", path.c_str());
+ ready_file_created_ = false;
+}
+
} // namespace launchpad
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2023 - 2025 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
void OnIOEventReceived(int fd, int condition) override;
int GetSchedPriority() const;
void CreateReadyFile();
+ void DeleteReadyFile();
private:
void UpdateScore();