Index: /branches/libc-0.6/src/emx/include/InnoTekLIBC/backend.h
===================================================================
--- /branches/libc-0.6/src/emx/include/InnoTekLIBC/backend.h	(revision 3810)
+++ /branches/libc-0.6/src/emx/include/InnoTekLIBC/backend.h	(revision 3811)
@@ -542,4 +542,8 @@
 /** @defgroup __libc_Back_ldr   LIBC Backend - Loader
  * @{ */
+
+/** Special handle that's returned when passing NULL as library name to
+ * __libc_Back_ldrOpen. */
+#define __LIBC_BACK_LDR_GLOBAL  ((void *)(intptr_t)-2)
 
 /**
Index: /branches/libc-0.6/src/emx/src/lib/sys/b_ldrClose.c
===================================================================
--- /branches/libc-0.6/src/emx/src/lib/sys/b_ldrClose.c	(revision 3810)
+++ /branches/libc-0.6/src/emx/src/lib/sys/b_ldrClose.c	(revision 3811)
@@ -4,5 +4,5 @@
  * LIBC SYS Backend - dlclose.
  *
- * Copyright (c) 2004 knut st. osmundsen <bird@innotek.de>
+ * Copyright (c) 2004-2014 knut st. osmundsen <bird@innotek.de>
  *
  *
@@ -49,8 +49,14 @@
 {
     LIBCLOG_ENTER("pvModule=%p\n", pvModule);
-    FS_VAR();
-    FS_SAVE_LOAD();
-    int rc = DosFreeModuleEx((HMODULE)pvModule);
-    FS_RESTORE();
+    int rc;
+    if (pvModule == __LIBC_BACK_LDR_GLOBAL)
+        rc = NO_ERROR;
+    else
+    {
+        FS_VAR();
+        FS_SAVE_LOAD();
+        int rc = DosFreeModuleEx((HMODULE)pvModule);
+        FS_RESTORE();
+    }
     if (!rc)
         LIBCLOG_RETURN_INT(rc);
Index: /branches/libc-0.6/src/emx/src/lib/sys/b_ldrOpen.c
===================================================================
--- /branches/libc-0.6/src/emx/src/lib/sys/b_ldrOpen.c	(revision 3810)
+++ /branches/libc-0.6/src/emx/src/lib/sys/b_ldrOpen.c	(revision 3811)
@@ -4,5 +4,5 @@
  * LIBC SYS Backend - dlopen.
  *
- * Copyright (c) 2004 knut st. osmundsen <bird@innotek.de>
+ * Copyright (c) 2004-2014 knut st. osmundsen <bird@innotek.de>
  *
  *
@@ -61,4 +61,14 @@
 
     /*
+     * Sepecial case where we're requested to open the global namespace object
+     * for the process.
+     */
+    if (!pszLibrary)
+    {
+        *ppvModule = __LIBC_BACK_LDR_GLOBAL;
+        LIBCLOG_RETURN_INT(0);
+    }
+
+    /*
      * Resolve the path if one is given.  Ignore failures to resolve the file
      * name is it may lack the extension (I think) - DosLoadModule will fail,
Index: /branches/libc-0.6/src/emx/src/lib/sys/b_ldrSymbol.c
===================================================================
--- /branches/libc-0.6/src/emx/src/lib/sys/b_ldrSymbol.c	(revision 3810)
+++ /branches/libc-0.6/src/emx/src/lib/sys/b_ldrSymbol.c	(revision 3811)
@@ -4,5 +4,5 @@
  * LIBC SYS Backend - dlsym.
  *
- * Copyright (c) 2004 knut st. osmundsen <bird@innotek.de>
+ * Copyright (c) 2004-2014 knut st. osmundsen <bird@innotek.de>
  *
  *
@@ -51,17 +51,27 @@
     LIBCLOG_ENTER("pvHandle=%p pszSymbol=%p:{%s} ppfn=%p\n", pvHandle,
                   (void *)pszSymbol, (uintptr_t)pszSymbol >= 10000 ? pszSymbol : "<ordinal>", (void *)ppfn);
-    PFN     pfn;
-    FS_VAR();
-    FS_SAVE_LOAD();
     int rc;
-    if ((uintptr_t)pszSymbol < 10000)
-        rc = DosQueryProcAddr((HMODULE)pvHandle, (uintptr_t)pszSymbol, NULL, &pfn);
+    if (pvHandle == __LIBC_BACK_LDR_GLOBAL)
+    {
+        /* Pretending there aren't anything in the global name space for now.
+           Later we could probably do a QS_MTE assisted scan of loaded modules
+           and what not.  */
+        rc = ERROR_PROC_NOT_FOUND;
+    }
     else
-        rc = DosQueryProcAddr((HMODULE)pvHandle, 0, (PCSZ)pszSymbol, &pfn);
-    FS_RESTORE();
-    if (!rc)
     {
-        *ppfn = (void *)pfn;
-        LIBCLOG_RETURN_MSG(0, "ret 0 *ppfn=%p\n", (void *)pfn);
+        PFN     pfn;
+        FS_VAR();
+        FS_SAVE_LOAD();
+        if ((uintptr_t)pszSymbol < 10000)
+            rc = DosQueryProcAddr((HMODULE)pvHandle, (uintptr_t)pszSymbol, NULL, &pfn);
+        else
+            rc = DosQueryProcAddr((HMODULE)pvHandle, 0, (PCSZ)pszSymbol, &pfn);
+        FS_RESTORE();
+        if (!rc)
+        {
+            *ppfn = (void *)pfn;
+            LIBCLOG_RETURN_MSG(0, "ret 0 *ppfn=%p\n", (void *)pfn);
+        }
     }
     LIBCLOG_ERROR_RETURN_INT(rc);
