diff -urN vbox-trunk-bk\src\libs\xpcom18a4/Config.kmk vbox-trunk\src\libs\xpcom18a4/Config.kmk
--- vbox-trunk-bk\src\libs\xpcom18a4/Config.kmk	2015-10-25 02:47:36.000000000 +0300
+++ vbox-trunk\src\libs\xpcom18a4/Config.kmk	2015-10-14 00:43:42.000000000 +0300
@@ -37,7 +37,8 @@
 TEMPLATE_XPCOM_ASFLAGS.x86         = -m32
 TEMPLATE_XPCOM_ASFLAGS.amd64       = -m64
 TEMPLATE_XPCOM_ASDEFS              = $(NO_SUCH_VARIABLE)
-TEMPLATE_XPCOM_CXXFLAGS            = -g -pipe -ansi -Wall -Wno-unused -Wno-non-virtual-dtor \
+# -ansi
+TEMPLATE_XPCOM_CXXFLAGS            = -g -pipe -Wall -Wno-unused -Wno-non-virtual-dtor \
 	$(VBOX_GCC_Wno-invalid-offsetof) -Wno-sign-compare -Wno-unused -Wno-ctor-dtor-privacy \
 	$(VBOX_GCC_fvisibility-inlines-hidden) $(VBOX_GCC_fvisibility-hidden) \
 	$(VBOX_GCC_fdiagnostics-show-option) $(VBOX_GCC_Wno-delete-non-virtual-dtor)
diff -urN vbox-trunk-bk\src\libs\xpcom18a4/ipc/ipcd/client/src/ipcdclient.cpp vbox-trunk\src\libs\xpcom18a4/ipc/ipcd/client/src/ipcdclient.cpp
--- vbox-trunk-bk\src\libs\xpcom18a4/ipc/ipcd/client/src/ipcdclient.cpp	2015-10-25 02:48:38.000000000 +0300
+++ vbox-trunk\src\libs\xpcom18a4/ipc/ipcd/client/src/ipcdclient.cpp	2015-10-14 00:43:42.000000000 +0300
@@ -1290,7 +1290,11 @@
   if (PR_ProcessAttrSetInheritableFD(attr, writable, IPC_STARTUP_PIPE_NAME) != PR_SUCCESS)
   goto end;
 
+#ifdef XP_OS2
+  devNull = PR_Open("/dev/nul", PR_RDWR, 0);
+#else
   devNull = PR_Open("/dev/null", PR_RDWR, 0);
+#endif
   if (!devNull)
     goto end;
 
diff -urN vbox-trunk-bk\src\libs\xpcom18a4/ipc/ipcd/daemon/src/ipcdUnix.cpp vbox-trunk\src\libs\xpcom18a4/ipc/ipcd/daemon/src/ipcdUnix.cpp
--- vbox-trunk-bk\src\libs\xpcom18a4/ipc/ipcd/daemon/src/ipcdUnix.cpp	2015-10-25 02:48:36.000000000 +0300
+++ vbox-trunk\src\libs\xpcom18a4/ipc/ipcd/daemon/src/ipcdUnix.cpp	2015-10-14 00:43:42.000000000 +0300
@@ -549,11 +549,20 @@
             // redirect all standard file descriptors to /dev/null for
             // proper daemonizing
             PR_Close(PR_STDIN);
+#ifndef XP_OS2
             PR_Open("/dev/null", O_RDONLY, 0);
             PR_Close(PR_STDOUT);
             PR_Open("/dev/null", O_WRONLY, 0);
             PR_Close(PR_STDERR);
             PR_Open("/dev/null", O_WRONLY, 0);
+#else
+            PR_Open("/dev/nul", O_RDONLY, 0);
+            PR_Close(PR_STDOUT);
+            PR_Open("/dev/nul", O_WRONLY, 0);
+            PR_Close(PR_STDERR);
+            PR_Open("/dev/nul", O_WRONLY, 0);
+#endif
+
 #endif
 
             IPC_NotifyParent();
