Logwrapper: Remove unused support for input / output processing.
Should make it easier to switch callers over to posix_spawn once
that's available.
NOTE: The (now) unused arguments will be removed in a followup (multi-project)c
hange once we empirically confirm that there aren't any prebuilt blobs
using this function. I did readelf all currently checked in prebuilts to look
for a reference to this method, but one can never be too paranoid.
Test: make checkbuild
Change-Id: I454d80c52f269c31846133cc54375decd702fe71
diff --git a/logwrapper/logwrap.c b/logwrapper/logwrap.c
index 3ad0983..7076078 100644
--- a/logwrapper/logwrap.c
+++ b/logwrapper/logwrap.c
@@ -291,8 +291,7 @@
}
static int parent(const char *tag, int parent_read, pid_t pid,
- int *chld_sts, int log_target, bool abbreviated, char *file_path,
- const struct AndroidForkExecvpOption* opts, size_t opts_len) {
+ int *chld_sts, int log_target, bool abbreviated, char *file_path) {
int status = 0;
char buffer[4096];
struct pollfd poll_fds[] = {
@@ -359,13 +358,6 @@
sz = TEMP_FAILURE_RETRY(
read(parent_read, &buffer[b], sizeof(buffer) - 1 - b));
- for (size_t i = 0; sz > 0 && i < opts_len; ++i) {
- if (opts[i].opt_type == FORK_EXECVP_OPTION_CAPTURE_OUTPUT) {
- opts[i].opt_capture_output.on_output(
- (uint8_t*)&buffer[b], sz, opts[i].opt_capture_output.user_pointer);
- }
- }
-
sz += b;
// Log one line at a time
for (b = 0; b < sz; b++) {
@@ -483,7 +475,7 @@
int android_fork_execvp_ext(int argc, char* argv[], int *status, bool ignore_int_quit,
int log_target, bool abbreviated, char *file_path,
- const struct AndroidForkExecvpOption* opts, size_t opts_len) {
+ void *unused_opts, int unused_opts_len) {
pid_t pid;
int parent_ptty;
int child_ptty;
@@ -493,6 +485,9 @@
sigset_t oldset;
int rc = 0;
+ LOG_ALWAYS_FATAL_IF(unused_opts != NULL);
+ LOG_ALWAYS_FATAL_IF(unused_opts_len != 0);
+
rc = pthread_mutex_lock(&fd_mutex);
if (rc) {
ERROR("failed to lock signal_fd mutex\n");
@@ -538,13 +533,6 @@
pthread_sigmask(SIG_SETMASK, &oldset, NULL);
close(parent_ptty);
- // redirect stdin, stdout and stderr
- for (size_t i = 0; i < opts_len; ++i) {
- if (opts[i].opt_type == FORK_EXECVP_OPTION_INPUT) {
- dup2(child_ptty, 0);
- break;
- }
- }
dup2(child_ptty, 1);
dup2(child_ptty, 2);
close(child_ptty);
@@ -561,24 +549,8 @@
sigaction(SIGQUIT, &ignact, &quitact);
}
- for (size_t i = 0; i < opts_len; ++i) {
- if (opts[i].opt_type == FORK_EXECVP_OPTION_INPUT) {
- size_t left = opts[i].opt_input.input_len;
- const uint8_t* input = opts[i].opt_input.input;
- while (left > 0) {
- ssize_t res =
- TEMP_FAILURE_RETRY(write(parent_ptty, input, left));
- if (res < 0) {
- break;
- }
- left -= res;
- input += res;
- }
- }
- }
-
rc = parent(argv[0], parent_ptty, pid, status, log_target,
- abbreviated, file_path, opts, opts_len);
+ abbreviated, file_path);
}
if (ignore_int_quit) {