Пример #1
0
void Cosa_BackgroundCommit
	(
		char*	   				    pDestComp,
		char*						pDestPath,
		BOOL						bSet
	)
{
    PCOMMIT_PARAMS params = malloc(sizeof(COMMIT_PARAMS));
    if (!params) {
        printf("!!!!!Failed snmp background commit malloc\n");
        return;
    }
    params->pDestComp = pDestComp;
    params->pDestPath = pDestPath;
    params->bSet = bSet;
    AnscCreateTask(commitThread, USER_DEFAULT_TASK_STACK_SIZE, USER_DEFAULT_TASK_PRIORITY, (void*)params, "SNMPWifiCustomCommitThread");
//    AnscSpawnTask(commitThread, (void*)params, "SNMPBackgroundCommitThread");
}
ANSC_STATUS 
CosaDml_GreInit(void)
{
    int shmid;
    void *params = NULL;

    sysevent_fd = sysevent_open(
            "127.0.0.1", SE_SERVER_WELL_KNOWN_PORT, 
            SE_VERSION, kHotspotfd_events, 
            &sysevent_token
    );

    if (sysevent_fd < 0)
    {
        AnscTraceError(("sysevent_open failed\n"));
    } else {
        AnscTraceWarning(("sysevent_open success\n"));
    }

    if ((shmid = shmget(kKeepAlive_Statistics, kKeepAlive_SharedMemSize, IPC_CREAT | 0666)) < 0) {
        AnscTraceError(("shmget: %s\n", strerror(errno)));
        return ANSC_STATUS_FAILURE;
    }

    if ((g_hsfdStat = shmat(shmid, NULL, 0)) == (hotspotfd_statistics_s *)-1) {
        AnscTraceError(("shmat: %s\n", strerror(errno)));
        g_hsfdStat = NULL;
        return ANSC_STATUS_FAILURE;
    }
    
    AnscCreateTask(circuit_id_init_thread, USER_DEFAULT_TASK_STACK_SIZE, USER_DEFAULT_TASK_PRIORITY, params, "CircuitIDInitThread");

    AnscTraceDebug(("Init Hotspot GRE Done\n"));

    return ANSC_STATUS_SUCCESS;
}