diff -urN vbox-trunk-bk\src\libs\xpcom18a4/Makefile.kmk vbox-trunk\src\libs\xpcom18a4/Makefile.kmk
--- vbox-trunk-bk\src\libs\xpcom18a4/Makefile.kmk	2015-10-25 02:48:38.000000000 +0300
+++ vbox-trunk\src\libs\xpcom18a4/Makefile.kmk	2015-10-14 00:43:58.000000000 +0300
@@ -819,6 +819,7 @@
 VBox-xpcom-threads_TEMPLATE = XPCOM
 VBox-xpcom-threads_INSTTYPE = none
 VBox-xpcom-threads_DEFS = _IMPL_NS_COM
+VBox-xpcom-threads_DEFS.os2 = # OS2_PM_EVENT_QUEUES
 VBox-xpcom-threads_SOURCES = \
 	xpcom/threads/plevent.c \
 	xpcom/threads/nsAutoLock.cpp \
diff -urN vbox-trunk-bk\src\libs\xpcom18a4/nsprpub/pr/include/md/_os2_errors.h vbox-trunk\src\libs\xpcom18a4/nsprpub/pr/include/md/_os2_errors.h
--- vbox-trunk-bk\src\libs\xpcom18a4/nsprpub/pr/include/md/_os2_errors.h	2015-10-25 02:48:18.000000000 +0300
+++ vbox-trunk\src\libs\xpcom18a4/nsprpub/pr/include/md/_os2_errors.h	2015-10-14 00:43:58.000000000 +0300
@@ -109,7 +109,7 @@
 NSPR_API(void) _MD_os2_map_sendto_error(PRInt32 err);
 #define	_PR_MD_MAP_SENDTO_ERROR	_MD_os2_map_sendto_error
 
-NSPR_API(void) _MD_os2_map_writev_error(int err);
+NSPR_API(void) _MD_os2_map_writev_error(PRInt32 err); // int
 #define	_PR_MD_MAP_WRITEV_ERROR	_MD_os2_map_writev_error
 
 NSPR_API(void) _MD_os2_map_accept_error(PRInt32 err);
@@ -131,7 +131,7 @@
 #define	_PR_MD_MAP_SHUTDOWN_ERROR	_MD_os2_map_shutdown_error
 
 #ifndef XP_OS2_VACPP
-NSPR_API(void) _MD_os2_map_socketpair_error(int err);
+NSPR_API(void) _MD_os2_map_socketpair_error(PRInt32 err); // int
 #define	_PR_MD_MAP_SOCKETPAIR_ERROR	_MD_os2_map_socketpair_error
 #endif
 
@@ -156,7 +156,7 @@
 NSPR_API(void) _MD_os2_map_select_error(PRInt32 err);
 #define	_PR_MD_MAP_SELECT_ERROR	_MD_os2_map_select_error
 
-NSPR_API(void) _MD_os2_map_lockf_error(int err);
+NSPR_API(void) _MD_os2_map_lockf_error(PRInt32 err); // int
 #define _PR_MD_MAP_LOCKF_ERROR  _MD_os2_map_lockf_error
 
 #endif /* nspr_os2_errors_h___ */
