Index: trunk/src/emx/Makefile
===================================================================
--- trunk/src/emx/Makefile	(revision 1288)
+++ trunk/src/emx/Makefile	(revision 1289)
@@ -105,5 +105,5 @@
 CFLAGS.omf  = -Zomf
 CFLAGS.prof = -pg
-CFLAGS.log  = -DDEBUG_LOGGING
+CFLAGS.log  = -DDEBUG_LOGGING -D__LIBC_STRICT
 # The object files are put in subdirectory objectformat-targetkind,
 # we decompose object file name back and pick appropiate $CFLAGS
Index: trunk/src/emx/include/386/builtin.h
===================================================================
--- trunk/src/emx/include/386/builtin.h	(revision 1288)
+++ trunk/src/emx/include/386/builtin.h	(revision 1289)
@@ -39,4 +39,142 @@
   __asm__ __volatile__ ("cli");
 }
+
+/**
+ * Atomically sets a bit and return the old one.
+ *
+ * @returns 1 if the bit was set, 0 if it was clear.
+ * @param   pv      Pointer to base of bitmap.
+ * @param   uBit    Bit in question.
+ */
+static __inline__ int __atomic_set_bit(__volatile__ void *pv, unsigned uBit)
+{
+    int rc;
+    __asm__ __volatile__("lock btsl %2, %1\n\t"
+                         "sbbl %0,%0"
+                         : "=r" (rc),
+                           "=m" (*(__volatile__ unsigned *)pv)
+                         : "r" (uBit)
+                         : "memory");
+    return rc;
+}
+
+
+/**
+ * Atomically clears a bit.
+ *
+ * @param   pv      Pointer to base of bitmap.
+ * @param   uBit    Bit in question.
+ */
+static __inline__ void __atomic_clear_bit(__volatile__ void *pv, unsigned uBit)
+{
+    __asm__ __volatile__("lock btrl %1, %0"
+                         : "=m" (*(__volatile__ unsigned *)pv)
+                         : "r" (uBit));
+}
+
+
+/**
+ * Atomically (er?) tests if a bit is set.
+ *
+ * @returns non zero if the bit was set.
+ * @returns 0 if the bit was clear.
+ * @param   pv      Pointer to base of bitmap.
+ * @param   uBit    Bit in question.
+ */
+static __inline__ int __atomic_test_bit(const __volatile__ void *pv, unsigned uBit)
+{
+    __asm__ __volatile__("btl %0, %1\n\t"
+                         "sbbl %0, %0\t\n"
+                         : "=r" (uBit)
+                         : "m"  (*(const __volatile__ unsigned *)pv));
+    return uBit;
+}
+
+
+/**
+ * Atomically increments a 32-bit unsigned value.
+ *
+ * @param   pu      Pointer to the value to increment.
+ */
+static __inline__ void __atomic_increment(__volatile__ unsigned *pu)
+{
+    __asm__ __volatile__("lock incl %0"
+                         : "=m" (*pu));
+}
+
+/**
+ * Atomically decrements a 32-bit unsigned value.
+ *
+ * @param   pu      Pointer to the value to decrement.
+ */
+static __inline__ void __atomic_decrement(__volatile__ unsigned *pu)
+{
+    __asm__ __volatile__("lock decl %0"
+                         : "=m" (*pu));
+}
+
+/**
+ * Atomically increments a 32-bit unsigned value if less than max.
+ *
+ * @returns 0 if incremented.
+ * @returns *pu + 1 when not updated.
+ * @param   pu      Pointer to the value to increment.
+ * @param   uMax    *pu must not be above this value.
+ */
+static __inline__ int __atomic_increment_max(__volatile__ unsigned *pu, unsigned uMax)
+{
+    unsigned rc;
+    __asm__ __volatile__("movl  %1, %%eax\n"
+                         "1:\n\t"
+                         "lea   1(%%eax), %0\n\t"
+                         "cmpl  %0, %2\n\t"
+                         "jna   2f\n\t"
+                         "jmp   4f\n"
+                         "2:\n\t"
+                         "lock  cmpxchgl %0, %1\n\t"
+                         "jz    3f\n\t"
+                         "jmp   1b\n"
+                         "3:"
+                         "xorl  %0, %0\n\t"
+                         "4:"
+                         : "=r" (rc),
+                           "=m" (pu)
+                         : "r"  (uMax)
+                         : "%eax");
+    return rc;
+}
+
+
+/**
+ * Atomically decrements a 32-bit unsigned value if greater than a min.
+ *
+ * @returns 0 if incremented.
+ * @returns *pu + 1 when not updated.
+ * @param   pu      Pointer to the value to decrement.
+ * @param   uMin    *pu must not be below this value.
+ */
+static __inline__ int __atomic_increment_min(__volatile__ unsigned *pu, unsigned uMin)
+{
+    unsigned rc;
+    __asm__ __volatile__("movl  %1, %%eax\n"
+                         "1:\n\t"
+                         "lea   -1(%%eax), %0\n\t"
+                         "cmpl  %0, %2\n\t"
+                         "jnb   2f\n\t"
+                         "jmp   4f\n"
+                         "2:\n\t"
+                         "lock  cmpxchgl %0, %1\n\t"
+                         "jz    3f\n\t"
+                         "jmp   1b\n"
+                         "3:"
+                         "xorl  %0, %0\n\t"
+                         "4:"
+                         : "=r" (rc),
+                           "=m" (*pu)
+                         : "r"  (uMin)
+                         : "%eax");
+    return rc;
+}
+
 
 #define __ROTATE_FUN(F,I,T) \
Index: trunk/src/emx/include/InnoTekLIBC/log.h
===================================================================
--- trunk/src/emx/include/InnoTekLIBC/log.h	(revision 1288)
+++ 	(revision )
@@ -1,452 +1,0 @@
-/* $Id$ */
-/** @file
- *
- * InnoTek LIBC - Debug Logging and Strict Checking Features.
- *
- * InnoTek Systemberatung GmbH confidential
- *
- * Copyright (c) 2004 InnoTek Systemberatung GmbH
- * Author: knut st. osmundsen <bird-srcspam@anduin.net>
- *
- * All Rights Reserved
- *
- */
-
-#ifndef __InnoTekLIBC_LOG_H__
-#define __InnoTekLIBC_LOG_H__
-
-/** @defgroup   __libc_log      Debug Logging and Strict Checking Features
- *
- * The logging feature is not accessible unless DEBUG_LOGGING is #defined.
- *
- * The user of this feature must #define __LIBC_LOG_GROUP to a valid group
- * number before including this file.
- *
- * The user may also #define __LIBC_LOG_INSTANCE if it doesn't want to use
- * the default logging device.
- *
- * Note that all everything but the main logger macros are using the default
- * prefix to avoid namespace pollution. The main logger macros are not
- * prefixed with the double underscore because that would make the code less
- * readable (and it's more to type which for me means more pain).
- *
- * @{
- */
-
-
-/*******************************************************************************
-*   Defined Constants And Macros                                               *
-*******************************************************************************/
-/**
- * The user may also #define __LIBC_LOG_INSTANCE if it doesn't want to use
- * the default logging device.
- */
-#ifdef DEBUG_LOGGING
-#ifndef __LIBC_LOG_INSTANCE
-#define __LIBC_LOG_INSTANCE NULL
-#endif
-#endif
-
-/**
- * The user of this feature must #define __LIBC_LOG_GROUP to a valid group
- * number before including this file.
- */
-#ifdef DEBUG_LOGGING
-#ifndef __LIBC_LOG_GROUP
-#define __LIBC_LOG_GROUP    0
-#error "__LIBC_LOG_GROUP must be defined before including InnoTekLIBC/log.h"
-#endif
-#endif
-
-/** Macro to log a function entry. */
-#ifdef DEBUG_LOGGING
-#define LIBCLOG_ENTER(...) \
-    unsigned __libclog_uEnterTS__ = __libc_LogEnter(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __VA_ARGS__)
-#else
-#define LIBCLOG_ENTER(...)  //hmm
-#endif
-
-/** Macro to log a generic message within a function entered by LIBCLOG_ENTER(). */
-#ifdef DEBUG_LOGGING
-#define LIBCLOG_MSG(...) \
-    __libc_LogMsg(__libclog_uEnterTS__, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __VA_ARGS__)
-#else
-#define LIBCLOG_MSG(...)    do {} while (0)
-#endif
-
-/** Macro to log a generic message within a functionw. */
-#ifdef DEBUG_LOGGING
-#define LIBCLOG_MSG2(...) \
-    __libc_LogMsg(~0, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __VA_ARGS__)
-#else
-#define LIBCLOG_MSG2(...)   do {} while (0)
-#endif
-
-/** Macro to log a raw message. */
-#ifdef DEBUG_LOGGING
-#define LIBCLOG_RAW(string, maxlen) \
-    __libc_LogRaw(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, string, maxlen)
-#else
-#define LIBCLOG_RAW(...)    do {} while (0)
-#endif
-
-/** Macro to log a function exit. */
-#ifdef DEBUG_LOGGING
-#define LIBCLOG_LEAVE(...) \
-    __libc_LogLeave(__libclog_uEnterTS__, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __VA_ARGS__)
-#else
-#define LIBCLOG_LEAVE(...)  do {} while (0)
-#endif
-/** Macro to log a void return and do the return. */
-#define LIBCLOG_RETURN_VOID()    do { LIBCLOG_LEAVE("ret void\n");                      return;      } while (0)
-/** Macro to log an int return and do the return. */
-#define LIBCLOG_RETURN_INT(rc)   do { LIBCLOG_LEAVE("ret %d (%#x)\n", (rc), (rc));      return (rc); } while (0)
-/** Macro to log an unsigned int return and do the return. */
-#define LIBCLOG_RETURN_UINT(rc)  do { LIBCLOG_LEAVE("ret %u (%#x)\n", (rc), (rc));      return (rc); } while (0)
-/** Macro to log an long int return and do the return. */
-#define LIBCLOG_RETURN_LONG(rc)  do { LIBCLOG_LEAVE("ret %ld (%#lx)\n", (rc), (rc));    return (rc); } while (0)
-/** Macro to log an unsigned long int return and do the return. */
-#define LIBCLOG_RETURN_ULONG(rc) do { LIBCLOG_LEAVE("ret %lu (%#lx)\n", (rc), (rc));    return (rc); } while (0)
-/** Macro to log a pointer return and do the return. */
-#define LIBCLOG_RETURN_P(rc)     do { LIBCLOG_LEAVE("ret %p\n", (rc));                  return (rc); } while (0)
-
-
-/** @defgroup   __libc_log_groups   Default Logging Groups
- * @{ */
-/** whatever. */
-#define __LIBCLOG_GRP_NOGROUP       0
-
-/*-- LIBC --*/
-/** Process APIs. */
-#define __LIBCLOG_GRP_PROCESS       1
-/** Heap APIs. */
-#define __LIBCLOG_GRP_HEAP          2
-/** File stream APIs. */
-#define __LIBCLOG_GRP_STREAM        3
-/** Other I/O APIs. */
-#define __LIBCLOG_GRP_IO            4
-/** String APIs. */
-#define __LIBCLOG_GRP_STRING        5
-/** Locale APIs. */
-#define __LIBCLOG_GRP_LOCALE        6
-/** Regular expression APIs. */
-#define __LIBCLOG_GRP_REGEX         7
-/** Math APIs. */
-#define __LIBCLOG_GRP_MATH          8
-/** Time APIs. */
-#define __LIBCLOG_GRP_TIME          9
-/** BSD DB APIs. */
-#define __LIBCLOG_GRP_BSD_DB        10
-/** GLIBC POSIX APIs. */
-#define __LIBCLOG_GRP_GLIBC_POSIX   11
-
-/** Backend APIs. */
-#define __LIBCLOG_GRP_BACKEND       28
-/** Misc APIs. */
-#define __LIBCLOG_GRP_MISC          29
-/** BSD Gen APIs. */
-#define __LIBCLOG_GRP_BSD_GEN       30
-/** GLIBC Misc APIs. */
-#define __LIBCLOG_GRP_GLIBC_MISC    31
-
-/*-- other libraries/APIs --*/
-/** Socket APIs. */
-#define __LIBCLOG_GRP_SOCKET        32
-/** Other TCP/IP APIs. */
-#define __LIBCLOG_GRP_TCPIP         33
-/** iconv APIs. */
-#define __LIBCLOG_GRP_ICONV         34
-/** Dynamic Library (libdl) APIs. */
-#define __LIBCLOG_GRP_DLFCN         35
-/** Posix thread APIs. */
-#define __LIBCLOG_GRP_PTHREAD       36
-
-/** @todo complete this */
-#define __LIBCLOG_GRP_MAX           36
-/** @} */
-
-
-/** @defgroup   __libc_log_strict   Strict Assertions
- * @{ */
-
-/** Generic assertion.
- * @param expr  Boolean expression,
- */
-#ifdef DEBUG_STRICT
-#define LIBC_ASSERT(expr) ((expr) ? (void)0 \
-    : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #expr, \
-                       NULL))
-#else
-#define LIBC_ASSERT(expr) ((void)0)
-#endif
-
-/** Assert that a memory buffer is readable.
- * @param pv    Pointer to buffer.
- * @param cb    Size of buffer.
- */
-#ifdef DEBUG_STRICT
-#define LIBC_ASSERT_MEM_R(pv, cb) (__libc_StrictMemoryR((pv), (cb)) ? (void)0 \
-    : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #pv "; " #cb, \
-                       "Memory buffer at %p of %d bytes isn't readable!\n", (pv), (cb)))
-#else
-#define LIBC_ASSERT_MEM_R(pv, cb) ((void)0)
-#endif
-
-/** Assert that a memory buffer is readable and writable.
- * @param pv    Pointer to buffer.
- * @param cb    Size of buffer.
- */
-#ifdef DEBUG_STRICT
-#define LIBC_ASSERT_MEM_RW(pv, cb) (__libc_StrictMemoryRW((pv), (cb)) ? (void)0 \
-    : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #pv "; " #cb, \
-                       "Memory buffer at %p of %d bytes isn't readable and writable!\n", (pv), (cb)))
-#else
-#define LIBC_ASSERT_MEM_RW(pv, cb) ((void)0)
-#endif
-
-/** Assert that a zero terminated string is readable.
- * @param psz    Pointer to buffer.
- */
-#ifdef DEBUG_STRICT
-#define LIBC_ASSERT_STR(psz) (__libc_StrictStringR((psz), ~0) ? (void)0 \
-    : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #psz, \
-                       "String at %p isn't readable!\n", (psz)))
-#else
-#define LIBC_ASSERT_STR(psz) ((void)0)
-#endif
-
-/** Assert that a zero terminated string with a maximum lenght is readable.
- * @param psz       Pointer to buffer.
- * @param cchMax    Max string length.
- */
-#ifdef DEBUG_STRICT
-#define LIBC_ASSERT_NSTR(psz, cchMax) (__libc_StrictStringR((psz), cchMax) ? (void)0 \
-    : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #psz " " #cchMax, \
-                       "String at %p of maximum %d bytes isn't readable!\n", (psz), (cchMax)))
-#else
-#define LIBC_ASSERT_NSTR(psz, cchMax) ((void)0)
-#endif
-
-
-/** Generic assertion, custom message.
- * @param expr  Boolean expression,
- * @param ...   Custom error message.
- */
-#ifdef DEBUG_STRICT
-#define LIBC_ASSERTM(expr, ...) ((expr) ? (void)0 \
-    : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #expr, \
-                       __VA_ARGS__))
-#else
-#define LIBC_ASSERTM(expr, ...) ((void)0)
-#endif
-
-/** Assert that a memory buffer is readable, custom message
- * @param pv    Pointer to buffer.
- * @param cb    Size of buffer.
- */
-#ifdef DEBUG_STRICT
-#define LIBC_ASSERTM_MEM_R(pv, cb, ...) (__libc_StrictMemoryR((pv), (cb)) ? (void)0 \
-    : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #pv "; " #cb, \
-                       __VA_ARGS__))
-#else
-#define LIBC_ASSERTM_MEM_R(pv, cb, ...) ((void)0)
-#endif
-
-/** Assert that a memory buffer is readable and writable, custom message
- * @param pv    Pointer to buffer.
- * @param cb    Size of buffer.
- */
-#ifdef DEBUG_STRICT
-#define LIBC_ASSERTM_MEM_RW(pv, cb, ...) (__libc_StrictMemoryRW((pv), (cb)) ? (void)0 \
-    : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #pv "; " #cb, \
-                       __VA_ARGS__))
-#else
-#define LIBC_ASSERTM_MEM_RW(pv, cb, ...) ((void)0)
-#endif
-
-/** Assert that a zero terminated string is readable, custom message
- * @param psz    Pointer to buffer.
- */
-#ifdef DEBUG_STRICT
-#define LIBC_ASSERTM_STR(psz, ...) (__libc_StrictStringR((psz), ~0) ? (void)0 \
-    : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #psz, \
-                       __VA_ARGS__))
-#else
-#define LIBC_ASSERTM_STR(psz, ...) ((void)0)
-#endif
-
-/** Assert that a zero terminated string with a maximum lenght is readable, custom message
- * @param psz       Pointer to buffer.
- * @param cchMax    Max string length.
- */
-#ifdef DEBUG_STRICT
-#define LIBC_ASSERTM_NSTR(psz, cchMax, ...) (__libc_StrictStringR((psz), cchMax) ? (void)0 \
-    : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #psz " " #cchMax, \
-                       __VA_ARGS__))
-#else
-#define LIBC_ASSERTM_NSTR(psz, cchMax, ...) ((void)0)
-#endif
-
-/** @} */
-
-
-/*******************************************************************************
-*   Structures and Typedefs                                                    *
-*******************************************************************************/
-/** Logging group. */
-typedef struct __libc_log_group
-{
-    /** Set if logging for the group is enabled, clear if it's disabled. */
-    int             fEnabled;
-    /** Group name */
-    const char *    pszGroupName;
-} __LIBC_LOGGROUP, *__LIBC_PLOGGROUP;
-
-/** Ordered collection of logging groups. */
-typedef struct __libc_log_groups
-{
-    /** Group index base. This value is subtracted from the group part of the
-     * fFlagsAndGroups arguments to make an index into paGroups. */
-    unsigned            uBase;
-    /** Number of groups in the array. */
-    unsigned            cGroups;
-    /** Array of log groups. */
-    __LIBC_PLOGGROUP    paGroups;
-} __LIBC_LOGGROUPS, __LIBC_PLOGGROUPS;
-
-
-/*******************************************************************************
-*   External Functions                                                         *
-*******************************************************************************/
-/**
- * Create a logger.
- *
- * @returns Pointer to a logger instance on success.
- * @returns NULL on failure. errno is set.
- * @param   fFlags              Flags reserved for future use. Set to zero.
- * @param   pGroups             Pointer to a table of logging groups used for this
- *                              logger instance.
- * @param   pszFilenameFormat   Format string for making up the log filename.
- * @param   ...                 Arguments to the format string.
- */
-extern void *__libc_logInit(unsigned fFlags, __LIBC_PLOGGROUPS pGroups, const char *pszFilenameFormat, ...) __printflike(3, 4);
-
-/**
- * Terminate (or close if you like) a logger instance.
- * This means flushing any buffered messages and writing a termination
- * message before closing the log file.
- *
- * @returns 0 on succes.
- * @returns -1 on failure, error is set.
- * @param   pvInstance      Logger instance.
- */
-extern int   __libc_logTerm(void *pvInstance);
-
-/**
- * Output an enter function log message.
- * An enter message is considered to be one line and is appended a newline if
- * none was given.
- *
- * @returns Current timestamp.
- * @param   pvInstance      Logger instance. If NULL the message goes to the
- *                          default log instance.
- * @param   fGroupAndFlags  Logging group and logging flags.
- * @param   pszFunction     Name of the function which was entered.
- * @param   pszFormat       Format string to display arguments.
- * @param   ...             Arguments to the format string.
- */
-extern unsigned __libc_LogEnter(void *pvInstance, unsigned fGroupAndFlags, const char *pszFunction, const char *pszFormat, ...) __printflike(4, 5);
-
-/**
- * Output a leave function log message.
- * A leave message is considered to be one line and is appended a newline if
- * none was given.
- *
- * @param   uEnterTS        The timestamp returned by LogEnter.
- * @param   pvInstance      Logger instance. If NULL the message goes to the
- *                          default log instance.
- * @param   fGroupAndFlags  Logging group and logging flags.
- * @param   pszFunction     Name of the function which was entered.
- * @param   pszFormat       Format string to display the result.
- * @param   ...             Arguments to the format string.
- */
-extern void     __libc_LogLeave(unsigned uEnterTS, void *pvInstance, unsigned fGroupAndFlags, const char *pszFunction, const char *pszFormat, ...) __printflike(5, 6);
-
-/**
- * Output a log message.
- * A log message is considered to be one line and is appended a newline if
- * none was given.
- *
- * @param   uEnterTS        The timestamp returned by LogEnter.
- * @param   pvInstance      Logger instance. If NULL the message goes to the
- *                          default log instance.
- * @param   fGroupAndFlags  Logging group and logging flags.
- * @param   pszFunction     Name of the function which was entered.
- * @param   pszFormat       Format string for the message to log.
- * @param   ...             Arguments to the format string.
- */
-extern void     __libc_LogMsg(unsigned uEnterTS, void *pvInstance, unsigned fGroupAndFlags, const char *pszFunction, const char *pszFormat, ...) __printflike(5, 6);
-
-/**
- * Output a raw log message.
- * Nothing is prepended. No newline is appended.
- *
- * @param   uEnterTS        The timestamp returned by LogEnter.
- * @param   pvInstance      Logger instance. If NULL the message goes to the
- *                          default log instance.
- * @param   fGroupAndFlags  Logging group and logging flags.
- * @param   pszFunction     Name of the function which was entered.
- * @param   pszString       Pointer to raw log message.
- * @param   cchMax          Maximum number of bytes to write.
- */
-extern void     __libc_LogRaw(void *pvInstance, unsigned fGroupAndFlags, const char *pszString, unsigned cchMax);
-
-/**
- * Assertion helper.
- * Logs and displays (stderr) an assertion failed message.
- *
- * @param   pvInstance      Logger instance. If NULL the message goes to the
- *                          default log instance.
- * @param   pszFunction     Name of the function which was entered.
- * @param   pszFile         Source filename.
- * @param   uLine           Line number.
- * @param   pszExpression   Expression.
- * @param   pszFormat       Format string for the message to log.
- * @param   ...             Arguments to the format string.
- */
-extern void     __libc_LogAssert(void *pvInstance, unsigned fGroupAndFlags,
-                                 const char *pszFunction, const char *pszFile, unsigned uLine, const char *pszExpression,
-                                 const char *pszFormat, ...) __printflike(7, 8);
-
-/**
- * Validate a memory area for read access.
- * @returns 1 if readable.
- * @returns 0 if not entirely readable.
- * @param   pv      Pointer to memory area.
- * @param   cb      Size of memory area.
- */
-extern int      __libc_StrictMemoryR(const void *pv, size_t cb);
-
-/**
- * Validate a memory area for read & write access.
- * @returns 1 if readable and writable.
- * @returns 0 if not entirely readable and writable.
- * @param   pv      Pointer to memory area.
- * @param   cb      Size of memory area.
- */
-extern int      __libc_StrictMemoryRW(void *pv, size_t cb);
-
-/**
- * Validate a zero terminated string for read access.
- * @returns 1 if readable.
- * @returns 0 if not entirely readable.
- * @param   psz         Pointer to string.
- * @param   cchMax      Max string length. Use ~0 if to very all the
- *                      way to the terminator.
- */
-extern int      __libc_StrictStringR(const void *psz, size_t cchMax);
-
-
-/** @} */
-
-#endif
Index: trunk/src/emx/include/InnoTekLIBC/logstrict.h
===================================================================
--- trunk/src/emx/include/InnoTekLIBC/logstrict.h	(revision 1289)
+++ trunk/src/emx/include/InnoTekLIBC/logstrict.h	(revision 1289)
@@ -0,0 +1,531 @@
+/* $Id$ */
+/** @file
+ *
+ * InnoTek LIBC - Debug Logging and Strict Checking Features.
+ *
+ * InnoTek Systemberatung GmbH confidential
+ *
+ * Copyright (c) 2004 InnoTek Systemberatung GmbH
+ * Author: knut st. osmundsen <bird-srcspam@anduin.net>
+ *
+ * All Rights Reserved
+ *
+ */
+
+#ifndef __InnoTekLIBC_LOG_H__
+#define __InnoTekLIBC_LOG_H__
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <sys/cdefs.h>
+#include <sys/types.h>                  /* size_t */
+#include <sys/param.h>                  /* NULL */
+
+/** @defgroup   __libc_log      Debug Logging and Strict Checking Features
+ *
+ * The logging feature is not accessible unless DEBUG_LOGGING is #defined.
+ *
+ * The strict checking feature is not accessible unless __LIBC_STRICT is #defined.
+ *
+ * The user of this feature must #define __LIBC_LOG_GROUP to a valid group
+ * number before including this file.
+ *
+ * The user may also #define __LIBC_LOG_INSTANCE if it doesn't want to use
+ * the default logging device.
+ *
+ * Note that all everything but the main logger & strict macros are using the
+ * default prefix to avoid too much namespace pollution. The main logger and
+ * strict macros are not prefixed with the double underscore because that
+ * would make the code less readable (and mean more typing which is painful).
+ *
+ * @{
+ */
+
+
+/*******************************************************************************
+*   Defined Constants And Macros                                               *
+*******************************************************************************/
+/**
+ * The user may also #define __LIBC_LOG_INSTANCE if it doesn't want to use
+ * the default logging device.
+ */
+#ifdef DEBUG_LOGGING
+#ifndef __LIBC_LOG_INSTANCE
+#define __LIBC_LOG_INSTANCE NULL
+#endif
+#endif
+
+/**
+ * The user of this feature must #define __LIBC_LOG_GROUP to a valid group
+ * number before including this file.
+ */
+#ifdef DEBUG_LOGGING
+#ifndef __LIBC_LOG_GROUP
+#define __LIBC_LOG_GROUP    0
+#error "__LIBC_LOG_GROUP must be defined before including InnoTekLIBC/log.h"
+#endif
+#endif
+
+/** Macro to log a function entry. */
+#ifdef DEBUG_LOGGING
+#define LIBCLOG_ENTER(...) \
+    unsigned __libclog_uEnterTS__ = __libc_LogEnter(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __VA_ARGS__)
+#else
+#define LIBCLOG_ENTER(...)  //hmm
+#endif
+
+/** Macro to log a generic message within a function entered by LIBCLOG_ENTER(). */
+#ifdef DEBUG_LOGGING
+#define LIBCLOG_MSG(...) \
+    __libc_LogMsg(__libclog_uEnterTS__, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __VA_ARGS__)
+#else
+#define LIBCLOG_MSG(...)    do {} while (0)
+#endif
+
+/** Macro to log a generic message within a functionw. */
+#ifdef DEBUG_LOGGING
+#define LIBCLOG_MSG2(...) \
+    __libc_LogMsg(~0, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __VA_ARGS__)
+#else
+#define LIBCLOG_MSG2(...)   do {} while (0)
+#endif
+
+/** Macro to log a raw message. */
+#ifdef DEBUG_LOGGING
+#define LIBCLOG_RAW(string, maxlen) \
+    __libc_LogRaw(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, string, maxlen)
+#else
+#define LIBCLOG_RAW(...)    do {} while (0)
+#endif
+
+/** Macro to log a function exit. */
+#ifdef DEBUG_LOGGING
+#define LIBCLOG_LEAVE(...) \
+    __libc_LogLeave(__libclog_uEnterTS__, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __VA_ARGS__)
+#else
+#define LIBCLOG_LEAVE(...)  do {} while (0)
+#endif
+
+/** Macro to log a custom message and return. */
+#define LIBCLOG_RETURN_MSG(rc,...)      do { LIBCLOG_LEAVE(__VA_ARGS__);                       return (rc); } while (0)
+/** Macro to log a custom message and return. */
+#define LIBCLOG_RETURN_MSG_VOID(...)    do { LIBCLOG_LEAVE(__VA_ARGS__);                       return; } while (0)
+
+/** Macro to log a void return and do the return. */
+#define LIBCLOG_RETURN_VOID()           LIBCLOG_RETURN_MSG_VOID( "ret void\n")
+/** Macro to log an int return and do the return. */
+#define LIBCLOG_RETURN_INT(rc)          LIBCLOG_RETURN_MSG((rc), "ret %d (%#x)\n", (rc), (rc))
+/** Macro to log an unsigned int return and do the return. */
+#define LIBCLOG_RETURN_UINT(rc)         LIBCLOG_RETURN_MSG((rc), "ret %u (%#x)\n", (rc), (rc));
+/** Macro to log an long int return and do the return. */
+#define LIBCLOG_RETURN_LONG(rc)         LIBCLOG_RETURN_MSG((rc), "ret %ld (%#lx)\n", (rc), (rc));
+/** Macro to log an unsigned long int return and do the return. */
+#define LIBCLOG_RETURN_ULONG(rc)        LIBCLOG_RETURN_MSG((rc), "ret %lu (%#lx)\n", (rc), (rc));
+/** Macro to log a pointer return and do the return. */
+#define LIBCLOG_RETURN_P(rc)            LIBCLOG_RETURN_MSG((rc), "ret %p\n", (void*)(rc));
+
+/** @defgroup   __libc_log_flags    Message Flags (to be combined with group)
+ *
+ * In source files which uses the logger you can or these flags together
+ * with a group specification in the __LIBC_LOG_GROUP #define.
+ * @{
+ */
+/** Forces a flush of the output file after the message have been written. */
+#define __LIBC_LOG_MSGF_FLUSH       0x00010000
+/** @} */
+
+
+/** @defgroup   __libc_log_groups   Default Logging Groups
+*
+ * In source files which uses the default logger you must #define
+ * __LIBC_LOG_GROUP to one of these defines.
+ *
+ * @{
+ */
+/** whatever. */
+#define __LIBC_LOG_GRP_NOGROUP      0
+
+/*-- LIBC --*/
+/** Process APIs. */
+#define __LIBC_LOG_GRP_PROCESS      1
+/** Heap APIs. */
+#define __LIBC_LOG_GRP_HEAP         2
+/** File stream APIs. */
+#define __LIBC_LOG_GRP_STREAM       3
+/** Other I/O APIs. */
+#define __LIBC_LOG_GRP_IO           4
+/** String APIs. */
+#define __LIBC_LOG_GRP_STRING       5
+/** Locale APIs. */
+#define __LIBC_LOG_GRP_LOCALE       6
+/** Regular expression APIs. */
+#define __LIBC_LOG_GRP_REGEX        7
+/** Math APIs. */
+#define __LIBC_LOG_GRP_MATH         8
+/** Time APIs. */
+#define __LIBC_LOG_GRP_TIME         9
+/** BSD DB APIs. */
+#define __LIBC_LOG_GRP_BSD_DB       10
+/** GLIBC POSIX APIs. */
+#define __LIBC_LOG_GRP_GLIBC_POSIX  11
+/** Thread APIs. */
+#define __LIBC_LOG_GRP_THREAD       12
+/** Mutex Semaphores. */
+#define __LIBC_LOG_GRP_MUTEX        13
+/** Signal APIs and events. */
+#define __LIBC_LOG_GRP_SIGNAL       14
+
+/** Init/Term APIs and Events. */
+#define __LIBC_LOG_GRP_INITTERM     27
+/** Backend APIs. */
+#define __LIBC_LOG_GRP_BACKEND      28
+/** Misc APIs. */
+#define __LIBC_LOG_GRP_MISC         29
+/** BSD Gen APIs. */
+#define __LIBC_LOG_GRP_BSD_GEN      30
+/** GLIBC Misc APIs. */
+#define __LIBC_LOG_GRP_GLIBC_MISC   31
+
+/*-- other libraries/APIs --*/
+/** Socket APIs. */
+#define __LIBC_LOG_GRP_SOCKET       32
+/** Other TCP/IP APIs. */
+#define __LIBC_LOG_GRP_TCPIP        33
+/** iconv APIs. */
+#define __LIBC_LOG_GRP_ICONV        34
+/** Dynamic Library (libdl) APIs. */
+#define __LIBC_LOG_GRP_DLFCN        35
+/** Posix thread APIs. */
+#define __LIBC_LOG_GRP_PTHREAD      36
+
+/** @todo complete this */
+#define __LIBC_LOG_GRP_MAX          36
+/** @} */
+
+
+/** @defgroup   __libc_log_strict   Strict Assertions
+ * @{ */
+
+/** Generic assertion.
+ * @param expr  Boolean expression,
+ */
+#ifdef __LIBC_STRICT
+#define LIBC_ASSERT(expr) ((expr) ? (void)0 \
+    : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #expr, NULL))
+#else
+#define LIBC_ASSERT(expr) ((void)0)
+#endif
+
+/** Generic assertion failed.
+ * (Yeah, this always fails.)
+ */
+#ifdef __LIBC_STRICT
+#define LIBC_ASSERT_FAILED() __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, "0", NULL)
+#else
+#define LIBC_ASSERT_FAILED() ((void)0)
+#endif
+
+/** Assert that a memory buffer is readable.
+ * @param pv    Pointer to buffer.
+ * @param cb    Size of buffer.
+ */
+#ifdef __LIBC_STRICT
+#define LIBC_ASSERT_MEM_R(pv, cb) (__libc_StrictMemoryR((pv), (cb)) ? (void)0 \
+    : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #pv "; " #cb, \
+                       "Memory buffer at %p of %d bytes isn't readable!\n", (pv), (cb)))
+#else
+#define LIBC_ASSERT_MEM_R(pv, cb) ((void)0)
+#endif
+
+/** Assert that a memory buffer is readable and writable.
+ * @param pv    Pointer to buffer.
+ * @param cb    Size of buffer.
+ */
+#ifdef __LIBC_STRICT
+#define LIBC_ASSERT_MEM_RW(pv, cb) (__libc_StrictMemoryRW((pv), (cb)) ? (void)0 \
+    : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #pv "; " #cb, \
+                       "Memory buffer at %p of %d bytes isn't readable and writable!\n", (pv), (cb)))
+#else
+#define LIBC_ASSERT_MEM_RW(pv, cb) ((void)0)
+#endif
+
+/** Assert that a zero terminated string is readable.
+ * @param psz    Pointer to buffer.
+ */
+#ifdef __LIBC_STRICT
+#define LIBC_ASSERT_STR(psz) (__libc_StrictStringR((psz), ~0) ? (void)0 \
+    : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #psz, \
+                       "String at %p isn't readable!\n", (psz)))
+#else
+#define LIBC_ASSERT_STR(psz) ((void)0)
+#endif
+
+/** Assert that a zero terminated string with a maximum lenght is readable.
+ * @param psz       Pointer to buffer.
+ * @param cchMax    Max string length.
+ */
+#ifdef __LIBC_STRICT
+#define LIBC_ASSERT_NSTR(psz, cchMax) (__libc_StrictStringR((psz), cchMax) ? (void)0 \
+    : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #psz " " #cchMax, \
+                       "String at %p of maximum %d bytes isn't readable!\n", (psz), (cchMax)))
+#else
+#define LIBC_ASSERT_NSTR(psz, cchMax) ((void)0)
+#endif
+
+
+/** Generic assertion, custom message.
+ * @param expr  Boolean expression,
+ * @param ...   Custom error message.
+ */
+#ifdef __LIBC_STRICT
+#define LIBC_ASSERTM(expr, ...) ((expr) ? (void)0 \
+    : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #expr, \
+                       __VA_ARGS__))
+#else
+#define LIBC_ASSERTM(expr, ...) ((void)0)
+#endif
+
+/** Generic assertion failed, custom message.
+ * (Yeah, this always fails.)
+ * @param ...   Custom error message.
+ */
+#ifdef __LIBC_STRICT
+#define LIBC_ASSERTM_FAILED(...) __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, "0", __VA_ARGS__)
+#else
+#define LIBC_ASSERTM_FAILED(...) ((void)0)
+#endif
+
+/** Assert that a memory buffer is readable, custom message
+ * @param pv    Pointer to buffer.
+ * @param cb    Size of buffer.
+ */
+#ifdef __LIBC_STRICT
+#define LIBC_ASSERTM_MEM_R(pv, cb, ...) (__libc_StrictMemoryR((pv), (cb)) ? (void)0 \
+    : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #pv "; " #cb, \
+                       __VA_ARGS__))
+#else
+#define LIBC_ASSERTM_MEM_R(pv, cb, ...) ((void)0)
+#endif
+
+/** Assert that a memory buffer is readable and writable, custom message
+ * @param pv    Pointer to buffer.
+ * @param cb    Size of buffer.
+ */
+#ifdef __LIBC_STRICT
+#define LIBC_ASSERTM_MEM_RW(pv, cb, ...) (__libc_StrictMemoryRW((pv), (cb)) ? (void)0 \
+    : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #pv "; " #cb, \
+                       __VA_ARGS__))
+#else
+#define LIBC_ASSERTM_MEM_RW(pv, cb, ...) ((void)0)
+#endif
+
+/** Assert that a zero terminated string is readable, custom message
+ * @param psz    Pointer to buffer.
+ */
+#ifdef __LIBC_STRICT
+#define LIBC_ASSERTM_STR(psz, ...) (__libc_StrictStringR((psz), ~0) ? (void)0 \
+    : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #psz, \
+                       __VA_ARGS__))
+#else
+#define LIBC_ASSERTM_STR(psz, ...) ((void)0)
+#endif
+
+/** Assert that a zero terminated string with a maximum lenght is readable, custom message
+ * @param psz       Pointer to buffer.
+ * @param cchMax    Max string length.
+ */
+#ifdef __LIBC_STRICT
+#define LIBC_ASSERTM_NSTR(psz, cchMax, ...) (__libc_StrictStringR((psz), cchMax) ? (void)0 \
+    : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #psz " " #cchMax, \
+                       __VA_ARGS__))
+#else
+#define LIBC_ASSERTM_NSTR(psz, cchMax, ...) ((void)0)
+#endif
+
+/** Extracts the group from the fGroupAndFlags argument. */
+#define __LIBC_LOG_GETGROUP(fGroupAndFlags) ((fGroupAndFlags) & 0xffff)
+
+/** @} */
+
+
+/*******************************************************************************
+*   Structures and Typedefs                                                    *
+*******************************************************************************/
+/** Logging group. */
+typedef struct __libc_log_group
+{
+    /** Set if logging for the group is enabled, clear if it's disabled. */
+    int             fEnabled;
+    /** Group name */
+    const char *    pszGroupName;
+} __LIBC_LOGGROUP, *__LIBC_PLOGGROUP;
+
+/** Ordered collection of logging groups. */
+typedef struct __libc_log_groups
+{
+    /** Group index base. This value is subtracted from the group part of the
+     * fFlagsAndGroups arguments to make an index into paGroups. */
+    unsigned            uBase;
+    /** Number of groups in the array. */
+    unsigned            cGroups;
+    /** Array of log groups. */
+    __LIBC_PLOGGROUP    paGroups;
+} __LIBC_LOGGROUPS, *__LIBC_PLOGGROUPS;
+
+
+/*******************************************************************************
+*   External Functions                                                         *
+*******************************************************************************/
+__BEGIN_DECLS
+/**
+ * Create a logger.
+ *
+ * @returns Pointer to a logger instance on success.
+ * @returns NULL on failure. errno is set.
+ * @param   fFlags              Flags reserved for future use. Set to zero.
+ * @param   pGroups             Pointer to a table of logging groups used for this
+ *                              logger instance.
+ * @param   pszFilenameFormat   Format string for making up the log filename.
+ * @param   ...                 Arguments to the format string.
+ */
+extern void *__libc_LogInit(unsigned fFlags, __LIBC_PLOGGROUPS pGroups, const char *pszFilenameFormat, ...) __printflike(3, 4);
+
+/**
+ * Parses the given environment variable and sets the group
+ * flags accordingly.
+ *
+ * The environment variable is a sequence of group idendifiers with
+ * a prefix which determins whether or not that group is enabled.
+ * A special group 'all' can be used to address all groups.
+ *
+ * If the environment variable is not present no changes will be
+ * performed.
+ *
+ * @param   pGroups     Pointer to groups to init.
+ * @param   pszEnvVar   Name of the environment variable.
+ *                      This is taken from the initial environment of the process
+ *                      and not from the current!!
+ */
+extern void __libc_LogGroupInit(__LIBC_PLOGGROUPS pGroups, const char *pszEnvVar);
+
+/**
+ * Terminate (or close if you like) a logger instance.
+ * This means flushing any buffered messages and writing a termination
+ * message before closing the log file.
+ *
+ * @returns 0 on succes.
+ * @returns -1 on failure, error is set.
+ * @param   pvInstance      Logger instance.
+ */
+extern int   __libc_LogTerm(void *pvInstance);
+
+/**
+ * Output an enter function log message.
+ * An enter message is considered to be one line and is appended a newline if
+ * none was given.
+ *
+ * @returns Current timestamp.
+ * @param   pvInstance      Logger instance. If NULL the message goes to the
+ *                          default log instance.
+ * @param   fGroupAndFlags  Logging group and logging flags.
+ * @param   pszFunction     Name of the function which was entered.
+ * @param   pszFormat       Format string to display arguments.
+ * @param   ...             Arguments to the format string.
+ */
+extern unsigned __libc_LogEnter(void *pvInstance, unsigned fGroupAndFlags, const char *pszFunction, const char *pszFormat, ...) __printflike(4, 5);
+
+/**
+ * Output a leave function log message.
+ * A leave message is considered to be one line and is appended a newline if
+ * none was given.
+ *
+ * @param   uEnterTS        The timestamp returned by LogEnter.
+ * @param   pvInstance      Logger instance. If NULL the message goes to the
+ *                          default log instance.
+ * @param   fGroupAndFlags  Logging group and logging flags.
+ * @param   pszFunction     Name of the function which was entered.
+ * @param   pszFormat       Format string to display the result.
+ * @param   ...             Arguments to the format string.
+ */
+extern void     __libc_LogLeave(unsigned uEnterTS, void *pvInstance, unsigned fGroupAndFlags, const char *pszFunction, const char *pszFormat, ...) __printflike(5, 6);
+
+/**
+ * Output a log message.
+ * A log message is considered to be one line and is appended a newline if
+ * none was given.
+ *
+ * @param   uEnterTS        The timestamp returned by LogEnter.
+ * @param   pvInstance      Logger instance. If NULL the message goes to the
+ *                          default log instance.
+ * @param   fGroupAndFlags  Logging group and logging flags.
+ * @param   pszFunction     Name of the function which was entered.
+ * @param   pszFormat       Format string for the message to log.
+ * @param   ...             Arguments to the format string.
+ */
+extern void     __libc_LogMsg(unsigned uEnterTS, void *pvInstance, unsigned fGroupAndFlags, const char *pszFunction, const char *pszFormat, ...) __printflike(5, 6);
+
+/**
+ * Output a raw log message.
+ * Nothing is prepended. No newline is appended.
+ *
+ * @param   uEnterTS        The timestamp returned by LogEnter.
+ * @param   pvInstance      Logger instance. If NULL the message goes to the
+ *                          default log instance.
+ * @param   fGroupAndFlags  Logging group and logging flags.
+ * @param   pszFunction     Name of the function which was entered.
+ * @param   pszString       Pointer to raw log message.
+ * @param   cchMax          Maximum number of bytes to write.
+ */
+extern void     __libc_LogRaw(void *pvInstance, unsigned fGroupAndFlags, const char *pszString, unsigned cchMax);
+
+/**
+ * Assertion helper.
+ * Logs and displays (stderr) an assertion failed message.
+ *
+ * @param   pvInstance      Logger instance. If NULL the message goes to the
+ *                          default log instance.
+ * @param   pszFunction     Name of the function which was entered.
+ * @param   pszFile         Source filename.
+ * @param   uLine           Line number.
+ * @param   pszExpression   Expression.
+ * @param   pszFormat       Format string for the message to log.
+ * @param   ...             Arguments to the format string.
+ */
+extern void     __libc_LogAssert(void *pvInstance, unsigned fGroupAndFlags,
+                                 const char *pszFunction, const char *pszFile, unsigned uLine, const char *pszExpression,
+                                 const char *pszFormat, ...) __printflike(7, 8);
+
+/**
+ * Validate a memory area for read access.
+ * @returns 1 if readable.
+ * @returns 0 if not entirely readable.
+ * @param   pv      Pointer to memory area.
+ * @param   cb      Size of memory area.
+ */
+extern int      __libc_StrictMemoryR(const void *pv, size_t cb);
+
+/**
+ * Validate a memory area for read & write access.
+ * @returns 1 if readable and writable.
+ * @returns 0 if not entirely readable and writable.
+ * @param   pv      Pointer to memory area.
+ * @param   cb      Size of memory area.
+ */
+extern int      __libc_StrictMemoryRW(void *pv, size_t cb);
+
+/**
+ * Validate a zero terminated string for read access.
+ * @returns 1 if readable.
+ * @returns 0 if not entirely readable.
+ * @param   psz         Pointer to string.
+ * @param   cchMax      Max string length. Use ~0 if to very all the
+ *                      way to the terminator.
+ */
+extern int      __libc_StrictStringR(const char *psz, size_t cchMax);
+
+__END_DECLS
+
+/** @} */
+
+#endif
Index: trunk/src/emx/include/emx/libclog.h
===================================================================
--- trunk/src/emx/include/emx/libclog.h	(revision 1288)
+++ 	(revision )
@@ -1,87 +1,0 @@
-/* $Id$ */
-/** @file
- *
- * Debug Logging Features - internal libc use only.
- *
- * InnoTek Systemberatung GmbH confidential
- *
- * Copyright (c) 2004 InnoTek Systemberatung GmbH
- * Author: knut st. osmundsen <bird-srcspam@anduin.net>
- *
- * All Rights Reserved
- *
- */
-
-#ifndef __LIBCLOG_H__
-#define __LIBCLOG_H__
-
-
-#ifdef DEBUG_LOGGING
-/*
- * Logging is enabled.
- */
-/**
- * Output an enter function log message.
- * An enter message is considered to be one line and is appended a newline if
- * none was given.
- *
- * @returns Current timestamp.
- * @param   pszFunction     Name of the function which was entered.
- * @param   pszFormat       Format string to display arguments.
- * @param   ...             Arguments to the format string.
- */
-extern unsigned __libc_LogEnter(const char *pszFunction, const char *pszFormat, ...) __printflike(2, 3);
-/**
- * Output a leave function log message.
- * A leave message is considered to be one line and is appended a newline if
- * none was given.
- *
- * @param   uEnterTS        The timestamp returned by LogEnter.
- * @param   pszFunction     Name of the function which was entered.
- * @param   pszFormat       Format string to display the result.
- * @param   ...             Arguments to the format string.
- */
-extern void     __libc_LogLeave(unsigned uEnterTS, const char *pszFunction, const char *pszFormat, ...) __printflike(3, 4);
-
-/**
- * Output a log message.
- * A log message is considered to be one line and is appended a newline if
- * none was given.
- *
- * @param   uEnterTS        The timestamp returned by LogEnter.
- * @param   pszFunction     Name of the function which was entered.
- * @param   pszFormat       Format string for the message to log.
- * @param   ...             Arguments to the format string.
- */
-extern void     __libc_LogMsg(unsigned uEnterTS, const char *pszFunction, const char *pszFormat, ...) __printflike(3, 4);
-
-/** Macro to log a function entry. */
-#define LIBCLOG_ENTER(...) \
-    unsigned __libclog_uEnterTS__ = __libc_LogEnter(__PRETTY_FUNCTION__, __VA_ARGS__)
-#define LIBCLOG_LEAVE(...) \
-    __libc_LogLeave(__libclog_uEnterTS__, __PRETTY_FUNCTION__, __VA_ARGS__)
-#define LIBCLOG_MSG(...) \
-    __libc_LogLeave(__libclog_uEnterTS__, __PRETTY_FUNCTION__, __VA_ARGS__)
-#define LIBCLOG_MSG2(...) \
-    __libc_LogLeave(~0, __PRETTY_FUNCTION__, __VA_ARGS__)
-
-#else
-/*
- * Logging is disabled.
- */
-#define LIBCLOG_ENTER(...) //hmm
-#define LIBCLOG_LEAVE(...)  do {} while (0)
-#define LIBCLOG_MSG(...)    do {} while (0)
-#define LIBCLOG_MSG2(...)    do {} while (0)
-
-#endif
-
-/* helpers */
-#define LIBCLOG_RETURN_VOID()    do { LIBCLOG_LEAVE("ret void\n");                      return;      } while (0)
-#define LIBCLOG_RETURN_INT(rc)   do { LIBCLOG_LEAVE("ret %d (%#x)\n", (rc), (rc));      return (rc); } while (0)
-#define LIBCLOG_RETURN_UINT(rc)  do { LIBCLOG_LEAVE("ret %u (%#x)\n", (rc), (rc));      return (rc); } while (0)
-#define LIBCLOG_RETURN_LONG(rc)  do { LIBCLOG_LEAVE("ret %ld (%#lx)\n", (rc), (rc));    return (rc); } while (0)
-#define LIBCLOG_RETURN_ULONG(rc) do { LIBCLOG_LEAVE("ret %lu (%#lx)\n", (rc), (rc));    return (rc); } while (0)
-#define LIBCLOG_RETURN_P(rc)     do { LIBCLOG_LEAVE("ret %p\n", (rc));                  return (rc); } while (0)
-
-#endif
Index: trunk/src/emx/include/emx/syscalls.h
===================================================================
--- trunk/src/emx/include/emx/syscalls.h	(revision 1288)
+++ trunk/src/emx/include/emx/syscalls.h	(revision 1289)
@@ -78,6 +78,5 @@
   unsigned short env_count;
   unsigned short env_size;
