Ejemplo n.º 1
0
Result
srvSysInit()
{
    Result rc = 0;

    if (!initLockinit) {
        RecursiveLock_Init(&initLock);
    }

    RecursiveLock_Lock(&initLock);

    if (srvRefCount > 0) {
        RecursiveLock_Unlock(&initLock);
        return MAKERESULT(RL_INFO, RS_NOP, 25, RD_ALREADY_INITIALIZED);
    }

    while (1) {
        rc = svcConnectToPort(&srvHandle, "srv:");
        if (R_LEVEL(rc) != RL_PERMANENT || R_SUMMARY(rc) != RS_NOTFOUND || R_DESCRIPTION(rc) != RD_NOT_FOUND)
            break;
        svcSleepThread(500000);
    }
    if (R_SUCCEEDED(rc)) {
        rc = srvSysRegisterClient();
        srvRefCount++;
    }

    RecursiveLock_Unlock(&initLock);
    return rc;
}
Ejemplo n.º 2
0
Archivo: errf.c Proyecto: Thog/ctrulib
Result errfInit(void)
{
	Result rc = 0;

	if (AtomicPostIncrement(&errfRefCount)) return 0;

	rc = svcConnectToPort(&errfHandle, "err:f");
	if (R_FAILED(rc)) goto end;

end:
	if (R_FAILED(rc)) errfExit();
	return rc;
}
Ejemplo n.º 3
0
Result srvInit(void)
{
	Result rc = 0;

	if (AtomicPostIncrement(&srvRefCount)) return 0;

	rc = svcConnectToPort(&srvHandle, "srv:");
	if (R_FAILED(rc)) goto end;

	rc = srvRegisterClient();
end:
	if (R_FAILED(rc)) srvExit();
	return rc;
}