Changeset 1676
- Timestamp:
- Dec 2, 2004, 2:42:51 AM (21 years ago)
- Location:
- trunk/src/emx
- Files:
-
- 2 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/emx/include/emx/startup.h
-
Property cvs2svn:cvs-rev
changed from
1.4
to1.5
r1675 r1676 8 8 #endif 9 9 10 extern int _CRT_init (void); 11 extern void _CRT_term (void); 12 extern void __ctordtorInit (void); 13 extern void __ctordtorTerm (void); 10 extern int _CRT_init(void); 11 extern void _CRT_term(void); 12 extern void __ctordtorInit(void); 13 extern void __ctordtorTerm(void); 14 15 extern void __ctordtorInit1(int *); 16 extern void __ctordtorTerm1(int *); 17 18 /** init and term vectors. 19 * @{ 20 */ 21 /** Array of CRT init functions. */ 22 extern int __crtinit1__; 23 /** Array of CRT exit functions. */ 24 extern int __crtexit1__; 25 /** Array of exception handlers something. */ 26 extern int __eh_init__; 27 /** Array of exception handlers something. */ 28 extern int __eh_term__; 29 /** Array of constructors. */ 30 extern int __CTOR_LIST__; 31 /** Array of destructors. */ 32 extern int __DTOR_LIST__; 33 /** @} */ 34 14 35 15 36 /* argv[i][-1] contains some flag bits: */ -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/include/os2emx.h
-
Property cvs2svn:cvs-rev
changed from
1.25
to1.26
r1675 r1676 13529 13529 APIRET APIENTRY DosCloseEventSemEx(HEV hev); 13530 13530 13531 /** 13532 * Extended DosLoadModule() which will make sure the loaded module is 13533 * loaded in a forked process. 13534 */ 13535 APIRET APIENTRY DosLoadModuleEx(PSZ pszObject, ULONG cbObject, PCSZ pszModule, PHMODULE phmod); 13536 13537 /** 13538 * Free module loaded using the extended APIs. 13539 */ 13540 APIRET APIENTRY DosFreeModuleEx(HMODULE hmod); 13541 13542 13531 13543 #ifdef INCL_EXAPIS_MAPPINGS 13532 13544 … … 13542 13554 #define DosCloseEventSem(a) DosCloseEventSemEx((a)) 13543 13555 13556 #define DosLoadModule(a,b,c,d) DosLoadModuleEx(a,b,c,d) 13557 #define DosFreeModule(a) DosFreeModuleEx(a) 13558 13544 13559 #endif /* INCL_EXAPIS_MAPPINGS */ 13545 13560 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/include/sys/fmutex.h
-
Property cvs2svn:cvs-rev
changed from
1.4
to1.5
r1675 r1676 100 100 } 101 101 102 /** 103 * Release a semaphore in the child process after the 104 * semaphore was locked for the forking the parent. 105 * 106 * @param pSem Semaphore to unlock. 107 */ 108 static __inline__ void _fmutex_release_fork(_fmutex *pSem) 109 { 110 pSem->fs = _FMS_AVAILABLE; 111 pSem->Owner = 0; 112 } 102 113 103 114 unsigned _fmutex_create (_fmutex *, unsigned); -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/libc.def
-
Property cvs2svn:cvs-rev
changed from
1.82
to1.83
r1675 r1676 1273 1273 "_warnc" @1291 1274 1274 ; new stuff 1275 "DosLoadModuleEx" @1292 1276 "DosFreeModuleEx" @1293 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/malloc/initr.c
-
Property cvs2svn:cvs-rev
changed from
1.5
to1.6
r1675 r1676 167 167 LIBCLOG_MSG("Unlocking the heaps.\n"); 168 168 if (_um_tiled_heap) 169 _ um_heap_unlock(_um_tiled_heap);169 _fmutex_release_fork(&_um_tiled_heap->fsem); 170 170 if (_um_high_heap) 171 _ um_heap_unlock(_um_high_heap);171 _fmutex_release_fork(&_um_high_heap->fsem); 172 172 if (_um_low_heap) 173 _ um_heap_unlock(_um_low_heap);173 _fmutex_release_fork(&_um_low_heap->fsem); 174 174 gfForkCleanupDone = 1; 175 175 } -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/startup/cleanup.c
-
Property cvs2svn:cvs-rev
changed from
1.3
to1.4
r1675 r1676 2 2 3 3 #include <stdio.h> 4 #include <emx\startup.h> 5 6 extern int __crtexit1__; 7 extern void __ctordtorTerm1 (int *ptr); 4 #include <emx/startup.h> 8 5 9 6 void _CRT_term (void) -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/startup/ctor1.c
-
Property cvs2svn:cvs-rev
changed from
1.2
to1.3
r1675 r1676 2 2 3 3 #include <stdlib.h> 4 #include <emx/startup.h> 4 5 5 void __ctordtorInit1 (int *ptr);6 6 void __ctordtorInit1 (int *ptr) 7 7 { -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/startup/startup.c
-
Property cvs2svn:cvs-rev
changed from
1.12
to1.13
r1675 r1676 11 11 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_INITTERM 12 12 #include <InnoTekLIBC/logstrict.h> 13 14 extern int __crtinit1__;15 extern void __ctordtorInit1 (int *ptr);16 13 17 14 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/DosEx.c
-
Property cvs2svn:cvs-rev
changed from
1.6
to1.7
r1675 r1676 158 158 static int dosexForkPreEventCreate(PDOSEX pEntry); 159 159 static int dosexForkPreEventOpen(PDOSEX pEntry); 160 static int dosexForkPreLoadModule(PDOSEX pEntry); 160 161 static int dosexForkChild(__LIBC_PFORKHANDLE pForkHandle, __LIBC_FORKOP enmOperation); 161 162 static void dosexForkCleanup(void *pvArg, int rc, __LIBC_FORKCTX enmCtx); … … 192 193 * @returns OS/2 error code on failure. 193 194 */ 194 int dosexRequestMutex(void)195 static int dosexRequestMutex(void) 195 196 { 196 197 LIBCLOG_ENTER("\n"); … … 227 228 * Release mutex succesfully obtained by dosexRequestMutex(). 228 229 */ 229 void dosexReleaseMutex(void)230 static void dosexReleaseMutex(void) 230 231 { 231 232 LIBCLOG_ENTER("\n"); … … 255 256 * @remark Caller owns mutex. 256 257 */ 257 int dosexAllocPool(void)258 static int dosexAllocPool(void) 258 259 { 259 260 LIBCLOG_ENTER("\n"); … … 495 496 * 496 497 */ 497 int dosexFreeEntry(DOSEXTYPE enmType, PDOSEX pCur, PDOSEX pPrev, PDOSEXHDR pPool)498 static int dosexFreeEntry(DOSEXTYPE enmType, PDOSEX pCur, PDOSEX pPrev, PDOSEXHDR pPool) 498 499 { 499 500 int rc; … … 550 551 break; 551 552 553 case DOSEX_TYPE_LOAD_MODULE: 554 rc = DosFreeModule(pCur->u.LoadModule.hmte); 555 if (rc && rc != ERROR_INVALID_HANDLE) 556 fUnlink = 0; 557 else 558 { 559 pCur->u.LoadModule.cLoads--; 560 if (pCur->u.LoadModule.cLoads > 0) 561 fUnlink = 0; 562 } 563 break; 564 552 565 default: 553 566 rc = ERROR_INVALID_PARAMETER; … … 714 727 * @param pForkHandle Pointer to the fork handle. 715 728 */ 716 int dosexForkOpExecParent(__LIBC_PFORKHANDLE pForkHandle)729 static int dosexForkOpExecParent(__LIBC_PFORKHANDLE pForkHandle) 717 730 { 718 731 LIBCLOG_ENTER("pForkHandle=%p\n", (void *)pForkHandle); … … 833 846 * @param pForkHandle Pointer to the fork handle. 834 847 */ 835 int dosexForkOpForkParent(__LIBC_PFORKHANDLE pForkHandle)848 static int dosexForkOpForkParent(__LIBC_PFORKHANDLE pForkHandle) 836 849 { 837 850 LIBCLOG_ENTER("pForkHandle=%p\n", (void *)pForkHandle); … … 885 898 * @param cbArg sizeof(DOSEXFORKCHILDALLOC). 886 899 */ 887 int dosexForkChildAlloc(__LIBC_PFORKHANDLE pForkHandle, void *pvArg, size_t cbArg)900 static int dosexForkChildAlloc(__LIBC_PFORKHANDLE pForkHandle, void *pvArg, size_t cbArg) 888 901 { 889 902 LIBCLOG_ENTER("pForkHandle=%p pvArg=%p cbArg=%d\n", (void *)pForkHandle, pvArg, cbArg); … … 912 925 * @param cbArg sizeof(PDOSEXHDR). 913 926 */ 914 int dosexForkChildProcess(__LIBC_PFORKHANDLE pForkHandle, void *pvArg, size_t cbArg)927 static int dosexForkChildProcess(__LIBC_PFORKHANDLE pForkHandle, void *pvArg, size_t cbArg) 915 928 { 916 929 LIBCLOG_ENTER("pForkHandle=%p pvArg=%p:{%p} cbArg=%d\n", (void *)pForkHandle, pvArg, *(void **)pvArg, cbArg); … … 961 974 if (rc) 962 975 break; 976 977 /* Module loading. */ 978 for (pEntry = pPool->apHeads[DOSEX_TYPE_LOAD_MODULE]; !rc && pEntry; pEntry = pEntry->pNext) 979 rc = dosexForkPreLoadModule(pEntry); 980 if (rc) 981 break; 963 982 } 964 983 … … 967 986 968 987 /** 969 * Allocates the memory described in the entry.988 * Allocates the memory object described in the entry. 970 989 * 971 990 * @returns 0 on success. … … 973 992 * @param pEntry Entry containing a memory allocation. 974 993 */ 975 int dosexForkPreMemAlloc(PDOSEX pEntry)994 static int dosexForkPreMemAlloc(PDOSEX pEntry) 976 995 { 977 996 int rc; … … 986 1005 987 1006 /** 988 * Allocates the memory described in the entry.1007 * Allocates the memory object described in the entry. 989 1008 * 990 1009 * @returns 0 on success. … … 992 1011 * @param pEntry Entry containing a memory allocation. 993 1012 */ 994 int dosexForkPreMemOpen(PDOSEX pEntry)1013 static int dosexForkPreMemOpen(PDOSEX pEntry) 995 1014 { 996 1015 unsigned cOpens = pEntry->u.MemOpen.cOpens; … … 1007 1026 1008 1027 /** 1009 * Allocates the memorydescribed in the entry.1028 * Creates the mutex semaphore described in the entry. 1010 1029 * 1011 1030 * @returns 0 on success. … … 1013 1032 * @param pEntry Entry containing a memory allocation. 1014 1033 */ 1015 int dosexForkPreMutexCreate(PDOSEX pEntry)1034 static int dosexForkPreMutexCreate(PDOSEX pEntry) 1016 1035 { 1017 1036 int i; … … 1084 1103 1085 1104 /** 1086 * Allocates the memorydescribed in the entry.1105 * Opens the mutex semaphore described in the entry. 1087 1106 * 1088 1107 * @returns 0 on success. … … 1090 1109 * @param pEntry Entry containing a memory allocation. 1091 1110 */ 1092 int dosexForkPreMutexOpen(PDOSEX pEntry)1111 static int dosexForkPreMutexOpen(PDOSEX pEntry) 1093 1112 { 1094 1113 int cOpens = pEntry->u.MutexOpen.cOpens; … … 1105 1124 1106 1125 /** 1107 * Allocates the memorydescribed in the entry.1126 * Creates the event semaphore described in the entry. 1108 1127 * 1109 1128 * @returns 0 on success. … … 1111 1130 * @param pEntry Entry containing a memory allocation. 1112 1131 */ 1113 int dosexForkPreEventCreate(PDOSEX pEntry)1132 static int dosexForkPreEventCreate(PDOSEX pEntry) 1114 1133 { 1115 1134 int i; … … 1182 1201 1183 1202 /** 1184 * Allocates the memorydescribed in the entry.1203 * Opens the event semaphore described in the entry. 1185 1204 * 1186 1205 * @returns 0 on success. … … 1188 1207 * @param pEntry Entry containing a memory allocation. 1189 1208 */ 1190 int dosexForkPreEventOpen(PDOSEX pEntry)1209 static int dosexForkPreEventOpen(PDOSEX pEntry) 1191 1210 { 1192 1211 int cOpens = pEntry->u.EventOpen.cOpens; … … 1195 1214 int rc = DosOpenEventSem(NULL, &pEntry->u.EventOpen.hev); 1196 1215 LIBC_ASSERTM(!rc, "DosOpenEventSem(,%#lx) -> rc=%d\n", pEntry->u.EventOpen.hev, rc); 1216 if (rc) 1217 return -__libc_native2errno(rc); 1218 } 1219 return 0; 1220 } 1221 1222 1223 /** 1224 * Loads the module described in the entry. 1225 * 1226 * @returns 0 on success. 1227 * @returns -errno on failure. 1228 * @param pEntry Entry containing a memory allocation. 1229 */ 1230 static int dosexForkPreLoadModule(PDOSEX pEntry) 1231 { 1232 char szName[CCHMAXPATH]; 1233 int cLoads = pEntry->u.LoadModule.cLoads; 1234 1235 /* 1236 * Figure out the name first. 1237 */ 1238 int rc = DosQueryModuleName(pEntry->u.LoadModule.hmte, sizeof(szName), szName); 1239 if (rc) 1240 { 1241 LIBC_ASSERTM(!rc, "DosQueryModuleName(%#lx,%d,%p) -> rc=%d \n", pEntry->u.LoadModule.hmte, sizeof(szName), szName, rc); 1242 if (rc) 1243 return -__libc_native2errno(rc); 1244 } 1245 1246 /* 1247 * Perform the loads. 1248 */ 1249 while (cLoads-- > 0) 1250 { 1251 HMODULE hmod = 0; 1252 rc = DosLoadModule(NULL, 0, (PCSZ)szName, &hmod); 1253 LIBC_ASSERTM(!rc, "DosLoadModule(,,'%s',) -> rc=%d (hmte=%#lx)\n", szName, rc, pEntry->u.LoadModule.hmte); 1197 1254 if (rc) 1198 1255 return -__libc_native2errno(rc); … … 1264 1321 } 1265 1322 1266 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/DosEx.h
-
Property cvs2svn:cvs-rev
changed from
1.2
to1.3
r1675 r1676 49 49 /** Event open. */ 50 50 DOSEX_TYPE_EVENT_OPEN, 51 /** Load module. */ 52 DOSEX_TYPE_LOAD_MODULE, 51 53 /** Max type (exclusive). */ 52 54 DOSEX_TYPE_MAX … … 69 71 { 70 72 /** Search key. 71 * We assume that sizeof(unsigned) == sizeof(PVOID) == sizeof(HMTX) == sizeof(HEV) .73 * We assume that sizeof(unsigned) == sizeof(PVOID) == sizeof(HMTX) == sizeof(HEV) == sizeof(HMODULE). 72 74 */ 73 75 unsigned uKey; … … 151 153 unsigned cOpens; 152 154 } EventOpen; 155 156 /** 157 * Loaded module. 158 */ 159 struct 160 { 161 /** Module handle. */ 162 HMODULE hmte; 163 /** Load count. */ 164 unsigned cLoads; 165 } LoadModule; 153 166 } u; 154 167 } DOSEX; -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/b_ldrClose.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1675 r1676 31 31 #include "libc-alias.h" 32 32 #define INCL_BASE 33 #define INCL_EXAPIS 33 34 #define INCL_FSMACROS 34 35 #include <os2emx.h> … … 50 51 FS_VAR(); 51 52 FS_SAVE_LOAD(); 52 int rc = DosFreeModule ((HMODULE)pvModule);53 int rc = DosFreeModuleEx((HMODULE)pvModule); 53 54 FS_RESTORE(); 54 55 LIBCLOG_RETURN_INT(rc); -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/b_ldrOpen.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1675 r1676 32 32 #define INCL_BASE 33 33 #define INCL_FSMACROS 34 #define INCL_EXAPIS 34 35 #include <os2emx.h> 35 36 #include <InnoTekLIBC/backend.h> … … 55 56 FS_VAR(); 56 57 FS_SAVE_LOAD(); 57 int rc = DosLoadModule ((PSZ)pszError, cchError, (PCSZ)pszLibrary, &hmod);58 int rc = DosLoadModuleEx((PSZ)pszError, cchError, (PCSZ)pszLibrary, &hmod); 58 59 FS_RESTORE(); 59 60 if (!rc) -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.