diff -urN vbox-trunk-bk\src\libs\xpcom18a4/nsprpub/pr/src/md/os2/os2sock.c vbox-trunk\src\libs\xpcom18a4/nsprpub/pr/src/md/os2/os2sock.c
--- vbox-trunk-bk\src\libs\xpcom18a4/nsprpub/pr/src/md/os2/os2sock.c	2015-10-25 02:48:24.000000000 +0300
+++ vbox-trunk\src\libs\xpcom18a4/nsprpub/pr/src/md/os2/os2sock.c	2015-10-14 00:43:58.000000000 +0300
@@ -639,7 +639,7 @@
 {
     PRInt32 rv, err;
 
-    rv = socketpair(af, type, flags, osfd);
+    rv = socketpair(af, type, flags, (int *)osfd);
     if (rv < 0) {
         err = _MD_ERRNO();
         _PR_MD_MAP_SOCKETPAIR_ERROR(err);
diff -urN vbox-trunk-bk\src\libs\xpcom18a4/nsprpub/pr/src/misc/prinit.c vbox-trunk\src\libs\xpcom18a4/nsprpub/pr/src/misc/prinit.c
--- vbox-trunk-bk\src\libs\xpcom18a4/nsprpub/pr/src/misc/prinit.c	2015-10-25 02:48:22.000000000 +0300
+++ vbox-trunk\src\libs\xpcom18a4/nsprpub/pr/src/misc/prinit.c	2015-10-14 00:43:58.000000000 +0300
@@ -748,7 +748,7 @@
 #ifndef _PR_MD_CREATE_PROCESS_DETACHED
     PRProcess *process;
     PRStatus rv;
-s
+
 #ifdef XP_OS2
     process = _PR_CreateOS2ProcessEx(path, argv, envp, attr, PR_TRUE);
 #else
diff -urN vbox-trunk-bk\src\libs\xpcom18a4/python/Makefile.kmk vbox-trunk\src\libs\xpcom18a4/python/Makefile.kmk
--- vbox-trunk-bk\src\libs\xpcom18a4/python/Makefile.kmk	2015-10-25 02:47:34.000000000 +0300
+++ vbox-trunk\src\libs\xpcom18a4/python/Makefile.kmk	2015-10-14 00:43:58.000000000 +0300
@@ -50,12 +50,19 @@
  endif
 
 else
- # Use the script.
- $(eval $(subst |,$(NL),$(shell $(VBOX_BLD_PYTHON) \
-	$(PATH_SUB_CURRENT)/gen_python_deps.py \
-	    $(KBUILD_TARGET) \
-	    $(KBUILD_TARGET_ARCH) \
-	    $(VBOX_MULTIPYTHON) )))
+ ifeq ($(KBUILD_TARGET),os2)
+  ifneq ($(VBOX_PATH_PYTHON_INC),)
+    VBOX_PYTHON27_INC = $(VBOX_PATH_PYTHON_INC)
+    VBOX_PYTHON27_LIB = $(VBOX_LIB_PYTHON)
+  endif
+ else
+  # Use the script.
+  $(eval $(subst |,$(NL),$(shell $(VBOX_BLD_PYTHON) \
+	 $(PATH_SUB_CURRENT)/gen_python_deps.py \
+	     $(KBUILD_TARGET) \
+	     $(KBUILD_TARGET_ARCH) \
+	     $(VBOX_MULTIPYTHON) )))
+ endif
 endif
 
 ifndef VBOX_ONLY_SDK
@@ -66,6 +73,7 @@
 VBoxPythonBase_TEMPLATE = XPCOM
 VBoxPythonBase_CXXFLAGS = -Wno-write-strings
 VBoxPythonBase_DLLSUFF.darwin = .so
+VBoxPythonBase_DLLSUFF.os2 = .dll
 VBoxPythonBase_DEFS     = \
 	_IMPL_NS_COM \
 	_IMPL_NS_BASE \
@@ -102,8 +110,13 @@
 	src/TypeObject.cpp \
 	src/VariantUtils.cpp
 VBoxPythonBase_LIBS     = \
-	$(PATH_STAGE_LIB)/VBoxCOM$(VBOX_SUFF_LIB) \
-	$(PATH_STAGE_BIN)/VBoxXPCOM$(VBOX_SUFF_DLL)
+	$(PATH_STAGE_LIB)/VBoxCOM$(VBOX_SUFF_LIB)
+
+ifn1of ($(KBUILD_TARGET),os2)
+ VBoxPythonBase_LIBS	+= $(PATH_STAGE_BIN)/VBoxXPCOM$(VBOX_SUFF_DLL)
+else
+ VBoxPythonBase_LIBS	+= $(PATH_STAGE_BIN)/VBoxXCOM$(VBOX_SUFF_DLL)
+endif
 
 # 32-bit base.
 VBoxPythonBase_x86_TEMPLATE = XPCOM-x86
@@ -124,6 +137,7 @@
 VBoxPython2_3_TEMPLATE   = XPCOM$(if-expr "$(KBUILD_TARGET)" == "darwin",OSX104,)
 VBoxPython2_3_INCS       = $(VBOX_PYTHON23_INC)
 VBoxPython2_3_LIBS       = $(VBOX_PYTHON23_LIB)
+VBoxPython2_3_NAME.os2   = VBoxPy23
 
  ifdef VBOX_WITH_32_ON_64_MAIN_API
 DLLS += VBoxPython2_3_x86
@@ -144,6 +158,7 @@
 VBoxPython2_4_EXTENDS_BY = appending
 VBoxPython2_4_INCS       = $(VBOX_PYTHON24_INC)
 VBoxPython2_4_LIBS       = $(VBOX_PYTHON24_LIB)
+VBoxPython2_4_NAME.os2   = VBoxPy24
 
  ifdef VBOX_WITH_32_ON_64_MAIN_API
 DLLS += VBoxPython2_4_x86
@@ -163,6 +178,7 @@
 VBoxPython2_5_EXTENDS_BY = appending
 VBoxPython2_5_INCS       = $(VBOX_PYTHON25_INC)
 VBoxPython2_5_LIBS       = $(VBOX_PYTHON25_LIB)
+VBoxPython2_5_NAME.os2   = VBoxPy25
 
  ifdef VBOX_WITH_32_ON_64_MAIN_API
 DLLS += VBoxPython2_5_x86
@@ -183,6 +199,7 @@
 VBoxPython2_6_TEMPLATE   = XPCOM$(if-expr "$(KBUILD_TARGET)" == "darwin" && "$(VBOX_DEF_MACOSX_VERSION_MIN)" <= "10.6",OSX106,)
 VBoxPython2_6_INCS       = $(VBOX_PYTHON26_INC)
 VBoxPython2_6_LIBS       = $(VBOX_PYTHON26_LIB)
+VBoxPython2_6_NAME.os2   = VBoxPy26
 
  ifdef VBOX_WITH_32_ON_64_MAIN_API
 DLLS += VBoxPython2_6_x86
@@ -204,6 +221,7 @@
 VBoxPython2_7_TEMPLATE   = XPCOM$(if-expr "$(KBUILD_TARGET)" == "darwin" && "$(VBOX_DEF_MACOSX_VERSION_MIN)" <= "10.7",OSX107,)
 VBoxPython2_7_INCS       = $(VBOX_PYTHON27_INC)
 VBoxPython2_7_LIBS       = $(VBOX_PYTHON27_LIB)
+VBoxPython2_7_NAME.os2   = VBoxPy27
 
  ifdef VBOX_WITH_32_ON_64_MAIN_API
 DLLS += VBoxPython2_7_x86
diff -urN vbox-trunk-bk\src\libs\xpcom18a4/python/src/module/_xpcom.cpp vbox-trunk\src\libs\xpcom18a4/python/src/module/_xpcom.cpp
--- vbox-trunk-bk\src\libs\xpcom18a4/python/src/module/_xpcom.cpp	2015-10-25 02:47:32.000000000 +0300
+++ vbox-trunk\src\libs\xpcom18a4/python/src/module/_xpcom.cpp	2015-10-14 00:43:58.000000000 +0300
@@ -83,31 +83,60 @@
 #  define MANGLE_MODULE_INIT(a_Name)    RT_CONCAT(a_Name, MODULE_NAME_SUFFIX)
 # endif
 # ifdef VBOX_PYXPCOM_VERSIONED
-#  if   PY_VERSION_HEX >= 0x02080000
-#   define MODULE_NAME    MANGLE_MODULE_NAME("VBoxPython2_8")
-#   define initVBoxPython MANGLE_MODULE_INIT(initVBoxPython2_8)
-
-#  elif PY_VERSION_HEX >= 0x02070000
-#   define MODULE_NAME    MANGLE_MODULE_NAME("VBoxPython2_7")
-#   define initVBoxPython MANGLE_MODULE_INIT(initVBoxPython2_7)
-
-#  elif PY_VERSION_HEX >= 0x02060000
-#   define MODULE_NAME    MANGLE_MODULE_NAME("VBoxPython2_6")
-#   define initVBoxPython MANGLE_MODULE_INIT(initVBoxPython2_6)
-
-#  elif PY_VERSION_HEX >= 0x02050000
-#   define MODULE_NAME 	  MANGLE_MODULE_NAME("VBoxPython2_5")
-#   define initVBoxPython MANGLE_MODULE_INIT(initVBoxPython2_5)
-
-#  elif PY_VERSION_HEX >= 0x02040000
-#   define MODULE_NAME    MANGLE_MODULE_NAME("VBoxPython2_4")
-#   define initVBoxPython MANGLE_MODULE_INIT(initVBoxPython2_4)
-
-#  elif PY_VERSION_HEX >= 0x02030000
-#   define MODULE_NAME    MANGLE_MODULE_NAME("VBoxPython2_3")
-#   define initVBoxPython MANGLE_MODULE_INIT(initVBoxPython2_3)
+#  ifndef XP_OS2
+#   if   PY_VERSION_HEX >= 0x02080000
+#    define MODULE_NAME    MANGLE_MODULE_NAME("VBoxPython2_8")
+#    define initVBoxPython MANGLE_MODULE_INIT(initVBoxPython2_8)
+
+#   elif PY_VERSION_HEX >= 0x02070000
+#    define MODULE_NAME    MANGLE_MODULE_NAME("VBoxPython2_7")
+#    define initVBoxPython MANGLE_MODULE_INIT(initVBoxPython2_7)
+
+#   elif PY_VERSION_HEX >= 0x02060000
+#    define MODULE_NAME    MANGLE_MODULE_NAME("VBoxPython2_6")
+#    define initVBoxPython MANGLE_MODULE_INIT(initVBoxPython2_6)
+
+#   elif PY_VERSION_HEX >= 0x02050000
+#    define MODULE_NAME 	  MANGLE_MODULE_NAME("VBoxPython2_5")
+#    define initVBoxPython MANGLE_MODULE_INIT(initVBoxPython2_5)
+
+#   elif PY_VERSION_HEX >= 0x02040000
+#    define MODULE_NAME    MANGLE_MODULE_NAME("VBoxPython2_4")
+#    define initVBoxPython MANGLE_MODULE_INIT(initVBoxPython2_4)
+
+#   elif PY_VERSION_HEX >= 0x02030000
+#    define MODULE_NAME    MANGLE_MODULE_NAME("VBoxPython2_3")
+#    define initVBoxPython MANGLE_MODULE_INIT(initVBoxPython2_3)
+#   else
+#    error "Fix module versioning."
+#   endif
 #  else
-#   error "Fix module versioning."
+#   if   PY_VERSION_HEX >= 0x02080000
+#    define MODULE_NAME    MANGLE_MODULE_NAME("VBoxPy28")
+#    define initVBoxPython MANGLE_MODULE_INIT(initVBoxPy28)
+
+#   elif PY_VERSION_HEX >= 0x02070000
+#    define MODULE_NAME    MANGLE_MODULE_NAME("VBoxPy27")
+#    define initVBoxPython MANGLE_MODULE_INIT(initVBoxPy27)
+
+#   elif PY_VERSION_HEX >= 0x02060000
+#    define MODULE_NAME    MANGLE_MODULE_NAME("VBoxPy26")
+#    define initVBoxPython MANGLE_MODULE_INIT(initVBoxPy26)
+
+#   elif PY_VERSION_HEX >= 0x02050000
+#    define MODULE_NAME    MANGLE_MODULE_NAME("VBoxPy25")
+#    define initVBoxPython MANGLE_MODULE_INIT(initVBoxPy25)
+
+#   elif PY_VERSION_HEX >= 0x02040000
+#    define MODULE_NAME    MANGLE_MODULE_NAME("VBoxPy24")
+#    define initVBoxPython MANGLE_MODULE_INIT(initVBoxPy24)
+
+#   elif PY_VERSION_HEX >= 0x02030000
+#    define MODULE_NAME    MANGLE_MODULE_NAME("VBoxPy23")
+#    define initVBoxPython MANGLE_MODULE_INIT(initVBoxPy23)
+#   else
+#    error "Fix module versioning."
+#   endif
 #  endif
 # else
 #  define MODULE_NAME 	  MANGLE_MODULE_NAME("VBoxPython")
diff -urN vbox-trunk-bk\src\libs\xpcom18a4/xpcom/threads/plevent.c vbox-trunk\src\libs\xpcom18a4/xpcom/threads/plevent.c
--- vbox-trunk-bk\src\libs\xpcom18a4/xpcom/threads/plevent.c	2015-10-25 02:47:44.000000000 +0300
+++ vbox-trunk\src\libs\xpcom18a4/xpcom/threads/plevent.c	2015-10-14 00:43:58.000000000 +0300
@@ -39,12 +39,18 @@
 #include <windows.h>
 #endif
 
-#if defined(XP_OS2)
+#if defined(XP_OS2) && !defined(QT_CORE_LIB)
 #define INCL_DOS
 #define INCL_DOSERRORS
+#if defined(OS2_PM_EVENT_QUEUES)
 #define INCL_WIN
+#endif
 #include <os2.h>
+#if defined(OS2_PM_EVENT_QUEUES)
 #define DefWindowProc WinDefWindowProc
+#endif
+#elif defined(XP_OS2) && defined(QT_CORE_LIB)
+#include <prtypes.h>
 #endif /* XP_OS2 */
 
 #include "nspr.h"
@@ -53,12 +59,12 @@
 #if !defined(WIN32)
 #include <errno.h>
 #include <stddef.h>
-#if !defined(XP_OS2)
+//#if !defined(XP_OS2)
 #include <unistd.h>
-#endif /* !XP_OS2 */
+//#endif /* !XP_OS2 */
 #endif /* !Win32 */
 
-#if defined(XP_UNIX)
+#if defined(XP_UNIX) || ( defined(XP_OS2) && !defined(OS2_PM_EVENT_QUEUES) )
 /* for fcntl */
 #include <sys/types.h>
 #include <fcntl.h>
@@ -153,7 +159,7 @@
     PRPackedBool        timerSet;
 #endif
 
-#if defined(XP_UNIX) && !defined(XP_MACOSX)
+#if ( defined(XP_UNIX) && !defined(XP_MACOSX) ) || ( defined(XP_OS2) && !defined(OS2_PM_EVENT_QUEUES) )
 #if defined(VMS)
     int                 efn;
 #else
@@ -161,7 +167,7 @@
 #endif
     PLGetEventIDFunc    idFunc;
     void*               idFuncClosure;
-#elif defined(_WIN32) || defined(XP_OS2)
+#elif defined(_WIN32) || ( defined(XP_OS2) && defined(OS2_PM_EVENT_QUEUES) )
     HWND                eventReceiverWindow;
     PRBool              removeMsg;
 #elif defined(XP_BEOS)
@@ -189,7 +195,7 @@
 static PRInt32     _pl_GetEventCount(PLEventQueue* self);
 
 
-#if defined(_WIN32) || defined(XP_OS2)
+#if defined(_WIN32) || ( defined(XP_OS2) && defined(OS2_PM_EVENT_QUEUES) )
 #if defined(XP_OS2)
 ULONG _pr_PostEventMsgId;
 #else
@@ -255,7 +261,7 @@
 #if defined(_WIN32)
     self->timerSet = PR_FALSE;
 #endif
-#if defined(_WIN32) || defined(XP_OS2)
+#if defined(_WIN32) || ( defined(XP_OS2) && defined(OS2_PM_EVENT_QUEUES) )
     self->removeMsg = PR_TRUE;
 #endif
 
@@ -337,7 +343,7 @@
     mon = self->monitor;
     PR_EnterMonitor(mon);
 
-#if defined(XP_UNIX) && !defined(XP_MACOSX)
+#if ( defined(XP_UNIX) && !defined(XP_MACOSX) ) || ( defined(XP_OS2) && !defined(OS2_PM_EVENT_QUEUES) )
     if (self->idFunc && event)
         event->id = self->idFunc(self->idFuncClosure);
 #endif
@@ -662,7 +668,7 @@
     self->handled = PR_FALSE;
     self->lock = NULL;
     self->condVar = NULL;
-#if defined(XP_UNIX) && !defined(XP_MACOSX)
+#if ( defined(XP_UNIX) && !defined(XP_MACOSX) ) || ( defined(XP_OS2) && !defined(OS2_PM_EVENT_QUEUES) )
     self->id = 0;
 #endif
 }
@@ -851,14 +857,21 @@
     PR_LOG(event_lm, PR_LOG_DEBUG,
            ("$$$ Allocated event flag %d", self->efn));
     return PR_SUCCESS;
-#elif defined(XP_UNIX) && !defined(XP_MACOSX)
+#elif ( defined(XP_UNIX) && !defined(XP_MACOSX) ) || ( defined(XP_OS2) && !defined(OS2_PM_EVENT_QUEUES) )
     int err;
     int flags;
 
     self->idFunc = 0;
     self->idFuncClosure = 0;
 
+#ifndef XP_OS2
     err = pipe(self->eventPipe);
+#else
+    /* use a pair for local sockets for non-blocking case,
+     * and for use with select(), instead of a pipe
+     */
+    err = socketpair(AF_LOCAL, SOCK_STREAM, 0, (int *)self->eventPipe);
+#endif
     if (err != 0) {
         return PR_FAILURE;
     }
@@ -867,6 +880,7 @@
     fcntl(self->eventPipe[1], F_SETFD, FD_CLOEXEC);
 #endif
 
+#ifndef XP_OS2
     /* make the pipe nonblocking */
     flags = fcntl(self->eventPipe[0], F_GETFL, 0);
     if (flags == -1) {
@@ -884,6 +898,20 @@
     if (err == -1) {
         goto failed;
     }
+#else
+    int val;
+    /* make the pipe nonblocking */
+    val = 1;
+    err = os2_ioctl(self->eventPipe[0], FIONBIO, (char *)&val, sizeof(val));
+    if (err == -1) {
+        goto failed;
+    }
+    val = 1;
+    err = os2_ioctl(self->eventPipe[1], FIONBIO, (char *)&val, sizeof(val));
+    if (err == -1) {
+        goto failed;
+    }
+#endif
     return PR_SUCCESS;
 
 failed:
@@ -929,7 +957,7 @@
            ("$$$ Freeing event flag %d", self->efn));
         status = LIB$FREE_EF(&self->efn);
     }
