Lines Matching defs:name
13 /* The service name should not exceed SERVICE_NAME_MAX to avoid
16 * - Starting a service is done by writing its name to the "ctl.start"
20 * - Stopping the service is done by writing its name to "ctl.stop"
24 * named "init.svc.<name>"
26 * If strlen(<name>) > (PROPERTY_KEY_MAX-1)-9, then you can start/stop
28 * read its state due to the truncation of "init.svc.<name>" into a
41 int ServiceManager::start(const char *name) {
42 if (strlen(name) > SERVICE_NAME_MAX) {
43 SLOGE("Service name '%s' is too long", name);
46 if (isRunning(name)) {
47 SLOGW("Service '%s' is already running", name);
51 SLOGD("Starting service '%s'", name);
52 property_set("ctl.start", name);
58 if (isRunning(name))
62 SLOGW("Timed out waiting for service '%s' to start", name);
66 SLOGD("Sucessfully started '%s'", name);
70 int ServiceManager::stop(const char *name) {
71 if (strlen(name) > SERVICE_NAME_MAX) {
72 SLOGE("Service name '%s' is too long", name);
75 if (!isRunning(name)) {
76 SLOGW("Service '%s' is already stopped", name);
80 SLOGD("Stopping service '%s'", name);
81 property_set("ctl.stop", name);
87 if (!isRunning(name))
92 SLOGW("Timed out waiting for service '%s' to stop", name);
96 SLOGD("Successfully stopped '%s'", name);
100 bool ServiceManager::isRunning(const char *name) {
105 ret = snprintf(propName, sizeof(propName), "init.svc.%s", name);
107 SLOGD("Service name '%s' is too long", name);