Changeset 2905


Ignore:
Timestamp:
Dec 26, 2006, 1:24:25 AM (19 years ago)
Author:
bird
Message:

hacking.

Location:
trunk/libc/src/kNIX
Files:
4 deleted
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/libc/src/kNIX/b_ioClose.c

    r2739 r2905  
    2929*   Header Files                                                               *
    3030*******************************************************************************/
     31#include "kNIX.h"
    3132#define __LIBC_LOG_GROUP    __LIBC_LOG_GRP_BACK_IO
    32 #include "kNix.h"
    33 #include <errno.h>
    34 #include <klibc/backend.h>
    3533#include <klibc/logstrict.h>
    3634
  • trunk/libc/src/kNIX/b_ioFileSizeSet.c

    r2742 r2905  
    2929*   Header Files                                                               *
    3030*******************************************************************************/
     31#include "kNIX.h"
    3132#define __LIBC_LOG_GROUP    __LIBC_LOG_GRP_BACK_IO
    32 #include "kNIX.h"
    33 #include <klibc/backend.h>
    3433#include <klibc/logstrict.h>
    3534
  • trunk/libc/src/kNIX/b_ioRead.c

    r2739 r2905  
    2828*   Header Files                                                               *
    2929*******************************************************************************/
     30#include "kNIX.h"
    3031#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_IO
    31 #include "kNIX.h"
    32 #include <errno.h>
    33 #include <klibc/backend.h>
    3432#include <klibc/logstrict.h>
    3533
     
    4745int __libc_Back_ioRead(int fh, void *pvBuf, size_t cbToRead, size_t *pcbRead)
    4846{
    49     LIBCLOG_ENTER("fh=%d pvBuf=%p cbToRead=%zu pcbRead=%p\n", fh, buf, cbToRead, (void *)pcbRead);
     47    LIBCLOG_ENTER("fh=%d pvBuf=%p cbToRead=%zu pcbRead=%p\n", fh, pvBuf, cbToRead, (void *)pcbRead);
    5048    *pcbRead = 0;
    5149
     
    5957            rc = pFH->pOps->pfnRead(pFH, pvBuf, cbToRead, pcbRead);
    6058            LIBC_ASSERT(rc <= 0);
    61             LIBC_ASSERT(*pcbRead <= cbRead);
     59            LIBC_ASSERT(*pcbRead <= cbToRead);
    6260        }
    6361        else
     
    6967    }
    7068    if (!rc)
    71         LIBCLOG_RETURN_MSG(rc, "ret %d *pcbRead=%zu\n", rc, *pcRead);
     69        LIBCLOG_RETURN_MSG(rc, "ret %d *pcbRead=%zu\n", rc, *pcbRead);
    7270    LIBCLOG_ERROR_RETURN_INT(rc);
    7371}
  • trunk/libc/src/kNIX/b_ioSeek.c

    r2742 r2905  
    2929*   Header Files                                                               *
    3030*******************************************************************************/
    31 #define __LIBC_LOG_GROUP    __LIBC_LOG_GRP_BACK_IO
    3231#include "kNIX.h"
    33 #include <errno.h>
    34 #include <stdio.h>
    35 #include <unistd.h>
    36 #include <klibc/backend.h>
     32#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_IO
    3733#include <klibc/logstrict.h>
    3834
  • trunk/libc/src/kNIX/b_ioWrite.c

    r2739 r2905  
    2828*   Header Files                                                               *
    2929*******************************************************************************/
     30#include "kNIX.h"
    3031#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_IO
    31 #include "libc-alias.h"
    32 #include <errno.h>
    33 #include <klibc/backend.h>
    3432#include <klibc/logstrict.h>
    3533
     
    4745int __libc_Back_ioWrite(int fh, const void *pvBuf, size_t cbToWrite, size_t *pcbWritten)
    4846{
    49     LIBCLOG_ENTER("fh=%d pvBuf=%p cbToWrite=%zu pcbWritten=%p\n", fh, buf, cbToWrite, (void *)pcbWritten);
     47    LIBCLOG_ENTER("fh=%d pvBuf=%p cbToWrite=%zu pcbWritten=%p\n", fh, pvBuf, cbToWrite, (void *)pcbWritten);
    5048    *pcbWritten = 0;
    5149
     
    6361                rc = pFH->pOps->pfnWrite(pFH, pvBuf, cbToWrite, pcbWritten);
    6462                LIBC_ASSERT(rc <= 0);
    65                 LIBC_ASSERT(*pcbWritten <= cbWritten);
     63                LIBC_ASSERT(*pcbWritten <= cbToWrite);
    6664            }
    6765        }
  • trunk/libc/src/kNIX/b_mmanBrk.c

    r2739 r2905  
    2929*   Header Files                                                               *
    3030*******************************************************************************/
     31#include "kNIX.h"
    3132#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_MMAN
    32 #include "kNIX.h"
    33 #include <errno.h>
    34 #include <sys/fmutex.h>
    3533#include <klibc/logstrict.h>
    3634
     
    5250    int rc = _fmutex_request(&__libc_back_gmtxHeap, _FMR_IGNINT);
    5351    if (rc)
    54         LIBCLOG_ERROR_RETURN(-EDOOFUS);
     52        LIBCLOG_ERROR_RETURN_INT(-EDOOFUS);
    5553
    5654    /*
  • trunk/libc/src/kNIX/b_mmanSBrk.c

    r2739 r2905  
    2828*   Header Files                                                               *
    2929*******************************************************************************/
     30#include "kNIX.h"
    3031#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_MMAN
    31 #include "kNIX.h"
    32 #include <errno.h>
    33 #include <sys/fmutex.h>
    3432#include <klibc/logstrict.h>
    3533
     
    5351    int rc = _fmutex_request(&__libc_back_gmtxHeap, _FMR_IGNINT);
    5452    if (rc)
    55         LIBCLOG_ERROR_RETURN(-EDOOFUS);
     53        LIBCLOG_ERROR_RETURN_INT(-EDOOFUS);
    5654
    5755    /*
  • trunk/libc/src/kNIX/b_mmanSBrkGetModel.c

    r2739 r2905  
    2828*   Header Files                                                               *
    2929*******************************************************************************/
     30#include "kNIX.h"
    3031#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_MMAN
    31 #include "kNIX.h"
    32 #include <errno.h>
    33 #include <sys/fmutex.h>
    3432#include <klibc/logstrict.h>
    3533
     
    4341__LIBCSBRKMODEL __libc_Back_mmanSBrkGetModel(void)
    4442{
    45     LIBCLOG_ENTER("\n",);
     43    LIBCLOG_ENTER("\n");
    4644    int rc = _fmutex_request(&__libc_back_gmtxHeap, _FMR_IGNINT);
    4745    if (rc)
  • trunk/libc/src/kNIX/b_mmanSBrkSetModel.c

    r2739 r2905  
    2525 */
    2626
     27
    2728/*******************************************************************************
    2829*   Header Files                                                               *
    2930*******************************************************************************/
     31#include "kNIX.h"
    3032#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_MMAN
    31 #include "kNIX.h"
    32 #include <errno.h>
    33 #include <sys/fmutex.h>
    3433#include <klibc/logstrict.h>
    3534
     
    4544__LIBCSBRKMODEL __libc_Back_mmanSBrkSetModel(__LIBCSBRKMODEL enmModel)
    4645{
    47     LIBCLOG_ENTER("enmModel=%d\n",);
     46    LIBCLOG_ENTER("enmModel=%d\n", enmModel);
    4847    int rc = _fmutex_request(&__libc_back_gmtxHeap, _FMR_IGNINT);
    4948    if (rc)
    50         LIBCLOG_ERROR_RETURN(-EDOOFUS);
     49        LIBCLOG_ERROR_RETURN_INT(-EDOOFUS);
    5150
    5251    const __LIBCSBRKMODEL enmOldModel = __libc_back_genmSBrkModel;
  • trunk/libc/src/kNIX/b_processGetResourceLimit.c

    r2805 r2905  
    2626
    2727
    28 
    2928/*******************************************************************************
    3029*   Header Files                                                               *
    3130*******************************************************************************/
     31#include "kNIX.h"
    3232#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_PROCESS
    33 #include "kNIX.h"
    34 #include <errno.h>
    35 #include <sys/resource.h>
    36 #include <klibc/backend.h>
    3733#include <klibc/logstrict.h>
    3834
     
    9187        }
    9288    }
    93     LIBCLOG_RETURN_MSG(0, "ret 0 *pLimit={.rlim_cur=%#lx, .rlim_max=%#lx}\n", pLimit->rlim_cur, pLimit->rlim_max);
     89    LIBCLOG_RETURN_MSG(0, "ret 0 *pLimit={.rlim_cur=%#llx, .rlim_max=%#llx}\n", pLimit->rlim_cur, pLimit->rlim_max);
    9490}
    9591
  • trunk/libc/src/kNIX/b_processSetResourceLimit.c

    r2748 r2905  
    3030*   Header Files                                                               *
    3131*******************************************************************************/
     32#include "kNIX.h"
    3233#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_PROCESS
    33 #include "kNIX.h"
    34 #include <errno.h>
    35 #include <sys/resource.h>
    36 #include <klibc/backend.h>
    3734#include <klibc/logstrict.h>
    3835
     
    4845int __libc_Back_processSetResourceLimit(int iResId, const struct rlimit *pLimit)
    4946{
    50     LIBCLOG_ENTER("iResId=%d pLimit=%p:{.rlim_cur=%#lx, .rlim_max=%#lx}\n",
     47    LIBCLOG_ENTER("iResId=%d pLimit=%p:{.rlim_cur=%#llx, .rlim_max=%#llx}\n",
    5148                  iResId, pLimit, pLimit->rlim_cur, pLimit->rlim_max);
    5249    /** @todo Implement __libc_Back_processSetResourceLimit(). */
    53     LIBCLOG_ERROR_RETURN_MSG(-ENOSYS);
     50    LIBCLOG_ERROR_RETURN_INT(-ENOSYS);
    5451}
    5552
  • trunk/libc/src/kNIX/b_signalSendPid.c

    r2805 r2905  
    2929*   Header Files                                                               *
    3030*******************************************************************************/
     31#include "kNIX.h"
    3132#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_SIGNAL
    32 #include "kNIX.h"
     33#include <klibc/logstrict.h>
    3334#ifdef __OS2__ /* later on NT. */
    3435# include "os2/b_signal.h"
  • trunk/libc/src/kNIX/backend.h

    r2733 r2905  
    3232__BEGIN_DECLS
    3333
    34 /** Wait Event Semaphore.
    35  * This is an event semaphore which will never be posted (unless we wanna resolve
    36  * some nasty deadlock in the future) but is used to wait for a signal to arrive.
    37  * When a signal arrives the wait will be interrupted to allow for execution of
    38  * the exception and signal processing. DosWaitEventSem will return ERROR_INTERRUPT.
    39  */
    40 extern unsigned long __libc_back_ghevWait;
    4134
    4235/**
     
    4740int __libc_native2errno(unsigned long rc);
    4841
    49 /**
    50  * Initializes the various LIBC hooks using the given
    51  * specification string.
    52  */
    53 void __libc_back_hooksInit(const char *pszSpec, unsigned long hmod);
    5442
    5543__END_DECLS
  • trunk/libc/src/kNIX/filehandles.c

    r2904 r2905  
    44 * kNIX File Handles.
    55 *
    6  * Copyright (c) 2006 knut st. osmundsen <bird@innotek.de>
     6 * Copyright (c) 2004-2006 knut st. osmundsen <bird-srcspam@anduin.net>
    77 *
    88 *
     
    2929*   Header Files                                                               *
    3030*******************************************************************************/
     31#include "kNIX.h"
    3132#define __LIBC_LOG_GROUP    __LIBC_LOG_GRP_INITTERM
    32 #include "kNIX.h"
    33 
     33#include <klibc/logstrict.h>
     34
     35/** @todo remove these: */
    3436#include <InnoTekLIBC/fork.h>
    3537#include <InnoTekLIBC/sharedpm.h>
    3638#include <InnoTekLIBC/tcpip.h>
    37 #include "b_fs.h"
    38 #include "b_dir.h"
    3939
    4040
  • trunk/libc/src/kNIX/fs.c

    r2903 r2905  
    2929*   Header Files                                                               *
    3030*******************************************************************************/
     31#include "kNIX.h"
    3132#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_FS
    32 #define _GNU_SOURCE
    33 #include "kNIX.h"
    34 #include <klibc/backend.h>
    3533#include <klibc/logstrict.h>
    3634
     
    9593}
    9694
     95
     96/**
     97 * Request the owner ship of the FS mutex.
     98 *
     99 * @returns 0 on success.
     100 * @returns -1 and errno on failure.
     101 */
    97102int __libc_back_fsMutexRequest(void)
    98103{
     
    104109
    105110
     111/**
     112 * Releases the owner ship of the FS mutex obtained by __libc_back_fsMutexRelease().
     113 */
    106114void __libc_back_fsMutexRelease(void)
    107115{
  • trunk/libc/src/kNIX/heap.c

    r2902 r2905  
    3030*   Header Files                                                               *
    3131*******************************************************************************/
    32 #define  __LIBC_LOG_GROUP __LIBC_LOG_GRP_HEAP
    3332#include "kNIX.h"
    34 #ifdef __OS2__
    35 # define INCL_DOSERRORS
    36 # define INCL_FSMACROS
    37 # define INCL_EXAPIS
    38 # include <os2emx.h>
    39 #endif
    40 #ifdef __NT__
    41 # include <klibc/nt/nt.h>
    42 #endif
    43 #include <errno.h>
    44 #include <klibc/backend.h>
     33#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_HEAP
    4534#include <klibc/logstrict.h>
    46 
    4735
    4836
     
    5543    FS_VAR_SAVE_LOAD();
    5644    int rc = DosFreeMemEx((void *)ObjPtr);
    57     LIBC_ASSERTM(!rc, vs"ObjPtr=%p rc=%d\n", ObjPtr, rc); (void)rc;
     45    LIBC_ASSERTM(!rc, "ObjPtr=%tx rc=%d\n", ObjPtr, rc); (void)rc;
    5846    FS_RESTORE();
    5947
     
    243231void *__libc_back_heapExpandBy(uintptr_t incr, __LIBCSBRKMODEL enmSBrkModel)
    244232{
    245     LIBCLOG_ENTER("incr=%p enmSBrkModel=%d\n", incr, enmSBrkModel);
     233    LIBCLOG_ENTER("incr=%tx enmSBrkModel=%d\n", incr, enmSBrkModel);
    246234    const unsigned old_obj_count = __libc_back_gcHeapObjs;
    247235
     
    353341void *__libc_back_heapShrinkTo(uintptr_t new_brk)
    354342{
    355     LIBCLOG_ENTER("new_brk=%ld\n", new_brk);
     343    LIBCLOG_ENTER("new_brk=%tx\n", new_brk);
    356344
    357345    /*
     
    448436void *__libc_back_heapShrinkBy(uintptr_t decr, __LIBCSBRKMODEL enmSBrkModel)
    449437{
    450     LIBCLOG_ENTER("decr=%ld enmSBrkModel=%d\n", decr, enmSBrkModel);
     438    LIBCLOG_ENTER("decr=%tx enmSBrkModel=%d\n", decr, enmSBrkModel);
    451439    if (    __libc_back_gcHeapObjs != 0
    452440        &&  __libc_back_gpHeapTopObj->brk - decr >= __libc_back_gpHeapTopObj->base)
  • trunk/libc/src/kNIX/kNIX.h

    r2904 r2905  
    3030
    3131#include "libc-alias.h"
    32 #ifdef __OS2__
     32#if defined(__OS2__)
    3333# include <klibc/os2/os2.h>
    3434# include "os2/kNIXConfig.h"
     
    5555#include <klibc/thread.h>
    5656#include <klibc/backend.h>
    57 #ifdef __LIBC_LOG_GROUP
    58 # include <klibc/logstrict.h>
    59 #endif
    6057
    6158
     
    6461/** File handle operations for 'files'. */
    6562extern const __LIBC_FHOPS __libc_back_gFileOps;
     63
     64/** @name Directories
     65 * @{
     66 */
     67
     68/**
     69 * A directory handle.
     70 */
     71typedef struct __LIBC_FHDIR
     72{
     73    /** The common fh core. */
     74    __LIBC_FH       Core;
     75#ifdef __OS2__
     76    /** The directory handle. */
     77    HDIR            hDir;
     78    /** Set if the path is in the unix tree, else clear.
     79     * This is for fchdir() handling. */
     80    unsigned        fInUnixTree;
     81    /** The find operation type. */
     82    unsigned        fType;
     83    union
     84    {
     85        /** Pointer to the old kind of buffer. */
     86        PFILEFINDBUF4   p4;
     87        /** Pointer to the large file kind of buffer. */
     88        PFILEFINDBUF4L  p4L;
     89        /** Byte pointer used to advance the buffer entries. */
     90        uint8_t        *pu8;
     91        /** Void pointer. */
     92        void           *pv;
     93    }
     94    /** Pointer to the find buffer.
     95     * This is located in low memory. */
     96                    uBuf,
     97    /** Pointer to the current buffer position.
     98     * This is invalid if cFiles is 0. */
     99                    uCur;
     100    /** The number of files left in the buffer. */
     101    ULONG           cFiles;
     102    /** The size of the find buffer. */
     103    unsigned        cbBuf;
     104    /** Current entry number (total, for seeking). */
     105    unsigned        uCurEntry;
     106#endif /* __OS2__ */
     107} __LIBC_FHDIR;
     108/** Pointer to the a directory handle. */
     109typedef __LIBC_FHDIR *__LIBC_PFHDIR;
     110
     111int __libc_Back_dirOpenNative(char *pszNativePath, unsigned fInUnixTree, unsigned fLibc, struct stat *pStat);
     112int __libc_back_dirInherit(int fh, const char *pszNativePath, unsigned fInUnixTree, unsigned fFlags,
     113                           ino_t Inode, dev_t Dev, unsigned uCurEntry);
     114ssize_t __libc_back_dirGetEntries(__LIBC_PFHDIR pFHDir, void *pvBuf, size_t cbBuf);
     115/** @} */
     116
     117
    66118
    67119/** @name Heap
     
    166218 */
    167219int __libc_back_sys_processGetResourceLimit(int iResId, struct rlimit *pLimit);
     220int __libc_back_native2errno(int rc);
     221void __libc_back_hooksInit(const char *pszSpec, uintptr_t hmod);
    168222/** @} */
    169223
     
    186240 * Include the target specific parts.
    187241 */
    188 #ifdef __OS2__
     242#if defined(__OS2__)
    189243# include "os2/kNIX-os2.h"
    190244#elif defined(__NT__)
  • trunk/libc/src/kNIX/os2/kNIX-os2.h

    r2903 r2905  
    44 * kNIX - The OS/2 specific bits of the Main header.
    55 *
    6  * Copyright (c) 2006 knut st. osmundsen <bird-srcspam@anduin.net>
     6 * Copyright (c) 2004-2006 knut st. osmundsen <bird-srcspam@anduin.net>
    77 *
    88 *
     
    219219int __libc_back_fsInheritPack(__LIBC_PSPMINHFS *ppFS, size_t *pcbFS, __LIBC_PSPMINHFS2 *ppFS2, size_t *pcbFS2);
    220220
     221
     222/** Wait Event Semaphore.
     223 * This is an event semaphore which will never be posted (unless we wanna resolve
     224 * some nasty deadlock in the future) but is used to wait for a signal to arrive.
     225 * When a signal arrives the wait will be interrupted to allow for execution of
     226 * the exception and signal processing. DosWaitEventSem will return ERROR_INTERRUPT.
     227 */
     228extern unsigned long __libc_back_ghevWait;
     229
    221230__END_DECLS
    222231
  • trunk/libc/src/kNIX/os2/seterrno.c

    r2732 r2905  
    1 /* sys/seterrno.c (emx+gcc) -- Copyright (c) 1992-1998 by Eberhard Mattes */
     1/* $Id: $ */
     2/** @file
     3 *
     4 * kNIX - Error convertion from OS/2 to errno.h.
     5 *
     6 * Copyright (c) 1992-1998 by Eberhard Mattes
     7 * Copyright (c) 2006 knut st. osmundsen <bird@anduin.net>
     8 *
     9 *
     10 * This file is part of kLIBC.
     11 *
     12 * kLIBC is free software; you can redistribute it and/or modify
     13 * it under the terms of the GNU Lesser General Public License as published
     14 * by the Free Software Foundation; either version 2 of the License, or
     15 * (at your option) any later version.
     16 *
     17 * kLIBC is distributed in the hope that it will be useful,
     18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     20 * GNU Lesser General Public License for more details.
     21 *
     22 * You should have received a copy of the GNU Lesser General Public License
     23 * along with kLIBC; if not, write to the Free Software
     24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     25 *
     26 */
    227
    3 #include "libc-alias.h"
    4 #include <errno.h>
    5 #include "syscalls.h"
    6 #include "backend.h"
     28/*******************************************************************************
     29*   Header Files                                                               *
     30*******************************************************************************/
     31#include "kNIX.h"
    732
    8 static unsigned char const errno_tab[] =
     33
     34/*******************************************************************************
     35*   Global Variables                                                           *
     36*******************************************************************************/
     37static unsigned char const g_auchOS2ToErrno[] =
    938{
    1039  EINVAL, EINVAL, ENOENT, ENOENT, EMFILE,  /* 0..4 */
     
    78107
    79108
    80 void _sys_set_errno (unsigned long rc)
     109/**
     110 * Converts a native error code to an error.h code.
     111 *
     112 * @returns errno.h error code.
     113 * @param   rc  Native error code.
     114 */
     115int __libc_back_native2errno(int rc)
    81116{
    82   if (rc >= sizeof (errno_tab))
    83     errno = EINVAL;
    84   else
    85     errno = errno_tab[rc];
     117    if ((unsigned)rc < sizeof(g_auchOS2ToErrno))
     118        return g_auchOS2ToErrno[rc];
     119    return EINVAL;
    86120}
    87121
    88 int __libc_native2errno (unsigned long rc)
     122int __libc_native2errno(unsigned long rc)
    89123{
    90   if (rc >= sizeof (errno_tab))
    91     return EINVAL;
    92   return errno_tab[rc];
     124    return __libc_back_native2errno((int)rc);
    93125}
    94126
  • trunk/libc/src/kNIX/thread.c

    r2819 r2905  
    44 * kUNIX - Thread Management.
    55 *
    6  * Copyright (c) 2006 knut st. osmundsen <bird@innotek.de>
     6 * Copyright (c) 2006 knut st. osmundsen <bird-srcspam@innotek.de>
    77 *
    88 *
     
    3030#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_THREAD
    3131#include "kNIX.h"
    32 
    3332
    3433
     
    219218{
    220219    LIBCLOG_ENTER("\n");
     220
    221221    /*
    222222     * No need to use the pre allocated here since the current thread will
Note: See TracChangeset for help on using the changeset viewer.