-#elif defined(XP_UNIX) && !defined(XP_MACOSX)
+#elif ( defined(XP_UNIX) && !defined(XP_MACOSX) ) || ( defined(XP_OS2) && !defined(OS2_PM_EVENT_QUEUES) )
     close(self->eventPipe[0]);
     close(self->eventPipe[1]);
 #elif defined(_WIN32)
@@ -945,7 +973,7 @@
      */
     SendMessage(self->eventReceiverWindow, WM_CLOSE, 0, 0);
 
-#elif defined(XP_OS2)
+#elif defined(XP_OS2) && defined(OS2_PM_EVENT_QUEUES)
     WinDestroyWindow(self->eventReceiverWindow);
 #elif defined(MAC_USE_CFRUNLOOPSOURCE)
 
@@ -1191,7 +1219,7 @@
 #endif
 
 
-#if defined(XP_OS2)
+#if defined(XP_OS2) && defined(OS2_PM_EVENT_QUEUES)
 static PRStatus
 _pl_NativeNotify(PLEventQueue* self)
 {
@@ -1213,7 +1241,7 @@
     status = SYS$SETEF(self->efn);
     return ($VMS_STATUS_SUCCESS(status)) ? PR_SUCCESS : PR_FAILURE;
 }/* --- end _pl_NativeNotify() --- */