-  unsigned short mode;
-  unsigned short mode2;         /* Present only if (mode & 0x8000) */
+  unsigned       mode;
 };
 
Index: trunk/src/emx/include/sys/process.h
===================================================================
--- trunk/src/emx/include/sys/process.h	(revision 1288)
+++ trunk/src/emx/include/sys/process.h	(revision 1289)
@@ -28,6 +28,4 @@
 #define P_NOCLOSE    0x2000
 #define P_NOSESSION  0x4000
-
-/* Note: 0x8000 is used internally. */
 
 #define P_QUOTE      0x10000
Index: trunk/src/emx/src/lib/libc.def
===================================================================
--- trunk/src/emx/src/lib/libc.def	(revision 1288)
+++ trunk/src/emx/src/lib/libc.def	(revision 1289)
@@ -14,1076 +14,1079 @@
 ;
 ; Imports which are freqently used may of course be moved to an low ordinal
-; number to save 5 cpu cycles every now and then ;-)
+; number to save 5 cpu cycles every now and then ;-) However the general idea
+; is just to sort them and assign fresh ordinals when a libc version goes out
+; of development.
 ;
 
 EXPORTS
 ; data
-    "___digits" @1
-    "___locale" @2
-    "___default_hash" @3
+    "___default_hash" @1
+    "___digits" @2
+    "___locale" @3
     "___locale_collate" @4
     "___locale_ctype" @5
     "___locale_lconv" @6
     "___locale_time" @7
