Changeset 3811
- Timestamp:
- Feb 16, 2014, 11:56:50 PM (11 years ago)
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/libc-0.6/src/emx/include/InnoTekLIBC/backend.h
r3771 r3811 542 542 /** @defgroup __libc_Back_ldr LIBC Backend - Loader 543 543 * @{ */ 544 545 /** Special handle that's returned when passing NULL as library name to 546 * __libc_Back_ldrOpen. */ 547 #define __LIBC_BACK_LDR_GLOBAL ((void *)(intptr_t)-2) 544 548 545 549 /** -
branches/libc-0.6/src/emx/src/lib/sys/b_ldrClose.c
r2254 r3811 4 4 * LIBC SYS Backend - dlclose. 5 5 * 6 * Copyright (c) 2004 knut st. osmundsen <bird@innotek.de>6 * Copyright (c) 2004-2014 knut st. osmundsen <bird@innotek.de> 7 7 * 8 8 * … … 49 49 { 50 50 LIBCLOG_ENTER("pvModule=%p\n", pvModule); 51 FS_VAR(); 52 FS_SAVE_LOAD(); 53 int rc = DosFreeModuleEx((HMODULE)pvModule); 54 FS_RESTORE(); 51 int rc; 52 if (pvModule == __LIBC_BACK_LDR_GLOBAL) 53 rc = NO_ERROR; 54 else 55 { 56 FS_VAR(); 57 FS_SAVE_LOAD(); 58 int rc = DosFreeModuleEx((HMODULE)pvModule); 59 FS_RESTORE(); 60 } 55 61 if (!rc) 56 62 LIBCLOG_RETURN_INT(rc); -
branches/libc-0.6/src/emx/src/lib/sys/b_ldrOpen.c
r3692 r3811 4 4 * LIBC SYS Backend - dlopen. 5 5 * 6 * Copyright (c) 2004 knut st. osmundsen <bird@innotek.de>6 * Copyright (c) 2004-2014 knut st. osmundsen <bird@innotek.de> 7 7 * 8 8 * … … 61 61 62 62 /* 63 * Sepecial case where we're requested to open the global namespace object 64 * for the process. 65 */ 66 if (!pszLibrary) 67 { 68 *ppvModule = __LIBC_BACK_LDR_GLOBAL; 69 LIBCLOG_RETURN_INT(0); 70 } 71 72 /* 63 73 * Resolve the path if one is given. Ignore failures to resolve the file 64 74 * name is it may lack the extension (I think) - DosLoadModule will fail, -
branches/libc-0.6/src/emx/src/lib/sys/b_ldrSymbol.c
r2254 r3811 4 4 * LIBC SYS Backend - dlsym. 5 5 * 6 * Copyright (c) 2004 knut st. osmundsen <bird@innotek.de>6 * Copyright (c) 2004-2014 knut st. osmundsen <bird@innotek.de> 7 7 * 8 8 * … … 51 51 LIBCLOG_ENTER("pvHandle=%p pszSymbol=%p:{%s} ppfn=%p\n", pvHandle, 52 52 (void *)pszSymbol, (uintptr_t)pszSymbol >= 10000 ? pszSymbol : "<ordinal>", (void *)ppfn); 53 PFN pfn;54 FS_VAR();55 FS_SAVE_LOAD();56 53 int rc; 57 if ((uintptr_t)pszSymbol < 10000) 58 rc = DosQueryProcAddr((HMODULE)pvHandle, (uintptr_t)pszSymbol, NULL, &pfn); 54 if (pvHandle == __LIBC_BACK_LDR_GLOBAL) 55 { 56 /* Pretending there aren't anything in the global name space for now. 57 Later we could probably do a QS_MTE assisted scan of loaded modules 58 and what not. */ 59 rc = ERROR_PROC_NOT_FOUND; 60 } 59 61 else 60 rc = DosQueryProcAddr((HMODULE)pvHandle, 0, (PCSZ)pszSymbol, &pfn);61 FS_RESTORE();62 if (!rc)63 62 { 64 *ppfn = (void *)pfn; 65 LIBCLOG_RETURN_MSG(0, "ret 0 *ppfn=%p\n", (void *)pfn); 63 PFN pfn; 64 FS_VAR(); 65 FS_SAVE_LOAD(); 66 if ((uintptr_t)pszSymbol < 10000) 67 rc = DosQueryProcAddr((HMODULE)pvHandle, (uintptr_t)pszSymbol, NULL, &pfn); 68 else 69 rc = DosQueryProcAddr((HMODULE)pvHandle, 0, (PCSZ)pszSymbol, &pfn); 70 FS_RESTORE(); 71 if (!rc) 72 { 73 *ppfn = (void *)pfn; 74 LIBCLOG_RETURN_MSG(0, "ret 0 *ppfn=%p\n", (void *)pfn); 75 } 66 76 } 67 77 LIBCLOG_ERROR_RETURN_INT(rc); -
trunk/libc/include/klibc/backend.h
r3768 r3811 725 725 * @{ */ 726 726 727 /** Special handle that's returned when passing NULL as library name to 728 * __libc_Back_ldrOpen. */ 729 #define __LIBC_BACK_LDR_GLOBAL ((void *)(intptr_t)-2) 730 727 731 /** 728 732 * Opens a shared library. -
trunk/libc/src/kNIX/os2/b_ldrClose.c
r2929 r3811 1 1 /* $Id$ */ 2 2 /** @file 3 *4 3 * kNIX - dlclose, OS/2. 5 * 6 * Copyright (c) 2004-2006 knut st. osmundsen <bird-src-spam@anduin.net> 4 */ 5 6 /* 7 * Copyright (c) 2004-2014 knut st. osmundsen <bird-src-spam@anduin.net> 7 8 * 8 9 * … … 44 45 { 45 46 LIBCLOG_ENTER("pvModule=%p\n", pvModule); 46 FS_VAR(); 47 FS_SAVE_LOAD(); 48 int rc = DosFreeModuleEx((HMODULE)pvModule); 49 FS_RESTORE(); 47 int rc; 48 if (pvModule == __LIBC_BACK_LDR_GLOBAL) 49 rc = NO_ERROR; 50 else 51 { 52 FS_VAR(); 53 FS_SAVE_LOAD(); 54 int rc = DosFreeModuleEx((HMODULE)pvModule); 55 FS_RESTORE(); 56 } 50 57 if (!rc) 51 58 LIBCLOG_RETURN_INT(rc); -
trunk/libc/src/kNIX/os2/b_ldrOpen.c
r3684 r3811 1 1 /* $Id$ */ 2 2 /** @file 3 *4 3 * kNIX - dlopen, OS/2. 5 * 6 * Copyright (c) 2004-2006 knut st. osmundsen <bird-src-spam@anduin.net> 4 */ 5 6 /* 7 * Copyright (c) 2004-2014 knut st. osmundsen <bird-src-spam@anduin.net> 7 8 * 8 9 * … … 48 49 49 50 /* 51 * Sepecial case where we're requested to open the global namespace object 52 * for the process. 53 */ 54 if (!pszLibrary) 55 { 56 *ppvModule = __LIBC_BACK_LDR_GLOBAL; 57 LIBCLOG_RETURN_INT(0); 58 } 59 60 /* 50 61 * Resolve the path if one is given. Ignore failures to resolve the file 51 62 * name is it may lack the extension (I think) - DosLoadModule will fail, -
trunk/libc/src/kNIX/os2/b_ldrSymbol.c
r2929 r3811 1 1 /* $Id$ */ 2 2 /** @file 3 *4 3 * kNIX - dlsym, OS/2. 5 * 6 * Copyright (c) 2004-2006 knut st. osmundsen <bird-src-spam@anduin.net> 4 */ 5 6 /* 7 * Copyright (c) 2004-2014 knut st. osmundsen <bird-src-spam@anduin.net> 7 8 * 8 9 * … … 42 43 LIBCLOG_ENTER("pvHandle=%p pszSymbol=%p:{%s} ppfn=%p\n", pvHandle, 43 44 (void *)pszSymbol, (uintptr_t)pszSymbol >= 10000 ? pszSymbol : "<ordinal>", (void *)ppfn); 44 PFN pfn;45 FS_VAR();46 FS_SAVE_LOAD();47 45 int rc; 48 if ((uintptr_t)pszSymbol < 10000) 49 rc = DosQueryProcAddr((HMODULE)pvHandle, (uintptr_t)pszSymbol, NULL, &pfn); 46 if (pvHandle == __LIBC_BACK_LDR_GLOBAL) 47 { 48 /* Pretending there aren't anything in the global name space for now. 49 Later we could probably do a QS_MTE assisted scan of loaded modules 50 and what not. */ 51 rc = ERROR_PROC_NOT_FOUND; 52 } 50 53 else 51 rc = DosQueryProcAddr((HMODULE)pvHandle, 0, (PCSZ)pszSymbol, &pfn);52 FS_RESTORE();53 if (!rc)54 54 { 55 *ppfn = (void *)pfn; 56 LIBCLOG_RETURN_MSG(0, "ret 0 *ppfn=%p\n", (void *)pfn); 55 PFN pfn; 56 FS_VAR(); 57 FS_SAVE_LOAD(); 58 if ((uintptr_t)pszSymbol < 10000) 59 rc = DosQueryProcAddr((HMODULE)pvHandle, (uintptr_t)pszSymbol, NULL, &pfn); 60 else 61 rc = DosQueryProcAddr((HMODULE)pvHandle, 0, (PCSZ)pszSymbol, &pfn); 62 FS_RESTORE(); 63 if (!rc) 64 { 65 *ppfn = (void *)pfn; 66 LIBCLOG_RETURN_MSG(0, "ret 0 *ppfn=%p\n", (void *)pfn); 67 } 57 68 } 58 69 LIBCLOG_ERROR_RETURN_INT(rc);
Note:
See TracChangeset
for help on using the changeset viewer.