Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 50f39ddb authored by Elliott Hughes's avatar Elliott Hughes
Browse files

Lose start/stop to toybox.

Change-Id: Ifd918a40616ec55fd3e782423fba67e0183bb8f3
parent aa9f3718
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -34,13 +34,10 @@ OUR_TOOLS := \
    getevent \
    newfs_msdos \
    sendevent \
    start \
    stop \

ALL_TOOLS = $(BSD_TOOLS) $(OUR_TOOLS)

LOCAL_SRC_FILES := \
    start_stop.cpp \
    toolbox.c \
    $(patsubst %,%.c,$(OUR_TOOLS)) \

toolbox/start.c

deleted100644 → 0
+0 −1
Original line number Diff line number Diff line
/* Needed by Android.mk. Actual code in start_stop.cpp. */

toolbox/start_stop.cpp

deleted100644 → 0
+0 −43
Original line number Diff line number Diff line
#include <error.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

#include <cutils/properties.h>

static const char* services[] = {
  "netd",
  "surfaceflinger",
  "zygote",
  "zygote_secondary",
};

static int start_stop(bool start, int argc, char* argv[]) {
  if (getuid() != 0) error(1, 0, "must be root");
  const char* property = start ? "ctl.start" : "ctl.stop";
  if (argc > 2) {
    error(1, 0, "usage: %s [SERVICE]\n", argv[0]);
  } else if (argc == 2) {
    property_set(property, argv[1]);
  } else {
    if (start) {
      for (size_t i = 0; i < sizeof(services)/sizeof(services[0]); ++i) {
        property_set(property, services[i]);
      }
    } else {
      for (int i = sizeof(services)/sizeof(services[0]) - 1; i >= 0; --i) {
        property_set(property, services[i]);
      }
    }
  }
  return 0;
}

extern "C" int start_main(int argc, char* argv[]) {
  return start_stop(true, argc, argv);
}

extern "C" int stop_main(int argc, char* argv[]) {
  return start_stop(false, argc, argv);
}

toolbox/stop.c

deleted100644 → 0
+0 −1
Original line number Diff line number Diff line
/* Needed by Android.mk. Actual code in start_stop.cpp. */