-    "___stderrp" @8
-    "___stdinp" @9
-    "___stdoutp" @10
-    "__atexit_n" @11
-    "__atexit_v" @12
-    "__fmode_bin" @13
-    "__mb_cur_max" @14
-    "__org_environ" @15
-    "__osmajor" @16
-    "__osminor" @17
-    "__pipe_size" @18
-    "__rand48_add" @19
-    "__rand48_mult" @20
-    "__rand48_seed" @21
-    "__std_daylight" @22
-    "__std_environ" @23
-    "__std_timezone" @24
-    "__std_tzname" @25
-    "__streamv_rmutex" @26
-    "__streamvec_head" @27
-; fixme "" @28
-    "__tmpidx" @29
-    "__tzi" @30
-    "__tzset_flag" @31
-    "__um_high_heap" @32
-    "__um_low_heap" @33
-    "__um_regular_heap" @34
-    "__um_tiled_heap" @35
-    "__emx_optarg" @36
-    "__emx_opterr" @37
-    "__emx_optind" @38
-    "__emx_optmode" @39
-    "__emx_optopt" @40
-    "__emx_optswchar" @41
-    "_optarg" @42
-    "_opterr" @43
-    "_optind" @44
-    "_optopt" @45
-    "_optreset" @46
-    "___progname" @47
-    "_error_message_count" @48
-    "_error_one_per_line" @49
-    "_error_print_progname" @50
+    "___progname" @8
+    "___stderrp" @9
+    "___stdinp" @10
+    "___stdoutp" @11
+    "__atexit_n" @12
+    "__atexit_v" @13
+    "__emx_optarg" @14
+    "__emx_opterr" @15
+    "__emx_optind" @16
+    "__emx_optmode" @17
+    "__emx_optopt" @18
+    "__emx_optswchar" @19
+    "__fmode_bin" @20
+    "__mb_cur_max" @21
+    "__org_environ" @22
+    "__osmajor" @23
+    "__osminor" @24
+    "__pipe_size" @25
+    "__rand48_add" @26
+    "__rand48_mult" @27
+    "__rand48_seed" @28
+    "__std_daylight" @29
+    "__std_environ" @30
+    "__std_timezone" @31
+    "__std_tzname" @32
+    "__streamv_rmutex" @33
+    "__streamvec_head" @34
+    "__tmpidx" @35
+    "__tzi" @36
+    "__tzset_flag" @37
+    "__um_high_heap" @38
+    "__um_low_heap" @39
+    "__um_regular_heap" @40
+    "__um_tiled_heap" @41
+    "_error_message_count" @42
+    "_error_one_per_line" @43
+    "_error_print_progname" @44
+    "_optarg" @45
+    "_opterr" @46
+    "_optind" @47
+    "_optopt" @48
+    "_optreset" @49
 
 
-; code - and const
-    "__CRT_init" @101
-    "__CRT_term" @102
-    "__HUGE_VAL" @103
-    "__LHUGE_VAL" @104
-; fixme    "___alloc_thread" @105
-    "___atod" @106
-    "___chdir" @107
-    "___chmod" @108
-    "___chsize" @109
-    "___close" @110
-    "___convert_codepage" @111
-    "___ctordtorInit1" @112
-    "___ctordtorTerm1" @113
-    "___do_Unicode" @114
-    "___dtoa" @115
-    "___dup" @116
-    "___dup2" @117
-; fixme    "___endthread" @118
-    "___exit" @119
-    "___fcntl" @120
-    "___findfirst" @121
-    "___findnext" @122
-    "___fmutex_release_internal" @123
-    "___fmutex_request_internal" @124
-    "___fork" @125
-    "___fpclassify" @126
-    "___fpclassifyf" @127
-    "___fpclassifyl" @128
-    "___from_ucs" @129
-    "___fstat" @130
-    "___ftime" @131
-    "___ftruncate" @132
-    "___getcwd" @133
-    "___gnu_basename" @134
-    "___imphandle" @135
-    "___init" @136
-    "___init_app" @137
-    "___init_dll" @138
-; fixme    "___initthread" @139
-    "___ioctl1" @140
-    "___ioctl2" @141
-    "___isfinite" @142
-    "___isfinitef" @143
-    "___isfinitel" @144
-    "___isnan" @145
-    "___isnanf" @146
-    "___isnanl" @147
-    "___isnormal" @148
-    "___isnormalf" @149
-    "___isnormall" @150
-    "___libc_FH" @151
-    "___libc_FHAllocate" @152
-    "___libc_FHClose" @153
-    "___libc_FHEnsureHandles" @154
-    "___libc_HasHighMem" @155
-    "___libc_HeapEndVoting" @156
-    "___libc_HeapGetResult" @157
-    "___libc_HeapVote" @158
-    "___libc_HimemDefaultAlloc" @159
-    "___libc_HimemDefaultRelease" @160
-    "___lseek" @161
-    "___mkdir" @162
-; fixme    "___newthread" @163
-    "___open" @164
-    "___pipe" @165
-    "___read" @166
-    "___read_kbd" @167
-    "___remove_zeros" @168
-    "___rmdir" @169
-    "___select" @170
-    "___settime" @171
-    "___signbit" @172
-    "___signbitf" @173
-    "___signbitl" @174
-    "___small_atod" @175
-    "___small_dtoa" @176
-    "___smutex_request_internal" @177
-    "___spawnve" @178
-    "___stat" @179
-    "___swchar" @180
-    "___threadid" @181
-    "___to_ucs" @182
-    "___ttyname" @183
-    "___ulimit" @184
-    "___unwind2" @185
-    "___utimes" @186
-    "___wait" @187
-    "___waitpid" @188
-    "___write" @189
-    "__abspath" @190
-    "__assert" @191
-    "__beginthread" @192
-    "__bi_add_bb" @193
-    "__bi_cmp_bb" @194
-    "__bi_cmp_pow2" @195
-    "__bi_div_add_back" @196
-    "__bi_div_estimate" @197
-    "__bi_div_rem_bb" @198
-    "__bi_div_rem_bw" @199
-    "__bi_div_rem_pow2" @200
-    "__bi_div_subtract" @201
-    "__bi_fls" @202
-    "__bi_hdiv_rem_b" @203
-    "__bi_mul_bb" @204
-    "__bi_mul_bw" @205
-    "__bi_pow5" @206
-    "__bi_set_b" @207
-    "__bi_set_d" @208
-    "__bi_set_w" @209
-    "__bi_shl_b" @210
-    "__bi_shl_w" @211
-    "__bi_shr_b" @212
-    "__bi_sub_mul_bw" @213
-    "__bi_wdiv_rem_pow2" @214
-    "__chdir2" @215
-    "__clear87" @216
-    "__closestream" @217
-    "__compute_dst_table" @218
-    "__const_HALF" @219
-    "__const_M_ONE" @220
-    "__const_NAN" @221
-    "__const_ONE" @222
-    "__const_TWO" @223
-    "__const_ZERO" @224
-    "__control87" @225
-    "__core" @226
-    "__crlf" @227
-    "__day" @228
-    "__defext" @229
-    "__dorand48" @230
-    "__dt_free" @231
-    "__dt_read" @232
-    "__dt_sort" @233
-    "__dt_split" @234
-    "__ea_free" @235
-    "__ea_get" @236
-    "__ea_put" @237
-    "__ea_remove" @238
-    "__ea_set_errno" @239
-    "__ea_write" @240
-    "__ead_add" @241
-    "__ead_clear" @242
-    "__ead_copy" @243
-    "__ead_count" @244
-    "__ead_create" @245
-    "__ead_delete" @246
-    "__ead_destroy" @247
-    "__ead_enum" @248
-    "__ead_fea2list_size" @249
-    "__ead_fea2list_to_fealist" @250
-    "__ead_fealist_to_fea2list" @251
-    "__ead_find" @252
-    "__ead_get_fea2list" @253
-    "__ead_get_flags" @254
-    "__ead_get_name" @255
-    "__ead_get_value" @256
-    "__ead_make_index" @257
-    "__ead_name_len" @258
-    "__ead_read" @259
-    "__ead_replace" @260
-    "__ead_size_buffer" @261
-    "__ead_sort" @262
-    "__ead_use_fea2list" @263
-    "__ead_value_size" @264
-    "__ead_write" @265
-    "__emxload_connect" @266
-    "__emxload_disconnect" @267
-    "__emxload_do_connect" @268
-    "__emxload_do_disconnect" @269
-    "__emxload_do_receive" @270
-    "__emxload_do_request" @271
-    "__emxload_do_wait" @272
-    "__emxload_env" @273
-    "__emxload_list_get" @274
-    "__emxload_list_start" @275
-    "__emxload_prog" @276
-    "__emxload_request" @277
-    "__emxload_stop" @278
-    "__emxload_this" @279
-    "__emxload_unload" @280
-    "__endbuf1" @281
-    "__endthread" @282
-    "__envargs" @283
-    "__errno" @284
-    "__errno_fun" @285
-    "__execname" @286
-    "__exit" @287
-    "__exit_streams" @288
-    "__fassign" @289
-    "__fbuf" @290
-    "__fcloseall" @291
-    "__fflush_nolock" @292
-    "__filesys" @293
-    "__fill" @294
-    "__flush" @295
-    "__flushstream" @296
-    "__fmutex_checked_close" @297
-    "__fmutex_checked_create" @298
-    "__fmutex_checked_open" @299
-    "___collate_range_cmp" @300
-    "_toupper" @301
-    "__fmutex_close" @302
-    "__fmutex_create" @303
-    "__fmutex_dummy" @304
-    "__fmutex_open" @305
-    "__fnexplode" @306
-    "__fnexplodefree" @307
-    "__fngetdrive" @308
-    "__fnisabs" @309
-    "__fnisrel" @310
-    "__fnlwr" @311
-    "__fnlwr2" @312
-    "__fnslashify" @313
-    "__fpreset" @314
-    "__fseek_hdr" @315
-    "__fseek_nolock" @316
-    "__fsetmode" @317
-    "__fsopen" @318
-    "__ftell_nolock" @319
-    "__fullpath" @320
-    "__fwrite_nolock" @321
-    "__fxam" @322
-    "__fxaml" @323
-    "__getcwd1" @324
-    "__getcwd2" @325
-    "__getdrive" @326
-    "__getext" @327
-    "__getext2" @328
-    "__getname" @329
-    "__getpass1" @330
-    "__getpass2" @331
-    "__gettid" @332
-    "__getvol" @333
-    "__std_glob" @334
-    "__std_globfree" @335
-    "__gmt2loc" @336
-    "__std_gmtime_r" @337
-    "__hcalloc" @338
-    "__heap_walk" @339
-    "__heapchk" @340
-    "__heapmin" @341
-    "__heapset" @342
-    "__hinitheap" @343
-    "__hmalloc" @344
-    "__hrealloc" @345
-    "__imphandle" @346
-    "__init1_tmp" @347
-    "__init_streams" @348
-    "__input" @349
-    "__int86" @350
-    "__isterm" @351
-    "__lcalloc" @352
-    "__libc_16to32" @353
-    "__libc_32to16" @354
-    "__libc_thunk1" @355
-    "__linitheap" @356
-    "__lmalloc" @357
-    "__loc2gmt" @358
-    "__std_localtime_r" @359
-    "__lrealloc" @360
-    "__makepath" @361
-    "__memcount" @362
-    "__memdif" @363
-    "__memrchr" @364
-    "__memswap" @365
-    "__mfclose" @366
-    "__mfopen" @367
-    "__mheap" @368
-    "__mktime" @369
-    "__month_day_leap" @370
-    "__month_day_non_leap" @371
-    "__msize" @372
-    "__newstream" @373
-    "__openstream" @374
-    "__os2_bad" @375
-    "__output" @376
-    "__path" @377
-    "__read_kbd" @378
-    "__remext" @379
-    "__response" @380
-    "__rfnlwr" @381
-    "__rmtmp" @382
-    "__rmutex_checked_close" @383
-    "__rmutex_checked_create" @384
-    "__rmutex_checked_open" @385
-    "__rmutex_close" @386
-    "__rmutex_create" @387
-    "__rmutex_dummy" @388
-    "__rmutex_fork" @389
-    "__rmutex_open" @390
-    "__scrsize" @391
-    "__searchenv" @392
-    "__seek_hdr" @393
-    "__setdummymore" @394
-    "__setmore" @395
-    "__sfnlwr" @396
-    "__sleep2" @397
-    "__splitargs" @398
-    "__splitpath" @399
-    "__status87" @400
-    "__std_abort" @401
-    "__std_abs" @402
-    "__std_access" @403
-    "__std_acos" @404
-    "__std_acosl" @405
-    "__std_asctime" @406
-    "__std_asin" @407
-    "__std_asinl" @408
-    "__std_atan" @409
-    "__std_atan2" @410
-    "__std_atan2l" @411
-    "__std_atanl" @412
-    "__std_atexit" @413
-    "__std_atof" @414
-    "__std_atofl" @415
-    "__std_atoi" @416
-    "__std_atol" @417
-    "__std_atoll" @418
-    "__std_basename" @419
-    "__std_bcmp" @420
-    "__std_bcopy" @421
-    "__std_brk" @422
-    "__std_bsearch" @423
-    "__std_bzero" @424
-    "__std_calloc" @425
-    "__std_cbrt" @426
-    "__std_cbrtl" @427
-    "__std_ceil" @428
-    "__std_ceill" @429
-    "__std_cfgetispeed" @430
-    "__std_cfgetospeed" @431
-    "__std_cfsetispeed" @432
-    "__std_cfsetospeed" @433
-    "__std_cfsetspeed" @434
-    "__std_chdir" @435
-    "__std_chdrive" @436
-    "__std_chmod" @437
-    "__std_chsize" @438
-    "__std_clearerr" @439
-    "__std_clock" @440
-    "__std_close" @441
-    "__std_closedir" @442
-    "__std_copysign" @443
-    "__std_copysignf" @444
-    "__std_copysignl" @445
-    "__std_cos" @446
-    "__std_cosh" @447
-    "__std_coshl" @448
-    "__std_cosl" @449
-    "__std_creat" @450
-    "__std_ctime" @451
-    "__std_cuserid" @452
-    "__std_difftime" @453
-    "__std_dirname" @454
-    "__std_div" @455
-    "__std_drand48" @456
-    "__std_dup" @457
-    "__std_dup2" @458
-    "__std_endpwent" @459
-    "__std_eof" @460
-    "__std_erand48" @461
-    "__std_execl" @462
-    "__std_execle" @463
-    "__std_execlp" @464
-    "__std_execlpe" @465
-    "__std_execv" @466
-    "__std_execve" @467
-    "__std_execvp" @468
-    "__std_execvpe" @469
-    "__std_exit" @470
-    "__std_exp" @471
-    "__std_expand" @472
-    "__std_expl" @473
-    "__std_fabs" @474
-    "__std_fabsl" @475
-    "__std_fclose" @476
-    "__std_fcntl" @477
-    "__std_fdopen" @478
-    "__std_feof" @479
-    "__std_ferror" @480
-    "__std_fflush" @481
-    "__std_ffs" @482
-    "__std_fgetc" @483
-    "__std_fgetchar" @484
-    "__std_fgetpos" @485
-    "__std_fgets" @486
-    "__std_filelength" @487
-    "__std_fileno" @488
-    "__std_flock" @489
-    "__std_floor" @490
-    "__std_floorl" @491
-    "__std_flushall" @492
-    "__std_fmod" @493
-    "__std_fmodl" @494
-    "__std_fnmatch" @495
-    "__std_fopen" @496
-    "__std_fork" @497
-    "__std_fpathconf" @498
-    "__std_fprintf" @499
-    "__std_fputc" @500
-    "__std_fputchar" @501
-    "__std_fputs" @502
-    "__std_fread" @503
-    "__std_free" @504
-    "__std_freopen" @505
-    "__std_frexp" @506
-    "__std_frexpl" @507
-    "__std_fscanf" @508
-    "__std_fseek" @509
-    "__std_fseeko" @510
-    "__std_fsetpos" @511
-    "__std_fstat" @512
-    "__std_fsync" @513
-    "__std_ftell" @514
-    "__std_ftello" @515
-    "__std_ftime" @516
-    "__std_ftruncate" @517
-    "__std_ftw" @518
-    "__std_fwrite" @519
-    "__std_gcvt" @520
-    "__std_getchar" @521
-    "__std_getcwd" @522
-    "__std_getegid" @523
-    "__std_getenv" @524
-    "__std_geteuid" @525
-    "__std_getgid" @526
-    "__std_getgrgid" @527
-    "__std_getgrnam" @528
-    "__std_getgroups" @529
-    "__std_getlogin" @530
-    "__std_getopt" @531
-    "__std_getpagesize" @532
-    "__std_getpass" @533
-    "__std_getpgrp" @534
-    "__std_getpid" @535
-    "__std_getppid" @536
-    "__std_getpw" @537
-    "__std_getpwent" @538
-    "__std_getpwnam" @539
-    "__std_getpwuid" @540
-    "__std_gets" @541
-    "__std_gettimeofday" @542
-    "__std_getuid" @543
-    "__std_getw" @544
-    "__std_getwd" @545
-    "__std_gmtime" @546
-    "__std_hypot" @547
-    "__std_hypotl" @548
-    "__std_index" @549
-    "__std_ioctl" @550
-    "__std_isatty" @551
-    "__std_jrand48" @552
-    "__std_kill" @553
-    "__std_labs" @554
-    "__std_lcong48" @555
-    "__std_ldexp" @556
-    "__std_ldexpl" @557
-    "__std_ldiv" @558
-    "__std_lltoa" @559
-    "__std_localeconv" @560
-    "__std_localtime" @561
-    "__std_lockf" @562
-    "__std_log" @563
-    "__std_log10" @564
-    "__std_log10l" @565
-    "__std_logl" @566
-    "__std_longjmp" @567
-    "__std_lrand48" @568
-    "__std_lseek" @569
-    "__std_lstat" @570
-    "__std_ltoa" @571
-    "__std_malloc" @572
-    "__std_mblen" @573
-    "__std_mbstowcs" @574
-    "__std_mbtowc" @575
-    "__std_memccpy" @576
-    "__std_memchr" @577
-    "__std_memcmp" @578
-    "__std_memcpy" @579
-    "__std_memicmp" @580
-    "__std_memmove" @581
-    "__std_memset" @582
-    "__std_mkdir" @583
-    "__std_mkstemp" @584
-    "__std_mktemp" @585
-    "__std_mktime" @586
-    "__std_modf" @587
-    "__std_modfl" @588
-    "__std_mrand48" @589
-    "__std_nextafter" @590
-    "__std_nextafterf" @591
-    "__std_nextafterl" @592
-    "__std_nrand48" @593
-    "__std_open" @594
-    "__std_opendir" @595
-    "__std_pathconf" @596
-    "__std_pause" @597
-    "__std_pclose" @598
-    "__std_perror" @599
-    "__std_pipe" @600
-    "__std_popen" @601
-    "__std_posix_memalign" @602
-    "__std_pow" @603
-    "__std_powl" @604
-    "__std_printf" @605
-    "__std_putchar" @606
-    "__std_putenv" @607
-    "__std_puts" @608
-    "__std_putw" @609
-    "__std_qsort" @610
-    "__std_qsort_r" @611
-    "__std_raise" @612
-    "__std_rand" @613
-    "__std_read" @614
-    "__std_readdir" @615
-    "__std_readdir_r" @616
-    "__std_readv" @617
-    "__std_realloc" @618
-    "__std_remove" @619
-    "__std_rename" @620
-    "__std_rewind" @621
-    "__std_rewinddir" @622
-    "__std_rindex" @623
-    "__std_rint" @624
-    "__std_rintl" @625
-    "__std_rmdir" @626
-    "__std_sbrk" @627
-    "__std_scanf" @628
-    "__std_seed48" @629
-    "__std_seekdir" @630
-    "__std_select" @631
-    "__std_setbuf" @632
-    "__std_setbuffer" @633
-    "__std_setenv" @634
-    "__std_setgid" @635
-    "__std_setjmp" @636
-    "__std_setlocale" @637
-    "__std_setmode" @638
-    "__std_setpgid" @639
-    "__std_setpwent" @640
-    "__std_setsid" @641
-    "__std_settimeofday" @642
-    "__std_setuid" @643
-    "__std_setvbuf" @644
-    "__std_sigaction" @645
-    "__std_sigaddset" @646
-    "__std_sigdelset" @647
-    "__std_sigemptyset" @648
-    "__std_sigfillset" @649
-    "__std_sigismember" @650
-    "__std_siglongjmp" @651
-    "__std_signal" @652
-    "__std_sigpending" @653
-    "__std_sigprocmask" @654
-    "__std_sigsetjmp" @655
-    "__std_sigsuspend" @656
-    "__std_sin" @657
-    "__std_sinh" @658
-    "__std_sinhl" @659
-    "__std_sinl" @660
-    "__std_sleep" @661
-    "__std_snprintf" @662
-    "__std_sopen" @663
-    "__std_spawnl" @664
-    "__std_spawnle" @665
-    "__std_spawnlp" @666
-    "__std_spawnlpe" @667
-    "__std_spawnv" @668
-    "__std_spawnve" @669
-    "__std_spawnvp" @670
-    "__std_spawnvpe" @671
-    "__std_sprintf" @672
-    "__std_sqrt" @673
-    "__std_sqrtl" @674
-    "__std_srand" @675
-    "__std_srand48" @676
-    "__std_sscanf" @677
-    "__std_stat" @678
-    "__std_strcat" @679
-    "__std_strchr" @680
-    "__std_strcmp" @681
-    "__std_strcoll" @682
-    "__std_strcpy" @683
-    "__std_strcspn" @684
-    "__std_strdup" @685
-    "__std_strerror" @686
-    "__std_strftime" @687
-    "__std_stricmp" @688
-    "__std_strlen" @689
-    "__std_strlwr" @690
-    "__std_strncat" @691
-    "__std_strncmp" @692
-    "__std_strncpy" @693
-    "__std_strnicmp" @694
-    "__std_strnset" @695
-    "__std_strpbrk" @696
-    "__std_strptime" @697
-    "__std_strrchr" @698
-    "__std_strrev" @699
-    "__std_strset" @700
-    "__std_strspn" @701
-    "__std_strstr" @702
-    "__std_strtod" @703
-    "__std_strtof" @704
-    "__std_strtok" @705
-    "__std_strtol" @706
-    "__std_strtold" @707
-    "__std_strtoll" @708
-    "__std_strtoul" @709
-    "__std_strtoull" @710
-    "__std_strupr" @711
-    "__std_strxfrm" @712
-    "__std_swab" @713
-    "__std_sys_errlist" @714
-    "__std_sys_nerr" @715
-    "__std_sysconf" @716
-    "__std_system" @717
-    "__std_tan" @718
-    "__std_tanh" @719
-    "__std_tanhl" @720
-    "__std_tanl" @721
-    "__std_tcdrain" @722
-    "__std_tcflow" @723
-    "__std_tcflush" @724
-    "__std_tcgetattr" @725
-    "__std_tcgetpgrp" @726
-    "__std_tcsendbreak" @727
-    "__std_tcsetattr" @728
-    "__std_tcsetpgrp" @729
-    "__std_tell" @730
-    "__std_telldir" @731
-    "__std_tempnam" @732
-    "__std_time" @733
-    "__std_times" @734
-    "__std_tmpfile" @735
-    "__std_tmpnam" @736
-    "__std_trunc" @737
-    "__std_truncate" @738
-    "__std_truncl" @739
-    "__std_ttyname" @740
-    "__std_tzset" @741
-    "__std_ulimit" @742
-    "__std_ulltoa" @743
-    "__std_ultoa" @744
-    "__std_umask" @745
-    "__std_uname" @746
-    "__std_ungetc" @747
-    "__std_unlink" @748
-    "__std_unsetenv" @749
-    "__std_utime" @750
-    "__std_utimes" @751
-    "__std_vfprintf" @752
-    "__std_vfscanf" @753
-    "__std_vprintf" @754
-    "__std_vscanf" @755
-    "__std_vsnprintf" @756
-    "__std_vsprintf" @757
-    "__std_vsscanf" @758
-    "__std_wait" @759
-    "__std_waitpid" @760
-    "__std_wcstombs" @761
-    "__std_wctomb" @762
-    "__std_write" @763
-    "__std_writev" @764
-    "__stream_read" @765
-    "__stream_write" @766
-    "__strncpy" @767
-    "__swchar" @768
-    "__sys_dump_heap_objs" @769
-    "_sys_exception" @770
-    "__tcalloc" @771
-    "__tfree" @772
-    "__theapmin" @773
-; fixme    "__thread" @774
-    "__threadstore" @775
-    "__tmalloc" @776
-    "__tmpbuf1" @777
-    "__tmpidx_lock" @778
-    "__tmpidx_unlock" @779
-    "__tmpidxnam" @780
-    "__trealloc" @781
-    "__trslash" @782
-    "__uaddmem" @783
-    "__ucalloc" @784
-    "__uclose" @785
-    "__ucreate" @786
-    "__ucreate2" @787
-    "__udefault" @788
-    "__udestroy" @789
-    "__uflags" @790
-    "__uheap_type" @791
-    "__uheap_walk" @792
-    "__uheap_walk2" @793
-    "__uheapchk" @794
-    "__uheapmin" @795
-    "__uheapset" @796
-    "__uldiv" @797
-    "__um_addmem_nolock" @798
-    "__um_alloc_no_lock" @799
-    "__um_crumb_free_maybe_lock" @800
-    "__um_default_alloc" @801
-    "__um_default_expand" @802
-    "__um_default_release" @803
-    "__um_default_shrink" @804
-    "__um_find_bucket" @805
-    "__um_free_maybe_lock" @806
-    "__um_init_default_regular_heap" @807
-    "__um_init_default_tiled_heap" @808
-    "__um_lump_alloc" @809
-    "__um_lump_coalesce_free" @810
-    "__um_lump_free_maybe_lock" @811
-    "__um_lump_link_heap" @812
-    "__um_lump_make_free" @813
-    "__um_lump_unlink_bucket" @814
-    "__um_lump_unlink_heap" @815
-    "__um_realloc" @816
-    "__um_seg_addmem" @817
-    "__um_seg_setmem" @818
-    "__um_walk_error" @819
-    "__um_walk_no_lock" @820
-    "__umalloc" @821
-    "__ungetc_nolock" @822
-    "__uopen" @823
-    "__ustats" @824
-    "__utcalloc" @825
-    "__utdefault" @826
-    "__utmalloc" @827
-    "__vsopen" @828
-    "__wildcard" @829
-    "__year_day" @830
-    "_heapsort" @831
-    "_initstate" @832
-    "_isalnum" @833
-    "_isalpha" @834
-    "_isascii" @835
-    "_iscntrl" @836
-    "_isdigit" @837
-    "_isgraph" @838
-    "_islower" @839
-    "_isprint" @840
-    "_ispunct" @841
-    "_isspace" @842
-    "_isupper" @843
-    "_isxdigit" @844
-    "_lchmod" @845
-    "_mergesort" @846
-    "_radixsort" @847
-    "_random" @848
-    "_setstate" @849
-    "_sig_info" @850
-    "_sradixsort" @851
-    "_srandom" @852
-    "_srandomdev" @853
-    "_stpcpy" @854
-    "_strcasestr" @855
-    "_strlcat" @856
-    "_strlcpy" @857
-    "_strnstr" @858
-    "_strsep" @859
-    "_toascii" @860
-    "_tolower" @861
-    "__std_asctime_r" @862
-    "__std_ctime_r" @863
-    "__std_strerror_r" @864
-    "__err" @865
-    "_errc" @866
-    "_err_set_exit" @867
-    "_err_set_file" @868
-    "_errx" @869
-    "__emx_getopt" @870
-    "_getopt_long" @871
-    "__getprogname" @872
-    "_setprogname" @873
-    "_verr" @874
-    "_verrc" @875
-    "_verrx" @876
-    "_vwarn" @877
-    "_vwarnc" @878
-    "_vwarnx" @879
-    "__warn" @880
-    "_warnc" @881
-    "_warnx" @882
-    "__std_imaxabs" @883
-    "__std_imaxdiv" @884
-    "__std_strtoimax" @885
-    "__std_strtoumax" @886
-    "__std_hcreate" @887
-    "__std_hdestroy" @888
-    "__std_hsearch" @889
-    "__std_insque" @890
-    "__std_lfind" @891
-    "__std_lsearch" @892
-    "__std_remque" @893
-    "__std_tdelete" @894
-    "__std_tfind" @895
-    "__std_tsearch" @896
-    "__std_twalk" @897
-    "___addel" @898
-    "___add_ovflpage" @899
-    "___big_delete" @900
-    "___big_insert" @901
-    "___big_keydata" @902
-    "___big_return" @903
-    "___big_split" @904
-    "___buf_free" @905
-    "___buf_init" @906
-    "___call_hash" @907
-    "_dbm_clearerr" @908
-    "_dbm_close" @909
-    "_dbm_delete" @910
-    "_dbm_dirfno" @911
-    "_dbm_error" @912
-    "_dbm_fetch" @913
-    "_dbm_firstkey" @914
-    "_dbm_nextkey" @915
-    "_dbm_open" @916
-    "_dbm_store" @917
-    "___split_page" @918
-    "___delpair" @919
-    "___expand_table" @920
-    "___find_bigpair" @921
-    "___find_last_page" @922
-    "___free_ovflpage" @923
-    "___get_buf" @924
-    "___get_page" @925
-    "___hash_open" @926
-    "___ibitmap" @927
-    "___log2" @928
-    "___put_page" @929
-    "___reclaim_buf" @930
-    "_reallocf" @931
-    "___bt_close" @932
-    "___bt_cmp" @933
-    "___bt_defcmp" @934
-    "___bt_defpfx" @935
-    "___bt_delete" @936
-    "___bt_dleaf" @937
-    "___bt_dmpage" @938
-    "___bt_dnpage" @939
-    "___bt_dpage" @940
-    "___bt_dump" @941
-    "___bt_fd" @942
-    "___bt_free" @943
-    "___bt_get" @944
-    "___bt_new" @945
-    "___bt_open" @946
-    "___bt_pgin" @947
-    "___bt_pgout" @948
-    "___bt_put" @949
-    "___bt_ret" @950
-    "___bt_search" @951
-    "___bt_seq" @952
-    "___bt_setcur" @953
-    "___bt_split" @954
-    "___bt_sync" @955
-    "___ovfl_delete" @956
-    "___ovfl_get" @957
-    "___ovfl_put" @958
-    "_mpool_close" @959
-    "_mpool_filter" @960
-    "_mpool_get" @961
-    "_mpool_new" @962
-    "_mpool_open" @963
-    "_mpool_put" @964
-    "_mpool_sync" @965
-    "___rec_close" @966
-    "___rec_delete" @967
-    "___rec_dleaf" @968
-    "___rec_fd" @969
-    "___rec_fmap" @970
-    "___rec_fpipe" @971
-    "___rec_get" @972
-    "___rec_iput" @973
-    "___rec_open" @974
-    "___rec_put" @975
-    "___rec_ret" @976
-    "___rec_search" @977
-    "___rec_seq" @978
-    "___rec_sync" @979
-    "___rec_vmap" @980
-    "___rec_vpipe" @981
-    "_dbopen" @982
-    "___dbpanic" @983
-    "_regcomp" @984
-    "_regerror" @985
-    "_regexec" @986
-    "_regfree" @987
-    "_isblank" @988
-    "_ishexnumber" @989
-    "_isnumber" @990
-    "___istype" @991
-    "___tolower" @992
-    "___toupper" @993
-    "___locale_C" @994
-    "___mempcpy" @995
-    "_posix_spawn" @996
-    "_posix_spawnattr_destroy" @997
-    "_posix_spawnattr_getflags" @998
-    "_posix_spawnattr_getpgroup" @999
-    "_posix_spawnattr_getschedparam" @1000
-    "_posix_spawnattr_getschedpolicy" @1001
-    "_posix_spawnattr_getsigdefault" @1002
-    "_posix_spawnattr_getsigmask" @1003
-    "_posix_spawnattr_init" @1004
-    "_posix_spawnattr_setflags" @1005
-    "_posix_spawnattr_setpgroup" @1006
-    "_posix_spawnattr_setschedparam" @1007
-    "_posix_spawnattr_setschedpolicy" @1008
-    "_posix_spawnattr_setsigdefault" @1009
-    "_posix_spawnattr_setsigmask" @1010
-    "_posix_spawn_file_actions_addclose" @1011
-    "_posix_spawn_file_actions_adddup2" @1012
-    "_posix_spawn_file_actions_addopen" @1013
-    "_posix_spawn_file_actions_destroy" @1014
-    "_posix_spawn_file_actions_init" @1015
-    "_posix_spawnp" @1016
-    "___posix_spawn_file_actions_realloc" @1017
-    "___spawni" @1018
-    "_strsignal" @1019
-    "___error" @1020
-    "___error_at_line" @1021
-    "_sys_nsig" @1022
-    "_sys_siglist" @1023
-    "_sys_signame" @1024
-    "__std_realpath" @1025
-    "___argz_add" @1026
-    "___argz_add_sep" @1027
-    "___argz_append" @1028
-    "___argz_count" @1029
-    "___argz_create" @1030
-    "___argz_create_sep" @1031
-    "_argz_delete" @1032
-    "___argz_extract" @1033
-    "___argz_insert" @1034
-    "___argz_next" @1035
-    "___argz_replace" @1036
-    "___argz_stringify" @1037
-    "___strndup" @1038
-    "___strnlen" @1039
-    "___libc_LogEnter" @1040
-    "___libc_LogLeave" @1041
-    "___libc_LogMsg" @1042
+; GCC322 code and const (starts at 100)
+    "__Unwind_DeleteException" @100
+    "__Unwind_Find_FDE" @101
+    "__Unwind_ForcedUnwind" @102
+    "__Unwind_GetDataRelBase" @103
+    "__Unwind_GetGR" @104
+    "__Unwind_GetIP" @105
+    "__Unwind_GetLanguageSpecificData" @106
+    "__Unwind_GetRegionStart" @107
+    "__Unwind_GetTextRelBase" @108
+    "__Unwind_RaiseException" @109
+    "__Unwind_Resume" @110
+    "__Unwind_SetGR" @111
+    "__Unwind_SetIP" @112
+    "___absvdi2" @113
+    "___absvsi2" @114
+    "___addvdi3" @115
+    "___addvsi3" @116
+    "___ashldi3" @117
+    "___ashrdi3" @118
+    "___clear_cache" @119
+    "___clz_tab" @120
+    "___cmpdi2" @121
+    "___deregister_frame" @122
+    "___deregister_frame_info" @123
+    "___deregister_frame_info_bases" @124
+    "___divdi3" @125
+    "___ffsdi2" @126
+    "___fixdfdi" @127
+    "___fixsfdi" @128
+    "___fixunsdfdi" @129
+    "___fixunsdfsi" @130
+    "___fixunssfdi" @131
+    "___fixunssfsi" @132
+    "___fixunsxfdi" @133
+    "___fixunsxfsi" @134
+    "___fixxfdi" @135
+    "___floatdidf" @136
+    "___floatdisf" @137
+    "___floatdixf" @138
+    "___frame_state_for" @139
+    "___lshrdi3" @140
+    "___moddi3" @141
+    "___muldi3" @142
+    "___mulvdi3" @143
+    "___mulvsi3" @144
+    "___negdi2" @145
+    "___negvdi2" @146
+    "___negvsi2" @147
+    "___register_frame" @148
+    "___register_frame_info" @149
+    "___register_frame_info_bases" @150
+    "___register_frame_info_table" @151
+    "___register_frame_info_table_bases" @152
+    "___register_frame_table" @153
+    "___subvdi3" @154
+    "___subvsi3" @155
+    "___ucmpdi2" @156
+    "___udiv_w_sdiv" @157
+    "___udivdi3" @158
+    "___udivmoddi4" @159
+    "___umoddi3" @160
+    "__alloca" @161
 
