예제 #1
0
static void msg_show(const char *name)
{
    if((!strcmp("prop", name)) || (!strcmp("property", name)))
        property_show();
    else if((!strcmp("svc", name)) || (!strcmp("service", name)))
        service_show();
}
예제 #2
0
파일: init.c 프로젝트: 4Fwolf/mt6572_x201
void handle_control_message(const char *msg, const char *arg)
{
    if (!strcmp(msg,"start")) {
        msg_start(arg);
    } else if (!strcmp(msg,"stop")) {
        msg_stop(arg);
    } else if (!strcmp(msg,"restart")) {
        msg_stop(arg);
        msg_start(arg);
    } else if (!strcmp(msg,"show")) {
        property_show();
    } else {
        ERROR("unknown control msg '%s'\n", msg);
    }
}
예제 #3
0
int property_set_overwirte(const char *name, const char *value, int allow_overwirte_ro) ////Lenovo [EasyImage]
{
    prop_info *pi;
    int ret;

    size_t namelen = strlen(name);
    size_t valuelen = strlen(value);

    if (!is_legal_property_name(name, namelen)) {
    	ERROR("PropSet Error:[%s:%s] property name is illegal\n", name, value);
    	return -1;
    }
    if (valuelen >= PROP_VALUE_MAX) {
    	ERROR("PropSet Error:[%s:%s] valuelen %d >= %d\n", name, value, valuelen, PROP_VALUE_MAX);
    	return -1;
    }
#ifdef MTK_INIT
    INFO("PropSet [%s:%s] Start>>\n", name, value);
#endif
    pi = (prop_info*) __system_property_find(name);

    if(pi != 0) {
        /* ro.* properties may NEVER be modified once set */
        if(allow_overwirte_ro!= 1 && !strncmp(name, "ro.", 3)){
#ifdef MTK_INIT
        	ERROR("PropSet Error:[%s:%s]  ro.* properties may NEVER be modified once set\n", name, value);
#endif
        	return -1;
        }
        __system_property_update(pi, value, valuelen);
    } else {
#ifdef INIT_ENG_BUILD
		prop_area *pa = __system_property_area__;
		if ((pa->bytes_used > PA_SIZE_ERR) && (0 == alarmed ))
		{
			alarmed = 1;
			ERROR("[Property Error]: Unable to set [%s:%s] property limit has arrived: %d\n", name, value, pa->bytes_used);
#ifdef MTK_INIT
			property_show();
#endif
		}
		else if ((pa->bytes_used > PA_SIZE_WARN) && (0 == warned ))
		{
			warned = 1;
			NOTICE("[Property Warning]: limit would be arrived:%d (Max:%d). "
					"Use getprop to review your properties!\n", pa->bytes_used, PA_SIZE);
#ifdef MTK_INIT
			property_show();
#endif
		}
#endif
        ret = __system_property_add(name, namelen, value, valuelen);
        if (ret < 0) {
#ifdef INIT_ENG_BUILD
            ERROR("Failed to set '%s'='%s' bytes_used=%u\n", name, value, pa->bytes_used);
#else
			ERROR("Failed to set '%s'='%s'\n", name, value);
#endif
            return ret;
        }
    }
    /* If name starts with "net." treat as a DNS property. */
    if (strncmp("net.", name, strlen("net.")) == 0)  {
        if (strcmp("net.change", name) == 0) {
#ifdef MTK_INIT
            INFO("PropSet [%s:%s] Done\n", name, value);
#endif
            return 0;
        }
       /*
        * The 'net.change' property is a special property used track when any
        * 'net.*' property name is updated. It is _ONLY_ updated here. Its value
        * contains the last updated 'net.*' property.
        */
        property_set("net.change", name);
    } else if (persistent_properties_loaded &&
            strncmp("persist.", name, strlen("persist.")) == 0) {
        /*
         * Don't write properties to disk until after we have read all default properties
         * to prevent them from being overwritten by default values.
         */
        write_persistent_property(name, value);
    } else if (strcmp("selinux.reload_policy", name) == 0 &&
               strcmp("1", value) == 0) {
        selinux_reload_policy();
    }
    property_changed(name, value);
#ifdef MTK_INIT
    INFO("PropSet [%s:%s] Done\n", name, value);
#endif
    return 0;
}