Changeset 2647


Ignore:
Timestamp:
Mar 15, 2006, 4:10:55 AM (19 years ago)
Author:
bird
Message:

read & write logging, and added support for more size flags to the log formatter.

Location:
branches/libc-0.6/src/emx
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/libc-0.6/src/emx/ChangeLog.LIBC

    r2646 r2647  
    552006-03-14: knut st. osmundsen <bird-gccos2-spam@anduin.net>
    66    - libc:
     7        o __read & __write logging, and added support for more size flags to the log formatter.
    78        o #68: Implemented the _GETOPT_DECLARED blocker in getopt.h too.
    89
  • branches/libc-0.6/src/emx/src/lib/sys/__read.c

    r2437 r2647  
    1515#include <emx/syscalls.h>
    1616#include "syscalls.h"
     17#define __LIBC_LOG_GROUP    __LIBC_LOG_GRP_BACK_IO
     18#include <InnoTekLIBC/logstrict.h>
    1719
    1820int __read (int handle, void *buf, size_t cbToRead)
    1921{
     22    LIBCLOG_ENTER("fd=%d buf=%p cbToRead=%zu\n", handle, buf, cbToRead);
    2023    int     rc;
    2124    PLIBCFH pFH;
     
    2932    {
    3033        errno = EBADF;
    31         return -1;
     34        LIBCLOG_ERROR_RETURN_INT(-1);
    3235    }
    3336
     
    5053            pvBuf_safe = _lmalloc(cbToRead);
    5154            if (!pvBuf_safe)
    52                 return ERROR_NOT_ENOUGH_MEMORY;
     55            {
     56                errno = ENOMEM;
     57                LIBCLOG_ERROR_RETURN_INT(-1);
     58            }
    5359            memcpy(pvBuf_safe, buf, cbToRead);
    5460        }
     
    8995            rc = -EBADF;
    9096        errno = -rc;
    91         return -1;
     97        LIBCLOG_ERROR_RETURN_INT(-1);
    9298    }
    93 
    94     return cbRead;
     99    LIBCLOG_RETURN_INT(cbRead);
    95100}
  • branches/libc-0.6/src/emx/src/lib/sys/__write.c

    r2437 r2647  
    1515#include <emx/syscalls.h>
    1616#include "syscalls.h"
     17#define __LIBC_LOG_GROUP    __LIBC_LOG_GRP_BACK_IO
     18#include <InnoTekLIBC/logstrict.h>
    1719
    1820int __write(int handle, const void *buf, size_t cbToWrite)
    1921{
     22    LIBCLOG_ENTER("fd=%d buf=%p cbToWrite=%zu\n", handle, buf, cbToWrite);
    2023    PLIBCFH pFH;
    2124    int     rc;
     
    3235    {
    3336        errno = EBADF;
    34         return -1;
     37        LIBCLOG_ERROR_RETURN_INT(-1);
    3538    }
    3639
     
    5255                pvBuf_safe = _lmalloc(cbToWrite);
    5356                if (!pvBuf_safe)
    54                     return ERROR_NOT_ENOUGH_MEMORY;
     57                {
     58                    errno = ENOMEM;
     59                    LIBCLOG_ERROR_RETURN_INT(-1);
     60                }
    5561                memcpy(pvBuf_safe, buf, cbToWrite);
    5662                buf = pvBuf_safe;
     
    98104            rc = -EBADF;
    99105        errno = -rc;
    100         return -1;
     106        LIBCLOG_ERROR_RETURN_INT(-1);
    101107    }
    102     return cbWritten;
     108    LIBCLOG_RETURN_INT(cbWritten);
    103109}
    104110
  • branches/libc-0.6/src/emx/src/lib/sys/logstrict.c

    r2260 r2647  
    18481848                /* argsize */
    18491849                chArgSize = *pszFormat;
    1850                 if (chArgSize != 'l' && chArgSize != 'L' && chArgSize != 'H')
     1850                if (    chArgSize != 'l' && chArgSize != 'L' && chArgSize != 'h'  && chArgSize != 'H'
     1851                    &&  chArgSize != 'j' && chArgSize != 'z' && chArgSize != 't')
    18511852                    chArgSize = 0;
    1852                 else if (*++pszFormat == 'l' && chArgSize == 'l')
     1853                else
    18531854                {
    1854                     chArgSize = 'L';
    18551855                    pszFormat++;
     1856                    if (*pszFormat == 'l' && chArgSize == 'l')
     1857                    {
     1858                        chArgSize = 'L';
     1859                        pszFormat++;
     1860                    }
     1861                    else if (*pszFormat == 'h' && chArgSize == 'h')
     1862                    {
     1863                        chArgSize = 'H';
     1864                        pszFormat++;
     1865                    }
    18561866                }
    18571867
     
    19881998                            else if (chArgSize == 'h')
    19891999                                ulValue = va_arg(args, signed /*short*/ int); /* the great GCC pedantically saith use int. */
     2000                            else if (chArgSize == 'H')
     2001                                ulValue = va_arg(args, /* int8_t */ int); /* the great GCC pedantically saith use int. */
     2002                            else if (chArgSize == 'j')
     2003                                ulValue = va_arg(args, intmax_t);
     2004                            else if (chArgSize == 'z')
     2005                                ulValue = va_arg(args, size_t);
     2006                            else if (chArgSize == 't')
     2007                                ulValue = va_arg(args, ptrdiff_t);
    19902008                            else
    19912009                                ulValue = va_arg(args, signed int);
Note: See TracChangeset for help on using the changeset viewer.