-    ; Same as gcc322.dll
-    "__Unwind_DeleteException" @1043
-    "__Unwind_Find_FDE" @1044
-    "__Unwind_ForcedUnwind" @1045
-    "__Unwind_GetDataRelBase" @1046
-    "__Unwind_GetGR" @1047
-    "__Unwind_GetIP" @1048
-    "__Unwind_GetLanguageSpecificData" @1049
-    "__Unwind_GetRegionStart" @1050
-    "__Unwind_GetTextRelBase" @1051
-    "__Unwind_RaiseException" @1052
-    "__Unwind_Resume" @1053
-    "__Unwind_SetGR" @1054
-    "__Unwind_SetIP" @1055
-    "___absvdi2" @1056
-    "___absvsi2" @1057
-    "___addvdi3" @1058
-    "___addvsi3" @1059
-    "___ashldi3" @1060
-    "___ashrdi3" @1061
-    "___clear_cache"                            @1062
-    "___clz_tab"                                @1063
-    "___cmpdi2"                                 @1064
-    "___deregister_frame"                       @1065
-    "___deregister_frame_info"                  @1066
-    "___deregister_frame_info_bases"            @1067
-    "___divdi3"                                 @1068
-    "___ffsdi2"                                 @1069
-    "___fixdfdi"                                @1070
-    "___fixsfdi"                                @1071
-    "___fixunsdfdi"                             @1072
-    "___fixunsdfsi"                             @1073
-    "___fixunssfdi"                             @1074
-    "___fixunssfsi"                             @1075
-    "___fixunsxfdi"                             @1076
-    "___fixunsxfsi"                             @1077
-    "___fixxfdi"                                @1078
-    "___floatdidf"                              @1079
-    "___floatdisf"                              @1080
-    "___floatdixf"                              @1081
-    "___frame_state_for"                        @1082
-    "___lshrdi3"                                @1083
-    "___moddi3"                                 @1084
-    "___muldi3"                                 @1085
-    "___mulvdi3"                                @1086
-    "___mulvsi3"                                @1087
-    "___negdi2"                                 @1088
-    "___negvdi2"                                @1089
-    "___negvsi2"                                @1090
-    "___register_frame"                         @1091
-    "___register_frame_info"                    @1092
-    "___register_frame_info_bases"              @1093
-    "___register_frame_info_table"              @1094
-    "___register_frame_info_table_bases"        @1095
-    "___register_frame_table"                   @1096
-    "___subvdi3"                                @1097
-    "___subvsi3"                                @1098
-    "___ucmpdi2"                                @1099
-    "___udiv_w_sdiv"                            @1100
-    "___udivdi3"                                @1101
-    "___udivmoddi4"                             @1102
-    "___umoddi3"                                @1103
-    "__alloca"                                  @1104
-    "__std_usleep" @1105
+; LIBC code - and const
+    "__CRT_init" @162
+    "__CRT_term" @163
+    "__HUGE_VAL" @164
+    "__LHUGE_VAL" @165
+    "___add_ovflpage" @166
+    "___addel" @167
+    "___argz_add" @168
+    "___argz_add_sep" @169
+    "___argz_append" @170
+    "___argz_count" @171
+    "___argz_create" @172
+    "___argz_create_sep" @173
+    "___argz_extract" @174
+    "___argz_insert" @175
+    "___argz_next" @176
+    "___argz_replace" @177
+    "___argz_stringify" @178
+    "___atod" @179
+    "___big_delete" @180
+    "___big_insert" @181
+    "___big_keydata" @182
+    "___big_return" @183
+    "___big_split" @184
+    "___bt_close" @185
+    "___bt_cmp" @186
+    "___bt_defcmp" @187
+    "___bt_defpfx" @188
+    "___bt_delete" @189
+    "___bt_dleaf" @190
+    "___bt_dmpage" @191
+    "___bt_dnpage" @192
+    "___bt_dpage" @193
+    "___bt_dump" @194
+    "___bt_fd" @195
+    "___bt_free" @196
+    "___bt_get" @197
+    "___bt_new" @198
+    "___bt_open" @199
+    "___bt_pgin" @200
+    "___bt_pgout" @201
+    "___bt_put" @202
+    "___bt_ret" @203
+    "___bt_search" @204
+    "___bt_seq" @205
+    "___bt_setcur" @206
+    "___bt_split" @207
+    "___bt_sync" @208
+    "___buf_free" @209
+    "___buf_init" @210
+    "___call_hash" @211
+    "___chdir" @212
+    "___chmod" @213
+    "___chsize" @214
+    "___close" @215
+    "___collate_range_cmp" @216
+    "___convert_codepage" @217
+    "___ctordtorInit1" @218
+    "___ctordtorTerm1" @219
+    "___dbpanic" @220
+    "___delpair" @221
+    "___do_Unicode" @222
+    "___dtoa" @223
+    "___dup" @224
+    "___dup2" @225
+    "___error" @226
+    "___error_at_line" @227
+    "___exit" @228
+    "___expand_table" @229
+    "___fcntl" @230
+    "___find_bigpair" @231
+    "___find_last_page" @232
+    "___findfirst" @233
+    "___findnext" @234
+    "___fmutex_release_internal" @235
+    "___fmutex_request_internal" @236
+    "___fork" @237
+    "___fpclassify" @238
+    "___fpclassifyf" @239
+    "___fpclassifyl" @240
+    "___free_ovflpage" @241
+    "___from_ucs" @242
+    "___fstat" @243
+    "___ftime" @244
+    "___ftruncate" @245
+    "___get_buf" @246
+    "___get_page" @247
+    "___getcwd" @248
+    "___gnu_basename" @249
+    "___hash_open" @250
+    "___ibitmap" @251
+    "___imphandle" @252
+    "___init" @253
+    "___init_app" @254
+    "___init_dll" @255
+    "___ioctl1" @256
+    "___ioctl2" @257
+    "___isfinite" @258
+    "___isfinitef" @259
+    "___isfinitel" @260
+    "___isnan" @261
+    "___isnanf" @262
+    "___isnanl" @263
+    "___isnormal" @264
+    "___isnormalf" @265
+    "___isnormall" @266
+    "___istype" @267
+    "___libc_Back_threadCleanup" @268
+    "___libc_Back_threadEnd" @269
+    "___libc_Back_threadInit" @270
+    "___libc_Back_threadStartup" @271
+    "___libc_FH" @272
+    "___libc_FHAllocate" @273
+    "___libc_FHClose" @274
+    "___libc_FHEnsureHandles" @275
+    "___libc_HasHighMem" @276
+    "___libc_HeapEndVoting" @277
+    "___libc_HeapGetResult" @278
+    "___libc_HeapVote" @279
+    "___libc_HimemDefaultAlloc" @280
+    "___libc_HimemDefaultRelease" @281
+    "___libc_LogAssert" @282
+    "___libc_LogEnter" @283
+    "___libc_LogGroupInit" @284
+    "___libc_LogInit" @285
+    "___libc_LogLeave" @286
+    "___libc_LogMsg" @287
+    "___libc_LogRaw" @288
+    "___libc_StrictMemoryR" @289
+    "___libc_StrictMemoryRW" @290
+    "___libc_StrictStringR" @291
+    "___libc_TLSAlloc" @292
+    "___libc_TLSFree" @293
+    "___libc_TLSGet" @294
+    "___libc_TLSSet" @295
+    "___locale_C" @296
+    "___log2" @297
+    "___lseek" @298
+    "___mempcpy" @299
+    "___mkdir" @300
+    "___open" @301
+    "___ovfl_delete" @302
+    "___ovfl_get" @303
+    "___ovfl_put" @304
+    "___pipe" @305
+    "___posix_spawn_file_actions_realloc" @306
+    "___put_page" @307
+    "___read" @308
+    "___read_kbd" @309
+    "___rec_close" @310
+    "___rec_delete" @311
+    "___rec_dleaf" @312
+    "___rec_fd" @313
+    "___rec_fmap" @314
+    "___rec_fpipe" @315
+    "___rec_get" @316
+    "___rec_iput" @317
+    "___rec_open" @318
+    "___rec_put" @319
+    "___rec_ret" @320
+    "___rec_search" @321
+    "___rec_seq" @322
+    "___rec_sync" @323
+    "___rec_vmap" @324
+    "___rec_vpipe" @325
+    "___reclaim_buf" @326
+    "___remove_zeros" @327
+    "___rmdir" @328
+    "___select" @329
+    "___settime" @330
+    "___signbit" @331
+    "___signbitf" @332
+    "___signbitl" @333
+    "___small_atod" @334
+    "___small_dtoa" @335
+    "___smutex_request_internal" @336
+    "___spawni" @337
+    "___spawnve" @338
+    "___split_page" @339
+    "___stat" @340
+    "___strndup" @341
+    "___strnlen" @342
+    "___swchar" @343
+    "___threadid" @344
+    "___to_ucs" @345
+    "___tolower" @346
+    "___toupper" @347
+    "___ttyname" @348
+    "___ulimit" @349
+    "___unwind2" @350
+    "___utimes" @351
+    "___wait" @352
+    "___waitpid" @353
+    "___write" @354
+    "__abspath" @355
+    "__assert" @356
+    "__beginthread" @357
+    "__bi_add_bb" @358
+    "__bi_cmp_bb" @359
+    "__bi_cmp_pow2" @360
+    "__bi_div_add_back" @361
+    "__bi_div_estimate" @362
+    "__bi_div_rem_bb" @363
+    "__bi_div_rem_bw" @364
+    "__bi_div_rem_pow2" @365
+    "__bi_div_subtract" @366
+    "__bi_fls" @367
+    "__bi_hdiv_rem_b" @368
+    "__bi_mul_bb" @369
+    "__bi_mul_bw" @370
+    "__bi_pow5" @371
+    "__bi_set_b" @372
+    "__bi_set_d" @373
+    "__bi_set_w" @374
+    "__bi_shl_b" @375
+    "__bi_shl_w" @376
+    "__bi_shr_b" @377
+    "__bi_sub_mul_bw" @378
+    "__bi_wdiv_rem_pow2" @379
+    "__chdir2" @380
+    "__clear87" @381
+    "__closestream" @382
+    "__compute_dst_table" @383
+    "__const_HALF" @384
+    "__const_M_ONE" @385
+    "__const_NAN" @386
+    "__const_ONE" @387
+    "__const_TWO" @388
+    "__const_ZERO" @389
+    "__control87" @390
+    "__core" @391
+    "__crlf" @392
+    "__day" @393
+    "__defext" @394
+    "__dorand48" @395
+    "__dt_free" @396
+    "__dt_read" @397
+    "__dt_sort" @398
+    "__dt_split" @399
+    "__ea_free" @400
+    "__ea_get" @401
+    "__ea_put" @402
+    "__ea_remove" @403
+    "__ea_set_errno" @404
+    "__ea_write" @405
+    "__ead_add" @406
+    "__ead_clear" @407
+    "__ead_copy" @408
+    "__ead_count" @409
+    "__ead_create" @410
+    "__ead_delete" @411
+    "__ead_destroy" @412
+    "__ead_enum" @413
+    "__ead_fea2list_size" @414
+    "__ead_fea2list_to_fealist" @415
+    "__ead_fealist_to_fea2list" @416
+    "__ead_find" @417
+    "__ead_get_fea2list" @418
+    "__ead_get_flags" @419
+    "__ead_get_name" @420
+    "__ead_get_value" @421
+    "__ead_make_index" @422
+    "__ead_name_len" @423
+    "__ead_read" @424
+    "__ead_replace" @425
+    "__ead_size_buffer" @426
+    "__ead_sort" @427
+    "__ead_use_fea2list" @428
+    "__ead_value_size" @429
+    "__ead_write" @430
+    "__emx_getopt" @431
+    "__emxload_connect" @432
+    "__emxload_disconnect" @433
+    "__emxload_do_connect" @434
+    "__emxload_do_disconnect" @435
+    "__emxload_do_receive" @436
+    "__emxload_do_request" @437
+    "__emxload_do_wait" @438
+    "__emxload_env" @439
+    "__emxload_list_get" @440
+    "__emxload_list_start" @441
+    "__emxload_prog" @442
+    "__emxload_request" @443
+    "__emxload_stop" @444
+    "__emxload_this" @445
+    "__emxload_unload" @446
+    "__endbuf1" @447
+    "__endthread" @448
+    "__envargs" @449
+    "__err" @450
+    "__errno" @451
+    "__errno_fun" @452
+    "__execname" @453
+    "__exit" @454
+    "__exit_streams" @455
+    "__fassign" @456
+    "__fbuf" @457
+    "__fcloseall" @458
+    "__fflush_nolock" @459
+    "__filesys" @460
+    "__fill" @461
+    "__flush" @462
+    "__flushstream" @463
+    "__fmutex_checked_close" @464
+    "__fmutex_checked_create" @465
+    "__fmutex_checked_open" @466
+    "__fmutex_close" @467
+    "__fmutex_create" @468
+    "__fmutex_dummy" @469
+    "__fmutex_open" @470
+    "__fnexplode" @471
+    "__fnexplodefree" @472
+    "__fngetdrive" @473
+    "__fnisabs" @474
+    "__fnisrel" @475
+    "__fnlwr" @476
+    "__fnlwr2" @477
+    "__fnslashify" @478
+    "__fpreset" @479
+    "__fseek_hdr" @480
+    "__fseek_nolock" @481
+    "__fsetmode" @482
+    "__fsopen" @483
+    "__ftell_nolock" @484
+    "__fullpath" @485
+    "__fwrite_nolock" @486
+    "__fxam" @487
+    "__fxaml" @488
+    "__getcwd1" @489
+    "__getcwd2" @490
+    "__getdrive" @491
+    "__getext" @492
+    "__getext2" @493
+    "__getname" @494
+    "__getpass1" @495
+    "__getpass2" @496
+    "__getprogname" @497
+    "__gettid" @498
+    "__getvol" @499
+    "__gmt2loc" @500
+    "__hcalloc" @501
+    "__heap_walk" @502
+    "__heapchk" @503
+    "__heapmin" @504
+    "__heapset" @505
+    "__hinitheap" @506
+    "__hmalloc" @507
+    "__hrealloc" @508
+    "__imphandle" @509
+    "__init1_tmp" @510
+    "__init_streams" @511
+    "__input" @512
+    "__int86" @513
+    "__isterm" @514
+    "__lcalloc" @515
+    "__libc_16to32" @516
+    "__libc_32to16" @517
+    "__libc_thunk1" @518
+    "__linitheap" @519
+    "__lmalloc" @520
+    "__loc2gmt" @521
+    "__lrealloc" @522
+    "__makepath" @523
+    "__memcount" @524
+    "__memdif" @525
+    "__memrchr" @526
+    "__memswap" @527
+    "__mfclose" @528
+    "__mfopen" @529
+    "__mheap" @530
+    "__mktime" @531
+    "__month_day_leap" @532
+    "__month_day_non_leap" @533
+    "__msize" @534
+    "__newstream" @535
+    "__openstream" @536
+    "__os2_bad" @537
+    "__output" @538
+    "__path" @539
+    "__read_kbd" @540
+    "__remext" @541
+    "__response" @542
+    "__rfnlwr" @543
+    "__rmtmp" @544
+    "__rmutex_checked_close" @545
+    "__rmutex_checked_create" @546
+    "__rmutex_checked_open" @547
+    "__rmutex_close" @548
+    "__rmutex_create" @549
+    "__rmutex_dummy" @550
+    "__rmutex_fork" @551
+    "__rmutex_open" @552
+    "__scrsize" @553
+    "__searchenv" @554
+    "__seek_hdr" @555
+    "__setdummymore" @556
+    "__setmore" @557
+    "__sfnlwr" @558
+    "__sleep2" @559
+    "__splitargs" @560
+    "__splitpath" @561
+    "__status87" @562
+    "__std_abort" @563
+    "__std_abs" @564
+    "__std_access" @565
+    "__std_acos" @566
+    "__std_acosl" @567
+    "__std_asctime" @568
+    "__std_asctime_r" @569
+    "__std_asin" @570
+    "__std_asinl" @571
+    "__std_atan" @572
+    "__std_atan2" @573
+    "__std_atan2l" @574
+    "__std_atanl" @575
+    "__std_atexit" @576
+    "__std_atof" @577
+    "__std_atofl" @578
+    "__std_atoi" @579
+    "__std_atol" @580
+    "__std_atoll" @581
+    "__std_basename" @582
+    "__std_bcmp" @583
+    "__std_bcopy" @584
+    "__std_brk" @585
+    "__std_bsearch" @586
+    "__std_bzero" @587
+    "__std_calloc" @588
+    "__std_cbrt" @589
+    "__std_cbrtl" @590
+    "__std_ceil" @591
+    "__std_ceill" @592
+    "__std_cfgetispeed" @593
+    "__std_cfgetospeed" @594
+    "__std_cfsetispeed" @595
+    "__std_cfsetospeed" @596
+    "__std_cfsetspeed" @597
+    "__std_chdir" @598
+    "__std_chdrive" @599
+    "__std_chmod" @600
+    "__std_chsize" @601
+    "__std_clearerr" @602
+    "__std_clock" @603
+    "__std_close" @604
+    "__std_closedir" @605
+    "__std_copysign" @606
+    "__std_copysignf" @607
+    "__std_copysignl" @608
+    "__std_cos" @609
+    "__std_cosh" @610
+    "__std_coshl" @611
+    "__std_cosl" @612
+    "__std_creat" @613
+    "__std_ctime" @614
+    "__std_ctime_r" @615
+    "__std_cuserid" @616
+    "__std_difftime" @617
+    "__std_dirname" @618
+    "__std_div" @619
+    "__std_drand48" @620
+    "__std_dup" @621
+    "__std_dup2" @622
+    "__std_endpwent" @623
+    "__std_eof" @624
+    "__std_erand48" @625
+    "__std_execl" @626
+    "__std_execle" @627
+    "__std_execlp" @628
+    "__std_execlpe" @629
+    "__std_execv" @630
+    "__std_execve" @631
+    "__std_execvp" @632
+    "__std_execvpe" @633
+    "__std_exit" @634
+    "__std_exp" @635
+    "__std_expand" @636
+    "__std_expl" @637
+    "__std_fabs" @638
+    "__std_fabsl" @639
+    "__std_fclose" @640
+    "__std_fcntl" @641
+    "__std_fdopen" @642
+    "__std_feof" @643
+    "__std_ferror" @644
+    "__std_fflush" @645
+    "__std_ffs" @646
+    "__std_fgetc" @647
+    "__std_fgetchar" @648
+    "__std_fgetpos" @649
+    "__std_fgets" @650
+    "__std_filelength" @651
+    "__std_fileno" @652
+    "__std_flock" @653
+    "__std_floor" @654
+    "__std_floorl" @655
+    "__std_flushall" @656
+    "__std_fmod" @657
+    "__std_fmodl" @658
+    "__std_fnmatch" @659
+    "__std_fopen" @660
+    "__std_fork" @661
+    "__std_fpathconf" @662
+    "__std_fprintf" @663
+    "__std_fputc" @664
+    "__std_fputchar" @665
+    "__std_fputs" @666
+    "__std_fread" @667
+    "__std_free" @668
+    "__std_freopen" @669
+    "__std_frexp" @670
+    "__std_frexpl" @671
+    "__std_fscanf" @672
+    "__std_fseek" @673
+    "__std_fseeko" @674
+    "__std_fsetpos" @675
+    "__std_fstat" @676
+    "__std_fsync" @677
+    "__std_ftell" @678
+    "__std_ftello" @679
+    "__std_ftime" @680
+    "__std_ftruncate" @681
+    "__std_ftw" @682
+    "__std_fwrite" @683
+    "__std_gcvt" @684
+    "__std_getchar" @685
+    "__std_getcwd" @686
+    "__std_getegid" @687
+    "__std_getenv" @688
+    "__std_geteuid" @689
+    "__std_getgid" @690
+    "__std_getgrgid" @691
+    "__std_getgrnam" @692
+    "__std_getgroups" @693
+    "__std_getlogin" @694
+    "__std_getopt" @695
+    "__std_getpagesize" @696
+    "__std_getpass" @697
+    "__std_getpgrp" @698
+    "__std_getpid" @699
+    "__std_getppid" @700
+    "__std_getpw" @701
+    "__std_getpwent" @702
+    "__std_getpwnam" @703
+    "__std_getpwuid" @704
+    "__std_gets" @705
+    "__std_gettimeofday" @706
+    "__std_getuid" @707
+    "__std_getw" @708
+    "__std_getwd" @709
+    "__std_glob" @710
+    "__std_globfree" @711
+    "__std_gmtime" @712
+    "__std_gmtime_r" @713
+    "__std_hcreate" @714
+    "__std_hdestroy" @715
+    "__std_hsearch" @716
+    "__std_hypot" @717
+    "__std_hypotl" @718
+    "__std_imaxabs" @719
+    "__std_imaxdiv" @720
+    "__std_index" @721
+    "__std_insque" @722
+    "__std_ioctl" @723
+    "__std_isatty" @724
+    "__std_jrand48" @725
+    "__std_kill" @726
+    "__std_labs" @727
+    "__std_lcong48" @728
+    "__std_ldexp" @729
+    "__std_ldexpl" @730
+    "__std_ldiv" @731
+    "__std_lfind" @732
+    "__std_lltoa" @733
+    "__std_localeconv" @734
+    "__std_localtime" @735
+    "__std_localtime_r" @736
+    "__std_lockf" @737
+    "__std_log" @738
+    "__std_log10" @739
+    "__std_log10l" @740
+    "__std_logl" @741
+    "__std_longjmp" @742
+    "__std_lrand48" @743
+    "__std_lsearch" @744
+    "__std_lseek" @745
+    "__std_lstat" @746
+    "__std_ltoa" @747
+    "__std_malloc" @748
+    "__std_mblen" @749
+    "__std_mbstowcs" @750
+    "__std_mbtowc" @751
+    "__std_memccpy" @752
+    "__std_memchr" @753
+    "__std_memcmp" @754
+    "__std_memcpy" @755
+    "__std_memicmp" @756
+    "__std_memmove" @757
+    "__std_memset" @758
+    "__std_mkdir" @759
+    "__std_mkstemp" @760
+    "__std_mktemp" @761
+    "__std_mktime" @762
+    "__std_modf" @763
+    "__std_modfl" @764
+    "__std_mrand48" @765
+    "__std_nextafter" @766
+    "__std_nextafterf" @767
+    "__std_nextafterl" @768
+    "__std_nrand48" @769
+    "__std_open" @770
+    "__std_opendir" @771
+    "__std_pathconf" @772
+    "__std_pause" @773
+    "__std_pclose" @774
+    "__std_perror" @775
+    "__std_pipe" @776
+    "__std_popen" @777
+    "__std_posix_memalign" @778
+    "__std_pow" @779
+    "__std_powl" @780
+    "__std_printf" @781
+    "__std_putchar" @782
+    "__std_putenv" @783
+    "__std_puts" @784
+    "__std_putw" @785
+    "__std_qsort" @786
+    "__std_qsort_r" @787
+    "__std_raise" @788
+    "__std_rand" @789
+    "__std_read" @790
+    "__std_readdir" @791
+    "__std_readdir_r" @792
+    "__std_readv" @793
+    "__std_realloc" @794
+    "__std_realpath" @795
+    "__std_remove" @796
+    "__std_remque" @797
+    "__std_rename" @798
+    "__std_rewind" @799
+    "__std_rewinddir" @800
+    "__std_rindex" @801
+    "__std_rint" @802
+    "__std_rintl" @803
+    "__std_rmdir" @804
+    "__std_sbrk" @805
+    "__std_scanf" @806
+    "__std_seed48" @807
+    "__std_seekdir" @808
+    "__std_select" @809
+    "__std_setbuf" @810
+    "__std_setbuffer" @811
+    "__std_setenv" @812
+    "__std_setgid" @813
+    "__std_setjmp" @814
+    "__std_setlocale" @815
+    "__std_setmode" @816
+    "__std_setpgid" @817
+    "__std_setpwent" @818
+    "__std_setsid" @819
+    "__std_settimeofday" @820
+    "__std_setuid" @821
+    "__std_setvbuf" @822
+    "__std_sigaction" @823
+    "__std_sigaddset" @824
+    "__std_sigdelset" @825
+    "__std_sigemptyset" @826
+    "__std_sigfillset" @827
+    "__std_sigismember" @828
+    "__std_siglongjmp" @829
+    "__std_signal" @830
+    "__std_sigpending" @831
+    "__std_sigprocmask" @832
+    "__std_sigsetjmp" @833
+    "__std_sigsuspend" @834
+    "__std_sin" @835
+    "__std_sinh" @836
+    "__std_sinhl" @837
+    "__std_sinl" @838
+    "__std_sleep" @839
+    "__std_snprintf" @840
+    "__std_sopen" @841
+    "__std_spawnl" @842
+    "__std_spawnle" @843
+    "__std_spawnlp" @844
+    "__std_spawnlpe" @845
+    "__std_spawnv" @846
+    "__std_spawnve" @847
+    "__std_spawnvp" @848
+    "__std_spawnvpe" @849
+    "__std_sprintf" @850
+    "__std_sqrt" @851
+    "__std_sqrtl" @852
+    "__std_srand" @853
+    "__std_srand48" @854
+    "__std_sscanf" @855
+    "__std_stat" @856
+    "__std_strcat" @857
+    "__std_strchr" @858
+    "__std_strcmp" @859
+    "__std_strcoll" @860
+    "__std_strcpy" @861
+    "__std_strcspn" @862
+    "__std_strdup" @863
+    "__std_strerror" @864
+    "__std_strerror_r" @865
+    "__std_strftime" @866
+    "__std_stricmp" @867
+    "__std_strlen" @868
+    "__std_strlwr" @869
+    "__std_strncat" @870
+    "__std_strncmp" @871
+    "__std_strncpy" @872
+    "__std_strnicmp" @873
+    "__std_strnset" @874
+    "__std_strpbrk" @875
+    "__std_strptime" @876
+    "__std_strrchr" @877
+    "__std_strrev" @878
+    "__std_strset" @879
+    "__std_strspn" @880
+    "__std_strstr" @881
+    "__std_strtod" @882
+    "__std_strtof" @883
+    "__std_strtoimax" @884
+    "__std_strtok" @885
+    "__std_strtol" @886
+    "__std_strtold" @887
+    "__std_strtoll" @888
+    "__std_strtoul" @889
+    "__std_strtoull" @890
+    "__std_strtoumax" @891
+    "__std_strupr" @892
+    "__std_strxfrm" @893
+    "__std_swab" @894
+    "__std_sys_errlist" @895
+    "__std_sys_nerr" @896
+    "__std_sysconf" @897
+    "__std_system" @898
+    "__std_tan" @899
+    "__std_tanh" @900
+    "__std_tanhl" @901
+    "__std_tanl" @902
+    "__std_tcdrain" @903
+    "__std_tcflow" @904
+    "__std_tcflush" @905
+    "__std_tcgetattr" @906
+    "__std_tcgetpgrp" @907
+    "__std_tcsendbreak" @908
+    "__std_tcsetattr" @909
+    "__std_tcsetpgrp" @910
+    "__std_tdelete" @911
+    "__std_tell" @912
+    "__std_telldir" @913
+    "__std_tempnam" @914
+    "__std_tfind" @915
+    "__std_time" @916
+    "__std_times" @917
+    "__std_tmpfile" @918
+    "__std_tmpnam" @919
+    "__std_trunc" @920
+    "__std_truncate" @921
+    "__std_truncl" @922
+    "__std_tsearch" @923
+    "__std_ttyname" @924
+    "__std_twalk" @925
+    "__std_tzset" @926
+    "__std_ulimit" @927
+    "__std_ulltoa" @928
+    "__std_ultoa" @929
+    "__std_umask" @930
+    "__std_uname" @931
+    "__std_ungetc" @932
+    "__std_unlink" @933
+    "__std_unsetenv" @934
+    "__std_usleep" @935
+    "__std_utime" @936
+    "__std_utimes" @937
+    "__std_vfprintf" @938
+    "__std_vfscanf" @939
+    "__std_vprintf" @940
+    "__std_vscanf" @941
+    "__std_vsnprintf" @942
+    "__std_vsprintf" @943
+    "__std_vsscanf" @944
+    "__std_wait" @945
+    "__std_waitpid" @946
+    "__std_wcstombs" @947
+    "__std_wctomb" @948
+    "__std_write" @949
+    "__std_writev" @950
+    "__stream_read" @951
+    "__stream_write" @952
+    "__strncpy" @953
+    "__swchar" @954
+    "__sys_dump_heap_objs" @955
+    "__tcalloc" @956
+    "__tfree" @957
+    "__theapmin" @958
+    "__threadstore" @959
+    "__tmalloc" @960
+    "__tmpbuf1" @961
+    "__tmpidx_lock" @962
+    "__tmpidx_unlock" @963
+    "__tmpidxnam" @964
+    "__trealloc" @965
+    "__trslash" @966
+    "__uaddmem" @967
+    "__ucalloc" @968
+    "__uclose" @969
+    "__ucreate" @970
+    "__ucreate2" @971
+    "__udefault" @972
+    "__udestroy" @973
+    "__uflags" @974
+    "__uheap_type" @975
+    "__uheap_walk" @976
+    "__uheap_walk2" @977
+    "__uheapchk" @978
+    "__uheapmin" @979
+    "__uheapset" @980
+    "__uldiv" @981
+    "__um_addmem_nolock" @982
+    "__um_alloc_no_lock" @983
+    "__um_crumb_free_maybe_lock" @984
+    "__um_default_alloc" @985
+    "__um_default_expand" @986
+    "__um_default_release" @987
+    "__um_default_shrink" @988
+    "__um_find_bucket" @989
+    "__um_free_maybe_lock" @990
+    "__um_init_default_regular_heap" @991
+    "__um_init_default_tiled_heap" @992
+    "__um_lump_alloc" @993
+    "__um_lump_coalesce_free" @994
+    "__um_lump_free_maybe_lock" @995
+    "__um_lump_link_heap" @996
+    "__um_lump_make_free" @997
+    "__um_lump_unlink_bucket" @998
+    "__um_lump_unlink_heap" @999
+    "__um_realloc" @1000
+    "__um_seg_addmem" @1001
+    "__um_seg_setmem" @1002
+    "__um_walk_error" @1003
+    "__um_walk_no_lock" @1004
+    "__umalloc" @1005
+    "__ungetc_nolock" @1006
+    "__uopen" @1007
+    "__ustats" @1008
+    "__utcalloc" @1009
+    "__utdefault" @1010
+    "__utmalloc" @1011
+    "__vsopen" @1012
+    "__warn" @1013
+    "__wildcard" @1014
+    "__year_day" @1015
+    "_argz_delete" @1016
+    "_dbm_clearerr" @1017
+    "_dbm_close" @1018
+    "_dbm_delete" @1019
+    "_dbm_dirfno" @1020
+    "_dbm_error" @1021
+    "_dbm_fetch" @1022
+    "_dbm_firstkey" @1023
+    "_dbm_nextkey" @1024
+    "_dbm_open" @1025
+    "_dbm_store" @1026
+    "_dbopen" @1027
+    "_err_set_exit" @1028
+    "_err_set_file" @1029
+    "_errc" @1030
+    "_errx" @1031
+    "_getopt_long" @1032
+    "_heapsort" @1033
+    "_initstate" @1034
+    "_isalnum" @1035
+    "_isalpha" @1036
+    "_isascii" @1037
+    "_isblank" @1038
+    "_iscntrl" @1039
+    "_isdigit" @1040
+    "_isgraph" @1041
+    "_ishexnumber" @1042
+    "_islower" @1043
+    "_isnumber" @1044
+    "_isprint" @1045
+    "_ispunct" @1046
+    "_isspace" @1047
+    "_isupper" @1048
+    "_isxdigit" @1049
+    "_lchmod" @1050
+    "_mergesort" @1051
+    "_mpool_close" @1052
+    "_mpool_filter" @1053
+    "_mpool_get" @1054
+    "_mpool_new" @1055
+    "_mpool_open" @1056
+    "_mpool_put" @1057
+    "_mpool_sync" @1058
+    "_posix_spawn" @1059
+    "_posix_spawn_file_actions_addclose" @1060
+    "_posix_spawn_file_actions_adddup2" @1061
+    "_posix_spawn_file_actions_addopen" @1062
+    "_posix_spawn_file_actions_destroy" @1063
+    "_posix_spawn_file_actions_init" @1064
+    "_posix_spawnattr_destroy" @1065
+    "_posix_spawnattr_getflags" @1066
+    "_posix_spawnattr_getpgroup" @1067
+    "_posix_spawnattr_getschedparam" @1068
+    "_posix_spawnattr_getschedpolicy" @1069
+    "_posix_spawnattr_getsigdefault" @1070
+    "_posix_spawnattr_getsigmask" @1071
+    "_posix_spawnattr_init" @1072
+    "_posix_spawnattr_setflags" @1073
+    "_posix_spawnattr_setpgroup" @1074
+    "_posix_spawnattr_setschedparam" @1075
+    "_posix_spawnattr_setschedpolicy" @1076
+    "_posix_spawnattr_setsigdefault" @1077
+    "_posix_spawnattr_setsigmask" @1078
+    "_posix_spawnp" @1079
+    "_radixsort" @1080
+    "_random" @1081
+    "_reallocf" @1082
+    "_regcomp" @1083
+    "_regerror" @1084
+    "_regexec" @1085
+    "_regfree" @1086
+    "_setprogname" @1087
+    "_setstate" @1088
+    "_sig_info" @1089
+    "_sradixsort" @1090
+    "_srandom" @1091
+    "_srandomdev" @1092
+    "_stpcpy" @1093
+    "_strcasestr" @1094
+    "_strlcat" @1095
+    "_strlcpy" @1096
+    "_strnstr" @1097
+    "_strsep" @1098
+    "_strsignal" @1099
+    "_sys_exception" @1100
+    "_sys_nsig" @1101
+    "_sys_siglist" @1102
+    "_sys_signame" @1103
+    "_toascii" @1104
+    "_tolower" @1105
+    "_toupper" @1106
+    "_verr" @1107
+    "_verrc" @1108
+    "_verrx" @1109
+    "_vwarn" @1110
+    "_vwarnc" @1111
+    "_vwarnx" @1112
+    "_warnc" @1113
+    "_warnx" @1114
 
-    "___libc_Back_threadCleanup" @1106
-    "___libc_Back_threadEnd" @1107
-    "___libc_Back_threadInit" @1108
-    "___libc_Back_threadStartup" @1109
-    "___libc_TLSAlloc" @1110
-    "___libc_TLSFree" @1111
-    "___libc_TLSGet" @1112
-    "___libc_TLSSet" @1113
Index: trunk/src/emx/src/lib/process/beginthr.c
===================================================================
--- trunk/src/emx/src/lib/process/beginthr.c	(revision 1288)
+++ trunk/src/emx/src/lib/process/beginthr.c	(revision 1289)
@@ -13,5 +13,6 @@
 #include <InnoTekLIBC/thread.h>
 #include <InnoTekLIBC/backend.h>
-
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_THREAD
+#include <InnoTekLIBC/logstrict.h>
 
 /**
@@ -22,4 +23,5 @@
 static void _System threadWrapper(__LIBC_PTHREAD pThrd)
 {
+    LIBCLOG_ENTER("pThrd=%p\n", pThrd);
     int                         tid;
     EXCEPTIONREGISTRATIONRECORD reg;
@@ -27,5 +29,7 @@
 
     __libc_Back_threadStartup(&reg);
+    LIBCLOG_MSG("calling thread function %p with arg %p\n", pThrd->u.startup.pfnStart, pThrd->u.startup.pvArg);
     pThrd->u.startup.pfnStart(pThrd->u.startup.pvArg);
+    LIBCLOG_MSG("thread function returned\n");
 
     FS_SAVE_LOAD();
@@ -33,4 +37,5 @@
     __libc_threadFree(pThrd);
     __libc_Back_threadEnd(&reg);
+    LIBCLOG_MSG("calling DosExit(%s, 0)\n", tid == 1 ? "EXIT_PROCESS" : "EXIT_THREAD");
     for (;;)
         DosExit(tid == 1 ? EXIT_PROCESS : EXIT_THREAD, 0);
@@ -40,4 +45,5 @@
 int _beginthread(void (*pfnStart)(void *), void *pvStack, unsigned cbStack, void *pvArg)
 {
+    LIBCLOG_ENTER("pfnStart=%p pvStart=%p cbStack=%d pvArg=%p\n", pfnStart, pvStack, cbStack, pvArg);
     APIRET          rc;
     TID             tid;
@@ -52,5 +58,5 @@
     {
         errno = ENOMEM;
-        return -1;
+        LIBCLOG_RETURN_INT(-1);
     }
 
@@ -68,9 +74,10 @@
     FS_RESTORE();
     if (!rc)
-        return tid;
+        LIBCLOG_RETURN_INT((int)tid);
 
     /*
      * Set errno and cleanup.
      */
+    LIBC_ASSERTM_FAILED("DosCreateThread failed with rc=%u cbStack=%u\n", rc, (unsigned)cbStack);
     if (rc == ERROR_NOT_ENOUGH_MEMORY)
         errno = ENOMEM;
@@ -80,5 +87,5 @@
         errno = EINVAL;
     __libc_threadFree(pThrd);
-    return -1;
+    LIBCLOG_RETURN_INT(-1);
 }
 
