Changeset 2819
- Timestamp:
- Oct 10, 2006, 4:55:35 AM (19 years ago)
- Location:
- trunk/libc
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libc/Config.kmk
r2805 r2819 76 76 ## @todo I need recursive inheritance! 77 77 TEMPLATE_libc = 78 TEMPLATE_libc_EXTENDS = lib 78 79 TEMPLATE_libc_TOOL = GCC3 79 80 TEMPLATE_libc_INCS = $(PATH_LIBC_INC) $(dir $(LIBC-STD.H)) … … 86 87 87 88 TEMPLATE_libc.logstrict = 88 TEMPLATE_libc.logstrict_TOOL = GCC3 89 TEMPLATE_libc.logstrict_INCS = $(TEMPLATE_libc_INCS) 90 TEMPLATE_libc.logstrict_INCS.nt = $(TEMPLATE_libc_INCS.nt) 89 TEMPLATE_libc.logstrict_EXTENDS = libc 91 90 TEMPLATE_libc.logstrict_DEFS = $(TEMPLATE_libc_DEFS) __LIBC_STRICT DEBUG_LOGGING 92 TEMPLATE_libc.logstrict_DEPS = $(TEMPLATE_libc_DEPS)93 TEMPLATE_libc.logstrict_INST = $(TEMPLATE_libc_INST)94 TEMPLATE_libc.logstrict_CFLAGS = $(TEMPLATE_libc_CFLAGS)95 91 96 92 TEMPLATE_libc.profiled = 97 TEMPLATE_libc.profiled_TOOL = GCC3 98 TEMPLATE_libc.profiled_INCS = $(TEMPLATE_libc_INCS) 99 TEMPLATE_libc.profiled_INCS.nt = $(TEMPLATE_libc_INCS.nt) 93 TEMPLATE_libc.profiled_EXTENDS = libc 100 94 TEMPLATE_libc.profiled_DEFS = $(TEMPLATE_libc_DEFS) __LIBC_PROFILED 101 TEMPLATE_libc.profiled_DEPS = $(TEMPLATE_libc_DEPS)102 TEMPLATE_libc.profiled_INST = $(TEMPLATE_libc_INST)103 TEMPLATE_libc.profiled_CFLAGS = $(TEMPLATE_libc_CFLAGS)104 95 105 96 TEMPLATE_libcsub = LIBC Sub-Library. … … 127 118 128 119 TEMPLATE_libcasm.logstrict = 129 TEMPLATE_libcasm.logstrict_TOOL = GCC3 130 TEMPLATE_libcasm.logstrict_TOOL.os2 = GCC3OMF 131 TEMPLATE_libcasm.logstrict_ASTOOL = ALP 120 TEMPLATE_libcasm.logstrict_EXTENDS = libcasm 132 121 TEMPLATE_libcasm.logstrict_DEFS = $(TEMPLATE_libcasm_DEFS) __LIBC_STRICT DEBUG_LOGGING 133 TEMPLATE_libcasm.logstrict_INCS = $(TEMPLATE_libcasm_INCS)134 TEMPLATE_libcasm.logstrict_INST = $(TEMPLATE_libcasm_INST)135 TEMPLATE_libcasm.logstrict_ASFLAGS = $(TEMPLATE_libcasm_ASFLAGS)136 122 137 123 TEMPLATE_libcasm.profiled = 138 TEMPLATE_libcasm.profiled_TOOL = GCC3 139 TEMPLATE_libcasm.profiled_TOOL.os2 = GCC3OMF 140 TEMPLATE_libcasm.profiled_ASTOOL = ALP 124 TEMPLATE_libcasm.profiled_EXTENDS = libcasm 141 125 TEMPLATE_libcasm.profiled_DEFS = $(TEMPLATE_libcasm_DEFS) __LIBC_PROFILED 142 TEMPLATE_libcasm.profiled_INCS = $(TEMPLATE_libcasm_INCS)143 TEMPLATE_libcasm.profiled_INST = $(TEMPLATE_libcasm_INST)144 TEMPLATE_libcasm.profiled_ASFLAGS = $(TEMPLATE_libcasm_ASFLAGS)145 126 146 127 TEMPLATE_libcsubasm = -
trunk/libc/include/InnoTekLIBC/sharedpm.h
r2672 r2819 652 652 653 653 654 654 /** 655 * Initializes the shared process management for this process. 656 * 657 * This might actually initialize the SPM globally too if this is the 658 * first process using it. 659 * 660 * @returns 0 on success. 661 * @returns Negative error code (errno.h) on failure. 662 */ 663 int __libc_spmInit(void); 655 664 656 665 /** -
trunk/libc/include/klibc/initterm.h
r2806 r2819 47 47 } __LIBC_INITMAINARGS, *__LIBC_PINITMAINARGS; 48 48 49 int__libc_InitExe(uintptr_t hmod, void *pvOS, unsigned fFlags, __LIBC_PINITMAINARGS pMainArgs);50 int __libc_InitDll(uintptr_t hmod, void *pvOS, unsigned fFlags);51 int__libc_TermDll(uintptr_t hmod, void *pvOS, unsigned fFlags);49 void __libc_InitExe(uintptr_t hmod, void *pvOS, unsigned fFlags, __LIBC_PINITMAINARGS pMainArgs); 50 int __libc_InitDll(uintptr_t hmod, void *pvOS, unsigned fFlags); 51 void __libc_TermDll(uintptr_t hmod, void *pvOS, unsigned fFlags); 52 52 53 53 __END_DECLS -
trunk/libc/src/kNIX/b_initterm.c
r2805 r2819 33 33 34 34 35 36 /** 37 * Initialize the kNIX backend. 38 * 39 * This is only called once. 40 * 41 * @returns 0 on success. 42 * @returns negated errno on failure. 43 * 44 * @param hmod The native module handle of the DLL/EXE. 45 * @param pvOS OS specific argument. 46 * @param fFlags Initialization flags, a combination of the __LIBC_INIT_FLAGS_* \#defines. 47 */ 48 static int __libc_init(uintptr_t hmod, void *pvOS, unsigned fFlags) 49 { 50 LIBCLOG_ENTER("hmod=%tx pvOS=%p fFlags=%#x\n", hmod, pvOs, fFlags); 51 int rc; 52 53 /* 54 * Do OS specific initialization of the process. 55 */ 56 #ifdef __NT__ 57 #endif 58 #ifdef __OS2__ 59 rc = __libc_spmInit(); 60 if (rc) 61 LIBCLOG_ERROR_RETURN_INT(rc); 62 #endif 63 64 /* 65 * Initialize the thread database entering this thread as the first one. 66 */ 67 rc = __libc_back_threadInit() 68 if (!rc) 69 { 70 /* 71 * Init the other 72 */ 73 74 rc = __libc_back_fsInit(); 75 if (!rc) 76 { 77 } 78 79 } 80 81 82 /* 83 * Initialize all backend mutexes residing in parts that doesn't have 84 * special initializers. 85 */ 86 87 88 if (__libc_back_fsInit()) 89 { 90 LIBC_ASSERTM_FAILED("__libc_back_fsInit() failed\n"); 91 return -1; 92 } 93 94 /* 95 * Init file handles. 96 */ 97 rc = __libc_fhInit(); 98 if (rc) 99 { 100 LIBC_ASSERTM_FAILED("__libc_fhInit() failed\n"); 101 return -1; 102 } 103 104 /* 105 * Init signals 106 */ 107 rc = __libc_back_signalInit(); 108 if (rc) 109 { 110 LIBC_ASSERTM_FAILED("__libc_back_signalInit() failed\n"); 111 return -1; 112 } 113 114 /* 115 * Setup environment (org_environ and _STD(environ)) 116 */ 117 rc = _sys_init_environ(fibGetEnv()); 118 if (rc) 119 { 120 LIBC_ASSERTM_FAILED("_sys_init_environ() failed\n"); 121 return -1; 122 } 123 124 125 LIBCLOG_RETURN_INT(0); 126 } 127 128 129 35 130 /** 36 131 * Invoked by the crt0 and dll0 code. -
trunk/libc/src/kNIX/kNIX.h
r2805 r2819 43 43 #include <string.h> 44 44 #include <signal.h> 45 #include <sys/builtin.h> 45 46 #include <sys/fmutex.h> 46 47 #include <sys/fcntl.h> 47 48 #include <sys/resource.h> 49 #include <sys/smutex.h> 48 50 #include <sys/time.h> 49 51 #include <sys/types.h> 50 52 #include <klibc/io.h> 51 53 #include <klibc/umalloc.h> 54 #include <klibc/thread.h> 52 55 #include <klibc/backend.h> 53 56 #ifdef __LIBC_LOG_GROUP -
trunk/libc/src/kNIX/os2/sharedpm.c
r2732 r2819 112 112 *******************************************************************************/ 113 113 static int spmForkChild1(__LIBC_PFORKHANDLE pForkHandle, __LIBC_FORKOP enmOperation); 114 static void spmCrtInit1(void);115 114 static int spmRequestMutexErrno(__LIBC_PSPMXCPTREGREC pRegRec); 116 115 static int spmRequestMutex(__LIBC_PSPMXCPTREGREC pRegRec); 117 116 static int spmReleaseMutex(__LIBC_PSPMXCPTREGREC pRegRec); 118 static int spmInit(void);119 117 static VOID APIENTRY spmExitList(ULONG ulReason); 120 118 static void spmCleanup(void); … … 377 375 * If we have we'll simply return. 378 376 */ 379 if (gpSPMSelf) 380 pProcess = gpSPMSelf; 381 else 377 pProcess = gpSPMSelf; 378 if (!pProcess) 382 379 { 383 380 __LIBC_SPMXCPTREGREC RegRec; … … 1972 1969 1973 1970 1974 _CRT_INIT1(spmCrtInit1)1975 /**1976 * Initializes the process database while we're still 100%1977 * sure we're single threaded. This avoids trouble.1978 *1979 * To tell the truth chances are _very_ high that this1980 * is not necessary because we will soon get the current1981 * process structure very early in the LIBC init process.1982 */1983 static void spmCrtInit1(void)1984 {1985 static void *hack = (void *)spmCrtInit1;1986 LIBCLOG_ENTER("\n");1987 hack = hack;1988 if (!gpSPMSelf)1989 __libc_spmSelf();1990 LIBCLOG_RETURN_VOID();1991 }1992 1993 1971 1994 1972 _FORK_CHILD1(0xfffffff0, spmForkChild1) … … 2125 2103 if (!ghmtxSPM || !gpSPMHdr) 2126 2104 { 2127 /*2128 * Perform lazy init.2129 */2130 rc = spmInit();2131 if (!rc)2132 {2133 FS_RESTORE();2134 LIBCLOG_RETURN_INT(0);2135 }2136 2137 2105 LIBC_ASSERTM_FAILED("not initialized!\n"); 2138 2106 DosUnsetExceptionHandler(&pRegRec->Core); … … 2224 2192 #endif /* unused */ 2225 2193 2226 /** 2227 * Open and if needed creates the LIBC shared memory. 2228 * 2229 * This is called lazily by the mutex request function. 2230 * 2231 * @returns 0 on success. Mutex is owned. 2194 2195 /** 2196 * Initializes the shared process management for this process. 2197 * 2198 * This might actually initialize the SPM globally too if this is the 2199 * first process using it. 2200 * 2201 * @returns 0 on success. 2232 2202 * @returns Negative error code (errno.h) on failure. 2233 2203 */ 2234 static intspmInit(void)2204 int __libc_spmInit(void) 2235 2205 { 2236 2206 LIBCLOG_ENTER("\n"); … … 2381 2351 2382 2352 /* 2383 * Register exit list handler and return with2384 * mutex ownership. This must have a priority lower than2385 * the TCPIP library of OS/2 to prevent it from closing2386 * sockets.2353 * Register exit list handler. 2354 * 2355 * This must have a priority lower than the TCPIP library of 2356 * OS/2 to prevent it from closing sockets. 2387 2357 */ 2388 2358 rc = DosExitList(0x9800 | EXLST_ADD, spmExitList); 2389 2359 FS_RESTORE(); 2360 DosReleaseMutexSem(ghmtxSPM); 2361 DosExitMustComplete(&ul); 2390 2362 LIBC_ASSERTM(!rc, "DosExitList failed with rc=%d\n", rc); 2391 2363 LIBCLOG_RETURN_INT(0); -
trunk/libc/src/libc/startup/Makefile.kmk
r2805 r2819 37 37 $(PATH_LIBC_SRC)/libc/startup/dtor1.c \ 38 38 $(PATH_LIBC_SRC)/libc/startup/exit.c \ 39 $(PATH_LIBC_SRC)/libc/startup/ startup.c \39 $(PATH_LIBC_SRC)/libc/startup/initterm.c \ 40 40 $(PATH_LIBC_SRC)/libc/startup/_exit.c \ 41 41
Note:
See TracChangeset
for help on using the changeset viewer.