Beispiel #1
0
NTSTATUS
SrvElementsInit(
    VOID
    )
{
    NTSTATUS ntStatus = STATUS_SUCCESS;
    int      iIter = 0;

    pthread_mutex_init(&gSrvElements.mutex, NULL);
    gSrvElements.pMutex = &gSrvElements.mutex;

    mt_init_genrand(&gSrvElements.randGen, time(NULL));

    ntStatus = SrvElementsConfigSetupInitial();
    BAIL_ON_NT_STATUS(ntStatus);

    gSrvElements.ulGlobalCreditLimit = SrvElementsConfigGetGlobalCreditLimit();

    ntStatus = SrvElementsResourcesInit();
    BAIL_ON_NT_STATUS(ntStatus);

    ntStatus = WireGetCurrentNTTime(&gSrvElements.llBootTime);
    BAIL_ON_NT_STATUS(ntStatus);

    while (!RAND_status() && (iIter++ < 10))
    {
        uuid_t uuid;
        CHAR   szUUID[37];

        memset(szUUID, 0, sizeof(szUUID));

        uuid_generate(uuid);
        uuid_unparse(uuid, szUUID);

        RAND_seed(szUUID, sizeof(szUUID));
    }

    ntStatus = SrvTimerInit(&gSrvElements.timer);
    BAIL_ON_NT_STATUS(ntStatus);

    pthread_rwlock_init(&gSrvElements.statsLock, NULL);
    gSrvElements.pStatsLock = &gSrvElements.statsLock;

    ntStatus = SrvAsyncCloseFileTrackerCreate(&gSrvElements.pAsyncCloseFileTracker);
    BAIL_ON_NT_STATUS(ntStatus);

error:

    return ntStatus;
}
Beispiel #2
0
NTSTATUS
SrvElementsInit(
    VOID
    )
{
    NTSTATUS status = STATUS_SUCCESS;
    int      iIter = 0;

    status = SrvElementsResourcesInit();
    BAIL_ON_NT_STATUS(status);

    status = WireGetCurrentNTTime(&gSrvElements.llBootTime);
    BAIL_ON_NT_STATUS(status);

    while (!RAND_status() && (iIter++ < 10))
    {
        uuid_t uuid;
        CHAR   szUUID[37];

        memset(szUUID, 0, sizeof(szUUID));

        uuid_generate(uuid);
        uuid_unparse(uuid, szUUID);

        RAND_seed(szUUID, sizeof(szUUID));
    }

    status = SrvTimerInit(&gSrvElements.timer);
    BAIL_ON_NT_STATUS(status);

    pthread_rwlock_init(&gSrvElements.statsLock, NULL);
    gSrvElements.pStatsLock = &gSrvElements.statsLock;

error:

    return status;
}