Implement susped, resume and cancel for the Postinstall action.
This patch sends SIGSTOP/SIGCONT to the running postinstall program to
suspend/resume the child process, and SIGKILL when cancelling it.
Bug: 27272144
TEST=Added unittest to check the signal being sent.
(cherry picked from commit d15c546ed794293d0a63770467a0f3c4c84c6214)
Change-Id: Ie99b406b4d7f73dda4189b7a5a7d627c866055d6
diff --git a/common/test_utils.cc b/common/test_utils.cc
index aba92e9..13ee564 100644
--- a/common/test_utils.cc
+++ b/common/test_utils.cc
@@ -103,6 +103,15 @@
0xbe, 0x9f, 0xa3, 0x5d,
};
+string Readlink(const string& path) {
+ vector<char> buf(PATH_MAX + 1);
+ ssize_t r = readlink(path.c_str(), buf.data(), buf.size());
+ if (r < 0)
+ return "";
+ CHECK_LT(r, static_cast<ssize_t>(buf.size()));
+ return string(buf.begin(), buf.begin() + r);
+}
+
bool IsXAttrSupported(const base::FilePath& dir_path) {
char *path = strdup(dir_path.Append("xattr_test_XXXXXX").value().c_str());