-#elif defined(XP_UNIX) && !defined(XP_MACOSX)
+#elif ( defined(XP_UNIX) && !defined(XP_MACOSX) ) || ( defined(XP_OS2) && !defined(OS2_PM_EVENT_QUEUES) )
 
 static PRStatus
 _pl_NativeNotify(PLEventQueue* self)
@@ -1289,7 +1317,7 @@
 static PRStatus
 _pl_AcknowledgeNativeNotify(PLEventQueue* self)
 {
-#if defined(_WIN32) || defined(XP_OS2)
+#if defined(_WIN32) || ( defined(XP_OS2) && defined(OS2_PM_EVENT_QUEUES) )
 #ifdef XP_OS2
     QMSG aMsg;
 #else
@@ -1327,7 +1355,7 @@
     */
     sys$clref(self->efn);
     return PR_SUCCESS;
-#elif defined(XP_UNIX) && !defined(XP_MACOSX)
+#elif ( defined(XP_UNIX) && !defined(XP_MACOSX) ) || ( defined(XP_OS2) && !defined(OS2_PM_EVENT_QUEUES) )
 
     PRInt32 count;
     unsigned char c;
@@ -1360,7 +1388,7 @@
 
 #if defined(VMS)
     return -(self->efn);
-#elif defined(XP_UNIX) && !defined(XP_MACOSX)
+#elif ( defined(XP_UNIX) && !defined(XP_MACOSX) ) || ( defined(XP_OS2) && !defined(OS2_PM_EVENT_QUEUES) )
     return self->eventPipe[0];
 #else
     return -1;    /* other platforms don't handle this (yet) */
@@ -1420,7 +1448,7 @@
 #endif
 
 
-#if defined(_WIN32) || defined(XP_OS2)
+#if defined(_WIN32) || ( defined(XP_OS2) && defined(OS2_PM_EVENT_QUEUES) )
 #ifdef XP_OS2
 MRESULT EXPENTRY
 _md_EventReceiverProc(HWND hwnd, ULONG uMsg, MPARAM wParam, MPARAM lParam)
@@ -1516,7 +1544,7 @@
 } /* end _md_CreateEventQueue() */
 #endif /* Winxx */
 
