- Timestamp:
- Jun 13, 2005, 4:16:10 AM (20 years ago)
- Location:
- trunk/src/emx
- Files:
-
- 1 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/emx/ChangeLog.LIBC
-
Property cvs2svn:cvs-rev
changed from
1.53
to1.54
r2020 r2021 1 1 /* $Id$ */ 2 3 2005-06-12: knut st. osmundsen <bird-gccos2-spam@anduin.net> 4 - libc: 5 o Changed the LIBC_PATHREADWRITERS to a generic LIBC_HOOK_DLLS. 6 See src/emx/src/lib/sys/hooks.c for details. 2 7 3 8 2005-06-11: knut st. osmundsen <bird-gccos2-spam@anduin.net> -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/include/InnoTekLIBC/pathrewrite.h
-
Property cvs2svn:cvs-rev
changed from
1.2
to1.3
r2020 r2021 4 4 * InnoTek LIBC - Path Rewrite. 5 5 * 6 * Copyright (c) 2004 knut st. osmundsen <bird-srcspam@anduin.net>6 * Copyright (c) 2004-2005 knut st. osmundsen <bird-srcspam@anduin.net> 7 7 * 8 8 * … … 57 57 /** Length of to path. */ 58 58 unsigned cchTo; 59 /** Reserved 0 - intended for function pointer to special open. */ 60 unsigned uReserved0; 61 /** Reserved 1 - intended for function pointer to special parser. */ 62 unsigned uReserved1; 63 /** Reserved 2 - 8 byte alignment*/ 64 unsigned uReserved2; 59 65 } __LIBC_PATHREWRITE, *__LIBC_PPATHREWRITE; 60 66 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/startup/386/dll0.s
-
Property cvs2svn:cvs-rev
changed from
1.15
to1.16
r2020 r2021 81 81 do_init: 82 82 #endif 83 pushl 4(%esp) 83 84 pushl $(FLAG_HIGHMEM + FLAG_NOUNIX) 84 85 call ___init_dll 85 add $ 4, %esp86 add $8, %esp 86 87 orl %eax, %eax 87 88 jz do_initterm -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/startup/startup.c
-
Property cvs2svn:cvs-rev
changed from
1.13
to1.14
r2020 r2021 68 68 * - __libc_fhInit() will call _hmalloc() and a number of OS/2 APIs 69 69 * to figure out what handles was inherited. 70 * - __init_dll checks for LIBC_HOOK_DLLS and calls __libc_back_hooksInit() 71 * to process it if it is present in the environment. 70 72 * - __init_dll then intializes _sys_clock0_ms with the current MS count. 71 73 * - dll0.s calls _DLL_InitTerm in startup/dllinit.c. -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/__init.c
-
Property cvs2svn:cvs-rev
changed from
1.21
to1.22
r2020 r2021 184 184 * Then end the heap voting. 185 185 */ 186 if (__init_dll(fFlags ))186 if (__init_dll(fFlags, 0)) 187 187 goto failure; 188 188 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/__initdll.c
-
Property cvs2svn:cvs-rev
changed from
1.20
to1.21
r2020 r2021 36 36 #include "b_fs.h" 37 37 #include "b_signal.h" 38 #include "backend.h" 38 39 #include <InnoTekLIBC/thread.h> 39 40 #include <InnoTekLIBC/libc.h> … … 89 90 * If clear all unix like features are enabled. 90 91 * Passed on to __init_dll(). 91 */ 92 int __init_dll(int fFlags) 92 * @param hmod The handle of the calling module. This is 0 when we're called from crt0.s. 93 * If we're not already initialized, this will be the handle of the libc dll. 94 */ 95 int __init_dll(int fFlags, unsigned long hmod) 93 96 { 94 97 ULONG aul[2]; … … 213 216 return -1; 214 217 } 218 219 /* 220 * Load and call hook DLLs. 221 */ 222 const char *psz = getenv("LIBC_HOOK_DLLS"); 223 if (psz) 224 __libc_back_hooksInit(psz, hmod); 215 225 216 226 /* -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/backend.h
-
Property cvs2svn:cvs-rev
changed from
1.2
to1.3
r2020 r2021 47 47 int __libc_native2errno(unsigned long rc); 48 48 49 /** 50 * Initializes the various LIBC hooks using the given 51 * specification string. 52 */ 53 void __libc_back_hooksInit(const char *pszSpec, unsigned long hmod); 49 54 50 55 __END_DECLS -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/pathrewrite.c
-
Property cvs2svn:cvs-rev
changed from
1.6
to1.7
r2020 r2021 26 26 27 27 28 /** @page PathRewrite Path Rewrite Feature28 /** @page pg_pathRewrite Path Rewrite Feature 29 29 * 30 30 * The Path Rewrite Feature was designed as a replacement for the hardcoded 31 31 * mapping of /dev/null to nul and /dev/tty to con in __open.c. It allows 32 * the user of LIBC to automatically rewrite (map) paths given to LIBC API S.32 * the user of LIBC to automatically rewrite (map) paths given to LIBC APIs. 33 33 * The user can dynamically add and remove rewrite rules. The environment 34 * variable LIBC_PATHREWRITERS can be used to dynamically load DLLs containing 35 * rewrite rules and add it to the process. 36 * 37 * 38 * @subsection LIBC_PATHREWRITERS 39 * 40 * The format is <dllname>@<export>. LIBC will load <dllname>, resolve <export> 41 * and call <export> with pointers to the three __libc_PathRewrite interfaces. 42 * The <export> function will then register and remove rules as it pleases it. 43 * Single of double quotes can be applied to the <dllname>. Multiple rewriters 44 * must be separated by space. 45 * 46 * Examples: 47 * set LIBC_PATHREWRITERS=prwhome.dll@_instprws 48 * set LIBC_PATHREWRITERS=/usr/lib/prwhome.dll@_instprws 49 * set LIBC_PATHREWRITERS="c:\My Plugins\prwhome.dll"@_instprws 50 * set LIBC_PATHREWRITERS=prwhome@_insthomeprws prwhome@_instetcprws 34 * variable LIBC_HOOK_DLLS can be used to dynamically load DLLs containing 35 * rewrite rules and add it to the process. See \ref pg_hooks for further 36 * details. 51 37 */ 52 38 … … 207 193 208 194 209 /** Flag which tells if we're initialized or not. */210 static int gfInited;211 212 195 /******************************************************************************* 213 196 * Internal Functions * 214 197 *******************************************************************************/ 215 198 static void __libc_pathRewriteDeleteDir(PDIRECTORY pDir); 216 static void __libc_pathRewriteInit(void);217 /* static void __libc_pathRewriteTerm(void); */218 219 _CRT_INIT1(__libc_pathRewriteInit)220 221 /**222 * Init rewriters if LIBC_PATHREWRITERS contains anything useful.223 * @remark Cannot be static as GCC will optimize it away then.224 */225 static void __libc_pathRewriteInit(void)226 {227 static void *pfnDummy = __libc_pathRewriteInit;228 LIBCLOG_ENTER("\n");229 if (gfInited)230 LIBCLOG_RETURN_VOID();231 gfInited = 1;232 233 /*234 * Check for the presense of the variable.235 */236 const char *psz = getenv("LIBC_PATHREWRITERS");237 if (!psz || !*psz)238 LIBCLOG_RETURN_MSG_VOID("no rewriters\n");239 240 /*241 * Parse the variable.242 */243 for (;;)244 {245 char chQuote;246 const char *pszDll;247 const char *pszDllEnd;248 const char *pszSym;249 const char *pszSymEnd;250 char szSym[CCHMAXPATH];251 char szDll[CCHMAXPATH];252 HMODULE hmod;253 APIRET rc;254 255 /*256 * Trimming off blanks.257 */258 while ((chQuote = *psz) == ' ' || chQuote == '\t' || chQuote == ';')259 psz++;260 if (!chQuote)261 break;262 263 /*264 * Check for quotes and find the end of the spec.265 */266 if (chQuote != '\'' && chQuote != '"')267 {268 pszDll = psz;269 chQuote = 0;270 pszDllEnd = strpbrk(psz, " \t;@");271 if (!pszDllEnd)272 {273 LIBC_ASSERTM_FAILED("missformed dll specification; '%s'\n", psz);274 LIBCLOG_RETURN_MSG_VOID("ret void. bad spec (1)! stopped parsing!\n");275 }276 pszSym = pszDllEnd;277 }278 else279 { /* quoted */280 pszDll = psz + 1;281 pszDllEnd = strchr(pszDll, chQuote);282 if (!pszDllEnd)283 {284 LIBC_ASSERTM_FAILED("mismatching quotes '%s'\n", psz);285 LIBCLOG_RETURN_MSG_VOID("ret void. bad spec (2)! stopped parsing!\n");286 }287 pszSym = pszDllEnd + 1;288 }289 290 if (*pszSym != '@' || pszSym[1] == ' ' || pszSym[1] == '\t' || pszSym[1] == '\0')291 {292 LIBC_ASSERTM_FAILED("missformed export specification; '%s'\n", psz);293 LIBCLOG_RETURN_MSG_VOID("ret void. bad spec (3)! stopped parsing!\n");294 }295 pszSym++;296 pszSymEnd = strpbrk(pszSym, " \t;@'\"");297 if (!pszSymEnd)298 pszSymEnd = strchr(pszSym, '\0');299 300 if (pszDllEnd - pszDll >= sizeof(szDll))301 {302 LIBC_ASSERTM_FAILED("dll name is too long! %d bytes ; '%s'\n", pszDllEnd - pszDll, psz);303 LIBCLOG_RETURN_MSG_VOID("ret void. bad spec (4)! stopped parsing!\n");304 }305 306 if (pszSymEnd - pszSym >= sizeof(szSym))307 {308 LIBC_ASSERTM_FAILED("symbol name is too long! %d bytes ; '%s'\n", pszSymEnd - pszSym, psz);309 LIBCLOG_RETURN_MSG_VOID("ret void. bad spec (4)! stopped parsing!\n");310 }311 312 /*313 * Load the DLL.314 */315 memcpy(szDll, pszDll, pszDllEnd - pszDll);316 szDll[pszDllEnd - pszDll] = '\0';317 #if defined(DEBUG_LOGGING) || defined(__LIBC_STRICT)318 rc = DosLoadModule((PSZ)szSym, sizeof(szSym), (PCSZ)szDll, &hmod);319 #else320 rc = DosLoadModule(NULL, 0, (PCSZ)szDll, &hmod);321 #endif322 if (!rc)323 {324 void (*pfnRewriter)(int (*pfnAdd)(), int (*pfnRemove)(), int (*pfnRewrite)());325 326 /*327 * Resolve the symbol.328 */329 memcpy(szSym, pszSym, pszSymEnd - pszSym);330 szSym[pszSymEnd - pszSym] = '\0';331 rc = DosQueryProcAddr(hmod, 0, (PSZ)szSym, (PFN*)(void *)&pfnRewriter);332 if (!rc)333 {334 LIBCLOG_MSG("Successfully loaded and resolved rewriter '%s' in '%s' to %p\n",335 szSym, szDll, (void*)pfnRewriter);336 pfnRewriter(__libc_PathRewriteAdd, __libc_PathRewriteRemove, __libc_PathRewrite);337 }338 else339 LIBC_ASSERTM_FAILED("Failed to resolve rewriter '%s' in '%s', rc=%lu\n", szSym, szDll, rc);340 }341 else342 LIBC_ASSERTM_FAILED("Failed to load rewriter '%s', rc=%lu szObj='%s'\n", szDll, rc, szSym);343 344 /*345 * Next part.346 */347 psz = pszSymEnd;348 }349 350 LIBCLOG_RETURN_VOID();351 pfnDummy = pfnDummy;352 }353 354 355 356 /** @todo proper cleanup for non process term. */357 #if 0358 void __libc_pathRewriteTerm(void)359 {360 361 }362 _CRT_TERM1(__libc_pathRewriteTerm);363 #endif364 365 366 199 367 200 /** … … 553 386 LIBCLOG_ENTER("paRules=%p cRules=%d\n", (void*)paRules, cRules); 554 387 int i; 555 556 /* 'Random' init order forces this. :/ */557 if (!gfInited)558 __libc_pathRewriteInit();559 388 560 389 /* … … 699 528 int i; 700 529 701 /* 'Random' init order forces this. :/ */702 if (!gfInited)703 __libc_pathRewriteInit();704 705 530 /* 706 531 * Validation. … … 842 667 const char *psz; 843 668 const char *pszBest; 844 845 /* 'Random' init order forces this. :/ */846 if (!gfInited)847 __libc_pathRewriteInit();848 669 849 670 /* -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/syscalls.h
-
Property cvs2svn:cvs-rev
changed from
1.15
to1.16
r2020 r2021 117 117 * @{ */ 118 118 extern void __init(int fFlags); 119 extern int __init_dll(int fFlags );119 extern int __init_dll(int fFlags, unsigned long hmod); 120 120 extern void /*volatile*/_sys_init_ret(void *stack) __attribute__((__noreturn__)); 121 121 extern int _sys_init_environ(const char *pszEnv); -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.