MCPcopy Create free account
hub / github.com/devkitPro/libctru / srvInit

Function srvInit

libctru/source/srv.c:28–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26}
27
28Result srvInit(void)
29{
30 Result rc = 0;
31
32 if (AtomicPostIncrement(&srvRefCount)) return 0;
33
34 if(GET_VERSION_MINOR(osGetKernelVersion()) < 39 && *srvPmGetSessionHandle() != 0)
35 rc = svcDuplicateHandle(&srvHandle, *srvPmGetSessionHandle()); // Prior to system version 7.0 srv:pm was a superset of srv:
36 else
37 rc = svcConnectToPort(&srvHandle, "srv:");
38
39 if (R_SUCCEEDED(rc))
40 rc = srvRegisterClient();
41 else
42 // Prior to system version 11.0, the kernel filled the resulting handle with junk in case of failure
43 srvHandle = 0;
44
45 if (R_FAILED(rc)) srvExit();
46 return rc;
47}
48
49void srvExit(void)
50{

Callers 3

srvPmInitFunction · 0.85
aptExitFunction · 0.85
__appInitFunction · 0.85

Calls 4

osGetKernelVersionFunction · 0.85
srvPmGetSessionHandleFunction · 0.85
srvRegisterClientFunction · 0.85
srvExitFunction · 0.85

Tested by

no test coverage detected