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.
Change-Id: Iebe9bd34448ad1d0a5340c82e1fd839ff8c69dd2
diff --git a/common/test_utils.cc b/common/test_utils.cc
index 0e7a8ef..4ab1663 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());