-#if defined(XP_OS2)
+#if defined(XP_OS2) && defined(OS2_PM_EVENT_QUEUES)
 /*
 ** _md_CreateEventQueue() -- ModelDependent initializer
 */
@@ -1565,7 +1593,8 @@
 } /* end _md_CreateEventQueue() */
 #endif /* XP_OS2 */
 
-#if (defined(XP_UNIX) && !defined(XP_MACOSX)) || defined(XP_BEOS)
+#if ( defined(XP_UNIX) && !defined(XP_MACOSX) ) || defined(XP_BEOS) || \
+    ( defined(XP_OS2) && !defined(OS2_PM_EVENT_QUEUES) )
 /*
 ** _md_CreateEventQueue() -- ModelDependent initializer
 */
@@ -1678,7 +1707,7 @@
 
 /* extra functions for unix */
 
-#if defined(XP_UNIX) && !defined(XP_MACOSX)
+#if ( defined(XP_UNIX) && !defined(XP_MACOSX) ) || ( defined(XP_OS2) && !defined(OS2_PM_EVENT_QUEUES) )
 
 PR_IMPLEMENT(PRInt32)
 PL_ProcessEventsBeforeID(PLEventQueue *aSelf, unsigned long aID)
diff -urN vbox-trunk-bk\src\libs\xpcom18a4/xpcom/threads/plevent.h vbox-trunk\src\libs\xpcom18a4/xpcom/threads/plevent.h
--- vbox-trunk-bk\src\libs\xpcom18a4/xpcom/threads/plevent.h	2015-10-25 02:47:44.000000000 +0300
+++ vbox-trunk\src\libs\xpcom18a4/xpcom/threads/plevent.h	2015-10-14 00:43:58.000000000 +0300
@@ -194,11 +194,13 @@
 /* For HWND */
 #if defined(XP_WIN32)
 #include <windef.h>
