SEM_ID semBCreate ( int options, /* semaphore options */ SEM_B_STATE initialState /* initial semaphore state */ ) { SEM_ID semId; if ((!semBLibInstalled) && (semBLibInit () != OK)) /* initialize package */ { return (NULL); } if ((semId = (SEM_ID) objAlloc (semClassId)) == NULL) { return (NULL); } /* initialize allocated semaphore */ if (semBInit (semId, options, initialState) != OK) { objFree (semClassId, (char *) semId); return (NULL); } return (semId); }
STATUS semBInit(SEMAPHORE* pSemaphore, int options, SEM_B_STATE initialState) { if((!semBLibInstalled)&&(OK!=semBLibInit())) { return (ERROR); } if(OK != semQInit(pSemaphore, options)) { return (ERROR); } return semBCoreInit(pSemaphore, options, initialState); }
int my_usrRoot(char* pMemPoolStart, unsigned int memPoolSize) { eventLibInit(); semBLibInit(); semMLibInit(); semCLibInit(); semQLibInit(); wdLibInit(); taskHookInit(); memInit(pMemPoolStart, memPoolSize); memPartLibInit(pMemPoolStart, memPoolSize); if (proc_sysMmuLibInit == 0) goto usrRoot_failed; int (*_sysMmuLibInit)() = (void*) proc_sysMmuLibInit; if (_sysMmuLibInit(0x1000) != 0) goto usrRoot_failed; if (vmMpuLibInit(0x1000) != 0) goto usrRoot_failed; if (vmBaseGlobalMapInit(&MemDescArray, MemDescArrayCount, 1) == 0) goto usrRoot_failed; sysClockConnect(usrClock, 0); sysClockRateSet(60); sysClockEnable(); selectInit(50); usrBootLineParse(0x1000); iosInit(20, 50, "/null"); ttyDrv(); usrSerialInit(); hashLibInit(); envLibInit(1); sigInit(); excInit(); logInit(fdConsole, 50); stdioInit(); fioLibInit(); selTaskDeleteHookAdd(); sub_FFB5F728(); my_taskcreate_Startup(); return 0; usrRoot_failed: printExc("usrRoot: MMU configuration failed, errno = %#x", *(long*) (GetErrorNumAddr()), 0, 0, 0, 0); reboot(1); return 0; }