Changeset 2254 for trunk/src/emx/include


Ignore:
Timestamp:
Jul 17, 2005, 2:25:44 PM (20 years ago)
Author:
bird
Message:

o LIBC_ASSERT*() are for internal libc errors, LIBCLOG_ERROR*() are

for user related error. Big code adjustements.

o Fixed a few smaller issues.
o Started fixing exec() backend.

Location:
trunk/src/emx/include
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/include/InnoTekLIBC/backend.h

    • Property cvs2svn:cvs-rev changed from 1.27 to 1.28
    r2253 r2254  
    770770 *
    771771 * @returns 0 on success, pSigInfo containing status info.
    772  * @returns -1 and errno on failure.
     772 * @returns Negated error code (errno.h) on failure.
    773773 * @param   enmIdType   What kind of process specification Id contains.
    774774 * @param   Id          Process specification of the enmIdType sort.
  • trunk/src/emx/include/InnoTekLIBC/logstrict.h

    • Property cvs2svn:cvs-rev changed from 1.13 to 1.14
    r2253 r2254  
    77 *
    88 * Copyright (c) 2004 InnoTek Systemberatung GmbH
     9 * Copyright (c) 2004-2005 knut st. osmundsen <bird-srcspam@anduin.net>
    910 * Author: knut st. osmundsen <bird-srcspam@anduin.net>
    1011 *
     
    7677    unsigned __libclog_uEnterTS__ = __libc_LogEnter(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __VA_ARGS__)
    7778#else
    78 #define LIBCLOG_ENTER(...)  //hmm
     79#define LIBCLOG_ENTER(...)      //...
    7980#endif
    8081
     
    8485    __libc_LogMsg(__libclog_uEnterTS__, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __VA_ARGS__)
    8586#else
    86 #define LIBCLOG_MSG(...)    do {} while (0)
    87 #endif
    88 
    89 /** Macro to log a generic message within a functionw. */
     87#define LIBCLOG_MSG(...)        ((void)0)
     88#endif
     89
     90/** Macro to log a generic message within a function. */
    9091#ifdef DEBUG_LOGGING
    9192#define LIBCLOG_MSG2(...) \
    9293    __libc_LogMsg(~0, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __VA_ARGS__)
    9394#else
    94 #define LIBCLOG_MSG2(...)   do {} while (0)
     95#define LIBCLOG_MSG2(...)       ((void)0)
     96#endif
     97
     98/** Macro to log an user error within a function entered by LIBCLOG_ENTER(). */
     99#ifdef DEBUG_LOGGING
     100#define LIBCLOG_ERROR(...) \
     101    __libc_LogError(__libclog_uEnterTS__, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, __VA_ARGS__)
     102#else
     103#define LIBCLOG_ERROR(...)      ((void)0)
     104#endif
     105
     106/** Macro to log an user error within a function. */
     107#ifdef DEBUG_LOGGING
     108#define LIBCLOG_ERROR2(...) \
     109    __libc_LogError(~0, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, __VA_ARGS__)
     110#else
     111#define LIBCLOG_ERROR2(...)     ((void)0)
     112#endif
     113
     114/** Macro to check for and log an user error within a function entered by LIBCLOG_ENTER(). */
     115#ifdef DEBUG_LOGGING
     116#define LIBCLOG_ERROR_CHECK(expr, ...) \
     117    (!(expr) ? __libc_LogError(__libclog_uEnterTS__, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, __VA_ARGS__) : ((void)0) )
     118#else
     119#define LIBCLOG_ERROR_CHECK(expr, ...) ((void)0)
     120#endif
     121
     122/** Macro to check for and log an user error within a function. */
     123#ifdef DEBUG_LOGGING
     124#define LIBCLOG_ERROR2_CHECK(expr, ...) \
     125    (!(expr) ? __libc_LogError(~0, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, __VA_ARGS__) : ((void)0) )
     126#else
     127#define LIBCLOG_ERROR2_CHECK(expr, ...) ((void)0)
    95128#endif
    96129
     
    100133    __libc_LogRaw(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, string, maxlen)
    101134#else
    102 #define LIBCLOG_RAW(...)    do {} while (0)
    103 #endif
    104 
    105 /** Macro to log a function exit. */
     135#define LIBCLOG_RAW(...)        ((void)0)
     136#endif
     137
     138/** Macro to leave a function entered by LIBCLOG_ENTER(). */
    106139#ifdef DEBUG_LOGGING
    107140#define LIBCLOG_LEAVE(...) \
    108141    __libc_LogLeave(__libclog_uEnterTS__, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __VA_ARGS__)
    109142#else
    110 #define LIBCLOG_LEAVE(...)  do {} while (0)
     143#define LIBCLOG_LEAVE(...)      ((void)0)
    111144#endif
    112145
    113146/** Macro to log a custom message and return. */
    114 #define LIBCLOG_RETURN_MSG(rc,...)      do { LIBCLOG_LEAVE(__VA_ARGS__);                       return (rc); } while (0)
     147#define LIBCLOG_RETURN_MSG(rc,...)      do { LIBCLOG_LEAVE(__VA_ARGS__); return (rc); } while (0)
    115148/** Macro to log a custom message and return. */
    116 #define LIBCLOG_RETURN_MSG_VOID(...)    do { LIBCLOG_LEAVE(__VA_ARGS__);                       return; } while (0)
     149#define LIBCLOG_RETURN_MSG_VOID(...)    do { LIBCLOG_LEAVE(__VA_ARGS__); return; } while (0)
    117150
    118151/** Macro to log a void return and do the return. */
     
    128161/** Macro to log a pointer return and do the return. */
    129162#define LIBCLOG_RETURN_P(rc)            LIBCLOG_RETURN_MSG((rc), "ret %p\n", (void*)(rc));
     163
     164
     165/** Macro to leave a function entered by LIBCLOG_ENTER() on user error. */
     166#ifdef DEBUG_LOGGING
     167#define LIBCLOG_ERROR_LEAVE(...) \
     168    __libc_LogErrorLeave(__libclog_uEnterTS__, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, __VA_ARGS__)
     169#else
     170#define LIBCLOG_ERROR_LEAVE(...)      ((void)0)
     171#endif
     172
     173/** Macro to log a user error and return. */
     174#define LIBCLOG_ERROR_RETURN(rc,...)          do { LIBCLOG_ERROR_LEAVE(__VA_ARGS__); return (rc); } while (0)
     175#define LIBCLOG_ERROR_RETURN_MSG              LIBCLOG_ERROR_RETURN
     176/** Macro to log a user error and return. */
     177#define LIBCLOG_ERROR_RETURN_MSG_VOID(...)    do { LIBCLOG_ERROR_LEAVE(__VA_ARGS__); return; } while (0)
     178
     179/** Macro to log a void return user error and do the return. */
     180#define LIBCLOG_ERROR_RETURN_VOID()           LIBCLOG_ERROR_RETURN_MSG_VOID( "ret void\n")
     181/** Macro to log an int return user error and do the return. */
     182#define LIBCLOG_ERROR_RETURN_INT(rc)          LIBCLOG_ERROR_RETURN_MSG((rc), "ret %d (%#x)\n", (rc), (rc))
     183/** Macro to log an unsigned int return user error and do the return. */
     184#define LIBCLOG_ERROR_RETURN_UINT(rc)         LIBCLOG_ERROR_RETURN_MSG((rc), "ret %u (%#x)\n", (rc), (rc));
     185/** Macro to log an long int return user error and do the return. */
     186#define LIBCLOG_ERROR_RETURN_LONG(rc)         LIBCLOG_ERROR_RETURN_MSG((rc), "ret %ld (%#lx)\n", (rc), (rc));
     187/** Macro to log an unsigned long int return user error and do the return. */
     188#define LIBCLOG_ERROR_RETURN_ULONG(rc)        LIBCLOG_ERROR_RETURN_MSG((rc), "ret %lu (%#lx)\n", (rc), (rc));
     189/** Macro to log a pointer return user error and do the return. */
     190#define LIBCLOG_ERROR_RETURN_P(rc)            LIBCLOG_ERROR_RETURN_MSG((rc), "ret %p\n", (void*)(rc));
     191
    130192
    131193/** @defgroup   __libc_log_flags    Message Flags (to be combined with group)
     
    183245/** Memory Manager APIs. */
    184246#define __LIBC_LOG_GRP_MMAN         16
     247/** Load APIs. */
     248#define __LIBC_LOG_GRP_LDR          1 /** @todo fix me */
    185249
    186250/** Backend SysV IPC APIs. */
     
    467531/**
    468532 * Output a leave function log message.
     533 *
    469534 * A leave message is considered to be one line and is appended a newline if
    470535 * none was given.
     
    481546
    482547/**
     548 * Output a leave function log message upon a user error.
     549 *
     550 * The function may breakpoint if configured to do so. A leave message is
     551 * considered to be one line and is appended a newline if none was given.
     552 *
     553 * @param   uEnterTS        The timestamp returned by LogEnter.
     554 * @param   pvInstance      Logger instance. If NULL the message goes to the
     555 *                          default log instance.
     556 * @param   fGroupAndFlags  Logging group and logging flags.
     557 * @param   pszFunction     Name of the function which was entered.
     558 * @param   pszFile         Source filename.
     559 * @param   uLine           Line number.
     560 * @param   pszFormat       Format string to display the result.
     561 * @param   ...             Arguments to the format string.
     562 */
     563extern void     __libc_LogErrorLeave(unsigned uEnterTS, void *pvInstance, unsigned fGroupAndFlags, const char *pszFunction, const char *pszFile, unsigned uLine, const char *pszFormat, ...) __printflike(7, 8);
     564
     565/**
    483566 * Output a log message.
     567 *
    484568 * A log message is considered to be one line and is appended a newline if
    485569 * none was given.
     
    494578 */
    495579extern void     __libc_LogMsg(unsigned uEnterTS, void *pvInstance, unsigned fGroupAndFlags, const char *pszFunction, const char *pszFormat, ...) __printflike(5, 6);
     580
     581/**
     582 * Output a log user error message.
     583 *
     584 * This may raise a breakpoint exception if configured so. A log message is
     585 * considered to be one line and is appended a newline if none was given.
     586 *
     587 * @param   uEnterTS        The timestamp returned by LogEnter.
     588 * @param   pvInstance      Logger instance. If NULL the message goes to the
     589 *                          default log instance.
     590 * @param   fGroupAndFlags  Logging group and logging flags.
     591 * @param   pszFunction     Name of the function which was entered.
     592 * @param   pszFile         Source filename.
     593 * @param   uLine           Line number.
     594 * @param   pszFormat       Format string for the message to log.
     595 * @param   ...             Arguments to the format string.
     596 */
     597extern void     __libc_LogError(unsigned uEnterTS, void *pvInstance, unsigned fGroupAndFlags, const char *pszFunction, const char *pszFile, unsigned uLine, const char *pszFormat, ...) __printflike(7, 8);
    496598
    497599/**
  • trunk/src/emx/include/InnoTekLIBC/thread.h

    • Property cvs2svn:cvs-rev changed from 1.13 to 1.14
    r2253 r2254  
    502502 * @returns 0 on success.
    503503 * @returns -1 on failure. errno set.
    504  * @param   iTLSIndex   Value returned by __libc_TLSAlloc().
     504 * @param   iIndex      Value returned by __libc_TLSAlloc().
    505505 */
    506506int     __libc_TLSFree(int iIndex);
     
    511511 * @returns value in given TLS entry.
    512512 * @returns NULL on failure with errno set.
    513  * @param   iTLSIndex   Value returned by __libc_TLSAlloc().
     513 * @param   iIndex      Value returned by __libc_TLSAlloc().
    514514 */
    515515void *  __libc_TLSGet(int iIndex);
     
    520520 * @returns 0 on success.
    521521 * @returns -1 on failure. errno set.
    522  * @param   iTLSIndex   Value returned by __libc_TLSAlloc().
     522 * @param   iIndex      Value returned by __libc_TLSAlloc().
    523523 * @param   pvValue     Value to store.
    524524 */
     
    529529 *
    530530 * The destructor function will be called when a thread terminates
    531  * in a normal fashion and the TLS entry iTLSIndex of that thread is
     531 * in a normal fashion and the TLS entry iIndex of that thread is
    532532 * not NULL.
    533533 *
     
    536536 * @returns 0 on succces.
    537537 * @returns -1 on failure. errno set.
    538  * @param   iTLSIndex       Value returned by __libc_TLSAlloc().
     538 * @param   iIndex          Value returned by __libc_TLSAlloc().
    539539 * @param   pfnDestructor   Callback function. Use NULL to unregister a previously
    540540 *                          registered destructor.
     
    552552 *          this function. The result from doing that is undefined.
    553553 */
    554 int     __libc_TLSDestructor(int iIndex, void (*pfnDestructor)(void *pvValue, int iTLSIndex, unsigned fFlags), unsigned fFlags);
     554int     __libc_TLSDestructor(int iIndex, void (*pfnDestructor)(void *pvValue, int iIndex, unsigned fFlags), unsigned fFlags);
    555555
    556556
     
    562562 * @returns Pointer to destructor if registered.
    563563 *
    564  * @param   iTLSIndex       Value returned by __libc_TLSAlloc().
     564 * @param   iIndex          Value returned by __libc_TLSAlloc().
    565565 * @param   pfFlags         Where to store the flags supplied to __libc_TLSDestructor().
    566566 *                          NULL is ok.
    567567 */
    568 void (*__libc_TLSGetDestructor(int iTLSIndex, unsigned *pfFlags))(void *, int, unsigned);
     568void (*__libc_TLSGetDestructor(int iIndex, unsigned *pfFlags))(void *, int, unsigned);
    569569
    570570/* fix later */
  • trunk/src/emx/include/emx/startup.h

    • Property cvs2svn:cvs-rev changed from 1.6 to 1.7
    r2253 r2254  
    44#define _EMX_STARTUP_H
    55
    6 #if defined (__cplusplus)
    7 extern "C" {
    8 #endif
     6#include <sys/cdefs.h>
    97
     8__BEGIN_DECLS
     9
     10unsigned _System _DLL_InitTerm(unsigned, unsigned);
    1011extern int  _CRT_init(void);
    1112extern void _CRT_term(void);
     
    5253extern char ** _org_environ;
    5354
    54 #if defined (__cplusplus)
    55 }
    56 #endif
     55__END_DECLS
    5756
    5857#endif /* not _EMX_STARTUP_H */
Note: See TracChangeset for help on using the changeset viewer.