@@ -86,4 +93,5 @@
 void _endthread(void)
 {
+    LIBCLOG_ENTER("\n");
     __LIBC_PTHREAD  pThrd = __libc_threadCurrent();
     int             tid;
@@ -93,4 +101,5 @@
     tid = _gettid();
     __libc_threadFree(pThrd);
+    LIBCLOG_MSG("calling DosExit(%s, 0)\n", tid == 1 ? "EXIT_PROCESS" : "EXIT_THREAD");
     for (;;)
         DosExit(tid == 1 ? EXIT_PROCESS : EXIT_THREAD, 0);
Index: trunk/src/emx/src/lib/process/execl.c
===================================================================
--- trunk/src/emx/src/lib/process/execl.c	(revision 1288)
+++ trunk/src/emx/src/lib/process/execl.c	(revision 1289)
@@ -5,12 +5,15 @@
 #include <stdarg.h>
 #include <process.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_PROCESS
+#include <InnoTekLIBC/logstrict.h>
 
 int _STD(execl) (const char *name, const char *arg0, ...)
 {
-  int result;
+    LIBCLOG_ENTER("name=%s arg0=%s ...\n", name, arg0);
+    int result;
 
-  /* Note: Passing `arg0' to spawnv() is not portable. */
+    /* Note: Passing `arg0' to spawnv() is not portable. */
 
-  result = spawnv (P_OVERLAY, name, (char * const *) &arg0);
-  return result;
+    result = spawnv(P_OVERLAY, name, (char * const *) &arg0);
+    LIBCLOG_RETURN_INT(result);
 }
Index: trunk/src/emx/src/lib/process/execle.c
===================================================================
--- trunk/src/emx/src/lib/process/execle.c	(revision 1288)
+++ trunk/src/emx/src/lib/process/execle.c	(revision 1289)
@@ -5,20 +5,23 @@
 #include <stdarg.h>
 #include <process.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_PROCESS
+#include <InnoTekLIBC/logstrict.h>
 
-int _STD(execle) (const char *name, const char *arg0, ...)
+int _STD(execle)(const char *name, const char *arg0, ...)
 {
-  va_list arg_ptr;
-  char * const *env_ptr;
-  int result;
+    LIBCLOG_ENTER("name=%s arg0=%s ...\n", name, arg0);
+    va_list arg_ptr;
+    char * const *env_ptr;
+    int rc;
 
-  va_start (arg_ptr, arg0);
-  while (va_arg (arg_ptr, char *) != NULL)
-    /* do nothing */;
-  env_ptr = va_arg (arg_ptr, char * const *);
-  va_end (arg_ptr);
+    va_start(arg_ptr, arg0);
+    while (va_arg(arg_ptr, char *) != NULL)
+        /* do nothing */;
+    env_ptr = va_arg(arg_ptr, char * const *);
+    va_end(arg_ptr);
 
-  /* Note: Passing `&arg0' to spawnve() is not portable. */
+    /* Note: Passing `&arg0' to spawnve() is not portable. */
 
-  result = spawnve (P_OVERLAY, name, (char * const *)&arg0, env_ptr);
-  return result;
+    rc = spawnve(P_OVERLAY, name, (char * const *)&arg0, env_ptr);
+    LIBCLOG_RETURN_INT(rc);
 }
Index: trunk/src/emx/src/lib/process/execlp.c
===================================================================
--- trunk/src/emx/src/lib/process/execlp.c	(revision 1288)
+++ trunk/src/emx/src/lib/process/execlp.c	(revision 1289)
@@ -5,12 +5,15 @@
 #include <stdarg.h>
 #include <process.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_PROCESS
+#include <InnoTekLIBC/logstrict.h>
 
-int _STD(execlp) (const char *name, const char *arg0, ...)
+int _STD(execlp)(const char *name, const char *arg0, ...)
 {
-  int result;
+    LIBCLOG_ENTER("name=%s arg0=%s ...\n", name, arg0);
+    int rc;
 
-  /* Note: Passing `&arg0' to spawnvp() is not portable. */
+    /* Note: Passing `&arg0' to spawnvp() is not portable. */
 
-  result = spawnvp (P_OVERLAY, name, (char * const *)&arg0);
-  return result;
+    rc = spawnvp(P_OVERLAY, name, (char * const *)&arg0);
+    LIBCLOG_RETURN_INT(rc);
 }
Index: trunk/src/emx/src/lib/process/execlpe.c
===================================================================
--- trunk/src/emx/src/lib/process/execlpe.c	(revision 1288)
+++ trunk/src/emx/src/lib/process/execlpe.c	(revision 1289)
@@ -5,20 +5,22 @@
 #include <stdarg.h>
 #include <process.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_PROCESS
+#include <InnoTekLIBC/logstrict.h>
 
-int _STD(execlpe) (const char *name, const char *arg0, ...)
+int _STD(execlpe)(const char *name, const char *arg0, ...)
 {
-  va_list arg_ptr;
-  char * const *env_ptr;
-  int result;
+    LIBCLOG_ENTER("name=%s arg0=%s ...\n", name, arg0);
+    va_list arg_ptr;
+    char * const *env_ptr;
+    int rc;
 
-  va_start (arg_ptr, arg0);
-  while (va_arg (arg_ptr, char *) != NULL)
-    /* do nothing */;
-  env_ptr = va_arg (arg_ptr, char * const *);
-  va_end (arg_ptr);
+    va_start(arg_ptr, arg0);
+    while (va_arg(arg_ptr, char *) != NULL)
+        /* do nothing */;
+    env_ptr = va_arg(arg_ptr, char * const *);
+    va_end(arg_ptr);
 
-  /* Note: Passing `&arg0' to spawnvpe() is not portable. */
-
-  result = spawnvpe (P_OVERLAY, name, (char * const *)&arg0, env_ptr);
-  return result;
+    /* Note: Passing `&arg0' to spawnvpe() is not portable. */
+    rc = spawnvpe(P_OVERLAY, name, (char * const *)&arg0, env_ptr);
+    LIBCLOG_RETURN_INT(rc);
 }
Index: trunk/src/emx/src/lib/process/execv.c
===================================================================
--- trunk/src/emx/src/lib/process/execv.c	(revision 1288)
+++ trunk/src/emx/src/lib/process/execv.c	(revision 1289)
@@ -3,7 +3,11 @@
 #include "libc-alias.h"
 #include <process.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_PROCESS
+#include <InnoTekLIBC/logstrict.h>
 
-int _STD(execv) (const char *name, char * const argv[])
+int _STD(execv)(const char *name, char * const argv[])
 {
-  return spawnv (P_OVERLAY, name, argv);
+    LIBCLOG_ENTER("name=%s argv=%p\n", name, argv);
+    int rc = spawnv(P_OVERLAY, name, argv);
+    LIBCLOG_RETURN_INT(rc);
 }
Index: trunk/src/emx/src/lib/process/execve.c
===================================================================
--- trunk/src/emx/src/lib/process/execve.c	(revision 1288)
+++ trunk/src/emx/src/lib/process/execve.c	(revision 1289)
@@ -3,7 +3,11 @@
 #include "libc-alias.h"
 #include <process.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_PROCESS
+#include <InnoTekLIBC/logstrict.h>
 
-int _STD(execve) (const char *name, char * const argv[], char * const envp[])
+int _STD(execve)(const char *name, char * const argv[], char * const envp[])
 {
-  return spawnve (P_OVERLAY, name, argv, envp);
+    LIBCLOG_ENTER("name=%s argv=%p envp=%p\n", name, argv, envp);
+    int rc = spawnve(P_OVERLAY, name, argv, envp);
+    LIBCLOG_RETURN_INT(rc);
 }
Index: trunk/src/emx/src/lib/process/execvp.c
===================================================================
--- trunk/src/emx/src/lib/process/execvp.c	(revision 1288)
+++ trunk/src/emx/src/lib/process/execvp.c	(revision 1289)
@@ -3,7 +3,11 @@
 #include "libc-alias.h"
 #include <process.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_PROCESS
+#include <InnoTekLIBC/logstrict.h>
 
-int _STD(execvp) (const char *name, char * const argv[])
+int _STD(execvp)(const char *name, char * const argv[])
 {
-  return spawnvp (P_OVERLAY, name, argv);
+    LIBCLOG_ENTER("name=%s argv=%s\n", name, argv);
+    int rc = spawnvp(P_OVERLAY, name, argv);
+    LIBCLOG_RETURN_INT(rc);
 }
Index: trunk/src/emx/src/lib/process/execvpe.c
===================================================================
--- trunk/src/emx/src/lib/process/execvpe.c	(revision 1288)
+++ trunk/src/emx/src/lib/process/execvpe.c	(revision 1289)
@@ -3,7 +3,11 @@
 #include "libc-alias.h"
 #include <process.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_PROCESS
+#include <InnoTekLIBC/logstrict.h>
 
-int _STD(execvpe) (const char *name, char * const argv[], char * const envp[])
+int _STD(execvpe)(const char *name, char * const argv[], char * const envp[])
 {
-  return spawnvpe (P_OVERLAY, name, argv, envp);
+    LIBCLOG_ENTER("name=%s argv=%s envp=%s\n", name, argv, envp);
+    int rc = spawnvpe(P_OVERLAY, name, argv, envp);
+    LIBCLOG_RETURN_INT(rc);
 }
Index: trunk/src/emx/src/lib/process/fmutex.c
===================================================================
--- trunk/src/emx/src/lib/process/fmutex.c	(revision 1288)
+++ trunk/src/emx/src/lib/process/fmutex.c	(revision 1289)
@@ -11,194 +11,205 @@
 #include <sys/fmutex.h>
 #include <sys/smutex.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_MUTEX
+#include <InnoTekLIBC/logstrict.h>
 
 /* These functions are available even in single-thread libraries. */
 
 
-unsigned _fmutex_create (_fmutex *sem, unsigned flags)
-{
-  unsigned rc;
-  FS_VAR();
-  sem->fs = _FMS_AVAILABLE;
-  sem->flags = flags;
-  sem->padding[0] = 'f';
-  sem->padding[1] = 'm';
-  FS_SAVE_LOAD();
-  rc = DosCreateEventSem (NULL, (PHEV)&sem->hev,
-                          (flags & _FMC_SHARED) ? DC_SEM_SHARED : 0,
+unsigned _fmutex_create(_fmutex *sem, unsigned flags)
+{
+    LIBCLOG_ENTER("sem=%p flags=%#x\n", sem, flags);
+    unsigned rc;
+    FS_VAR();
+    sem->fs         = _FMS_AVAILABLE;
+    sem->flags      = flags;
+    sem->padding[0] = 'f';
+    sem->padding[1] = 'm';
+    FS_SAVE_LOAD();
+    rc = DosCreateEventSem(NULL, (PHEV)&sem->hev,
+                           (flags & _FMC_SHARED) ? DC_SEM_SHARED : 0,
                            FALSE);
-  FS_RESTORE();
-  return rc;
-}
-
-
-unsigned _fmutex_open (_fmutex *sem)
-{
-  unsigned rc;
-  FS_VAR();
-  FS_SAVE_LOAD();
-  rc = DosOpenEventSem (NULL, (PHEV)&sem->hev);
-  FS_RESTORE();
-  return rc;
-}
-
-
-unsigned _fmutex_close (_fmutex *sem)
-{
-  unsigned rc;
-  FS_VAR();
-  FS_SAVE_LOAD();
-  rc = DosCloseEventSem (sem->hev);
-  FS_RESTORE();
-  return rc;
-}
-
-
-unsigned __fmutex_request_internal (_fmutex *sem, unsigned flags,
-                                    signed char fs)
-{
-  ULONG rc, count;
-  PTIB  pTib;
-  PPIB  pPib;
-
-  if (fs == _FMS_UNINIT)
-    return ERROR_INVALID_HANDLE;
-
-  if (flags & _FMR_NOWAIT)
-    {
-      if (fs == _FMS_OWNED_HARD)
+    FS_RESTORE();
+    LIBCLOG_RETURN_UINT(rc);
+}
+
+
+unsigned _fmutex_open(_fmutex *sem)
+{
+    LIBCLOG_ENTER("sem=%p\n", sem);
+    unsigned rc;
+    FS_VAR();
+    FS_SAVE_LOAD();
+    rc = DosOpenEventSem(NULL, (PHEV)&sem->hev);
+    FS_RESTORE();
+    LIBCLOG_RETURN_UINT(rc);
+}
+
+
+unsigned _fmutex_close(_fmutex *sem)
+{
+    LIBCLOG_ENTER("sem=%p\n", sem);
+    unsigned rc;
+    FS_VAR();
+    FS_SAVE_LOAD();
+    rc = DosCloseEventSem(sem->hev);
+    FS_RESTORE();
+    LIBCLOG_RETURN_UINT(rc);
+}
+
+
+unsigned __fmutex_request_internal(_fmutex *sem, unsigned flags, signed char fs)
+{
+    LIBCLOG_ENTER("sem=%p flags=%#x fs=%#x\n", sem, flags, (int)fs);
+    ULONG rc, count;
+    PTIB  pTib;
+    PPIB  pPib;
+
+    if (fs == _FMS_UNINIT)
+    {
+        LIBC_ASSERTM_FAILED("Invalid handle, fs == _FMS_UNINIT\n");
+        LIBCLOG_RETURN_UINT(ERROR_INVALID_HANDLE);
+    }
+
+    if (flags & _FMR_NOWAIT)
+    {
+        if (fs == _FMS_OWNED_HARD)
         {
-          if (__cxchg (&sem->fs, _FMS_OWNED_HARD) == _FMS_AVAILABLE)
-            return 0;
+            if (__cxchg(&sem->fs, _FMS_OWNED_HARD) == _FMS_AVAILABLE)
+                LIBCLOG_RETURN_UINT(0);
         }
-      return ERROR_MUTEX_OWNED;
-    }
-
-  for (;;)
-    {
-      FS_VAR();
-      FS_SAVE_LOAD();
-      rc = DosResetEventSem (sem->hev, &count);
-      FS_RESTORE();
-      if (rc != 0 && rc != ERROR_ALREADY_RESET)
-        return rc;
-      if (__cxchg (&sem->fs, _FMS_OWNED_HARD) == _FMS_AVAILABLE)
-        return 0;
-      FS_SAVE_LOAD();
-
-      do
+        LIBCLOG_RETURN_UINT(ERROR_MUTEX_OWNED);
+    }
+
+    for (;;)
+    {
+        FS_VAR();
+        FS_SAVE_LOAD();
+        rc = DosResetEventSem(sem->hev, &count);
+        FS_RESTORE();
+        if (rc != 0 && rc != ERROR_ALREADY_RESET)
+            LIBCLOG_RETURN_UINT(rc);
+        if (__cxchg(&sem->fs, _FMS_OWNED_HARD) == _FMS_AVAILABLE)
+            LIBCLOG_RETURN_UINT(0);
+        FS_SAVE_LOAD();
+
+        do
         {
-          rc = DosWaitEventSem (sem->hev, sem->flags & _FMC_SHARED ? SEM_INDEFINITE_WAIT : 3000);
-          if (rc == ERROR_INTERRUPT)
+            rc = DosWaitEventSem (sem->hev, sem->flags & _FMC_SHARED ? SEM_INDEFINITE_WAIT : 3000);
+            if (rc == ERROR_INTERRUPT)
             {
-              /*
-               * An interrupt occured, this might be a bug in the wait, or
-               * more likely someone is killing us. If we're dying/exiting or
-               * something along those lines, we return to the caller no matter
-               * what flags it specified.
-               */
-              if (!(flags & _FMR_IGNINT))
-                  break;
-              DosGetInfoBlocks(&pTib, &pPib);
-              if (pPib->pib_flstatus & (0x40/*dying*/ | 0x04/*exiting all*/ | 0x02/*Exiting Thread 1*/ | 0x01/* ExitList */))
-                  break;
-              rc = ERROR_TIMEOUT;
+                /*
+                 * An interrupt occured, this might be a bug in the wait, or
+                 * more likely someone is killing us. If we're dying/exiting or
+                 * something along those lines, we return to the caller no matter
+                 * what flags it specified.
+                 */
+                if (!(flags & _FMR_IGNINT))
+                    break;
+                DosGetInfoBlocks(&pTib, &pPib);
+                if (pPib->pib_flstatus & (0x40/*dying*/ | 0x04/*exiting all*/ | 0x02/*Exiting Thread 1*/ | 0x01/* ExitList */))
+                    break;
+                rc = ERROR_TIMEOUT;
             }
-          if (rc == ERROR_TIMEOUT && !(sem->flags & _FMC_SHARED))
+            if (rc == ERROR_TIMEOUT && !(sem->flags & _FMC_SHARED))
             {
-              /*
-               * Deadlock detection - if this is the only thread of the
-               * process we should just kill our selves.
-               * ASSUME thread ids are reused and upper thread limit or 4k.
-               */
-              int iThread;
-              DosGetInfoBlocks(&pTib, &pPib);
-              for (iThread = 1; iThread < 4096; iThread++)
+                /*
+                 * Deadlock detection - if this is the only thread of the
+                 * process we should just kill our selves.
+                 * ASSUME thread ids are reused and upper thread limit or 4k.
+                 */
+                int iThread;
+                DosGetInfoBlocks(&pTib, &pPib);
+                for (iThread = 1; iThread < 4096; iThread++)
                 {
-                  if (   iThread != pTib->tib_ptib2->tib2_ultid
-                      && !DosVerifyPidTid(pPib->pib_ulpid, iThread))
-                      break;
+                    if (iThread != pTib->tib_ptib2->tib2_ultid
+                        && !DosVerifyPidTid(pPib->pib_ulpid, iThread))
+                        break;
                 }
-              if (iThread >= 4096)
+                if (iThread >= 4096)
                 { /* No other threads! */
-                  ULONG ul;
-                  DosWrite((HFILE)2/*stderr*/, "\r\n!!!deadlock!!!\r\r", 18, &ul);
-                  __asm__ __volatile__ ("movl $0xdead10cc, %%eax; movl $0xdead10cc, %%edx; movl %0, %%ecx; int $3" : : "m" (sem) : "%eax", "%edx", "%ecx");
-                  rc = ERROR_SEM_OWNER_DIED;
-                  break;
+                    ULONG ul;
+                    DosWrite((HFILE)2/*stderr*/, "\r\n!!!deadlock!!!\r\r", 18, &ul);
+                    __asm__ __volatile__("movl $0xdead10cc, %%eax; movl $0xdead10cc, %%edx; movl %0, %%ecx; int $3" : : "m" (sem) : "%eax", "%edx", "%ecx");
+                    rc = ERROR_SEM_OWNER_DIED;
+                    break;
                 }
             }
         } while (rc == ERROR_TIMEOUT);
-      FS_RESTORE();
-      if (rc != 0)
-        return rc;
-    }
-}
-
-
-unsigned __fmutex_release_internal (_fmutex *sem)
-{
-  ULONG rc;
-  FS_VAR();
-
-  FS_SAVE_LOAD();
-  rc = DosPostEventSem (sem->hev);
-  if (rc != 0 && rc != ERROR_ALREADY_POSTED)
-    {
-      FS_RESTORE();
-      return rc;
-    }
-
-  /* Give up our time slice to give other threads a chance.  Without
-     doing so, a thread which continuously requests and releases a
-     _fmutex semaphore may prevent all other threads requesting the
-     _fmutex semaphore from running, forever.
-
-     Why?  Without DosSleep, the thread will keep the CPU for the rest
-     of the time slice.  It may request (and get) the semaphore again
-     in the same time slice, perhaps multiple times.  Assume that the
-     semaphore is still owned at the end of the time slice.  In one of
-     the next time slices, all the other threads blocking on the
-     semaphore will wake up for a short while only to see that the
-     semaphore is owned; they will all go sleeping again.  The thread
-     which owns the semaphore will get the CPU again.  And may happen
-     to own the semaphore again at the end of the time slice.  And so
-     on.  DosSleep reduces that problem a bit.
-
-     Even with DosSleep(0), assignment of time slices to threads
-     requesting a _fmutex semaphore can be quite unbalanced: The more
-     frequently a thread requests a _fmutex semaphore, the more CPU
-     time it will get.  In consequence, a thread which only rarely
-     needs the resource protected by the _fmutex semaphore will get
-     much less CPU time than threads competing heavily for the
-     resource.
-
-     DosSleep(1) would make _fmutex semaphores behave a bit better,
-     but would also give up way too much CPU time (in the average,
-     half a time slice (or one and a half?) per call of this
-     function).
-
-     DosReleaseMutexSem does a better job; it gives the time slice to
-     the thread which has waited longest on the semaphore (if all the
-     threads have the same priority).
-
-     Unfortunately, we cannot use an HMTX instead of an HEV because
-     only the owner (the thread which got assigned ownership by
-     DosRequestMutexSem) can release the HMTX with DosReleaseMutexSem.
-     If we could, that would take advantage of the FIFO of blocked
-     threads maintained by the kernel for each HMTX.
-
-     Using an HMTX would require the first thread requesting an owned
-     _fmutex semaphore to request the HMTX on behalf of the thread
-     owning the _fmutex semaphore. */
-
-  DosSleep (0);
-  FS_RESTORE();
-  return 0;
-}
-
-
-void _fmutex_dummy (_fmutex *sem)
-{
-  sem->fs = _FMS_AVAILABLE;
-  sem->hev = 0;
-}
+        FS_RESTORE();
+        if (rc != 0)
+            LIBCLOG_RETURN_UINT(rc);
+    }
+}
+
+
+unsigned __fmutex_release_internal(_fmutex *sem)
+{
+    LIBCLOG_ENTER("sem=%p\n", sem);
+    ULONG rc;
+    FS_VAR();
+
+    FS_SAVE_LOAD();
+    rc = DosPostEventSem(sem->hev);
+    if (rc != 0 && rc != ERROR_ALREADY_POSTED)
+    {
+        FS_RESTORE();
+        LIBCLOG_RETURN_UINT(rc);
+    }
+
+    /* Give up our time slice to give other threads a chance.  Without
+       doing so, a thread which continuously requests and releases a
+       _fmutex semaphore may prevent all other threads requesting the
+       _fmutex semaphore from running, forever.
+
+       Why?  Without DosSleep, the thread will keep the CPU for the rest
+       of the time slice.  It may request (and get) the semaphore again
+       in the same time slice, perhaps multiple times.  Assume that the
+       semaphore is still owned at the end of the time slice.  In one of
+       the next time slices, all the other threads blocking on the
+       semaphore will wake up for a short while only to see that the
+       semaphore is owned; they will all go sleeping again.  The thread
+       which owns the semaphore will get the CPU again.  And may happen
+       to own the semaphore again at the end of the time slice.  And so
+       on.  DosSleep reduces that problem a bit.
+
+       Even with DosSleep(0), assignment of time slices to threads
+       requesting a _fmutex semaphore can be quite unbalanced: The more
+       frequently a thread requests a _fmutex semaphore, the more CPU
+       time it will get.  In consequence, a thread which only rarely
+       needs the resource protected by the _fmutex semaphore will get
+       much less CPU time than threads competing heavily for the
+       resource.
+
+       DosSleep(1) would make _fmutex semaphores behave a bit better,
+       but would also give up way too much CPU time (in the average,
+       half a time slice (or one and a half?) per call of this
+       function).
+
+       DosReleaseMutexSem does a better job; it gives the time slice to
+       the thread which has waited longest on the semaphore (if all the
+       threads have the same priority).
+
+       Unfortunately, we cannot use an HMTX instead of an HEV because
+       only the owner (the thread which got assigned ownership by
+       DosRequestMutexSem) can release the HMTX with DosReleaseMutexSem.
+       If we could, that would take advantage of the FIFO of blocked
+       threads maintained by the kernel for each HMTX.
+
+       Using an HMTX would require the first thread requesting an owned
+       _fmutex semaphore to request the HMTX on behalf of the thread
+       owning the _fmutex semaphore. */
+
+    DosSleep(0);
+    FS_RESTORE();
+    LIBCLOG_RETURN_UINT(0);
+}
+
+
+void _fmutex_dummy(_fmutex *sem)
+{
+    LIBCLOG_ENTER("sem=%p\n", sem);
+    sem->fs  = _FMS_AVAILABLE;
+    sem->hev = 0;
+    LIBCLOG_RETURN_VOID();
+}
Index: trunk/src/emx/src/lib/process/fmutex2.c
===================================================================
--- trunk/src/emx/src/lib/process/fmutex2.c	(revision 1288)
+++ trunk/src/emx/src/lib/process/fmutex2.c	(revision 1289)
@@ -5,25 +5,42 @@
 #include <sys/builtin.h>
 #include <sys/fmutex.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_MUTEX
+#include <InnoTekLIBC/logstrict.h>
 
 /* These functions call abort() and therefore must not be linked in
    when building emx.dll. */
 
-void _fmutex_checked_close (_fmutex *sem)
+void _fmutex_checked_close(_fmutex *sem)
 {
-  if (_fmutex_close (sem) != 0)
-    abort ();
+    LIBCLOG_ENTER("sem=%p\n", sem);
+    if (_fmutex_close(sem) != 0)
+    {
+        LIBC_ASSERT_FAILED();
+        abort();
+    }
+    LIBCLOG_RETURN_VOID();
 }
 
 
-void _fmutex_checked_create (_fmutex *sem, unsigned flags)
+void _fmutex_checked_create(_fmutex *sem, unsigned flags)
 {
-  if (_fmutex_create (sem, flags) != 0)
-    abort ();
+    LIBCLOG_ENTER("sem=%p flags=%#x\n", sem, flags);
+    if (_fmutex_create(sem, flags) != 0)
+    {
+        LIBC_ASSERT_FAILED();
+        abort();
+    }
+    LIBCLOG_RETURN_VOID();
 }
 
 
-void _fmutex_checked_open (_fmutex *sem)
+void _fmutex_checked_open(_fmutex *sem)
 {
-  if (_fmutex_open (sem) != 0)
-    abort ();
+    LIBCLOG_ENTER("sem=%p\n", sem);
+    if (_fmutex_open(sem) != 0)
+    {
+        LIBC_ASSERT_FAILED();
+        abort();
+    }
+    LIBCLOG_RETURN_VOID();
 }
Index: trunk/src/emx/src/lib/process/fork.c
===================================================================
--- trunk/src/emx/src/lib/process/fork.c	(revision 1288)
+++ trunk/src/emx/src/lib/process/fork.c	(revision 1289)
@@ -4,14 +4,15 @@
 #include <process.h>
 #include <emx/syscalls.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_PROCESS
+#include <InnoTekLIBC/logstrict.h>
 
-extern void _rmutex_fork (void);
+extern void _rmutex_fork(void);
 
-int _STD(fork) (void)
+int _STD(fork)(void)
 {
-  int pid;
-
-  pid = __fork ();
-  if (pid == 0)
-    _rmutex_fork ();
-  return pid;
+    LIBCLOG_ENTER("\n");
+    int pid = __fork();
+    if (pid == 0)
+        _rmutex_fork();
+    LIBCLOG_RETURN_INT(pid);
 }
Index: trunk/src/emx/src/lib/process/rmutex.c
===================================================================
--- trunk/src/emx/src/lib/process/rmutex.c	(revision 1288)
+++ trunk/src/emx/src/lib/process/rmutex.c	(revision 1289)
@@ -9,165 +9,200 @@
 #include <sys/fmutex.h>
 #include <sys/rmutex.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_MUTEX
+#include <InnoTekLIBC/logstrict.h>
 
 /* These functions are available even in single-thread libraries. */
-
 
 static _rmutex *_rmutex_head;   /* Initialized to NULL */
 static _rmutex *_rmutex_tail;   /* Initialized to NULL */
 
-static void _rmutex_add (_rmutex *sem)
-{
-  sem->prev = NULL;
-  if (_rmutex_head == NULL)
-    _rmutex_tail = sem;
-  else
-    _rmutex_head->prev = sem;
-  sem->next = _rmutex_head;
-  _rmutex_head = sem;
-}
-
-
-static void _rmutex_remove (_rmutex *sem)
-{
-  if (sem->prev == NULL)
-    _rmutex_head = sem->next;
-  else
-    sem->prev->next = sem->next;
-  if (sem->next == NULL)
-    _rmutex_tail = sem->prev;
-  else
-    sem->next->prev = sem->prev;
-}
-
-
-unsigned _rmutex_create (_rmutex *sem, unsigned flags)
-{
-  unsigned rc;
-
-  rc = _fmutex_create (&sem->fm, flags);
-  if (rc == 0)
+static void _rmutex_add(_rmutex *sem)
+{
+    sem->prev = NULL;
+    if (_rmutex_head == NULL)
+        _rmutex_tail = sem;
+    else
+        _rmutex_head->prev = sem;
+    sem->next = _rmutex_head;
+    _rmutex_head = sem;
+}
+
+
+static void _rmutex_remove(_rmutex *sem)
+{
+    if (sem->prev == NULL)
+        _rmutex_head = sem->next;
+    else
+        sem->prev->next = sem->next;
+    if (sem->next == NULL)
+        _rmutex_tail = sem->prev;
+    else
+        sem->next->prev = sem->prev;
+}
+
+
+unsigned _rmutex_create(_rmutex *sem, unsigned flags)
+{
+    LIBCLOG_ENTER("sem=%p flags=%#x\n", sem, flags);
+    unsigned rc;
+
+    rc = _fmutex_create (&sem->fm, flags);
+    if (rc == 0)
     {
 #if !defined (NDEBUG)
-      _rmutex *p;
-      for (p = _rmutex_head; p != NULL; p = p->next)
-        if (sem == p)
-          abort ();
+        _rmutex *p;
+        for (p = _rmutex_head; p != NULL; p = p->next)
+            if (sem == p)
+            {
+                LIBC_ASSERT_FAILED();
+                abort();
+            }
 #endif
-      sem->count = 1;
-      sem->flags = (unsigned char)flags;
-      if (flags & _FMC_SHARED)
-        {
-          /* Shared _rmutex semaphores cannot be registered -- that
-             would mess up the doubly-linked list. */
-
-          sem->next = NULL;
-          sem->prev = NULL;
-        }
-      else
-        _rmutex_add (sem);
-    }
-  return rc;
-}
-
-
-unsigned _rmutex_open (_rmutex *sem)
-{
-  unsigned rc;
-
-  rc = _fmutex_open (&sem->fm);
-  if (rc == 0)
+        sem->count = 1;
+        sem->flags = (unsigned char)flags;
+        if (flags & _FMC_SHARED)
+        {
+            /* Shared _rmutex semaphores cannot be registered -- that
+               would mess up the doubly-linked list. */
+
+            sem->next = NULL;
+            sem->prev = NULL;
+        }
+        else
+            _rmutex_add(sem);
+    }
+    LIBCLOG_RETURN_UINT(rc);
+}
+
+
+unsigned _rmutex_open(_rmutex *sem)
+{
+    LIBCLOG_ENTER("sem=%p\n", sem);
+    unsigned rc;
+
+    rc = _fmutex_open(&sem->fm);
+    if (rc == 0)
     {
 #if !defined (NDEBUG)
-      _rmutex *p;
-      for (p = _rmutex_head; p != NULL; p = p->next)
-        if (sem == p)
-          break;
-      if (p == NULL)
-        abort ();
+        _rmutex *p;
+        for (p = _rmutex_head; p != NULL; p = p->next)
+            if (sem == p)
+                break;
+        if (p == NULL)
+        {
+            LIBC_ASSERT_FAILED();
+            abort();
+        }
 #endif
-      if (sem->count == USHRT_MAX)
-        abort ();
-      sem->count += 1;
-    }
-  return rc;
-}
-
-
-unsigned _rmutex_close (_rmutex *sem)
-{
-  unsigned rc;
-
-  rc = _fmutex_close (&sem->fm);
-
-  /* If it can't be closed, it probably wasn't created or opened.
-     Avoid messing up the doubly-linked list.  Shared semaphores
-     haven't been added to the list. */
-
-  if (rc == 0 && !(sem->flags & _FMC_SHARED))
-    {
-      if (sem->count == 0)
-        abort ();
-      sem->count -= 1;
-      if (sem->count == 0)
-        _rmutex_remove (sem);
-    }
-  return rc;
-}
-
-
-void _rmutex_dummy (_rmutex *sem)
-{
-  sem->prev = NULL;
-  sem->next = NULL;
-  sem->flags = 0;
-  sem->count = 0;
-  _fmutex_dummy (&sem->fm);
-}
-
-
-void _rmutex_checked_close (_rmutex *sem)
-{
-  if (_rmutex_close (sem) != 0)
-    abort ();
-}
-
-
-void _rmutex_checked_create (_rmutex *sem, unsigned flags)
-{
-  if (_rmutex_create (sem, flags) != 0)
-    abort ();
-}
-
-
-void _rmutex_checked_open (_rmutex *sem)
-{
-  if (_rmutex_open (sem) != 0)
-    abort ();
-}
-
-
-void _rmutex_fork (void);
-void _rmutex_fork (void)
-{
-  _rmutex *p;
-  unsigned i;
-
-  for (p = _rmutex_head; p != NULL; p = p->next)
-    {
-      if (p->flags & _FMC_SHARED)
-        _fmutex_checked_open (&p->fm);
-      else
-        _fmutex_checked_create (&p->fm, p->flags);
-
-      /* This is important for the _rmutex semaphores of heaps! */
-
-      for (i = 1; i < p->count; ++i)
-        _fmutex_checked_open (&p->fm);
-
-      /* Even if the semaphore was owned by the parent process, it's
-         available now in the child process.  This might cause
-         problems due to inconsistent data structures -- resolving
-         this problem (by making sure that all _rmutex semaphores are
-         available when calling fork()) is left to the application. */
-    }
-}
+        if (sem->count == USHRT_MAX)
+        {
+            LIBC_ASSERT_FAILED();
+            abort();
+        }
+        sem->count += 1;
+    }
+    LIBCLOG_RETURN_UINT(rc);
+}
+
+
+unsigned _rmutex_close(_rmutex *sem)
+{
+    LIBCLOG_ENTER("sem=%p\n", sem);
+    unsigned rc;
+
+    rc = _fmutex_close(&sem->fm);
+
+    /* If it can't be closed, it probably wasn't created or opened.
+       Avoid messing up the doubly-linked list.  Shared semaphores
+       haven't been added to the list. */
+
+    if (rc == 0 && !(sem->flags & _FMC_SHARED))
+    {
+        if (sem->count == 0)
+        {
+            LIBC_ASSERT_FAILED();
+            abort();
+        }
+        sem->count -= 1;
+        if (sem->count == 0)
+            _rmutex_remove(sem);
+    }
+    LIBCLOG_RETURN_UINT(rc);
+}
+
+
+void _rmutex_dummy(_rmutex *sem)
+{
+    LIBCLOG_ENTER("sem=%p\n", sem);
+    sem->prev = NULL;
+    sem->next = NULL;
+    sem->flags = 0;
+    sem->count = 0;
+    _fmutex_dummy(&sem->fm);
+    LIBCLOG_RETURN_VOID();
+}
+
+
+void _rmutex_checked_close(_rmutex *sem)
+{
+    LIBCLOG_ENTER("sem=%p\n", sem);
+    if (_rmutex_close(sem) != 0)
+    {
+        LIBC_ASSERT_FAILED();
+        abort();
+    }
+    LIBCLOG_RETURN_VOID();
+}
+
+
+void _rmutex_checked_create(_rmutex *sem, unsigned flags)
+{
+    LIBCLOG_ENTER("sem=%p flags=%d\n", sem, flags);
+    if (_rmutex_create(sem, flags) != 0)
+    {
+        LIBC_ASSERT_FAILED();
+        abort();
+    }
+    LIBCLOG_RETURN_VOID();
+}
+
+
+void _rmutex_checked_open(_rmutex *sem)
+{
+    LIBCLOG_ENTER("sem=%p\n", sem);
+    if (_rmutex_open(sem) != 0)
+    {
+        LIBC_ASSERT_FAILED();
+        abort();
+    }
+    LIBCLOG_RETURN_VOID();
+}
+
+
+void _rmutex_fork(void);
+void _rmutex_fork(void)
+{
+    LIBCLOG_ENTER("\n");
+    _rmutex *p;
+    unsigned i;
+
+    for (p = _rmutex_head; p != NULL; p = p->next)
+    {
+        if (p->flags & _FMC_SHARED)
+            _fmutex_checked_open(&p->fm);
+        else
+            _fmutex_checked_create(&p->fm, p->flags);
+
+        /* This is important for the _rmutex semaphores of heaps! */
+
+        for (i = 1; i < p->count; ++i)
+            _fmutex_checked_open(&p->fm);
+
+        /* Even if the semaphore was owned by the parent process, it's
+           available now in the child process.  This might cause
+           problems due to inconsistent data structures -- resolving
+           this problem (by making sure that all _rmutex semaphores are
+           available when calling fork()) is left to the application. */
+    }
+    LIBCLOG_RETURN_VOID();
+}
Index: trunk/src/emx/src/lib/process/sigaddse.c
===================================================================
--- trunk/src/emx/src/lib/process/sigaddse.c	(revision 1288)
+++ trunk/src/emx/src/lib/process/sigaddse.c	(revision 1289)
@@ -4,12 +4,18 @@
 #include <signal.h>
 #include <errno.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SIGNAL
+#include <InnoTekLIBC/logstrict.h>
 
 int _STD(sigaddset) (sigset_t *set, int sig)
 {
-  if (sig < 1 || sig >= NSIG)
+    LIBCLOG_ENTER("set=%p sig=%d\n", set, sig);
+    int rc;
+    if (sig < 1 || sig >= NSIG)
     {
-      errno = EINVAL;
-      return -1;
+        LIBC_ASSERTM_FAILED("invalid signal number %d\n", sig);
+        errno = EINVAL;
+        LIBCLOG_RETURN_INT(-1);
     }
-  return __sigaddset (set, sig);
+    rc = __sigaddset(set, sig);
+    LIBCLOG_RETURN_INT(rc);
 }
Index: trunk/src/emx/src/lib/process/sigdelse.c
===================================================================
--- trunk/src/emx/src/lib/process/sigdelse.c	(revision 1288)
+++ trunk/src/emx/src/lib/process/sigdelse.c	(revision 1289)
@@ -4,12 +4,18 @@
 #include <signal.h>
 #include <errno.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SIGNAL
+#include <InnoTekLIBC/logstrict.h>
 
-int _STD(sigdelset) (sigset_t *set, int sig)
+int _STD(sigdelset)(sigset_t *set, int sig)
 {
-  if (sig < 1 || sig >= NSIG)
+    LIBCLOG_ENTER("set=%p sig=%d\n", set, sig);
+    int rc;
+    if (sig < 1 || sig >= NSIG)
     {
-      errno = EINVAL;
-      return -1;
+        LIBC_ASSERTM_FAILED("invalid signal number %d\n", sig);
+        errno = EINVAL;
+        LIBCLOG_RETURN_INT(-1);
     }
-  return __sigdelset (set, sig);
+    rc = __sigdelset(set, sig);
+    LIBCLOG_RETURN_INT(rc);
 }
Index: trunk/src/emx/src/lib/process/sigempty.c
===================================================================
--- trunk/src/emx/src/lib/process/sigempty.c	(revision 1288)
+++ trunk/src/emx/src/lib/process/sigempty.c	(revision 1289)
@@ -3,7 +3,11 @@
 #include "libc-alias.h"
 #include <signal.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SIGNAL
+#include <InnoTekLIBC/logstrict.h>
 
-int _STD(sigemptyset) (sigset_t *set)
+int _STD(sigemptyset)(sigset_t *set)
 {
-  return __sigemptyset (set);
+    LIBCLOG_ENTER("set=%p\n", set);
+    int rc = __sigemptyset(set);
+    LIBCLOG_RETURN_INT(rc);
 }
Index: trunk/src/emx/src/lib/process/sigfills.c
===================================================================
--- trunk/src/emx/src/lib/process/sigfills.c	(revision 1288)
+++ trunk/src/emx/src/lib/process/sigfills.c	(revision 1289)
@@ -3,7 +3,11 @@
 #include "libc-alias.h"
 #include <signal.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SIGNAL
+#include <InnoTekLIBC/logstrict.h>
 
-int _STD(sigfillset) (sigset_t *set)
+int _STD(sigfillset)(sigset_t *set)
 {
-  return __sigfillset (set);
+    LIBCLOG_ENTER("set=%p\n", set);
+    int rc = __sigfillset(set);
+    LIBCLOG_RETURN_INT(rc);
 }
Index: trunk/src/emx/src/lib/process/sigismem.c
===================================================================
--- trunk/src/emx/src/lib/process/sigismem.c	(revision 1288)
+++ trunk/src/emx/src/lib/process/sigismem.c	(revision 1289)
@@ -4,12 +4,18 @@
 #include <signal.h>
 #include <errno.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SIGNAL
+#include <InnoTekLIBC/logstrict.h>
 
-int _STD(sigismember) (const sigset_t *set, int sig)
+int _STD(sigismember)(const sigset_t *set, int sig)
 {
-  if (sig < 1 || sig >= NSIG)
+    LIBCLOG_ENTER("set=%p sig=%d\n", set, sig);
+    int rc;
+    if (sig < 1 || sig >= NSIG)
     {
-      errno = EINVAL;
-      return -1;
+        LIBC_ASSERTM_FAILED("invalid signal number %d\n", sig);
+        errno = EINVAL;
+        LIBCLOG_RETURN_INT(-1);
     }
-  return __sigismember (set, sig);
+    rc = __sigismember(set, sig);
+    LIBCLOG_RETURN_INT(rc);
 }
Index: trunk/src/emx/src/lib/process/smutex.c
===================================================================
--- trunk/src/emx/src/lib/process/smutex.c	(revision 1288)
+++ trunk/src/emx/src/lib/process/smutex.c	(revision 1289)
@@ -7,14 +7,18 @@
 #include <sys/builtin.h>
 #include <sys/smutex.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_MUTEX
+#include <InnoTekLIBC/logstrict.h>
 
 
-void __smutex_request_internal (volatile _smutex *sem)
+void __smutex_request_internal(volatile _smutex *sem)
 {
-  FS_VAR();
-  FS_SAVE_LOAD();
-  do
+    LIBCLOG_ENTER("sem=%p\n", sem);
+    FS_VAR();
+    FS_SAVE_LOAD();
+    do
     {
-      DosSleep (1);
-    } while (__cxchg (sem, 1) != 0);
-  FS_RESTORE();
+        DosSleep(1);
+    } while (__cxchg(sem, 1) != 0);
+    FS_RESTORE();
+    LIBCLOG_RETURN_VOID();
 }