Index: /trunk/libc/include/klibc/backend.h
===================================================================
--- /trunk/libc/include/klibc/backend.h	(revision 3810)
+++ /trunk/libc/include/klibc/backend.h	(revision 3811)
@@ -725,4 +725,8 @@
  * @{ */
 
+/** Special handle that's returned when passing NULL as library name to
+ * __libc_Back_ldrOpen. */
+#define __LIBC_BACK_LDR_GLOBAL  ((void *)(intptr_t)-2)
+
 /**
  * Opens a shared library.
Index: /trunk/libc/src/kNIX/os2/b_ldrClose.c
===================================================================
--- /trunk/libc/src/kNIX/os2/b_ldrClose.c	(revision 3810)
+++ /trunk/libc/src/kNIX/os2/b_ldrClose.c	(revision 3811)
@@ -1,8 +1,9 @@
 /* $Id$ */
 /** @file
- *
  * kNIX - dlclose, OS/2.
- *
- * Copyright (c) 2004-2006 knut st. osmundsen <bird-src-spam@anduin.net>
+ */
+
+/*
+ * Copyright (c) 2004-2014 knut st. osmundsen <bird-src-spam@anduin.net>
  *
  *
@@ -44,8 +45,14 @@
 {
     LIBCLOG_ENTER("pvModule=%p\n", pvModule);
-    FS_VAR();
-    FS_SAVE_LOAD();
-    int rc = DosFreeModuleEx((HMODULE)pvModule);
-    FS_RESTORE();
+    int rc;
+    if (pvModule == __LIBC_BACK_LDR_GLOBAL)
+        rc = NO_ERROR;
+    else
+    {
+        FS_VAR();
+        FS_SAVE_LOAD();
+        int rc = DosFreeModuleEx((HMODULE)pvModule);
+        FS_RESTORE();
+    }
     if (!rc)
         LIBCLOG_RETURN_INT(rc);
Index: /trunk/libc/src/kNIX/os2/b_ldrOpen.c
===================================================================
--- /trunk/libc/src/kNIX/os2/b_ldrOpen.c	(revision 3810)
+++ /trunk/libc/src/kNIX/os2/b_ldrOpen.c	(revision 3811)
@@ -1,8 +1,9 @@
 /* $Id$ */
 /** @file
- *
  * kNIX - dlopen, OS/2.
- *
- * Copyright (c) 2004-2006 knut st. osmundsen <bird-src-spam@anduin.net>
+ */
+
+/*
+ * Copyright (c) 2004-2014 knut st. osmundsen <bird-src-spam@anduin.net>
  *
  *
@@ -48,4 +49,14 @@
 
     /*
+     * Sepecial case where we're requested to open the global namespace object
+     * for the process.
+     */
+    if (!pszLibrary)
+    {
+        *ppvModule = __LIBC_BACK_LDR_GLOBAL;
+        LIBCLOG_RETURN_INT(0);
+    }
+
+    /*
      * Resolve the path if one is given.  Ignore failures to resolve the file
      * name is it may lack the extension (I think) - DosLoadModule will fail,
Index: /trunk/libc/src/kNIX/os2/b_ldrSymbol.c
===================================================================
--- /trunk/libc/src/kNIX/os2/b_ldrSymbol.c	(revision 3810)
+++ /trunk/libc/src/kNIX/os2/b_ldrSymbol.c	(revision 3811)
@@ -1,8 +1,9 @@
 /* $Id$ */
 /** @file
- *
  * kNIX - dlsym, OS/2.
- *
- * Copyright (c) 2004-2006 knut st. osmundsen <bird-src-spam@anduin.net>
+ */
+
+/*
+ * Copyright (c) 2004-2014 knut st. osmundsen <bird-src-spam@anduin.net>
  *
  *
@@ -42,17 +43,27 @@
     LIBCLOG_ENTER("pvHandle=%p pszSymbol=%p:{%s} ppfn=%p\n", pvHandle,
                   (void *)pszSymbol, (uintptr_t)pszSymbol >= 10000 ? pszSymbol : "<ordinal>", (void *)ppfn);
-    PFN     pfn;
-    FS_VAR();
-    FS_SAVE_LOAD();
     int rc;
-    if ((uintptr_t)pszSymbol < 10000)
-        rc = DosQueryProcAddr((HMODULE)pvHandle, (uintptr_t)pszSymbol, NULL, &pfn);
+    if (pvHandle == __LIBC_BACK_LDR_GLOBAL)
+    {
+        /* Pretending there aren't anything in the global name space for now.
+           Later we could probably do a QS_MTE assisted scan of loaded modules
+           and what not.  */
+        rc = ERROR_PROC_NOT_FOUND;
+    }
     else
-        rc = DosQueryProcAddr((HMODULE)pvHandle, 0, (PCSZ)pszSymbol, &pfn);
-    FS_RESTORE();
-    if (!rc)
     {
-        *ppfn = (void *)pfn;
-        LIBCLOG_RETURN_MSG(0, "ret 0 *ppfn=%p\n", (void *)pfn);
+        PFN     pfn;
+        FS_VAR();
+        FS_SAVE_LOAD();
+        if ((uintptr_t)pszSymbol < 10000)
+            rc = DosQueryProcAddr((HMODULE)pvHandle, (uintptr_t)pszSymbol, NULL, &pfn);
+        else
+            rc = DosQueryProcAddr((HMODULE)pvHandle, 0, (PCSZ)pszSymbol, &pfn);
+        FS_RESTORE();
+        if (!rc)
+        {
+            *ppfn = (void *)pfn;
+            LIBCLOG_RETURN_MSG(0, "ret 0 *ppfn=%p\n", (void *)pfn);
+        }
     }
     LIBCLOG_ERROR_RETURN_INT(rc);