-#elif defined(XP_OS2)
+#elif defined(XP_OS2) && !defined(QT_CORE_LIB)
 #define INCL_DOSMISC
 #define INCL_DOSPROCESS
 #define INCL_DOSERRORS
 #include <os2.h>
+#elif defined(XP_OS2) && defined(QT_CORE_LIB)
+#include <prtypes.h>
 #endif
 
 #ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
@@ -541,7 +543,7 @@
 #ifdef PL_POST_TIMINGS
     PRIntervalTime      postTime;
 #endif
-#ifdef XP_UNIX
+#if defined(XP_UNIX) || ( defined(XP_OS2) && !defined(OS2_PM_EVENT_QUEUES) )
     unsigned long       id;
 #endif /* XP_UNIX */
     /* other fields follow... */
@@ -553,7 +555,7 @@
 ** Returns the event queue associated with the main thread.
 ** 
 */
-#if defined(XP_WIN) || defined(XP_OS2)
+#if defined(XP_WIN) || ( defined(XP_OS2) && defined(OS2_PM_EVENT_QUEUES) )
 /* -----------------------------------------------------------------------
 ** FUNCTION: PL_GetNativeEventReceiverWindow()
 ** 
@@ -577,7 +579,7 @@
     );
 #endif /* XP_WIN || XP_OS2 */
 
-#ifdef XP_UNIX
+#if defined(XP_UNIX) || ( defined(XP_OS2) && !defined(OS2_PM_EVENT_QUEUES) )
 /* -----------------------------------------------------------------------
 ** FUNCTION: PL_ProcessEventsBeforeID()
 **
