Add a timeout for all installd operations.
Bug: 216514270
Test: atest installd_utils_test
Test: atest installd_dexopt_test
Change-Id: I6c25e1df756ca486de1c8611185dbedf60d7cd7d
Merged-In: I6c25e1df756ca486de1c8611185dbedf60d7cd7d
(cherry picked from commit 495142ac75cdb2595a61755d7ab42a748e651728)
diff --git a/cmds/installd/utils.h b/cmds/installd/utils.h
index 0b1c324..3973894 100644
--- a/cmds/installd/utils.h
+++ b/cmds/installd/utils.h
@@ -153,7 +153,8 @@
int ensure_config_user_dirs(userid_t userid);
-int wait_child(pid_t pid);
+// Waits for a child process, or kills it if it times out. Returns the exit code.
+int wait_child_with_timeout(pid_t pid, int timeout_ms);
int prepare_app_cache_dir(const std::string& parent, const char* name, mode_t target_mode,
uid_t uid, gid_t gid);
@@ -170,6 +171,10 @@
void drop_capabilities(uid_t uid);
+// Removes a file specified by a file descriptor. Returns true on success. Reports the file path to
+// `path` if present.
+bool remove_file_at_fd(int fd, /*out*/ std::string* path = nullptr);
+
} // namespace installd
} // namespace android