Index: trunk/src/emx/src/lib/process/spawnl.c
===================================================================
--- trunk/src/emx/src/lib/process/spawnl.c	(revision 1288)
+++ trunk/src/emx/src/lib/process/spawnl.c	(revision 1289)
@@ -5,12 +5,12 @@
 #include <stdarg.h>
 #include <process.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_PROCESS
+#include <InnoTekLIBC/logstrict.h>
 
-int _STD(spawnl) (int mode, const char *name, const char *arg0, ...)
+int _STD(spawnl)(int mode, const char *name, const char *arg0, ...)
 {
-  int result;
-
-  /* Note: Passing `&arg0' to spawnv() is not portable. */
-
-  result = spawnv (mode, name, (char * const *)&arg0);
-  return result;
+    LIBCLOG_ENTER("mode=%#x name=%s arg0=%s ...\n", mode, name, arg0);
+    /* Note: Passing `&arg0' to spawnv() is not portable. */
+    int rc = spawnv (mode, name, (char * const *)&arg0);
+    LIBCLOG_RETURN_INT(rc);
 }
Index: trunk/src/emx/src/lib/process/spawnle.c
===================================================================
--- trunk/src/emx/src/lib/process/spawnle.c	(revision 1288)
+++ trunk/src/emx/src/lib/process/spawnle.c	(revision 1289)
@@ -5,20 +5,22 @@
 #include <stdarg.h>
 #include <process.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_PROCESS
+#include <InnoTekLIBC/logstrict.h>
 
-int _STD(spawnle) (int mode, const char *name, const char *arg0, ...)
+int _STD(spawnle)(int mode, const char *name, const char *arg0, ...)
 {
-  va_list arg_ptr;
-  char * const *env_ptr;
-  int result;
+    LIBCLOG_ENTER("mode=%#x name=%s arg0=%s ...\n", mode, name, arg0);
+    va_list arg_ptr;
+    char * const *env_ptr;
+    int rc;
 
-  va_start (arg_ptr, arg0);
-  while (va_arg (arg_ptr, char *) != NULL)
-    /* do nothing */;
-  env_ptr = va_arg (arg_ptr, char * const *);
-  va_end (arg_ptr);
+    va_start(arg_ptr, arg0);
+    while (va_arg(arg_ptr, char *) != NULL)
+        /* do nothing */;
+    env_ptr = va_arg(arg_ptr, char * const *);
+    va_end(arg_ptr);
 
-  /* Note: Passing `&arg0' to spawnve() is not portable. */
-
-  result = spawnve (mode, name, (char * const *)&arg0, env_ptr);
-  return result;
+    /* Note: Passing `&arg0' to spawnve() is not portable. */
+    rc = spawnve(mode, name, (char * const *)&arg0, env_ptr);
+    LIBCLOG_RETURN_INT(rc);
 }
Index: trunk/src/emx/src/lib/process/spawnlp.c
===================================================================
--- trunk/src/emx/src/lib/process/spawnlp.c	(revision 1288)
+++ trunk/src/emx/src/lib/process/spawnlp.c	(revision 1289)
@@ -5,12 +5,12 @@
 #include <stdarg.h>
 #include <process.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_PROCESS
+#include <InnoTekLIBC/logstrict.h>
 
-int _STD(spawnlp) (int mode, const char *name, const char *arg0, ...)
+int _STD(spawnlp)(int mode, const char *name, const char *arg0, ...)
 {
-  int result;
-
-  /* Note: Passing `&arg0' to spawnvp() is not portable. */
-
-  result = spawnvp (mode, name, (char * const *)&arg0);
-  return result;
+    LIBCLOG_ENTER("mode=%#x name=%s arg0=%s ...\n", mode, name, arg0);
+    /* Note: Passing `&arg0' to spawnvp() is not portable. */
+    int rc = spawnvp(mode, name, (char * const *)&arg0);
+    LIBCLOG_RETURN_INT(rc);
 }
Index: trunk/src/emx/src/lib/process/spawnlpe.c
===================================================================
--- trunk/src/emx/src/lib/process/spawnlpe.c	(revision 1288)
+++ trunk/src/emx/src/lib/process/spawnlpe.c	(revision 1289)
@@ -5,20 +5,23 @@
 #include <stdarg.h>
 #include <process.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_PROCESS
+#include <InnoTekLIBC/logstrict.h>
 
-int _STD(spawnlpe) (int mode, const char *name, const char *arg0, ...)
+int _STD(spawnlpe)(int mode, const char *name, const char *arg0, ...)
 {
-  va_list arg_ptr;
-  char * const *env_ptr;
-  int result;
+    LIBCLOG_ENTER("mode=%#x name=%s arg0=%s ...\n", mode, name, arg0);
+    va_list arg_ptr;
+    char * const *env_ptr;
+    int rc;
 
-  va_start (arg_ptr, arg0);
-  while (va_arg (arg_ptr, char *) != NULL)
-    /* do nothing */;
-  env_ptr = va_arg (arg_ptr, char * const *);
-  va_end (arg_ptr);
+    va_start(arg_ptr, arg0);
+    while (va_arg(arg_ptr, char *) != NULL)
+        /* do nothing */;
+    env_ptr = va_arg(arg_ptr, char * const *);
+    va_end(arg_ptr);
 
-  /* Note: Passing `&arg0' to spawnvpe() is not portable. */
+    /* Note: Passing `&arg0' to spawnvpe() is not portable. */
 
-  result = spawnvpe (mode, name, (char * const *)&arg0, env_ptr);
-  return result;
+    rc = spawnvpe(mode, name, (char * const *)&arg0, env_ptr);
+    LIBCLOG_RETURN_INT(rc);
 }
Index: trunk/src/emx/src/lib/process/spawnv.c
===================================================================
--- trunk/src/emx/src/lib/process/spawnv.c	(revision 1288)
+++ trunk/src/emx/src/lib/process/spawnv.c	(revision 1289)
@@ -4,7 +4,11 @@
 #include <stddef.h>
 #include <process.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_PROCESS
+#include <InnoTekLIBC/logstrict.h>
 
-int _STD(spawnv) (int mode, const char *name, char * const argv[])
+int _STD(spawnv)(int mode, const char *name, char * const argv[])
 {
-  return spawnve (mode, name, argv, NULL);
+    LIBCLOG_ENTER("mode=%#x name=%s arg=%p\n", mode, name, argv);
+    int rc = spawnve (mode, name, argv, NULL);
+    LIBCLOG_RETURN_INT(rc);
 }
Index: trunk/src/emx/src/lib/process/spawnve.c
===================================================================
--- trunk/src/emx/src/lib/process/spawnve.c	(revision 1288)
+++ trunk/src/emx/src/lib/process/spawnve.c	(revision 1289)
@@ -7,67 +7,84 @@
 #include <errno.h>
 #include <alloca.h>
+#include <sys/syslimits.h>
 #include <emx/startup.h>
 #include <emx/syscalls.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_PROCESS
+#include <InnoTekLIBC/logstrict.h>
 
-int _STD(spawnve) (int mode, const char *name, char * const argv[],
-  char * const envp[])
+int _STD(spawnve)(int mode, const char *name, char * const argv[], char * const envp[])
 {
-  struct _new_proc np;
-  int i, size, n;
-  const char * const *p;
-  char *d;
-  char exe[512];
+    LIBCLOG_ENTER("mode=%#x name=%s argv=%p envp=%p\n", mode, name, argv, envp);
+    struct _new_proc np;
+    int i, size, n, rc;
+    const char * const *p;
+    char *d;
+    char exe[PATH_MAX];
 
-  /* Kludge alert: Unfortunately, the `mode' member was made only 16
-     bits wide originally.  Bit 15 is used to indicate that the
-     `mode2' member is used, which holds the upper 16 bits of MODE.
-     This allows using emx 0.8 applications with emx 0.9 as emx
-     doesn't look at `mode2' unless bit 15 of `mode' is set.  Of
-     course, this fails if an (old) application program sets bit 15 of
-     MODE. */
+    /*
+     * Init the syscall struct np.
+     */
+    /* mode */
+    np.mode = mode;
+    /* exe name */
+    if (strlen(name) >= sizeof(exe) - 4)
+    {
+        LIBC_ASSERTM_FAILED("name is too long, %d bytes: %s\n", strlen(name), name);
+        errno = ENAMETOOLONG;
+        LIBCLOG_RETURN_INT(-1);
+    }
+    strcpy(exe, name);
+    _defext(exe, "exe");
+    LIBCLOG_MSG("exe=%s\n", exe);
+    np.fname_off = (unsigned long)exe;
 
-  np.mode = (unsigned short)(mode | 0x8000);
-  np.mode2 = (unsigned short)((unsigned)mode >> 16);
+    /* calc environment size */
+    if (envp == NULL)
+        envp = environ;
+    size = 1; n = 0;
+    for (p = (const char * const *)envp; *p != NULL; ++p)
+    {
+        ++n;
+        size += 1 + strlen(*p);
+    }
+    d = alloca(size);
+    LIBCLOG_MSG("environment: %d bytes %d entries block=%p\n", size, n, d);
+    np.env_count = n; np.env_size = size;
+    np.env_off = (unsigned long)d;
 
-  if (envp == NULL) envp = environ;
-  if (strlen (name) >= sizeof (exe) - 4)
+    /* copy environment */
+    for (p = (const char * const *)envp; *p != NULL; ++p)
     {
-      errno = ENAMETOOLONG;
-      return -1;
+        i = strlen(*p);
+        memcpy(d, *p, i + 1);
+        d += i + 1;
     }
-  strcpy (exe, name);
-  _defext (exe, "exe");
-  np.fname_off = (unsigned long)exe;
-  size = 1; n = 0;
-  for (p = (const char * const *)envp; *p != NULL; ++p)
+    *d = 0;
+
+    /* calc argument size */
+    size = 0; n = 0;
+    for (p = (const char * const *)argv; *p != NULL; ++p)
     {
-      ++n; size += 1 + strlen (*p);
+        ++n;
+        size += 2 + strlen(*p);
     }
-  d = alloca (size);
-  np.env_count = n; np.env_size = size;
-  np.env_off = (unsigned long)d;
-  for (p = (const char * const *)envp; *p != NULL; ++p)
+    d = alloca(size);
+    LIBCLOG_MSG("arguments: %d bytes %d entries block=%p\n", size, n, d);
+    np.arg_count = n; np.arg_size = size;
+    np.arg_off = (unsigned long)d;
+
+    /* copy arguments */
+    for (p = (const char * const *)argv; *p != NULL; ++p)
     {
-      i = strlen (*p);
-      memcpy (d, *p, i+1);
-      d += i+1;
+        i = strlen(*p);
+        *(unsigned char *)d++ = _ARG_NONZERO;
+        memcpy(d, *p, i + 1);
+        d += i + 1;
     }
-  *d = 0;
-  size = 0; n = 0;
-  for (p = (const char * const *)argv; *p != NULL; ++p)
-    {
-      ++n; size += 2 + strlen (*p);
-    }
-  d = alloca (size);
-  np.arg_count = n; np.arg_size = size;
-  np.arg_off = (unsigned long)d;
-  for (p = (const char * const *)argv; *p != NULL; ++p)
-    {
-      i = strlen (*p);
-      *d++ = _ARG_NONZERO;
-      memcpy (d, *p, i+1);
-      d += i+1;
-    }
-  i = __spawnve (&np);
-  return i;
+
+    /*
+     * Call syscall.
+     */
+    rc = __spawnve(&np);
+    LIBCLOG_RETURN_INT(rc);
 }
Index: trunk/src/emx/src/lib/process/spawnvp.c
===================================================================
--- trunk/src/emx/src/lib/process/spawnvp.c	(revision 1288)
+++ trunk/src/emx/src/lib/process/spawnvp.c	(revision 1289)
@@ -4,7 +4,11 @@
 #include <stddef.h>
 #include <process.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_PROCESS
+#include <InnoTekLIBC/logstrict.h>
 
 int _STD(spawnvp) (int mode, const char *name, char * const argv[])
 {
-  return spawnvpe (mode, name, argv, NULL);
+    LIBCLOG_ENTER("mode=%#x name=%s argv=%p\n", mode, name, argv);
+    int rc = spawnvpe (mode, name, argv, NULL);
+    LIBCLOG_RETURN_INT(rc);
 }
Index: trunk/src/emx/src/lib/process/spawnvpe.c
===================================================================
--- trunk/src/emx/src/lib/process/spawnvpe.c	(revision 1288)
+++ trunk/src/emx/src/lib/process/spawnvpe.c	(revision 1289)
@@ -6,20 +6,26 @@
 #include <string.h>
 #include <errno.h>
+#include <sys/syslimits.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_PROCESS
+#include <InnoTekLIBC/logstrict.h>
 
-int _STD(spawnvpe) (int mode, const char *name, char * const argv[],
-  char * const envp[])
+int _STD(spawnvpe)(int mode, const char *name, char * const argv[], char * const envp[])
 {
-  char exe[512];
-  char path[512];
+    LIBCLOG_ENTER("mode=%#x name=%s argv=%p envp=%p\n", mode, name, argv, envp);
+    char    exe[PATH_MAX];
+    char    path[PATH_MAX];
+    int     rc;
 
-  if (strlen (name) >= sizeof (exe) - 4)
+    if (strlen(name) >= sizeof(exe) - 4)
     {
-      errno = ENAMETOOLONG;
-      return -1;
+        LIBC_ASSERTM_FAILED("name is too long, %d bytes: %s\n", strlen(name), name);
+        errno = ENAMETOOLONG;
+        LIBCLOG_RETURN_INT(-1);
     }
-  strcpy (exe, name);
-  _defext (exe, "exe");
-  if (_path (path, exe) != 0)
-    return -1;
-  return spawnve (mode, path, argv, envp);
+    strcpy(exe, name);
+    _defext(exe, "exe");
+    if (!_path(path, exe))
+        LIBCLOG_RETURN_INT(-1);
+    rc = spawnve(mode, path, argv, envp);
+    LIBCLOG_RETURN_INT(rc);
 }
Index: trunk/src/emx/src/lib/process/system.c
===================================================================
--- trunk/src/emx/src/lib/process/system.c	(revision 1288)
+++ trunk/src/emx/src/lib/process/system.c	(revision 1289)
@@ -7,34 +7,42 @@
 #include <io.h>
 #include <errno.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_PROCESS
+#include <InnoTekLIBC/logstrict.h>
 
-int _STD(system) (const char *name)
+int _STD(system)(const char *name)
 {
-  int rc;
-  const char *sh, *base, *opt;
+    LIBCLOG_ENTER("name=%s\n", name);
+    int rc;
+    const char *sh, *base, *opt;
 
-  sh = getenv ("EMXSHELL");
-  if (sh == NULL)
-    sh = getenv ("COMSPEC");
-  if (sh == NULL)
+    sh = getenv("EMXSHELL");
+    if (sh == NULL)
+        sh = getenv("COMSPEC");
+    if (sh == NULL)
     {
-      errno = ENOENT;
-      return -1;
+        errno = ENOENT;
+        LIBCLOG_RETURN_INT(-1);
     }
-  if (name == NULL)   /* Check for command interpreter */
-    return access (sh, 0) == 0;
-  if (*name == 0)
-    rc = spawnlp (P_WAIT, sh, sh, (char *)0);
-  else
+    LIBCLOG_MSG("using shell: %s\n", sh);
+    if (name == NULL)   /* Check for command interpreter */
     {
-      base = _getname (sh);
-      if (stricmp (base, "cmd.exe") == 0
-       || stricmp (base, "4os2.exe") == 0
-       || stricmp (base, "command.com") == 0
-       || stricmp (base, "4dos.com") == 0)
-        opt = "/c";
-      else
-        opt = "-c";
-      rc = spawnlp (P_WAIT, sh, sh, opt, name, (char *)0);
+        LIBCLOG_MSG("check shell access\n");
+        rc = access(sh, 0) == 0;
+        LIBCLOG_RETURN_INT(rc);
     }
-  return rc;
+    if (*name == 0)
+        rc = spawnlp(P_WAIT, sh, sh, (char *)0);
+    else
+    {
+        base = _getname(sh);
+        if (stricmp(base, "cmd.exe") == 0
+            || stricmp(base, "4os2.exe") == 0
+            || stricmp(base, "command.com") == 0
+            || stricmp(base, "4dos.com") == 0)
+            opt = "/c";
+        else
+            opt = "-c";
+        rc = spawnlp(P_WAIT, sh, sh, opt, name, (char *)0);
+    }
+    LIBCLOG_RETURN_INT(rc);
 }
Index: trunk/src/emx/src/lib/process/thread_internals.c
===================================================================
--- trunk/src/emx/src/lib/process/thread_internals.c	(revision 1288)
+++ trunk/src/emx/src/lib/process/thread_internals.c	(revision 1289)
@@ -36,4 +36,6 @@
 #include <InnoTekLIBC/thread.h>
 #include <InnoTekLIBC/backend.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_THREAD
+#include <InnoTekLIBC/logstrict.h>
 
 
@@ -62,4 +64,5 @@
 __LIBC_PTHREAD __libc_threadCurrentSlow(void)
 {
+    LIBCLOG_ENTER("\n");
     if (!*__libc_gpTLS)
     {
@@ -83,7 +86,8 @@
 
         *__libc_gpTLS = pThrd;
+        LIBCLOG_MSG("Created thread block %p\n", pThrd);
     }
 
-    return *__libc_gpTLS;
+    LIBCLOG_RETURN_P(*__libc_gpTLS);
 }
 
