- Timestamp:
- Feb 16, 2014, 11:56:50 PM (11 years ago)
- Location:
- trunk/libc
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
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.