@@ -91,4 +95,5 @@
 __LIBC_PTHREAD __libc_threadAlloc(void)
 {
+    LIBCLOG_ENTER("\n");
     /*
      * No need to use the pre allocated here since the current thread will
@@ -98,5 +103,5 @@
     if (pThrd)
         threadInit(pThrd);
-    return pThrd;
+    LIBCLOG_RETURN_P(pThrd);
 }
 
@@ -104,4 +109,5 @@
 void  __libc_threadFree(__LIBC_PTHREAD pThrd)
 {
+    LIBCLOG_ENTER("pThrd=%p\n", pThrd);
     /*
      * Clean up members.
@@ -116,4 +122,5 @@
     else
         __lxchg(&gfPreAllocThrd, 0);
+    LIBCLOG_RETURN_VOID();
 }
 
Index: trunk/src/emx/src/lib/process/threadst.c
===================================================================
--- trunk/src/emx/src/lib/process/threadst.c	(revision 1288)
+++ trunk/src/emx/src/lib/process/threadst.c	(revision 1289)
@@ -4,10 +4,14 @@
 #include <stdlib.h>
 #include <InnoTekLIBC/thread.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_THREAD
+#include <InnoTekLIBC/logstrict.h>
 
 /**
  * @obsolete
  */
-void **_threadstore (void)
+void **_threadstore(void)
 {
-  return &__libc_threadCurrent()->pvThreadStoreVar;
+    LIBCLOG_ENTER("\n");
+    void **ppv = &__libc_threadCurrent()->pvThreadStoreVar;
+    LIBCLOG_RETURN_P(ppv);
 }
Index: trunk/src/emx/src/lib/process/wait.c
===================================================================
--- trunk/src/emx/src/lib/process/wait.c	(revision 1288)
+++ trunk/src/emx/src/lib/process/wait.c	(revision 1289)
@@ -6,11 +6,16 @@
 #include <errno.h>
 #include <emx/syscalls.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_PROCESS
+#include <InnoTekLIBC/logstrict.h>
 
-int _STD(wait) (int *status)
+int _STD(wait)(int *status)
 {
-  int dummy;
+    LIBCLOG_ENTER("status=%p\n", status);
+    int dummy;
+    int rc;
 
-  if (status == NULL)
-    status = &dummy;
-  return __wait (status);
+    if (status == NULL)
+        status = &dummy;
+    rc = __wait(status);
+    LIBCLOG_RETURN_MSG(rc,"ret %d (%#x). *status=%#x\n", rc, rc, *status);
 }
Index: trunk/src/emx/src/lib/process/waitpid.c
===================================================================
--- trunk/src/emx/src/lib/process/waitpid.c	(revision 1288)
+++ trunk/src/emx/src/lib/process/waitpid.c	(revision 1289)
@@ -1,3 +1,4 @@
 /* waitpid.c (emx+gcc) -- Copyright (c) 1993-1996 by Eberhard Mattes */
+
 
 #include "libc-alias.h"
@@ -6,11 +7,16 @@
 #include <errno.h>
 #include <emx/syscalls.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_PROCESS
+#include <InnoTekLIBC/logstrict.h>
 
-int _STD(waitpid) (int pid, int *status, int options)
+int _STD(waitpid)(int pid, int *status, int options)
 {
-  int dummy;
+    LIBCLOG_ENTER("pid=%d status=%p options=%#x\n", pid, status, options);
+    int dummy;
+    int rc;
 
-  if (status == NULL)
-    status = &dummy;
-  return __waitpid (pid, status, options);
+    if (status == NULL)
+        status = &dummy;
+    rc = __waitpid(pid, status, options);
+    LIBCLOG_RETURN_MSG(rc,"ret %d (%#x). *status=%#x\n", rc, rc, *status);
 }
Index: trunk/src/emx/src/lib/startup/exit.c
===================================================================
--- trunk/src/emx/src/lib/startup/exit.c	(revision 1288)
+++ trunk/src/emx/src/lib/startup/exit.c	(revision 1289)
@@ -1,8 +1,10 @@
 /* exit.c (emx+gcc) -- Copyright (c) 1990-1998 by Eberhard Mattes */
+
 
 #include "libc-alias.h"
 #include <stdlib.h>
 #include <emx/startup.h>
-#include <emx/libclog.h>
+#define __LIBC_LOG_GROUP  __LIBC_LOG_GRP_INITTERM
+#include <InnotekLIBC/logstrict.h>
 
 void (*_atexit_v[64])(void);
Index: trunk/src/emx/src/lib/startup/startup.c
===================================================================
--- trunk/src/emx/src/lib/startup/startup.c	(revision 1288)
+++ trunk/src/emx/src/lib/startup/startup.c	(revision 1289)
@@ -9,5 +9,6 @@
 #include <emx/syscalls.h>
 #include <emx/startup.h>
-#include <emx/libclog.h>
+#define __LIBC_LOG_GROUP    __LIBC_LOG_GRP_INITTERM
+#include <InnoTekLIBC/logstrict.h>
 
 extern int __crtinit1__;
Index: trunk/src/emx/src/lib/sys/__spawnve.c
===================================================================
--- trunk/src/emx/src/lib/sys/__spawnve.c	(revision 1288)
+++ trunk/src/emx/src/lib/sys/__spawnve.c	(revision 1289)
@@ -46,7 +46,4 @@
 
   mode = np->mode;
-  if (np->mode & 0x8000)
-    mode |= np->mode2 << 16;
-
   switch (mode & 0xff)
     {
Index: trunk/src/emx/src/lib/sys/libclog.c
===================================================================
--- trunk/src/emx/src/lib/sys/libclog.c	(revision 1288)
+++ 	(revision )
@@ -1,252 +1,0 @@
-/* $Id$ */
-/** @file
- *
- * Debug Logging Facility - internal libc use only.
- *
- * InnoTek Systemberatung GmbH confidential
- *
- * Copyright (c) 2004 InnoTek Systemberatung GmbH
- * Author: knut st. osmundsen <bird-srcspam@anduin.net>
- *
- * All Rights Reserved
- *
- */
-
-/*******************************************************************************
-*   Defined Constants And Macros                                               *
-*******************************************************************************/
-#define CCHTMPMSGBUFFER 512
-
-
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <process.h>
-#undef DEBUG_LOGGING
-#define DEBUG_LOGGING                   /* need prototypes. */
-#include <emx/libclog.h>
-
-#define INCL_BASE
-#include <os2.h>
-
-
-/*******************************************************************************
-*   Global Variables                                                           *
-*******************************************************************************/
-/** Logfile. */
-static HFILE    hLog = -1;
-
-/*******************************************************************************
-*   Internal Functions                                                         *
-*******************************************************************************/
-static int openLog(void);
-static unsigned getTimestamp(void);
-static unsigned getTid(void);
-
-
-/**
- * Opens the log file.
- * @returns 0 on success.
- * @returns -1 on failure.
- */
-static int openLog(void)
-{
-    char        szFilename[256];
-    ULONG       ulAction;
-    int         rc;
-    char       *pszMsg;
-
-    if ((int)hLog >= 0)
-        return 0;
-
-    sprintf(szFilename, "libc_%04x.log", getpid());
-    rc = DosOpen(szFilename, &hLog, &ulAction, 0, FILE_NORMAL,
-                 OPEN_ACTION_CREATE_IF_NEW | OPEN_ACTION_REPLACE_IF_EXISTS,
-                 OPEN_FLAGS_SEQUENTIAL | OPEN_FLAGS_NOINHERIT | OPEN_SHARE_DENYWRITE | OPEN_ACCESS_WRITEONLY,
-                 NULL);
-    if (rc)
-        return -1;
-
-    /* write a log header */
-    pszMsg = alloca(CCHTMPMSGBUFFER);
-    if (pszMsg)
-    {
-        PTIB        pTib;
-        PPIB        pPib;
-        DATETIME    dt;
-        const char *psz;
-        ULONG       cb;
-        int         cch;
-
-        DosGetInfoBlocks(&pTib, &pPib);
-        DosGetDateTime(&dt);
-        if (DosQueryModuleName(pPib->pib_hmte, sizeof(szFilename), &szFilename[0]))
-            szFilename[0] = '\0';
-
-        cch = snprintf(pszMsg, CCHTMPMSGBUFFER,
-                       "Opened log at %04d-%02d-%02d %02d:%02d:%02d.%02d\n"
-                       "Process ID: %#x (%d) Parent PID: %#x (%d)\n",
-                       dt.year, dt.month, dt.day, dt.hours, dt.minutes, dt.seconds, dt.hundredths,
-                       (int)pPib->pib_ulpid, (unsigned)pPib->pib_ulpid, (int)pPib->pib_ulppid, (unsigned)pPib->pib_ulppid);
-        DosWrite(hLog, pszMsg, cch, &cb);
-
-        cch = snprintf(pszMsg, CCHTMPMSGBUFFER,
-                       "Exe hmte  : %#x (%s)\n",
-                       (unsigned)pPib->pib_hmte, szFilename);
-        DosWrite(hLog, pszMsg, cch, &cb);
-
-        cch = snprintf(pszMsg, CCHTMPMSGBUFFER,
-                       "First arg : %s\n"
-                       "Second arg: ",
-                       pPib->pib_pchcmd);
-        DosWrite(hLog, pszMsg, cch, &cb);
-
-        psz = pPib->pib_pchcmd + strlen(pPib->pib_pchcmd) + 1;
-        cch = strlen(psz);
-        DosWrite(hLog, psz, cch, &cb);
-        DosWrite(hLog, "\n", 1, &cb);
-    }
-    return 0;
-}
-
-
-/**
- * Get ts. (milliseconds preferably)
- */
-inline static unsigned getTimestamp(void)
-{
-    unsigned long ulTs = 0;
-    DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT, &ulTs, sizeof(ulTs));
-    return (unsigned)ulTs;
-}
-
-
-/**
- * Gets the current thread id.
- */
-inline static unsigned getTid(void)
-{
-    PTIB    pTib;
-    PPIB    pPib;
-    DosGetInfoBlocks(&pTib, &pPib);
-    return pTib->tib_ptib2->tib2_ultid;
-}
-
-
-/**
- * Output an enter function log message.
- * An enter message is considered to be one line and is appended a newline if
- * none was given.
- *
- * @returns Current timestamp.
- * @param   pszFunction     Name of the function which was entered.
- * @param   pszFormat       Format string to display arguments.
- * @param   ...             Arguments to the format string.
- */
-unsigned __libc_LogEnter(const char *pszFunction, const char *pszFormat, ...)
-{
-    unsigned    uTS = getTimestamp();
-    char       *pszMsg;
-    int         cch;
-    va_list     args;
-    ULONG       cb;
-
-    if ((int)hLog < 0 && openLog())
-        return 0;
-
-    pszMsg = alloca(CCHTMPMSGBUFFER);
-    if (!pszMsg)
-        return uTS;
-
-    cch = snprintf(pszMsg, CCHTMPMSGBUFFER, "%08x %02x Entr %s: ", uTS, getTid(), pszFunction);
-    va_start(args, pszFormat);
-    cch += vsnprintf(pszMsg + cch, CCHTMPMSGBUFFER - cch, pszFormat, args);
-    va_end(args);
-    if (cch >= CCHTMPMSGBUFFER)
-        memcpy(pszMsg + CCHTMPMSGBUFFER - 5, "...\n", 5);
-    else if (pszMsg[cch - 1] != '\n')
-        memcpy(&pszMsg[cch++], "\n", 2);
-
-    DosWrite(hLog, pszMsg, cch, &cb);
-    return uTS;
-}
-
-/**
- * Output a leave function log message.
- * A leave message is considered to be one line and is appended a newline if
- * none was given.
- *
- * @param   uEnterTS        The timestamp returned by LogEnter.
- * @param   pszFunction     Name of the function which was entered.
- * @param   pszFormat       Format string to display the result.
- * @param   ...             Arguments to the format string.
- */
-void     __libc_LogLeave(unsigned uEnterTS, const char *pszFunction, const char *pszFormat, ...)
-{
-    unsigned    uTS = getTimestamp();
-    char       *pszMsg;
-    int         cch;
-    va_list     args;
-    ULONG       cb;
-
-    if ((int)hLog < 0 && openLog())
-        return;
-
-    pszMsg = alloca(CCHTMPMSGBUFFER);
-    if (!pszMsg)
-        return;
-
-    cch = snprintf(pszMsg, CCHTMPMSGBUFFER, "%08x %02x Leav %s (%2d ms): ", uTS, getTid(), pszFunction, uTS - uEnterTS);
-    va_start(args, pszFormat);
-    cch += vsnprintf(pszMsg + cch, CCHTMPMSGBUFFER - cch, pszFormat, args);
-    va_end(args);
-    if (cch >= CCHTMPMSGBUFFER)
-        memcpy(pszMsg + CCHTMPMSGBUFFER - 5, "...\n", 5);
-    else if (pszMsg[cch - 1] != '\n')
-        memcpy(&pszMsg[cch++], "\n", 2);
-    DosWrite(hLog, pszMsg, cch, &cb);
-}
-
-/**
- * Output a log message.
- * A log message is considered to be one line and is appended a newline if
- * none was given.
- *
- * @param   uEnterTS        The timestamp returned by LogEnter.
- * @param   pszFunction     Name of the function which was entered.
- * @param   pszFormat       Format string for the message to log.
- * @param   ...             Arguments to the format string.
- */
-void     __libc_LogMsg(unsigned uEnterTS, const char *pszFunction, const char *pszFormat, ...)
-{
-    unsigned    uTS = getTimestamp();
-    char       *pszMsg;
-    int         cch;
-    ULONG       cb;
-    va_list     args;
-
-    if ((int)hLog < 0 && openLog())
-        return;
-
-    pszMsg = alloca(CCHTMPMSGBUFFER);
-    if (!pszMsg)
-        return;
-
-    if (uEnterTS != ~0)
-        cch = snprintf(pszMsg, CCHTMPMSGBUFFER, "%08x %02x Msg  %s (%2d ms): ", uTS, getTid(), pszFunction, uTS - uEnterTS);
-    else
-        cch = snprintf(pszMsg, CCHTMPMSGBUFFER, "%08x %02x Msg  %s: ", uTS, getTid(), pszFunction);
-    va_start(args, pszFormat);
-    cch += vsnprintf(pszMsg + cch, CCHTMPMSGBUFFER - cch, pszFormat, args);
-    va_end(args);
-    if (cch >= CCHTMPMSGBUFFER)
-        memcpy(pszMsg + CCHTMPMSGBUFFER - 5, "...\n", 5);
-    else if (pszMsg[cch - 1] != '\n')
-        memcpy(&pszMsg[cch++], "\n", 2);
-    DosWrite(hLog, pszMsg, cch, &cb);
-}
-
Index: trunk/src/emx/src/lib/sys/logstrict.c
===================================================================
--- trunk/src/emx/src/lib/sys/logstrict.c	(revision 1289)
+++ trunk/src/emx/src/lib/sys/logstrict.c	(revision 1289)
@@ -0,0 +1,1598 @@
+/* $Id$ */
+/** @file
+ *
+ * LIBC SYS - Debug Logging and Strict Checking Facilities.
+ *
+ * InnoTek Systemberatung GmbH confidential
+ *
+ * Copyright (c) 2004 InnoTek Systemberatung GmbH
+ * Copyright (c) 2004 knut st. osmundsen <bird-srcspam@anduin.net>
+ *
+ * All Rights Reserved
+ *
+ */
+
+/*******************************************************************************
+*   Defined Constants And Macros                                               *
+*******************************************************************************/
+#define __LIBC_LOG_GROUP    __LIBC_LOG_GRP_NOGROUP
+
+#define CCHTMPMSGBUFFER     512
+
+#define ISDIGIT(c) ((c) >= '0' && (c) <= '9')
+#define MAX(a, b)  ((a) >= (b) ? (a) : (b))
+#define MIN(a, b)  ((a) < (b) ? (a) : (b))
+
+#define NTSF_CAPITAL    0x0001
+#define NTSF_LEFT       0x0002
+#define NTSF_ZEROPAD    0x0004
+#define NTSF_SPECIAL    0x0008
+#define NTSF_VALSIGNED  0x0010
+#define NTSF_PLUS       0x0020
+#define NTSF_BLANK      0x0040
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <InnoTekLIBC/logstrict.h>
+#define __USE_GNU                       /* strnlen() */
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <process.h>
+#include <errno.h>
+#include <sys/builtin.h>
+#include <emx/umalloc.h>
+#include <setjmp.h>
+#include <machine/param.h>
+
+#define INCL_BASE
+#define INCL_FSMACROS
+#include <os2.h>
+
+
+/*******************************************************************************
+*   Structures and Typedefs                                                    *
+*******************************************************************************/
+/** Internal representation of a logger instance. */
+typedef struct __libc_logInstance
+{
+    /** Write Semaphore. */
+    HMTX                    hmtx;
+    /** Filehandle. */
+    HFILE                   hFile;
+    /** Api groups. */
+    __LIBC_PLOGGROUPS       pGroups;
+} __LIBC_LOGINST, *__LIBC_PLOGINST;
+
+
+/** Extended exception registration record for usewith __libc_logXcptHandler(). */
+typedef struct __libc_XCPTRegistrationRec
+{
+    EXCEPTIONREGISTRATIONRECORD RegRec;
+    jmp_buf                     jmp;
+} __LIBC_XCPTREG, *__LIBC_PXCPTREG;
+
+
+
+/*******************************************************************************
+*   Internal Functions                                                         *
+*******************************************************************************/
+static void *   __libc_logInit(__LIBC_PLOGINST pInst, unsigned fFlags, __LIBC_PLOGGROUPS pGroups, const char *pszFilename);
+static void *   __libc_logDefault(void);
+static int      __libc_logBuildMsg(char *pszMsg, const char *pszFormatMsg, va_list args, const char *pszFormatPrefix, ...) __printflike(4, 5);
+static void     __libc_logWrite(__LIBC_PLOGINST pInst, unsigned fGroupAndFlags, const char *pszMsg, size_t cch);
+static inline unsigned getTimestamp(void);
+static inline unsigned getTid(void);
+static ULONG _System __libc_logXcptHandler(PEXCEPTIONREPORTRECORD pRepRec, struct _EXCEPTIONREGISTRATIONRECORD * pRegRec, PCONTEXTRECORD pCtxRec, PVOID pv);
+static int      __libc_logVSNPrintf(char *pszBuffer, size_t cchBuffer, const char *pszFormat, va_list args);
+static int      __libc_logSNPrintf(char *pszBuffer, size_t cchBuffer, const char *pszFormat, ...) __printflike(3, 4);
+
+
+/**
+ * Create a logger.
+ *
+ * @returns Pointer to a logger instance on success.
+ * @returns NULL on failure, errno set.
+ * @param   fFlags              Flags reserved for future use. Set to zero.
+ * @param   pGroups             Pointer to a table of logging groups used for this
+ *                              logger instance.
+ * @param   pszFilenameFormat   Format string for making up the log filename.
+ * @param   ...                 Arguments to the format string.
+ */
+void *__libc_LogInit(unsigned fFlags, __LIBC_PLOGGROUPS pGroups, const char *pszFilenameFormat, ...)
+{
+    __LIBC_PLOGINST pInst;
+    char           *pszFilename;
+    va_list         args;
+    void           *pvRet;
+
+    /*
+     * Validate input.
+     */
+    if (    fFlags != 0
+        ||  pszFilenameFormat == NULL
+        ||  (   pGroups
+             && (   !pGroups->paGroups
+                 || !pGroups->cGroups
+                 || pGroups->uBase > 0xffff
+                 )
+             )
+        )
+    {
+        errno = EINVAL;
+        return NULL;
+    }
+
+    /*
+     * Allocate a logger instance.
+     */
+    pInst = _hmalloc(sizeof(__LIBC_LOGINST) + CCHMAXPATH);
+    if (!pInst)
+        return NULL;
+    pszFilename = (char*)(pInst + 1);
+
+    /*
+     * Format the filename.
+     */
+    va_start(args, pszFilenameFormat);
+    __libc_logVSNPrintf(pszFilename, CCHMAXPATH, pszFilenameFormat, args);
+    va_end(args);
+
+    /*
+     * Call internal inititation worker.
+     * (shared with the default logger init code)
+     */
+    pvRet = __libc_logInit(pInst, fFlags, pGroups, pszFilename);
+    if (!pvRet)
+    {
+        free(pInst);                /* failure. */
+        errno = EACCES;                 /* good try, DosOpen probably failed. */
+    }
+
+    return pvRet;
+}
+
+
+/**
+ * Initates the logger instance, opening the specified file and such.
+ *
+ * @returns Pointer to pInst on success.
+ * @returns NULL on failure.
+ * @param   pInst       Pointer to logger instance (to be initiated).
+ * @param   fFlags      Flags. (reserved for future use, thus 0)
+ * @param   pGroups     Pointer to message groups.
+ * @param   pszFilename Name of the log file.
+ */
+static void *   __libc_logInit(__LIBC_PLOGINST pInst, unsigned fFlags, __LIBC_PLOGGROUPS pGroups, const char *pszFilename)
+{
+    ULONG       ulAction;
+    int         rc;
+    char       *pszMsg;
+    FS_VAR();
+    FS_SAVE_LOAD();
+
+    pInst->hmtx     = NULLHANDLE;
+    pInst->hFile    = NULLHANDLE;
+    pInst->pGroups  = pGroups;
+
+    /*
+     * Create the mutex.
+     */
+    rc = DosCreateMutexSem(NULL, &pInst->hmtx, 0, 0);
+    if (rc)
+    {
+        FS_RESTORE();
+        return NULL;
+    }
+
+    /*
+     * Open the file.
+     */
+    rc = DosOpen((PCSZ)pszFilename, &pInst->hFile, &ulAction, 0, FILE_NORMAL,
+                 OPEN_ACTION_CREATE_IF_NEW | OPEN_ACTION_REPLACE_IF_EXISTS,
+                 OPEN_FLAGS_SEQUENTIAL | OPEN_FLAGS_NOINHERIT | OPEN_SHARE_DENYWRITE | OPEN_ACCESS_WRITEONLY,
+                 NULL);
+    if (rc)
+    {
+        DosCloseMutexSem(pInst->hmtx);
+        FS_RESTORE();
+        return NULL;
+    }
+
+    /*
+     * Write log header.
+     */
+    pszMsg = alloca(CCHTMPMSGBUFFER);
+    if (pszMsg)
+    {
+        PTIB        pTib;
+        PPIB        pPib;
+        DATETIME    dt;
+        const char *psz;
+        ULONG       cb;
+        int         cch;
+
+        DosGetInfoBlocks(&pTib, &pPib);
+        DosGetDateTime(&dt);
+
+        cch = __libc_logSNPrintf(pszMsg, CCHTMPMSGBUFFER,
+                                 "Opened log at %04d-%02d-%02d %02d:%02d:%02d.%02d\n"
+                                 "Process ID: %#x (%d) Parent PID: %#x (%d)\n",
+                                 dt.year, dt.month, dt.day, dt.hours, dt.minutes, dt.seconds, dt.hundredths,
+                                 (int)pPib->pib_ulpid, (unsigned)pPib->pib_ulpid, (int)pPib->pib_ulppid, (unsigned)pPib->pib_ulppid);
+        DosWrite(pInst->hFile, pszMsg, cch, &cb);
+
+        cch = __libc_logSNPrintf(pszMsg, CCHTMPMSGBUFFER,
+                                 "Exe hmte  : %#x (",
+                                 (unsigned)pPib->pib_hmte);
+        DosWrite(pInst->hFile, pszMsg, cch, &cb);
+        if (DosQueryModuleName(pPib->pib_hmte, sizeof(pszMsg), pszMsg))
+            pszMsg[0] = '\0';
+        cch = strlen(pszMsg);
+        DosWrite(pInst->hFile, pszMsg, cch, &cb);
+        pszMsg[cch++] = ')';
+        pszMsg[cch++] = '\n';
+        DosWrite(pInst->hFile, pszMsg, cch, &cb);
+
+        cch = __libc_logSNPrintf(pszMsg, CCHTMPMSGBUFFER,
+                                 "First arg : %s\n"
+                                 "Second arg: ",
+                                 pPib->pib_pchcmd);
+        DosWrite(pInst->hFile, pszMsg, cch, &cb);
+        psz = pPib->pib_pchcmd + strlen(pPib->pib_pchcmd) + 1;
+        cch = strlen(psz);
+        DosWrite(pInst->hFile, psz, cch, &cb);
+        DosWrite(pInst->hFile, "\n", 1, &cb);
+    }
+
+    FS_RESTORE();
+    return pInst;
+}
+
+
+/**
+ * Parses the given environment variable and sets the group
+ * flags accordingly.
+ *
+ * The environment variable is a sequence of group idendifiers with
+ * a prefix which determins whether or not that group is enabled.
+ * A special group 'all' can be used to address all groups.
+ *
+ * If the environment variable is not present no changes will be
+ * performed.
+ *
+ * @param   pGroups     Pointer to groups to init.
+ * @param   pszEnvVar   Name of the environment variable.
+ *                      This is taken from the initial environment of the process
+ *                      and not from the current!!
+ */
+void __libc_LogGroupInit(__LIBC_PLOGGROUPS pGroups, const char *pszEnvVar)
+{
+    PSZ pszEnv = NULL;
+
+    /*
+     * Get and process the env.var. containing the logging settings.
+     */
+    if (DosScanEnv((PCSZ)pszEnvVar, &pszEnv) || !pszEnv)
+        return;
+
+    /*
+     * Process it.
+     */
+    while (*pszEnv)
+    {
+        char    ch;
+        int     fEnabled = 1;
+        PCSZ    pszStart;
+        int     i;
+        int     cch;
+
+        /* Prefixes (blanks, + and -). */
+        while ((ch = *pszEnv) == '+' || ch == '-' || ch == ' ' || ch == '\t')
+        {
+            fEnabled = ch != '-';
+            pszEnv++;
+        }
+        if (!*pszEnv)
+            break;
+
+        /*
+         * Find end.
+         */
+        pszStart = pszEnv;
+        while (!(ch = *pszEnv) && ch != '+' && ch != '-' && ch != ' ' && ch != '\t')
+            pszEnv++;
+
+        /*
+         * Find the group (ascii case insensitive search).
+         * Special group 'all'.
+         */
+        cch = pszEnv - pszStart;
+        if (    cch == 3
+            &&  (pszStart[0] == 'a' || pszStart[0] == 'A')
+            &&  (pszStart[1] == 'L' || pszStart[1] == 'L')
+            &&  (pszStart[2] == 'L' || pszStart[2] == 'L')
+                )
+        {   /* all */
+            for (i = 0; i < pGroups->cGroups; i++)
+                pGroups->paGroups[i].fEnabled = fEnabled;
+        }
+        else
+        {   /* specific group */
+            int fFound;
+            for (i = 0, fFound = 0; i < pGroups->cGroups && !fFound; i++)
+            {
+                const char *psz1 = pGroups->paGroups[i].pszGroupName;
+                if (psz1 && *psz1)
+                {
+                    const char *psz2    = (const char*)pszStart;
+                    int         cchLeft = cch;
+                    #define CHLOWER(ch)     ((ch) < 'A' && (ch) > 'Z' ? (ch) : (ch) + ('a' - 'A'))
+                    while (CHLOWER(*psz1) == CHLOWER(*psz2))
+                    {
+                        psz1++;
+                        if (--cchLeft)
+                        {   /* done */
+                            if (!*psz1)
+                            {
+                                fFound = 1;
+                                pGroups->paGroups[i].fEnabled = fEnabled;
+                            }
+                            break;
+                        }
+                        psz2++;
+                    }
+                }
+            }
+        }
+
+    } /* parse value */
+}
+
+
+/**
+ * Get the default logger instance.
+ * This call will open the default logger instance if required.
+ *
+ * @returns Pointer to default logger.
+ * @returns NULL on failure.
+ */
+static void *__libc_logDefault(void)
+{
+    /** Pointer to default logger instance. */
+    static __LIBC_PLOGINST  pDefault;
+    /** Set if we've already tried to init the log, but failed. */
+    static int              fAlreadyTried;
+
+    if (pDefault)
+        return pDefault;
+    else if (!fAlreadyTried)
+    {
+        static __LIBC_LOGINST   DefInst;
+        static __LIBC_LOGGROUP  aDefGrps[__LIBC_LOG_GRP_MAX + 1] =
+        {
+            { 1, "NOGROUP" },           /*  0 */
+            { 1, "PROCESS" },           /*  1 */
+            { 1, "HEAP" },              /*  2 */
+            { 1, "STREAM" },            /*  3 */
+            { 1, "IO" },                /*  4 */
+            { 1, "STRING" },            /*  5 */
+            { 1, "LOCALE" },            /*  6 */
+            { 1, "REGEX" },             /*  7 */
+            { 1, "MATH" },              /*  8 */
+            { 1, "TIME" },              /*  9 */
+            { 1, "BSD_DB" },            /* 10 */
+            { 1, "GLIBC_POSIX" },       /* 11 */
+            { 1, "THREAD" },            /* 12 */
+            { 1, "MUTEX" },             /* 13 */
+            { 1, "SIGNAL" },            /* 14 */
+            { 1, "future" },            /* 15 */
+            { 1, "future" },            /* 16 */
+            { 1, "future" },            /* 17 */
+            { 1, "future" },            /* 18 */
+            { 1, "future" },            /* 19 */
+            { 1, "future" },            /* 20 */
+            { 1, "future" },            /* 21 */
+            { 1, "future" },            /* 22 */
+            { 1, "future" },            /* 23 */
+            { 1, "future" },            /* 24 */
+            { 1, "future" },            /* 25 */
+            { 1, "future" },            /* 26 */
+            { 1, "INITTERM" },          /* 27 */
+            { 1, "BACKEND" },           /* 28 */
+            { 1, "MISC" },              /* 29 */
+            { 1, "BSD_GEN" },           /* 30 */
+            { 1, "GLIBC_MISC" },        /* 31 */
+            { 1, "SOCKET" },            /* 32 */
+            { 1, "TCPIP" },             /* 33 */
+            { 1, "ICONV" },             /* 34 */
+            { 1, "DLFCN" },             /* 35 */
+            { 1, "PTHREAD" }            /* 36 */
+        };
+        static __LIBC_LOGGROUPS DefGrps =
+        {
+            0,                          /* uBase */
+            __LIBC_LOG_GRP_MAX + 1,     /* cGroups */
+            &aDefGrps[0]                /* paGroups */
+        };
+        char                    szFilename[20];
+        fAlreadyTried = 1;
+
+        /*
+         * Create the log instance.
+         */
+        __libc_logSNPrintf(szFilename, sizeof(szFilename), "libc_%04x.log", getpid());
+        if (__libc_logInit(&DefInst, 0, &DefGrps, szFilename))
+            pDefault = &DefInst;
+
+        /*
+         * Init the groups.
+         */
+        __libc_LogGroupInit(&DefGrps, "LIBC_LOGGING");
+    }
+
+    return pDefault;
+}
+
+
+/**
+ * Builds a one line message from two format strings and arguments.
+ *
+ * @returns Message length in bytes.
+ *
+ * @param   pszMsg              Buffer of size CCHTMPMSGBUFFER.
+ * @param   pszFormatMsg        Message format string.
+ * @param   args                Message format arguments.
+ * @param   pszFormatPrefix     Message prefix format string.
+ * @param   ...                 Message prefix format string.
+ */
+static int __libc_logBuildMsg(char *pszMsg, const char *pszFormatMsg, va_list args, const char *pszFormatPrefix, ...)
+{
+    int     cch;
+    va_list args2;
+
+    /*
+     * Message prefix
+     */
+    va_start(args2, pszFormatPrefix);
+    cch = __libc_logVSNPrintf(pszMsg, CCHTMPMSGBUFFER, pszFormatPrefix, args2);
+    va_end(args2);
+
+    /*
+     * The message.
+     */
+    cch += __libc_logVSNPrintf(pszMsg + cch, CCHTMPMSGBUFFER - cch, pszFormatMsg, args);
+
+    /*
+     * ensure '\n'.
+     */
+    if (cch >= CCHTMPMSGBUFFER)
+        memcpy(pszMsg + CCHTMPMSGBUFFER - 5, "...\n", 5);
+    else if (pszMsg[cch - 1] != '\n')
+        memcpy(&pszMsg[cch++], "\n", 2);
+
+    return cch;
+}
+
+
+/**
+ * Writes a string to the log.
+ *
+ * @param   pInst           Logger instance to write to.
+ * @param   fGroupAndFlags  Flags and group for the write (group part is ignored)
+ * @param   pszMsg          String to write.
+ * @param   cch             Length of string.
+ */
+static void __libc_logWrite(__LIBC_PLOGINST pInst, unsigned fGroupAndFlags, const char *pszMsg, size_t cch)
+{
+    APIRET  rc;
+    ULONG   cb = 0;
+    HMTX    hmtx = pInst->hmtx;
+    FS_VAR();
+    FS_SAVE_LOAD();
+
+    /*
+     * Aquire mutex ownership.
+     */
+    rc = DosRequestMutexSem(hmtx, SEM_INDEFINITE_WAIT);
+    switch (rc)
+    {
+        case 0:
+            break;
+        /* recreate the semaphore for some odd. */
+        case ERROR_INVALID_HANDLE:
+        case ERROR_SEM_OWNER_DIED:
+        {
+            HMTX    hmtxNew;
+            rc = DosCreateMutexSem(NULL, &hmtxNew, 0, TRUE);
+            if (!rc)
+            {
+                hmtx = __lxchg((int*)&pInst->hmtx, hmtxNew);
+                DosCloseMutexSem(hmtx);
+            }
+            break;
+        }
+        /* ignore other errors. */
+    }
+
+    /*
+     * Write message and release the semaphore (if owned).
+     */
+    DosWrite(pInst->hFile, pszMsg, cch, &cb);
+    if (fGroupAndFlags & __LIBC_LOG_MSGF_FLUSH)
+        DosResetBuffer(pInst->hFile);
+    if (!rc)
+        DosReleaseMutexSem(pInst->hmtx);
+    FS_RESTORE();
+}
+
+
+
+/**
+ * Get ts. (milliseconds preferably)
+ */
+inline static unsigned getTimestamp(void)
+{
+    unsigned long ulTs = 0;
+    FS_VAR();
+    FS_SAVE_LOAD();
+    DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT, &ulTs, sizeof(ulTs));
+    FS_RESTORE();
+    return (unsigned)ulTs;
+}
+
+
+/**
+ * Gets the current thread id.
+ */
+inline static unsigned getTid(void)
+{
+    PTIB    pTib;
+    PPIB    pPib;
+    FS_VAR();
+    FS_SAVE_LOAD();
+    DosGetInfoBlocks(&pTib, &pPib);
+    FS_RESTORE();
+    return pTib->tib_ptib2->tib2_ultid;
+}
+
+
+/**
+ * Output an enter function log message.
+ * An enter message is considered to be one line and is appended a newline if
+ * none was given.
+ *
+ * @returns Current timestamp.
+ * @param   pvInstance      Logger instance. If NULL the message goes to the
+ *                          default log instance.
+ * @param   fGroupAndFlags  Logging group and logging flags.
+ * @param   pszFunction     Name of the function which was entered.
+ * @param   pszFormat       Format string to display arguments.
+ * @param   ...             Arguments to the format string.
+ */
+unsigned __libc_LogEnter(void *pvInstance, unsigned fGroupAndFlags, const char *pszFunction, const char *pszFormat, ...)
+{
+    unsigned        uTS = getTimestamp();
+    char           *pszMsg;
+    int             cch;
+    va_list         args;
+    __LIBC_PLOGINST pInst;
+
+    /*
+     * Check instance, get default.
+     */
+    if (!pvInstance)
+    {
+        pvInstance = __libc_logDefault();
+        if (!pvInstance)
+            return uTS;
+    }
+    pInst = (__LIBC_PLOGINST)pvInstance;
+
+    /*
+     * Check if this group is enabled.
+     */
+    if (pInst->pGroups)
+    {
+        int iGroup = __LIBC_LOG_GETGROUP(fGroupAndFlags);
+        if (    iGroup >= 0
+            &&  iGroup < pInst->pGroups->cGroups
+            &&  !pInst->pGroups->paGroups[iGroup].fEnabled)
+            return uTS;
+    }
+
+    /*
+     * Allocate logging buffer and format the message.
+     */
+    pszMsg = alloca(CCHTMPMSGBUFFER);
+    if (!pszMsg)
+        return uTS;
+
+    va_start(args, pszFormat);
+    cch = __libc_logBuildMsg(pszMsg, pszFormat, args, "%08x %02x %04x Entr %s: ",
+                             uTS, getTid(), __LIBC_LOG_GETGROUP(fGroupAndFlags), pszFunction);
+    va_end(args);
+
+    /*
+     * Write the message.
+     */
+    __libc_logWrite(pInst, fGroupAndFlags, pszMsg, cch);
+    return uTS;
+}
+
+
+/**
+ * Output a leave function log message.
+ * A leave message is considered to be one line and is appended a newline if
+ * none was given.
+ *
+ * @param   uEnterTS        The timestamp returned by LogEnter.
+ * @param   pvInstance      Logger instance. If NULL the message goes to the
+ *                          default log instance.
+ * @param   fGroupAndFlags  Logging group and logging flags.
+ * @param   pszFunction     Name of the function which was entered.
+ * @param   pszFormat       Format string to display the result.
+ * @param   ...             Arguments to the format string.
+ */
+void     __libc_LogLeave(unsigned uEnterTS, void *pvInstance, unsigned fGroupAndFlags, const char *pszFunction, const char *pszFormat, ...)
+{
+    unsigned        uTS = getTimestamp();
+    char           *pszMsg;
+    int             cch;
+    va_list         args;
+    __LIBC_PLOGINST pInst;
+
+    /*
+     * Check instance, get default.
+     */
+    if (!pvInstance)
+    {
+        pvInstance = __libc_logDefault();
+        if (!pvInstance)
+            return;
+    }
+    pInst = (__LIBC_PLOGINST)pvInstance;
+
+    /*
+     * Check if this group is enabled.
+     */
+    if (pInst->pGroups)
+    {
+        int iGroup = __LIBC_LOG_GETGROUP(fGroupAndFlags);
+        if (    iGroup >= 0
+            &&  iGroup < pInst->pGroups->cGroups
+            &&  !pInst->pGroups->paGroups[iGroup].fEnabled)
+            return;
+    }
+
+    /*
+     * Allocate logging buffer and format the message.
+     */
+    pszMsg = alloca(CCHTMPMSGBUFFER);
+    if (!pszMsg)
+        return;
+
+    va_start(args, pszFormat);
+    cch = __libc_logBuildMsg(pszMsg, pszFormat, args, "%08x %02x %04x Leav %s (%2d ms): ",
+                             uTS, getTid(), __LIBC_LOG_GETGROUP(fGroupAndFlags), pszFunction, uTS - uEnterTS);
+    va_end(args);
+
+    /*
+     * Write the message.
+     */
+    __libc_logWrite(pInst, fGroupAndFlags, pszMsg, cch);
+}
+
+
+/**
+ * Output a log message.
+ * A log message is considered to be one line and is appended a newline if
+ * none was given.
+ *
+ * @param   uEnterTS        The timestamp returned by LogEnter.
+ * @param   pvInstance      Logger instance. If NULL the message goes to the
+ *                          default log instance.
+ * @param   fGroupAndFlags  Logging group and logging flags.
+ * @param   pszFunction     Name of the function which was entered.
+ * @param   pszFormat       Format string for the message to log.
+ * @param   ...             Arguments to the format string.
+ */
+void     __libc_LogMsg(unsigned uEnterTS, void *pvInstance, unsigned fGroupAndFlags, const char *pszFunction, const char *pszFormat, ...)
+{
+    unsigned        uTS = getTimestamp();
+    char           *pszMsg;
+    int             cch;
+    va_list         args;
+    __LIBC_PLOGINST pInst;
+
+    /*
+     * Check instance, get default.
+     */
+    if (!pvInstance)
+    {
+        pvInstance = __libc_logDefault();
+        if (!pvInstance)
+            return;
+    }
+    pInst = (__LIBC_PLOGINST)pvInstance;
+
+    /*
+     * Check if this group is enabled.
+     */
+    if (pInst->pGroups)
+    {
+        int iGroup = __LIBC_LOG_GETGROUP(fGroupAndFlags);
+        if (    iGroup >= 0
+            &&  iGroup < pInst->pGroups->cGroups
+            &&  !pInst->pGroups->paGroups[iGroup].fEnabled)
+            return;
+    }
+
+    /*
+     * Allocate logging buffer and format the message.
+     */
+    pszMsg = alloca(CCHTMPMSGBUFFER);
+    if (!pszMsg)
+        return;
+
+    va_start(args, pszFormat);
+    if (uEnterTS != ~0)
+        cch = __libc_logBuildMsg(pszMsg, pszFormat, args, "%08x %02x %04x Mesg %s (%2d ms): ",
+                                 uTS, getTid(), __LIBC_LOG_GETGROUP(fGroupAndFlags), pszFunction, uTS - uEnterTS);
+    else
+        cch = __libc_logBuildMsg(pszMsg, pszFormat, args, "%08x %02x %04x Mesg %s: ",
+                                 uTS, getTid(), __LIBC_LOG_GETGROUP(fGroupAndFlags), pszFunction);
+    va_end(args);
+
+    /*
+     * Write the message.
+     */
+    __libc_logWrite(pInst, fGroupAndFlags, pszMsg, cch);
+}
+
+
+/**
+ * Output a raw log message.
+ * Nothing is prepended. No newline is appended.
+ *
+ * @param   uEnterTS        The timestamp returned by LogEnter.
+ * @param   pvInstance      Logger instance. If NULL the message goes to the
+ *                          default log instance.
+ * @param   fGroupAndFlags  Logging group and logging flags.
+ * @param   pszFunction     Name of the function which was entered.
+ * @param   pszString       Pointer to raw log message.
+ * @param   cchMax          Maximum number of bytes to write.
+ */
+void     __libc_LogRaw(void *pvInstance, unsigned fGroupAndFlags, const char *pszString, unsigned cchMax)
+{
+    int             cch;
+    __LIBC_PLOGINST pInst;
+
+    /*
+     * Check instance, get default.
+     */
+    if (!pvInstance)
+    {
+        pvInstance = __libc_logDefault();
+        if (!pvInstance)
+            return;
+    }
+    pInst = (__LIBC_PLOGINST)pvInstance;
+
+    /*
+     * Check if this group is enabled.
+     */
+    if (pInst->pGroups)
+    {
+        int iGroup = __LIBC_LOG_GETGROUP(fGroupAndFlags);
+        if (    iGroup >= 0
+            &&  iGroup < pInst->pGroups->cGroups
+            &&  !pInst->pGroups->paGroups[iGroup].fEnabled)
+            return;
+    }
+
+    /*
+     * Figure out how much to write.
+     */
+    cch = strnlen(pszString, cchMax);
+
+    /*
+     * Write the message.
+     */
+    __libc_logWrite(pInst, fGroupAndFlags, pszString, cch);
+}
+
+
+/**
+ * Assertion helper.
+ * Logs and displays (stderr) an assertion failed message.
+ *
+ * @param   pvInstance      Logger instance. If NULL the message goes to the
+ *                          default log instance.
+ * @param   pszFunction     Name of the function which was entered.
+ * @param   pszFile         Source filename.
+ * @param   uLine           Line number.
+ * @param   pszExpression   Expression.
+ * @param   pszFormat       Format string for the message to log.
+ * @param   ...             Arguments to the format string.
+ */
+void     __libc_LogAssert(void *pvInstance, unsigned fGroupAndFlags,
+                          const char *pszFunction, const char *pszFile, unsigned uLine, const char *pszExpression,
+                          const char *pszFormat, ...)
+{
+    unsigned        uTS = getTimestamp();
+    char           *pszMsg;
+    int             cch;
+    ULONG           cb;
+    va_list         args;
+    __LIBC_PLOGINST pInst;
+    FS_VAR();
+
+    /*
+     * Check instance, get default.
+     */
+    if (!pvInstance)
+    {
+        pvInstance = __libc_logDefault();
+        if (!pvInstance)
+            return;
+    }
+    pInst = (__LIBC_PLOGINST)pvInstance;
+
+#if 0
+    /*
+     * Check if this group is enabled.
+     */
+    if (pInst->pGroups)
+    {
+        int iGroup = __LIBC_LOG_GETGROUP(fGroupAndFlags);
+        if (    iGroup >= 0
+            &&  iGroup < pInst->pGroups->cGroups
+            &&  !pInst->pGroups->paGroups[iGroup].fEnabled)
+            return;
+    }
+#endif
+
+    /*
+     * Allocate logging buffer and format the message.
+     * NOTE: This buffer *must* be in low memory!!!
+     */
+    pszMsg = alloca(CCHTMPMSGBUFFER);
+    if (!pszMsg)
+        return;
+
+    /*
+     * Assertion message.
+     */
+    FS_SAVE_LOAD();
+    va_start(args, pszFormat);          /* make compiler happy we do it here. */
+    cch = __libc_logBuildMsg(pszMsg, "", args, "%08x %02x %04x Asrt: Assertion Failed!!!\n", uTS, getTid(), __LIBC_LOG_GETGROUP(fGroupAndFlags));
+    DosWrite(2, pszMsg, cch, &cb);
+    cch = __libc_logBuildMsg(pszMsg, "", args, "%08x %02x %04x Asrt: Function: %s\n", uTS, getTid(), __LIBC_LOG_GETGROUP(fGroupAndFlags), pszFunction);
+    DosWrite(2, pszMsg, cch, &cb);
+    cch = __libc_logBuildMsg(pszMsg, "", args, "%08x %02x %04x Asrt: File:     %s\n", uTS, getTid(), __LIBC_LOG_GETGROUP(fGroupAndFlags), pszFile);
+    DosWrite(2, pszMsg, cch, &cb);
+    cch = __libc_logBuildMsg(pszMsg, "", args, "%08x %02x %04x Asrt: Line:     %d\n", uTS, getTid(), __LIBC_LOG_GETGROUP(fGroupAndFlags), uLine);
+    DosWrite(2, pszMsg, cch, &cb);
+    cch = __libc_logBuildMsg(pszMsg, "", args, "%08x %02x %04x Asrt: Expr:     %s\n", uTS, getTid(), __LIBC_LOG_GETGROUP(fGroupAndFlags), pszExpression);
+    DosWrite(2, pszMsg, cch, &cb);
+    cch = __libc_logBuildMsg(pszMsg, pszFormat, args, "%08x %02x %04x Asrt: ",
+                             uTS, getTid(), __LIBC_LOG_GETGROUP(fGroupAndFlags));
+    va_end(args);
+
+    /*
+     * Write the message.
+     */
+    __libc_logWrite(pInst, fGroupAndFlags, pszMsg, cch);
+
+    __asm__ __volatile__("int $3");
+}
+
+
+/**
+ * Exception handler for catching read and write errors.
+ *
+ * Special registration record which is bundled with a longjump structure
+ * so we can jump back to the error handling of the failing code.
+ *
+ * @returns See cpref
+ * @param   pRepRec     See cpref.
+ * @param   pRegRec     See cpref.
+ * @param   pCtxRec     See cpref.
+ * @param   pv          See cpref.
+ */
+static ULONG _System __libc_logXcptHandler(PEXCEPTIONREPORTRECORD pRepRec, struct _EXCEPTIONREGISTRATIONRECORD * pRegRec, PCONTEXTRECORD pCtxRec, PVOID pv)
+{
+    switch (pRepRec->ExceptionNum)
+    {
+        case XCPT_ACCESS_VIOLATION:
+        {
+            __LIBC_PXCPTREG pXctpRegRec = (__LIBC_PXCPTREG)pRegRec;
+            longjmp(pXctpRegRec->jmp, 1);
+            break;
+        }
+    }
+
+    return XCPT_CONTINUE_SEARCH;
+}
+
+
+/**
+ * Validate a memory area for read access.
+ * @returns 1 if readable.
+ * @returns 0 if not entirely readable.
+ * @param   pv      Pointer to memory area.
+ * @param   cb      Size of memory area.
+ */
+int      __libc_StrictMemoryR(const void *pv, size_t cb)
+{
+    int             rc;
+    __LIBC_XCPTREG  XcptRegRec = { { (void *)-1, __libc_logXcptHandler }, };
+    FS_VAR();
+
+    /*
+     * Zero bytes.
+     */
+    if (!cb)
+        return 1;
+
+    FS_SAVE_LOAD();
+    DosSetExceptionHandler(&XcptRegRec.RegRec);
+    rc = setjmp(XcptRegRec.jmp);
+    if (!rc)
+    {
+        /*
+         * Read all the pages in the buffer we just got.
+         */
+        volatile const char *   pch = (volatile const char*)pv;
+        for (;;)
+        {
+            rc |= *pch;
+            pch += PAGE_SIZE;
+            if (cb < PAGE_SIZE)
+                break;
+            cb -= PAGE_SIZE;
+        }
+        rc = 1;
+    }
+    else
+    {
+        /*
+         * failure - no specific actions.
+         */
+        rc = 0;
+    }
+    DosUnsetExceptionHandler(&XcptRegRec.RegRec);
+    FS_RESTORE();
+
+    return rc;
+}
+
+
+/**
+ * Validate a memory area for read & write access.
+ * @returns 1 if readable and writable.
+ * @returns 0 if not entirely readable and writable.
+ * @param   pv      Pointer to memory area.
+ * @param   cb      Size of memory area.
+ */
+int      __libc_StrictMemoryRW(void *pv, size_t cb)
+{
+    int             rc;
+    __LIBC_XCPTREG  XcptRegRec = { { (void *)-1, __libc_logXcptHandler }, };
+    FS_VAR();
+
+    /*
+     * Zero bytes.
+     */
+    if (!cb)
+        return 1;
+
+    FS_SAVE_LOAD();
+    DosSetExceptionHandler(&XcptRegRec.RegRec);
+    rc = setjmp(XcptRegRec.jmp);
+    if (!rc)
+    {
+        /*
+         * Read/Write all the pages in the buffer we just got.
+         */
+        volatile char *   pch = (volatile char*)pv;
+        for (;;)
+        {
+            rc = *pch;
+            *pch = (char)rc;
+            pch += PAGE_SIZE;
+            if (cb < PAGE_SIZE)
+                break;
+            cb -= PAGE_SIZE;
+        }
+        rc = 1;
+    }
+    else
+    {
+        /*
+         * failure - no specific actions.
+         */
+        rc = 0;
+    }
+    DosUnsetExceptionHandler(&XcptRegRec.RegRec);
+    FS_RESTORE();
+
+    return rc;
+}
+
+
+/**
+ * Validate a zero terminated string for read access.
+ * @returns 1 if readable.
+ * @returns 0 if not entirely readable.
+ * @param   psz         Pointer to string.
+ * @param   cchMax      Max string length. Use ~0 if to very all the
+ *                      way to the terminator.
+ */
+int      __libc_StrictStringR(const char *psz, size_t cchMax)
+{
+    int             rc;
+    __LIBC_XCPTREG  XcptRegRec = { { (void *)-1, __libc_logXcptHandler }, };
+    FS_VAR();
+
+    /*
+     * Zero bytes.
+     */
+    if (!cchMax)
+        return 1;
+
+    FS_SAVE_LOAD();
+    DosSetExceptionHandler(&XcptRegRec.RegRec);
+    rc = setjmp(XcptRegRec.jmp);
+    if (!rc)
+    {
+        /*
+         * Read all the pages in the buffer we just got.
+         */
+        while (cchMax-- && *psz)
+            psz++;
+        rc = 1;
+    }
+    else
+    {
+        /*
+         * failure - no specific actions.
+         */
+        rc = 0;
+    }
+    DosUnsetExceptionHandler(&XcptRegRec.RegRec);
+    FS_RESTORE();
+
+    return rc;
+}
+
+
+
+/**
+ * Formats a number according to the parameters.
+ *
+ * @returns   Pointer to next char. (after number)
+ * @param     psz            Pointer to output string.
+ * @param     lValue         Value
+ * @param     uiBase         Number representation base.
+ * @param     cchWidth       Width
+ * @param     cchPrecision   Precision.
+ * @param     fFlags         Flags (NTFS_*).
+ */
+static char * numtostr(char *psz, long lValue, unsigned int uiBase,
+                       int cchWidth, int cchPrecision, unsigned int fFlags)
+{
+    char *          achDigits = "0123456789abcdef";
+    int             cchValue;
+    unsigned long   ul;
+    int             i;
+    int             j;
+
+    if (uiBase < 2 || uiBase > 16)
+        return NULL;
+    if (fFlags & NTSF_CAPITAL)
+        achDigits = "0123456789ABCDEF";
+    if (fFlags & NTSF_LEFT)
+        fFlags &= ~NTSF_ZEROPAD;
+
+    /* determin value length */
+    cchValue = 0;
+    ul = (unsigned long)((fFlags & NTSF_VALSIGNED) && lValue < 0L ? -lValue : lValue);
+    do
+    {
+        cchValue++;
+        ul /= uiBase;
+    } while (ul > 0);
+
+    i = 0;
+    if (fFlags & NTSF_VALSIGNED)
+    {
+        if (lValue < 0)
+        {
+            lValue = -lValue;
+            psz[i++] = '-';
+        }
+        else if (fFlags & (NTSF_PLUS | NTSF_BLANK))
+            psz[i++] = (char)(fFlags & NTSF_PLUS ? '+' : ' ');
+    }
+
+    if (fFlags & NTSF_SPECIAL && (uiBase % 8) == 0)
+    {
+        psz[i++] = '0';
+        if (uiBase == 16)
+            psz[i++] = (char)(fFlags & NTSF_CAPITAL ? 'X' : 'x');
+    }
+
+
+    /* width - only if ZEROPAD */
+    cchWidth -= i + cchValue;
+    if (fFlags & NTSF_ZEROPAD)
+        while (--cchWidth >= 0)
+        {
+            psz[i++] = '0';
+            cchPrecision--;
+        }
+    else if (!(fFlags & NTSF_LEFT) && cchWidth > 0)
+    {
+        for (j = i-1; j >= 0; j--)
+            psz[cchWidth + j] = psz[j];
+        for (j = 0; j < cchWidth; j++)
+            psz[j] = ' ';
+        i += cchWidth;
+    }
+
+    psz += i;
+
+    /* percision */
+    while (--cchPrecision >= cchValue)
+        *psz++ = '0';
+
+    /* write number - not good enough but it works */
+    i = -1;
+    psz += cchValue;
+    do
+    {
+        psz[i--] = achDigits[lValue % uiBase];
+        lValue /= uiBase;
+    } while (lValue > 0);
+
+    /* width if NTSF_LEFT */
+    if (fFlags & NTSF_LEFT)
+        while (--cchWidth >= 0)
+            *psz++ = ' ';
+
+
+    return psz;
+}
+
+
+/**
+ * Formats a number according to the parameters.
+ *
+ * @returns   Pointer to next char. (after number)
+ * @param     psz            Pointer to output string.
+ * @param     llValue        Value (64 bit).
+ * @param     uiBase         Number representation base.
+ * @param     cchWidth       Width.
+ * @param     cchPrecision   Precision.
+ * @param     fFlags         Flags (NTFS_*).
+ */
+static char * llnumtostr(char *psz, long long llValue, unsigned int uiBase,
+                         int cchWidth, int cchPrecision, unsigned int fFlags)
+{
+    char *              achDigits = "0123456789abcdef";
+    int                 cchValue;
+    unsigned long long  ull;
+    int                 i;
+    /*int                 j;*/
+
+    if (uiBase < 2 || uiBase > 16)
+        return NULL;
+    if (fFlags & NTSF_CAPITAL)
+        achDigits = "0123456789ABCDEF";
+    if (fFlags & NTSF_LEFT)
+        fFlags &= ~NTSF_ZEROPAD;
+
+    /* determin value length */
+    cchValue = 0;
+    ull = (unsigned long long)((fFlags & NTSF_VALSIGNED) && llValue < 0L ? -llValue : llValue);
+    do
+    {
+        cchValue++;
+        ull /= uiBase;
+    } while (ull > 0);
+
+    i = 0;
+    if (fFlags & NTSF_VALSIGNED)
+    {
+        if (llValue < 0)
+        {
+            llValue = -llValue;
+            psz[i++] = '-';
+        }
+        else if (fFlags & (NTSF_PLUS | NTSF_BLANK))
+            psz[i++] = (char)(fFlags & NTSF_PLUS ? '+' : ' ');
+    }
+
+    if (fFlags & NTSF_SPECIAL && (uiBase % 8) == 0)
+    {
+        psz[i++] = '0';
+        if (uiBase == 16)
+            psz[i++] = (char)(fFlags & NTSF_CAPITAL ? 'X' : 'x');
+    }
+
+
+    /* width - only if ZEROPAD */
+    cchWidth -= i + cchValue;
+    if (fFlags & NTSF_ZEROPAD)
+        while (--cchWidth >= 0)
+        {
+            psz[i++] = '0';
+            cchPrecision--;
+        }
+    #if 0  /** @todo */
+    else if (!(fFlags & NTSF_LEFT) && cchWidth > 0)
+    {
+        for (j = i-1; j >= 0; j--)
+            psz[cchWidth + j] = psz[j];
+        for (j = 0; j < cchWidth; j++)
+            psz[j] = ' ';
+        i += cchWidth;
+    }
+    #endif
+
+    psz += i;
+
+    /* percision */
+    while (--cchPrecision >= cchValue)
+        *psz++ = '0';
+
+    /* write number - not good enough but it works */
+    i = -1;
+    psz += cchValue;
+    do
+    {
+        psz[i--] = achDigits[llValue % uiBase];
+        llValue /= uiBase;
+    } while (llValue > 0);
+
+    /* width if NTSF_LEFT */
+    if (fFlags & NTSF_LEFT)
+        while (--cchWidth >= 0)
+            *psz++ = ' ';
+
+    return psz;
+}
+
+
+/**
+ * Partial vsprintf implementation.
+ *
+ * @returns number of bytes formatted.
+ * @param   pszBuffer   Where to put the the formatted string.
+ * @param   cchBuffer   Size of the buffer.
+ * @param   pszFormat   Format string.
+ * @param   args        Argument list.
+ */
+static int      __libc_logVSNPrintf(char *pszBuffer, size_t cchBuffer, const char *pszFormat, va_list args)
+{
+    int             rc;
+    char           *pszBufferIn = pszBuffer;
+    size_t          cchBufferIn = cchBuffer;
+    const char     *pszFormatIn = pszFormat;
+    unsigned        cch = 0;
+    __LIBC_XCPTREG  XcptRegRec = { { (void *)-1, __libc_logXcptHandler }, };
+    FS_VAR();
+
+    FS_SAVE_LOAD();
+    DosSetExceptionHandler(&XcptRegRec.RegRec);
+    rc = setjmp(XcptRegRec.jmp);
+    if (!rc)
+    {
+        while (*pszFormat != '\0' && cchBuffer)
+        {
+            if (*pszFormat == '%')
+            {
+                pszFormat++;  /* skip '%' */
+                if (*pszFormat == '%')    /* '%%'-> '%' */
+                {
+                    *pszBuffer++ = '%';
+                    cchBuffer--;
+                    pszFormat++;
+                    cch++;
+                }
+                else
+                {
+                    unsigned int fFlags = 0;
+                    int          cchWidth = -1;
+                    int          cchPrecision = -1;
+                    unsigned int uiBase = 10;
+                    char         chArgSize;
+
+                    /* flags */
+                    for (;;)
+                    {
+                        switch (*pszFormat++)
+                        {
+                            case '#':   fFlags |= NTSF_SPECIAL; continue;
+                            case '-':   fFlags |= NTSF_LEFT; continue;
+                            case '+':   fFlags |= NTSF_PLUS; continue;
+                            case ' ':   fFlags |= NTSF_BLANK; continue;
+                            case '0':   fFlags |= NTSF_ZEROPAD; continue;
+                        }
+                        pszFormat--;
+                        break;
+                    }
+                    /* width */
+                    if (ISDIGIT(*pszFormat))
+                    {
+                        for (cchWidth = 0; ISDIGIT(*pszFormat); pszFormat++)
+                        {
+                            cchWidth *= 10;
+                            cchWidth += *pszFormat - '0';
+                        }
+                    }
+                    else if (*pszFormat == '*')
+                    {
+                        pszFormat++;
+                        cchWidth = va_arg(args, int);
+                        if (cchWidth < 0)
+                        {
+                            cchWidth = -cchWidth;
+                            fFlags |= NTSF_LEFT;
+                        }
+                    }
+
+                    /* precision */
+                    if (*pszFormat == '.')
+                    {
+                        pszFormat++;
+                        if (ISDIGIT(*pszFormat))
+                        {
+                            for (cchPrecision = 0; ISDIGIT(*pszFormat); pszFormat++)
+                            {
+                                cchPrecision *= 10;
+                                cchPrecision += *pszFormat - '0';
+                            }
+
+                        }
+                        else if (*pszFormat == '*')
+                        {
+                            pszFormat++;
+                            cchPrecision = va_arg(args, int);
+                        }
+                        if (cchPrecision < 0)
+                            cchPrecision = 0;
+                    }
+
+                    /* argsize */
+                    chArgSize = *pszFormat;
+                    if (chArgSize != 'l' && chArgSize != 'L' && chArgSize != 'H')
+                        chArgSize = 0;
+                    else if (*++pszFormat == 'l' && chArgSize == 'l')
+                    {
+                        chArgSize = 'L';
+                        pszFormat++;
+                    }
+
+                    /* type */
+                    switch (*pszFormat++)
+                    {
+                        /* char */
+                        case 'c':
+                        {
+                            char ch;
+
+                            if (!(fFlags & NTSF_LEFT))
+                                while (--cchWidth > 0 && cchBuffer)
+                                {
+                                    cchBuffer--;
+                                    *pszBuffer++ = ' ';
+                                    cch++;
+                                }
+
+                            ch = (char)va_arg(args, int);
+                            if (!cchBuffer)
+                                break;
+
+                            cchBuffer--;
+                            *pszBuffer++ = ch;
+                            cch++;
+
+                            while (--cchWidth > 0 && cchBuffer)
+                            {
+                                cchBuffer--;
+                                *pszBuffer++ = ' ';
+                                cch++;
+                            }
+                            continue;
+                        }
+
+                        case 's':   /* string */
+                        {
+                            int   cchStr;
+                            char *pszStr = va_arg(args, char*);
+
+                            if (pszStr < (char*)0x10000)
+                                pszStr = "<NULL>";
+                            cchStr = strnlen(pszStr, (unsigned)cchPrecision);
+                            if (!(fFlags & NTSF_LEFT))
+                                while (--cchWidth >= cchStr && cchBuffer)
+                                {
+                                    cchBuffer--;
+                                    *pszBuffer++ = ' ';
+                                    cch++;
+                                }
+
+                            while (cchStr && cchBuffer)
+                            {
+                                cchStr--;
+                                cchBuffer--;
+                                *pszBuffer++ = *pszStr++;
+                                cch++;
+                            }
+
+                            while (--cchWidth >= cchStr && cchBuffer)
+                            {
+                                cchBuffer--;
+                                *pszBuffer++ = ' ';
+                                cch++;
+                            }
+                            continue;
+                        }
+
+                        /*-----------------*/
+                        /* integer/pointer */
+                        /*-----------------*/
+                        case 'd':
+                        case 'i':
+                        case 'o':
+                        case 'p':
+                        case 'u':
+                        case 'x':
+                        case 'X':
+                        case 'L':
+                        {
+                            char    achNum[64]; /* FIXME */
+                            char   *pszNum;
+                            int     cchNum;
+
+                            switch (pszFormat[-1])
+                            {
+                                case 'd': /* signed decimal integer */
+                                case 'i':
+                                    fFlags |= NTSF_VALSIGNED;
+                                    break;
+
+                                case 'o':
+                                    uiBase = 8;
+                                    break;
+
+                                case 'p':
+                                    fFlags |= NTSF_SPECIAL | NTSF_ZEROPAD; /* Note not standard behaviour (but I like it this way!) */
+                                    uiBase = 16;
+                                    if (cchWidth < 0)
+                                        cchWidth = sizeof(char *) * 2 + 2;
+                                    break;
+
+                                case 'u':
+                                    uiBase = 10;
+                                    break;
+
+                                case 'X':
+                                    fFlags |= NTSF_CAPITAL;
+                                case 'x':
+                                    uiBase = 16;
+                                    break;
+
+                                case 'L':
+                                    uiBase = 10;
+                                    chArgSize = 'L';
+                                    break;
+                            }
+
+                            pszNum = &achNum[0];
+                            if (chArgSize == 'L')
+                            {
+                                unsigned long long ullValue;
+                                ullValue = va_arg(args, unsigned long long);
+                                cchNum = llnumtostr(pszNum, ullValue, uiBase, cchWidth, cchPrecision, fFlags) - pszNum;
+                            }
+                            else
+                            {
+                                unsigned long ulValue;
+                                if (pszFormat[-1] == 'p')
+                                    ulValue = (unsigned long)va_arg(args, char *);
+                                else if (chArgSize == 'l')
+                                    ulValue = va_arg(args, signed long);
+                                else if (chArgSize == 'h')
+                                    ulValue = va_arg(args, signed short);
+                                else
+                                    ulValue = va_arg(args, signed int);
+                                cchNum = numtostr(pszNum, ulValue, uiBase, cchWidth, cchPrecision, fFlags) - pszNum;
+                            }
+
+                            for (; cchNum && cchBuffer; cchNum--, cchBuffer--, pszBuffer++, pszNum++, cch++)
+                                *pszBuffer = *pszNum;
+                            continue;
+                        }
+
+
+                        default:
+                            continue;
+                    }
+                }
+            }
+            else
+            {
+                *pszBuffer++ = *pszFormat++;
+                cchBuffer--;
+                cch++;
+            }
+        }
+
+        /*
+         * Terminator.
+         */
+        if (cchBuffer)
+            *pszBuffer = '\0';
+        else /* Use last buffer entry */
+        {
+            pszBuffer[-1] = '\0';
+            cch--;
+        }
+        DosUnsetExceptionHandler(&XcptRegRec.RegRec);
+    }
+    else
+    {
+        /*
+         * Exception during formatting.
+         *
+         * We unset the exception handler to make sure we will not
+         * mess up in loop...
+         */
+        const char *pszMsg = "!!!Format Exception!!! ";
+        DosUnsetExceptionHandler(&XcptRegRec.RegRec);
+        cch = 0;
+        while (*pszMsg && cchBufferIn)
+        {
+            *pszBufferIn++ = *pszMsg++;
+            cch++;
+            cchBufferIn--;
+        }
+        while (*pszFormatIn && cchBufferIn)
+        {
+            *pszBufferIn++ = *pszFormatIn++;
+            cch++;
+            cchBufferIn--;
+        }
+    }
+
+    FS_RESTORE();
+    return cch;
+}
+
+
+/**
+ * Partial vsprintf implementation.
+ *
+ * @returns number of bytes formatted.
+ * @param   pszBuffer   Where to put the the formatted string.
+ * @param   cchBuffer   Size of the buffer.
+ * @param   pszFormat   Format string.
+ * @param   ...         Format arguments.
+ */
+static int      __libc_logSNPrintf(char *pszBuffer, size_t cchBuffer, const char *pszFormat, ...)
+{
+    va_list args;
+    int     cch;
+    va_start(args, pszFormat);
+    cch = __libc_logVSNPrintf(pszBuffer, cchBuffer, pszFormat, args);
+    va_end(args);
+    return cch;
+}
+
Index: trunk/src/emx/src/lib/sys/tls.c
===================================================================
--- trunk/src/emx/src/lib/sys/tls.c	(revision 1288)
+++ 	(revision )
@@ -1,64 +1,0 @@
-/* $Id$ */
-/** @file
- *
- * InnoTek LIBC - Thread Local Storage Implementation.
- *
- * Copyright (c) 2004 knut st. osmundsen <bird-srcspam@anduin.net>
- *
- *
- * This file is part of InnoTek LIBC.
- *
- * InnoTek LIBC is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * InnoTek LIBC is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with InnoTek LIBC; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- */
-
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
-#include <InnoTekLIBC/thread.h>
-#include <errno.h>
-
-
-/*******************************************************************************
-*   Global Variables                                                           *
-*******************************************************************************/
-/** TLS allocation bitmap map.
- * Set means allocated, clear means free. Updated atomically. */
-static unsigned auchBitmap[(__LIBC_TLS_MAX + sizeof(unsigned) * 8 - 1) / (sizeof(unsigned) * 8)];
-/** Number of allocated TLS items.
- * Updated atomically. Update before allocation and after free. */
-static unsigned cTLSFree;
-
-
-int     __libc_TLSAlloc(void)
-{
-    return -1;
-}
-
-int     __libc_TLSFree(int iIndex)
-{
-    return 0;
-}
-
-void *  __libc_TLSGet(int iIndex)
-{
-    return NULL;
-}
-
-int     __libc_TLSSet(int iIndex, void *pvValue)
-{
-    return 0;
-}
-
Index: trunk/src/emx/src/lib/sys/usleep.c
===================================================================
--- trunk/src/emx/src/lib/sys/usleep.c	(revision 1288)
+++ trunk/src/emx/src/lib/sys/usleep.c	(revision 1289)
@@ -26,5 +26,4 @@
  */
 
-
 /*******************************************************************************
 *   Header Files                                                               *
@@ -33,8 +32,10 @@
 #include <unistd.h>
 #include <errno.h>
+#define __LIBC_LOG_GROUP    __LIBC_LOG_GRP_PROCESS
+#include <InnoTekLIBC/logstrict.h>
+
 #define INCL_BASE
 #define INCL_FSMACROS
 #include <os2.h>
-#include <emx/libclog.h>
 
 
Index: trunk/src/emx/src/libsocket/_getsockhandle.c
===================================================================
--- trunk/src/emx/src/libsocket/_getsockhandle.c	(revision 1288)
+++ trunk/src/emx/src/libsocket/_getsockhandle.c	(revision 1289)
@@ -33,5 +33,6 @@
 #include <sys/socket.h>
 #include <emx/io.h>
-#include <emx/libclog.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SOCKET
+#include <InnoTekLIBC/logstrict.h>
 #include "socket.h"
 
Index: trunk/src/emx/src/libsocket/_impsockhandle.c
===================================================================
--- trunk/src/emx/src/libsocket/_impsockhandle.c	(revision 1288)
+++ trunk/src/emx/src/libsocket/_impsockhandle.c	(revision 1289)
@@ -34,5 +34,6 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
-#include <emx/libclog.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SOCKET
+#include <InnoTekLIBC/logstrict.h>
 #include "socket.h"
 
Index: trunk/src/emx/src/libsocket/accept.c
===================================================================
--- trunk/src/emx/src/libsocket/accept.c	(revision 1288)
+++ trunk/src/emx/src/libsocket/accept.c	(revision 1289)
@@ -33,5 +33,6 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
-#include <emx/libclog.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SOCKET
+#include <InnoTekLIBC/logstrict.h>
 #include "socket.h"
 
Index: trunk/src/emx/src/libsocket/bind.c
===================================================================
--- trunk/src/emx/src/libsocket/bind.c	(revision 1288)
+++ trunk/src/emx/src/libsocket/bind.c	(revision 1289)
@@ -33,5 +33,6 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
-#include <emx/libclog.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SOCKET
+#include <InnoTekLIBC/logstrict.h>
 #include "socket.h"
 
Index: trunk/src/emx/src/libsocket/bsdselect.c
===================================================================
--- trunk/src/emx/src/libsocket/bsdselect.c	(revision 1288)
+++ trunk/src/emx/src/libsocket/bsdselect.c	(revision 1289)
@@ -34,5 +34,6 @@
 #include <sys/time.h>
 #include <emx/io.h>
-#include <emx/libclog.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SOCKET
+#include <InnoTekLIBC/logstrict.h>
 #include "socket.h"
 
Index: trunk/src/emx/src/libsocket/connect.c
===================================================================
--- trunk/src/emx/src/libsocket/connect.c	(revision 1288)
+++ trunk/src/emx/src/libsocket/connect.c	(revision 1289)
@@ -33,5 +33,6 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
-#include <emx/libclog.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SOCKET
+#include <InnoTekLIBC/logstrict.h>
 #include "socket.h"
 
Index: trunk/src/emx/src/libsocket/getpeername.c
===================================================================
--- trunk/src/emx/src/libsocket/getpeername.c	(revision 1288)
+++ trunk/src/emx/src/libsocket/getpeername.c	(revision 1289)
@@ -33,5 +33,6 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
-#include <emx/libclog.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SOCKET
+#include <InnoTekLIBC/logstrict.h>
 #include "socket.h"
 
Index: trunk/src/emx/src/libsocket/getsockname.c
===================================================================
--- trunk/src/emx/src/libsocket/getsockname.c	(revision 1288)
+++ trunk/src/emx/src/libsocket/getsockname.c	(revision 1289)
@@ -33,5 +33,6 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
-#include <emx/libclog.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SOCKET
+#include <InnoTekLIBC/logstrict.h>
 #include "socket.h"
 
Index: trunk/src/emx/src/libsocket/getsockopt.c
===================================================================
--- trunk/src/emx/src/libsocket/getsockopt.c	(revision 1288)
+++ trunk/src/emx/src/libsocket/getsockopt.c	(revision 1289)
@@ -33,5 +33,6 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
-#include <emx/libclog.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SOCKET
+#include <InnoTekLIBC/logstrict.h>
 #include "socket.h"
 
Index: trunk/src/emx/src/libsocket/herror.c
===================================================================
--- trunk/src/emx/src/libsocket/herror.c	(revision 1288)
+++ trunk/src/emx/src/libsocket/herror.c	(revision 1289)
@@ -9,5 +9,6 @@
 #include <sys/types.h>
 #include <netdb.h>
-#include <emx/libclog.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SOCKET
+#include <InnoTekLIBC/logstrict.h>
 
 extern int h_errno;
Index: trunk/src/emx/src/libsocket/listen.c
===================================================================
--- trunk/src/emx/src/libsocket/listen.c	(revision 1288)
+++ trunk/src/emx/src/libsocket/listen.c	(revision 1289)
@@ -33,5 +33,6 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
-#include <emx/libclog.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SOCKET
+#include <InnoTekLIBC/logstrict.h>
 #include "socket.h"
 
Index: trunk/src/emx/src/libsocket/os2_ioctl.c
===================================================================
--- trunk/src/emx/src/libsocket/os2_ioctl.c	(revision 1288)
+++ trunk/src/emx/src/libsocket/os2_ioctl.c	(revision 1289)
@@ -34,5 +34,6 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
-#include <emx/libclog.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SOCKET
+#include <InnoTekLIBC/logstrict.h>
 #include "socket.h"
 
Index: trunk/src/emx/src/libsocket/os2_select.c
===================================================================
--- trunk/src/emx/src/libsocket/os2_select.c	(revision 1288)
+++ trunk/src/emx/src/libsocket/os2_select.c	(revision 1289)
@@ -33,5 +33,6 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
-#include <emx/libclog.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SOCKET
+#include <InnoTekLIBC/logstrict.h>
 #include "socket.h"
 
Index: trunk/src/emx/src/libsocket/recv.c
===================================================================
--- trunk/src/emx/src/libsocket/recv.c	(revision 1288)
+++ trunk/src/emx/src/libsocket/recv.c	(revision 1289)
@@ -33,5 +33,6 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
-#include <emx/libclog.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SOCKET
+#include <InnoTekLIBC/logstrict.h>
 #include "socket.h"
 
Index: trunk/src/emx/src/libsocket/recvfrom.c
===================================================================
--- trunk/src/emx/src/libsocket/recvfrom.c	(revision 1288)
+++ trunk/src/emx/src/libsocket/recvfrom.c	(revision 1289)
@@ -33,5 +33,6 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
-#include <emx/libclog.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SOCKET
+#include <InnoTekLIBC/logstrict.h>
 #include "socket.h"
 
Index: trunk/src/emx/src/libsocket/recvmsg.c
===================================================================
--- trunk/src/emx/src/libsocket/recvmsg.c	(revision 1288)
+++ trunk/src/emx/src/libsocket/recvmsg.c	(revision 1289)
@@ -33,5 +33,6 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
-#include <emx/libclog.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SOCKET
+#include <InnoTekLIBC/logstrict.h>
 #include "socket.h"
 
Index: trunk/src/emx/src/libsocket/send.c
===================================================================
--- trunk/src/emx/src/libsocket/send.c	(revision 1288)
+++ trunk/src/emx/src/libsocket/send.c	(revision 1289)
@@ -33,5 +33,6 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
-#include <emx/libclog.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SOCKET
+#include <InnoTekLIBC/logstrict.h>
 #include "socket.h"
 
Index: trunk/src/emx/src/libsocket/sendmsg.c
===================================================================
--- trunk/src/emx/src/libsocket/sendmsg.c	(revision 1288)
+++ trunk/src/emx/src/libsocket/sendmsg.c	(revision 1289)
@@ -33,5 +33,6 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
-#include <emx/libclog.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SOCKET
+#include <InnoTekLIBC/logstrict.h>
 #include "socket.h"
 
Index: trunk/src/emx/src/libsocket/sendto.c
===================================================================
--- trunk/src/emx/src/libsocket/sendto.c	(revision 1288)
+++ trunk/src/emx/src/libsocket/sendto.c	(revision 1289)
@@ -33,5 +33,6 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
-#include <emx/libclog.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SOCKET
+#include <InnoTekLIBC/logstrict.h>
 #include "socket.h"
 
Index: trunk/src/emx/src/libsocket/setsockopt.c
===================================================================
--- trunk/src/emx/src/libsocket/setsockopt.c	(revision 1288)
+++ trunk/src/emx/src/libsocket/setsockopt.c	(revision 1289)
@@ -33,5 +33,6 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
-#include <emx/libclog.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SOCKET
+#include <InnoTekLIBC/logstrict.h>
 #include "socket.h"
 
Index: trunk/src/emx/src/libsocket/shutdown.c
===================================================================
--- trunk/src/emx/src/libsocket/shutdown.c	(revision 1288)
+++ trunk/src/emx/src/libsocket/shutdown.c	(revision 1289)
@@ -33,5 +33,6 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
-#include <emx/libclog.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SOCKET
+#include <InnoTekLIBC/logstrict.h>
 #include "socket.h"
 
Index: trunk/src/emx/src/libsocket/so_cancel.c
===================================================================
--- trunk/src/emx/src/libsocket/so_cancel.c	(revision 1288)
+++ trunk/src/emx/src/libsocket/so_cancel.c	(revision 1289)
@@ -33,5 +33,6 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
-#include <emx/libclog.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SOCKET
+#include <InnoTekLIBC/logstrict.h>
 #include "socket.h"
 
Index: trunk/src/emx/src/libsocket/so_ioctl.c
===================================================================
--- trunk/src/emx/src/libsocket/so_ioctl.c	(revision 1288)
+++ trunk/src/emx/src/libsocket/so_ioctl.c	(revision 1289)
@@ -35,5 +35,6 @@
 #include <sys/ioccom.h>
 #include <emx/io.h>
-#include <emx/libclog.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SOCKET
+#include <InnoTekLIBC/logstrict.h>
 #include "socket.h"
 
Index: trunk/src/emx/src/libsocket/so_readv.c
===================================================================
--- trunk/src/emx/src/libsocket/so_readv.c	(revision 1288)
+++ trunk/src/emx/src/libsocket/so_readv.c	(revision 1289)
@@ -33,5 +33,6 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
-#include <emx/libclog.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SOCKET
+#include <InnoTekLIBC/logstrict.h>
 #include "socket.h"
 
Index: trunk/src/emx/src/libsocket/so_writev.c
===================================================================
--- trunk/src/emx/src/libsocket/so_writev.c	(revision 1288)
+++ trunk/src/emx/src/libsocket/so_writev.c	(revision 1289)
@@ -33,5 +33,6 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
-#include <emx/libclog.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SOCKET
+#include <InnoTekLIBC/logstrict.h>
 #include "socket.h"
 
Index: trunk/src/emx/src/libsocket/soabort.c
===================================================================
--- trunk/src/emx/src/libsocket/soabort.c	(revision 1288)
+++ trunk/src/emx/src/libsocket/soabort.c	(revision 1289)
@@ -33,5 +33,6 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
-#include <emx/libclog.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SOCKET
+#include <InnoTekLIBC/logstrict.h>
 #include "socket.h"
 
Index: trunk/src/emx/src/libsocket/sock_errno.c
===================================================================
--- trunk/src/emx/src/libsocket/sock_errno.c	(revision 1288)
+++ trunk/src/emx/src/libsocket/sock_errno.c	(revision 1289)
@@ -18,5 +18,6 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
-#include <emx/libclog.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SOCKET
+#include <InnoTekLIBC/logstrict.h>
 #include "socket.h"
 
Index: trunk/src/emx/src/libsocket/socket.c
===================================================================
--- trunk/src/emx/src/libsocket/socket.c	(revision 1288)
+++ trunk/src/emx/src/libsocket/socket.c	(revision 1289)
@@ -33,5 +33,6 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
-#include <emx/libclog.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SOCKET
+#include <InnoTekLIBC/logstrict.h>
 #include "socket.h"
 
Index: trunk/src/emx/src/libsocket/socketops.c
===================================================================
--- trunk/src/emx/src/libsocket/socketops.c	(revision 1288)
+++ trunk/src/emx/src/libsocket/socketops.c	(revision 1289)
@@ -50,5 +50,6 @@
 #include <sys/filio.h>
 #include <emx/io.h>
-#include <emx/libclog.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SOCKET
+#include <InnoTekLIBC/logstrict.h>
 #include "socket.h"
 
Index: trunk/src/emx/src/libsocket/socketpair.c
===================================================================
--- trunk/src/emx/src/libsocket/socketpair.c	(revision 1288)
+++ trunk/src/emx/src/libsocket/socketpair.c	(revision 1289)
@@ -28,5 +28,6 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
-#include <emx/libclog.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SOCKET
+#include <InnoTekLIBC/logstrict.h>
 #include "socket.h"
 
Index: trunk/src/emx/src/libsocket/soclose.c
===================================================================
--- trunk/src/emx/src/libsocket/soclose.c	(revision 1288)
+++ trunk/src/emx/src/libsocket/soclose.c	(revision 1289)
@@ -33,5 +33,6 @@
 #include <sys/fcntl.h>
 #include <emx/io.h>
-#include <emx/libclog.h>
+#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SOCKET
+#include <InnoTekLIBC/logstrict.h>
 #include "socket.h"
 
