Changeset 2914


Ignore:
Timestamp:
Dec 27, 2006, 7:56:09 PM (19 years ago)
Author:
bird
Message:

cleanup in progress (evening meal)

Location:
trunk/libc
Files:
2 added
7 deleted
43 edited
1 copied
8 moved

Legend:

Unmodified
Added
Removed
  • trunk/libc/include/klibc/backend.h

    r2913 r2914  
    295295
    296296/**
    297  * Removes a new directory.
     297 * Removes a directory.
    298298 *
    299299 * @returns 0 on success.
     
    654654 */
    655655int __libc_Back_miscLoadAvg(double *pardAvgs, unsigned cAvgs);
     656
     657/**
     658 * Get the console size if the current session is associated with a console.
     659 *
     660 * @returns 0 on success.
     661 * @returns Negative error code (errno.h) on failure.
     662 * @param   pcRows      Where to store the row count.
     663 * @param   pcColumns   Where to store the column count.
     664 */
     665int __libc_Back_miscConsoleSize(int *pcRows, int *pcColumns);
    656666
    657667/** @} */
  • trunk/libc/include/klibc/os2/os2.h

    r2805 r2914  
    3838
    3939#include <os2emx.h>
     40#include <os2thunk.h>
    4041
    4142#endif
  • trunk/libc/src/kNIX/Makefile.kmk

    r2913 r2914  
    3434libc_kNIX_TEMPLATE = libcsub
    3535libc_kNIX_SOURCES = \
     36    $(PATH_LIBC_SRC)/kNIX/b_fsPathResolve.c \
     37    $(PATH_LIBC_SRC)/kNIX/b_fsSymlinkModeSet.c \
     38    $(PATH_LIBC_SRC)/kNIX/b_fsSymlinkCreate.c \
     39    $(PATH_LIBC_SRC)/kNIX/b_fsFileTimesSet.c \
     40    $(PATH_LIBC_SRC)/kNIX/b_fsDirRemove.c \
     41    $(PATH_LIBC_SRC)/kNIX/b_fsFileModeSet.c \
     42    $(PATH_LIBC_SRC)/kNIX/b_fsFileStat.c \
    3643    $(PATH_LIBC_SRC)/kNIX/b_fsSymlinkRead.c \
    3744    $(PATH_LIBC_SRC)/kNIX/b_fsSymlinkStat.c \
     
    6774    $(PATH_LIBC_SRC)/kNIX/os2/b_fsDirCurrentSet.c \
    6875    $(PATH_LIBC_SRC)/kNIX/os2/b_fsDirCurrentSetFH.c \
    69     $(PATH_LIBC_SRC)/kNIX/os2/b_fsDirRemove.c \
     76    $(PATH_LIBC_SRC)/kNIX/os2/b_fsNativeDirRemove.c \
    7077    $(PATH_LIBC_SRC)/kNIX/os2/b_fsDriveDefaultGet.c \
    7178    $(PATH_LIBC_SRC)/kNIX/os2/b_fsDriveDefaultSet.c \
    72     $(PATH_LIBC_SRC)/kNIX/os2/b_fsFileModeSet.c \
    7379    $(PATH_LIBC_SRC)/kNIX/os2/b_fsFileModeSetFH.c \
    74     $(PATH_LIBC_SRC)/kNIX/os2/b_fsFileStat.c \
    7580    $(PATH_LIBC_SRC)/kNIX/os2/b_fsFileStatFH.c \
    76     $(PATH_LIBC_SRC)/kNIX/os2/b_fsFileTimesSet.c \
    7781    $(PATH_LIBC_SRC)/kNIX/os2/b_fsFileTimesSetFH.c \
    7882    $(PATH_LIBC_SRC)/kNIX/os2/b_fsNativeFileModeSet.c \
    7983    $(PATH_LIBC_SRC)/kNIX/os2/b_fsNativeFileStat.c \
    8084    $(PATH_LIBC_SRC)/kNIX/os2/b_fsNativeFileTimesSet.c \
    81     $(PATH_LIBC_SRC)/kNIX/os2/b_fsPathResolve.c \
    8285    $(PATH_LIBC_SRC)/kNIX/os2/b_fsRename.c \
    8386    $(PATH_LIBC_SRC)/kNIX/os2/b_fsStat.c \
    84     $(PATH_LIBC_SRC)/kNIX/os2/b_fsSymlinkCreate.c \
    85     $(PATH_LIBC_SRC)/kNIX/os2/b_fsSymlinkModeSet.c \
    8687    $(PATH_LIBC_SRC)/kNIX/os2/b_fsSync.c \
    8788    $(PATH_LIBC_SRC)/kNIX/os2/b_fsUnlink.c \
     
    9293    $(PATH_LIBC_SRC)/kNIX/os2/b_ldrSymbol.c \
    9394    $(PATH_LIBC_SRC)/kNIX/os2/b_miscLoadAvg.c \
     95    $(PATH_LIBC_SRC)/kNIX/os2/b_miscConsoleSize.c \
    9496    $(PATH_LIBC_SRC)/kNIX/os2/b_mmanProtect.c \
    9597    $(PATH_LIBC_SRC)/kNIX/os2/b_nativeSymlinkCreate.c \
     
    153155    $(PATH_LIBC_SRC)/kNIX/os2/resource.c \
    154156    $(PATH_LIBC_SRC)/kNIX/os2/safesems.c \
    155     $(PATH_LIBC_SRC)/kNIX/os2/scrsize.c \
    156     $(PATH_LIBC_SRC)/kNIX/os2/seterrno.c \
     157    $(PATH_LIBC_SRC)/kNIX/os2/__libc_back_native2errno.c \
    157158    $(PATH_LIBC_SRC)/kNIX/os2/sharedpm.c \
    158159    $(PATH_LIBC_SRC)/kNIX/os2/signals.c \
  • trunk/libc/src/kNIX/b_fsDirRemove.c

    r2913 r2914  
    2525 */
    2626
    27 
    28 /*******************************************************************************
    29 *   Header Files                                                               *
    30 *******************************************************************************/
    31 #include "libc-alias.h"
    32 #define INCL_FSMACROS
    33 #define INCL_ERRORS
    34 #include <os2emx.h>
    35 #include "b_fs.h"
    36 #include <errno.h>
    37 #include <sys/stat.h>
    38 #include <InnoTekLIBC/backend.h>
     27#include "kNIX.h"
    3928#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_FS
    40 #include <InnoTekLIBC/logstrict.h>
    41 
     29#include <klibc/logstrict.h>
    4230
    4331/**
    44  * Removes a new directory.
     32 * Removes a directory.
    4533 *
    4634 * @returns 0 on success.
     
    5038int __libc_Back_fsDirRemove(const char *pszPath)
    5139{
    52     LIBCLOG_ENTER("pszPath=%s\n", pszPath);
    53     FS_VAR();
     40    LIBCLOG_ENTER("pszPath=%p:{%s}\n", (void *)pszPath, pszPath);
    5441
    5542    /*
    56      * Resolve the path.
    57      * (Symlinks should cause failure, so don't resolve last component.)
     43     * Resolve the path and execute the operation on the native path.
    5844     */
    5945    char szNativePath[PATH_MAX];
    6046    int rc = __libc_back_fsResolve(pszPath, BACKFS_FLAGS_RESOLVE_FULL_SYMLINK | BACKFS_FLAGS_RESOLVE_DIR, &szNativePath[0], NULL);
    61     if (rc)
    62         LIBCLOG_RETURN_INT(rc);
     47    if (!rc)
     48        rc = __libc_back_fsNativeDirRemove(szNativePath);
    6349
    64     /*
    65      * Do It.
    66      */
    67     FS_SAVE_LOAD();
    68     rc = DosDeleteDir((PCSZ)&szNativePath[0]);
    69     FS_RESTORE();
    70     if (!rc)
    71         LIBCLOG_RETURN_INT(rc);
    72 
    73 
    74     /*
    75      * OS/2 returns access denied when the directory
    76      * contains files or it is not a directory. Check for
    77      * directory/other and return failure accordingly.
    78      */
    79     if (rc == ERROR_ACCESS_DENIED)
    80     {
    81         struct stat s;
    82         rc = __libc_back_fsNativeFileStat(&szNativePath[0], &s);
    83         if (!rc)
    84             rc = S_ISDIR(s.st_mode) ? -ENOTEMPTY : -ENOTDIR;
    85     }
    86     else
    87         rc = -__libc_native2errno(rc);
    88     LIBCLOG_ERROR_RETURN_INT(rc);
     50    LIBCLOG_MIX_RETURN_INT(rc);
    8951}
    9052
  • trunk/libc/src/kNIX/b_fsFileModeSet.c

    r2913 r2914  
    2525 */
    2626
    27 /*******************************************************************************
    28 *   Header Files                                                               *
    29 *******************************************************************************/
    30 #include "b_fs.h"
    31 #include <sys/stat.h>
    32 #include <InnoTekLIBC/backend.h>
     27#include "kNIX.h"
    3328#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_FS
    34 #include <InnoTekLIBC/logstrict.h>
    35 
     29#include <klibc/logstrict.h>
    3630
    3731/**
  • trunk/libc/src/kNIX/b_fsFileStat.c

    r2913 r2914  
    22/** @file
    33 *
    4  * kNIX - stat.
     4 * kNIX - stat().
    55 *
    66 * Copyright (c) 2004 knut st. osmundsen <bird-src-spam@innotek.de>
     
    2525 */
    2626
    27 
    28 /*******************************************************************************
    29 *   Header Files                                                               *
    30 *******************************************************************************/
    31 #include "b_fs.h"
    32 #include <sys/stat.h>
    33 #include <InnoTekLIBC/backend.h>
     27#include "kNIX.h"
    3428#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_FS
    35 #include <InnoTekLIBC/logstrict.h>
    36 
     29#include <klibc/logstrict.h>
    3730
    3831/**
  • trunk/libc/src/kNIX/b_fsFileTimesSet.c

    r2913 r2914  
    2525 */
    2626
    27 /*******************************************************************************
    28 *   Header Files                                                               *
    29 *******************************************************************************/
    30 #include "b_fs.h"
    31 #include <sys/stat.h>
    32 #include <InnoTekLIBC/backend.h>
     27#include "kNIX.h"
    3328#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_FS
    34 #include <InnoTekLIBC/logstrict.h>
    35 
     29#include <klibc/logstrict.h>
    3630
    3731/**
  • trunk/libc/src/kNIX/b_fsPathResolve.c

    r2913 r2914  
    44 * kNIX - realpath.
    55 *
    6  * Copyright (c) 2004 knut st. osmundsen <bird-src-spam@innotek.de>
     6 * Copyright (c) 2004-2006 knut st. osmundsen <bird-src-spam@innotek.de>
    77 *
    88 *
     
    2525 */
    2626
    27 
    28 
    29 /*******************************************************************************
    30 *   Header Files                                                               *
    31 *******************************************************************************/
    32 #include "libc-alias.h"
    33 #define INCL_BASE
    34 #include <os2emx.h>
    35 #include "b_fs.h"
    36 #include <errno.h>
    37 #include <string.h>
    38 #include <InnoTekLIBC/backend.h>
     27#include "kNIX.h"
    3928#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_FS
    40 #include <InnoTekLIBC/logstrict.h>
    41 
     29#include <klibc/logstrict.h>
    4230
    4331
     
    9179}
    9280
    93 
  • trunk/libc/src/kNIX/b_fsSymlinkCreate.c

    r2913 r2914  
    2525 */
    2626
    27 
    28 
    29 /*******************************************************************************
    30 *   Header Files                                                               *
    31 *******************************************************************************/
    32 #include "b_fs.h"
    33 #include <string.h>
    34 #include <errno.h>
    35 #include <InnoTekLIBC/backend.h>
     27#include "kNIX.h"
    3628#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_FS
    37 #include <InnoTekLIBC/logstrict.h>
    38 
     29#include <klibc/logstrict.h>
    3930
    4031/**
  • trunk/libc/src/kNIX/b_fsSymlinkModeSet.c

    r2913 r2914  
    2525 */
    2626
    27 /*******************************************************************************
    28 *   Header Files                                                               *
    29 *******************************************************************************/
    30 #include "b_fs.h"
    31 #include <sys/stat.h>
    32 #include <InnoTekLIBC/backend.h>
     27#include "kNIX.h"
    3328#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_FS
    34 #include <InnoTekLIBC/logstrict.h>
    35 
     29#include <klibc/logstrict.h>
    3630
    3731/**
  • trunk/libc/src/kNIX/kNIX.h

    r2913 r2914  
    2828#define __kNIX_h__
    2929
     30#define _GNU_SOURCE
    3031
    3132#include "libc-alias.h"
     
    4142#include <errno.h>
    4243#include <malloc.h>
     44#include <share.h>
     45#include <signal.h>
    4346#include <string.h>
    44 #include <signal.h>
    4547#include <process.h>
    4648#include <sys/builtin.h>
     
    4850#include <sys/fmutex.h>
    4951#include <sys/fcntl.h>
     52#include <sys/mman.h>
    5053#include <sys/mount.h>
    5154#include <sys/resource.h>
     
    205208int __libc_back_fsUnixAttribsGet(int hFile, const char *pszNativePath, struct stat *pStat);
    206209int __libc_back_fsUnixAttribsGetMode(int hFile, const char *pszNativePath, mode_t *pMode);
     210int __libc_back_fsNativeDirRemove(const char *pszNativePath);
    207211int __libc_back_fsNativeSymlinkCreate(const char *pszTarget, char *pszNativePath);
    208212int __libc_back_fsNativeSymlinkRead(const char *pszNativePath, char *pachBuf, size_t cchBuf);
  • trunk/libc/src/kNIX/os2/DosEx.c

    r2913 r2914  
    877877            if (rc)
    878878            {
    879                 rc = -__libc_native2errno(rc);
     879                rc = -__libc_back_native2errno(rc);
    880880                LIBCLOG_ERROR_RETURN_INT(rc);
    881881            }
     
    10121012                 pEntry->u.MemAlloc.pv, pEntry->u.MemAlloc.cb, pEntry->u.MemAlloc.flFlags, rc);
    10131013    if (rc)
    1014         return -__libc_native2errno(rc);
     1014        return -__libc_back_native2errno(rc);
    10151015    return 0;
    10161016}
     
    10361036        LIBC_ASSERTM(!rc, "DosGetSharedMem(%p,%#lx) -> rc=%d\n", pEntry->u.MemOpen.pv, pEntry->u.MemOpen.flFlags, rc);
    10371037        if (rc)
    1038             return -__libc_native2errno(rc);
     1038            return -__libc_back_native2errno(rc);
    10391039    }
    10401040    return 0;
     
    10741074            LIBC_ASSERTM_FAILED("DosCreateMutexSem(,,%#lx,0) -> rc=%d\n", flFlags, rc);
    10751075            pBundle->cUsed = i;
    1076             rc = -__libc_native2errno(rc);
     1076            rc = -__libc_back_native2errno(rc);
    10771077            break;
    10781078        }
     
    11381138        LIBC_ASSERTM(!rc, "DosOpenMutexSem(,%#lx) -> rc=%d\n", pEntry->u.MutexOpen.hmtx, rc);
    11391139        if (rc)
    1140             return -__libc_native2errno(rc);
     1140            return -__libc_back_native2errno(rc);
    11411141    }
    11421142    return 0;
     
    11771177            LIBC_ASSERTM_FAILED("DosCreateEventSem(,,%#lx,%d) -> rc=%d\n", flFlags, cPostings > 0, rc);
    11781178            pBundle->cUsed = i;
    1179             rc = -__libc_native2errno(rc);
     1179            rc = -__libc_back_native2errno(rc);
    11801180            break;
    11811181        }
     
    12401240        LIBC_ASSERTM(!rc, "DosOpenEventSem(,%#lx) -> rc=%d\n", pEntry->u.EventOpen.hev, rc);
    12411241        if (rc)
    1242             return -__libc_native2errno(rc);
     1242            return -__libc_back_native2errno(rc);
    12431243    }
    12441244    return 0;
     
    12661266        LIBC_ASSERTM(!rc, "DosQueryModuleName(%#lx,%d,%p) -> rc=%d \n", pEntry->u.LoadModule.hmte, sizeof(szName), szName, rc);
    12671267        if (rc)
    1268             return -__libc_native2errno(rc);
     1268            return -__libc_back_native2errno(rc);
    12691269    }
    12701270
     
    12781278        LIBC_ASSERTM(!rc, "DosLoadModule(,,'%s',) -> rc=%d (hmte=%#lx)\n", szName, rc, pEntry->u.LoadModule.hmte);
    12791279        if (rc)
    1280             return -__libc_native2errno(rc);
     1280            return -__libc_back_native2errno(rc);
    12811281    }
    12821282    return 0;
  • trunk/libc/src/kNIX/os2/__libc_back_native2errno.c

    r2905 r2914  
    120120}
    121121
    122 int __libc_native2errno(unsigned long rc)
    123 {
    124     return __libc_back_native2errno((int)rc);
    125 }
    126 
  • trunk/libc/src/kNIX/os2/__select.c

    r2913 r2914  
    6565    if (!rc || rc == ERROR_TIMEOUT || rc == ERROR_SEM_TIMEOUT)
    6666        return 0;
    67     errno = __libc_native2errno(rc);
     67    errno = __libc_back_native2errno(rc);
    6868    return -1;
    6969}
  • trunk/libc/src/kNIX/os2/b_fsDirCurrentGet.c

    r2913 r2914  
    44 * kNIX - getcwd.
    55 *
    6  * Copyright (c) 2004 knut st. osmundsen <bird-src-spam@innotek.de>
     6 * Copyright (c) 2004-2006 knut st. osmundsen <bird-src-spam@innotek.de>
    77 *
    88 *
     
    2929*   Header Files                                                               *
    3030*******************************************************************************/
    31 #include "libc-alias.h"
    32 #define INCL_FSMACROS
    33 #include <os2emx.h>
    34 #include "b_fs.h"
    35 #include <string.h>
    36 #include <errno.h>
    37 #include <InnoTekLIBC/backend.h>
    38 #include <InnoTekLIBC/libc.h>
     31#include "kNIX.h"
    3932#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_FS
    40 #include <InnoTekLIBC/logstrict.h>
     33#include <klibc/logstrict.h>
    4134
    4235
     
    4538*******************************************************************************/
    4639static void slashify(char *psz);
     40
    4741
    4842/**
     
    144138                /* release the fs lock. */
    145139                __libc_back_fsMutexRelease();
    146                 if (!__libc_gfNoUnix)
    147                 {
    148                     szNativePath[2] = '/';
    149                     slashify(&szNativePath[3]);
    150                 }
     140                szNativePath[2] = '/';
     141                slashify(&szNativePath[3]);
    151142                pszSrc = &szNativePath[0];
    152143            }
     
    177168}
    178169
    179 
  • trunk/libc/src/kNIX/os2/b_fsDirCurrentSet.c

    r2913 r2914  
    2525 */
    2626
    27 
    28 /*******************************************************************************
    29 *   Header Files                                                               *
    30 *******************************************************************************/
    31 #include "libc-alias.h"
    32 #define INCL_FSMACROS
    33 #include <os2emx.h>
    34 #include "b_fs.h"
    35 #include <InnoTekLIBC/backend.h>
     27#include "kNIX.h"
    3628#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_FS
    37 #include <InnoTekLIBC/logstrict.h>
    38 
     29#include <klibc/logstrict.h>
    3930
    4031/**
  • trunk/libc/src/kNIX/os2/b_fsDirCurrentSetFH.c

    r2913 r2914  
    2929*   Header Files                                                               *
    3030*******************************************************************************/
    31 #include "libc-alias.h"
    32 #define INCL_FSMACROS
    33 #include <os2emx.h>
    34 #include "b_fs.h"
    35 #include "b_dir.h"
    36 #include <errno.h>
    37 #include <emx/io.h>
    38 #include <InnoTekLIBC/backend.h>
     31#include "kNIX.h"
    3932#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_FS
    40 #include <InnoTekLIBC/logstrict.h>
     33#include <klibc/logstrict.h>
    4134
    4235
     
    5245{
    5346    LIBCLOG_ENTER("fh=%d fDrive=%d\n", fh, fDrive);
    54     FS_VAR();
    5547
    5648    /*
     
    5850     */
    5951    __LIBC_PFH pFH;
    60     int rc = __libc_FHEx(fh, &pFH);
     52    int rc = __libc_FHGet(fh, &pFH);
    6153    if (rc)
    6254        LIBCLOG_ERROR_RETURN_INT(rc);
    6355    if ((pFH->fFlags & __LIBC_FH_TYPEMASK) != F_DIR)
     56    {
     57        __libc_FHPut(pFH);
    6458        LIBCLOG_ERROR_RETURN_INT(-ENOTDIR);
     59    }
    6560    __LIBC_PFHDIR pFHDir = (__LIBC_PFHDIR)pFH;
    6661
     
    7065    rc = __libc_back_fsMutexRequest();
    7166    if (rc)
     67    {
     68        __libc_FHPut(pFH);
    7269        LIBCLOG_ERROR_RETURN_INT(rc);
     70    }
    7371
    7472    /*
     
    7977     * when in the unix compartement or when fDrive is set.
    8078     */
    81     FS_SAVE_LOAD();
     79    FS_VAR_SAVE_LOAD();
    8280    rc = DosSetCurrentDir((PCSZ)pFHDir->Core.pszNativePath);
    8381    if (!rc)
     
    10199
    102100    __libc_back_fsMutexRelease();
    103     if (!rc)
    104         LIBCLOG_RETURN_INT(rc);
    105     LIBCLOG_ERROR_RETURN_INT(rc);
     101    __libc_FHPut(pFH);
     102    LIBCLOG_MIX_RETURN_INT(rc);
    106103}
    107104
  • trunk/libc/src/kNIX/os2/b_fsDriveDefaultGet.c

    r2913 r2914  
    2525 */
    2626
    27 
    28 /*******************************************************************************
    29 *   Header Files                                                               *
    30 *******************************************************************************/
    31 #include "libc-alias.h"
    32 #define INCL_FSMACROS
    33 #include <os2emx.h>
    34 #include "b_fs.h"
    35 #include <InnoTekLIBC/backend.h>
     27#include "kNIX.h"
    3628#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_FS
    37 #include <InnoTekLIBC/logstrict.h>
    38 
     29#include <klibc/logstrict.h>
    3930
    4031/**
     
    6859}
    6960
    70 
  • trunk/libc/src/kNIX/os2/b_fsDriveDefaultSet.c

    r2913 r2914  
    2525 */
    2626
    27 
    28 /*******************************************************************************
    29 *   Header Files                                                               *
    30 *******************************************************************************/
    31 #include "libc-alias.h"
    32 #define INCL_FSMACROS
    33 #include <os2emx.h>
    34 #include "b_fs.h"
    35 #include <InnoTekLIBC/backend.h>
     27#include "kNIX.h"
    3628#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_FS
    37 #include <InnoTekLIBC/logstrict.h>
     29#include <klibc/logstrict.h>
    3830
    3931
     
    7062
    7163    __libc_back_fsMutexRelease();
    72 
    73     if (!rc)
    74         LIBCLOG_RETURN_INT(rc);
    75     LIBCLOG_ERROR_RETURN_INT(rc);
     64    LIBCLOG_MIX_RETURN_INT(rc);
    7665}
    7766
  • trunk/libc/src/kNIX/os2/b_fsFileModeSetFH.c

    r2913 r2914  
    2525 */
    2626
    27 
    28 /*******************************************************************************
    29 *   Header Files                                                               *
    30 *******************************************************************************/
    31 #include "libc-alias.h"
    32 #define INCL_FSMACROS
    33 #define INCL_ERRORS
    34 #include <os2emx.h>
    35 #include "b_fs.h"
    36 #include <string.h>
    37 #include <errno.h>
    38 #include <sys/types.h>
    39 #include <sys/stat.h>
    40 #include <sys/fcntl.h>
    41 #include <emx/io.h>
    42 #include <emx/syscalls.h>
    43 #include <limits.h>
    44 #include "syscalls.h"
    45 #include <InnoTekLIBC/libc.h>
    46 #include <InnoTekLIBC/backend.h>
     27#include "kNIX.h"
    4728#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_FS
    48 #include <InnoTekLIBC/logstrict.h>
    49 
     29#include <klibc/logstrict.h>
    5030
    5131
     
    6545     * Get filehandle.
    6646     */
    67     PLIBCFH pFH;
    68     int rc = __libc_FHEx(fh, &pFH);
     47    __LIBC_PFH pFH;
     48    int rc = __libc_FHGet(fh, &pFH);
    6949    if (rc)
    7050        LIBCLOG_ERROR_RETURN_INT(rc);
     
    7858        case F_SOCKET:
    7959        case F_PIPE: /* treat as socket for now */
     60            __libc_FHPut(pFH);
    8061            LIBCLOG_ERROR_RETURN_INT(-EINVAL);
    8162        /* ignore */
    8263        case F_DEV:
     64            __libc_FHPut(pFH);
    8365            LIBCLOG_RETURN_INT(0);
    8466
     
    8668        case F_DIR:
    8769            if (__predict_false(!pFH->pszNativePath))
    88                 LIBCLOG_ERROR_RETURN_INT(-EINVAL);
    89             rc = __libc_back_fsNativeFileModeSet(pFH->pszNativePath, Mode);
     70                rc = -EINVAL;
     71            else
     72                rc = __libc_back_fsNativeFileModeSet(pFH->pszNativePath, Mode);
     73            __libc_FHPut(pFH);
    9074            if (rc)
    9175                LIBCLOG_ERROR_RETURN_INT(rc);
     
    11397        if (rc)
    11498        {
     99            __libc_FHPut(pFH);
    115100            FS_RESTORE();
    116101            rc = -__libc_native2errno(rc);
     
    121106         * If in unix mode we'll have to update/add the MODE too.
    122107         */
    123         if (    !__libc_gfNoUnix
    124             &&  pFH->pFsInfo
     108        if (    pFH->pFsInfo
    125109            &&  pFH->pFsInfo->fUnixEAs)
    126110        {
     
    179163            if (__predict_false(rc != 0))
    180164            {
     165                __libc_FHPut(pFH);
    181166                FS_RESTORE();
    182167                LIBCLOG_ERROR_RETURN_INT(rc);
     
    195180        if (rc)
    196181        {
     182            __libc_FHPut(pFH);
    197183            rc = -__libc_native2errno(rc);
    198184            LIBCLOG_ERROR_RETURN_INT(rc);
     
    204190         * Non-standard handle - fail.
    205191         */
     192        __libc_FHPut(pFH);
    206193        LIBCLOG_ERROR_RETURN_INT(-EOPNOTSUPP);
    207194    }
    208195
     196    __libc_FHPut(pFH);
    209197    LIBCLOG_RETURN_INT(0);
    210198}
  • trunk/libc/src/kNIX/os2/b_fsFileStatFH.c

    r2913 r2914  
    129129             */
    130130            /* Times: FAT might not return create and access time. */
    131             pStat->st_ctime = pStat->st_mtime = _sys_p2t(info.fsts4.ftimeLastWrite, info.fsts4.fdateLastWrite);
     131            pStat->st_ctime = pStat->st_mtime = __libc_back_timeFileTime2Unix(info.fsts4.ftimeLastWrite, info.fsts4.fdateLastWrite);
    132132            if (    FTIMEZEROP(info.fsts4.ftimeCreation)
    133133                &&  FDATEZEROP(info.fsts4.fdateCreation))
    134134                pStat->st_birthtime = pStat->st_mtime;
    135135            else
    136                 pStat->st_birthtime = _sys_p2t(info.fsts4.ftimeCreation, info.fsts4.fdateCreation);
     136                pStat->st_birthtime = __libc_back_timeFileTime2Unix(info.fsts4.ftimeCreation, info.fsts4.fdateCreation);
    137137            if (    FTIMEZEROP(info.fsts4.ftimeLastAccess)
    138138                &&  FDATEZEROP(info.fsts4.fdateLastAccess))
    139139                pStat->st_atime = pStat->st_mtime;
    140140            else
    141                 pStat->st_atime = _sys_p2t(info.fsts4.ftimeLastAccess, info.fsts4.fdateLastAccess);
     141                pStat->st_atime = __libc_back_timeFileTime2Unix(info.fsts4.ftimeLastAccess, info.fsts4.fdateLastAccess);
    142142
    143143#if OFF_MAX > LONG_MAX
  • trunk/libc/src/kNIX/os2/b_fsNativeDirRemove.c

    r2913 r2914  
    2525 */
    2626
    27 
    28 /*******************************************************************************
    29 *   Header Files                                                               *
    30 *******************************************************************************/
    31 #include "libc-alias.h"
    32 #define INCL_FSMACROS
    33 #define INCL_ERRORS
    34 #include <os2emx.h>
    35 #include "b_fs.h"
    36 #include <errno.h>
    37 #include <sys/stat.h>
    38 #include <InnoTekLIBC/backend.h>
     27#include "kNIX.h"
    3928#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_FS
    40 #include <InnoTekLIBC/logstrict.h>
    41 
     29#include <klibc/logstrict.h>
    4230
    4331/**
    44  * Removes a new directory.
     32 * Removes a directory.
    4533 *
    4634 * @returns 0 on success.
    47  * @returns -1 and errno on failure.
    48  * @param   pszPath     Path to the directory which is to be removed.
     35 * @returns Negated error code on failure.
     36 * @param   pszNativePath     Native path to the directory which is to be removed.
    4937 */
    50 int __libc_Back_fsDirRemove(const char *pszPath)
     38int __libc_back_fsNativeDirRemove(const char *pszNativePath)
    5139{
    52     LIBCLOG_ENTER("pszPath=%s\n", pszPath);
     40    LIBCLOG_ENTER("pszNativePath=%p:{%s}\n", (void *)pszNativePath, pszNativePath);
    5341    FS_VAR();
    5442
    5543    /*
    56      * Resolve the path.
    57      * (Symlinks should cause failure, so don't resolve last component.)
    58      */
    59     char szNativePath[PATH_MAX];
    60     int rc = __libc_back_fsResolve(pszPath, BACKFS_FLAGS_RESOLVE_FULL_SYMLINK | BACKFS_FLAGS_RESOLVE_DIR, &szNativePath[0], NULL);
    61     if (rc)
    62         LIBCLOG_RETURN_INT(rc);
    63 
    64     /*
    65      * Do It.
     44     * Try
    6645     */
    6746    FS_SAVE_LOAD();
    68     rc = DosDeleteDir((PCSZ)&szNativePath[0]);
     47    int rc = DosDeleteDir((PCSZ)pszNativePath);
    6948    FS_RESTORE();
    7049    if (!rc)
    7150        LIBCLOG_RETURN_INT(rc);
    72 
    7351
    7452    /*
     
    8058    {
    8159        struct stat s;
    82         rc = __libc_back_fsNativeFileStat(&szNativePath[0], &s);
     60        rc = __libc_back_fsNativeFileStat(pszNativePath, &s);
    8361        if (!rc)
    8462            rc = S_ISDIR(s.st_mode) ? -ENOTEMPTY : -ENOTDIR;
  • trunk/libc/src/kNIX/os2/b_fsNativeFileStat.c

    r2913 r2914  
    2525 */
    2626
    27 
    28 /*******************************************************************************
    29 *   Header Files                                                               *
    30 *******************************************************************************/
    31 #include "libc-alias.h"
    32 #define INCL_BASE
    33 #define INCL_FSMACROS
    34 #include <os2emx.h>
    35 #include "b_fs.h"
    36 #include <string.h>
    37 #include <errno.h>
    38 #include <sys/types.h>
    39 #include <sys/stat.h>
    40 #include <stdlib.h>
    41 #include <limits.h>
    42 #include "syscalls.h"
    43 #include <InnoTekLIBC/libc.h>
    44 #include <InnoTekLIBC/pathrewrite.h>
     27#include "kNIX.h"
    4528#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_FS
    46 #include <InnoTekLIBC/logstrict.h>
    47 
     29#include <klibc/logstrict.h>
    4830
    4931/**
     
    138120     */
    139121    /* Times: FAT might not return create and access time. */
    140     pStat->st_mtime = pStat->st_ctime = _sys_p2t(info.fsts4.ftimeLastWrite, info.fsts4.fdateLastWrite);
     122    pStat->st_mtime = pStat->st_ctime = __libc_back_timeFileTime2Unix(info.fsts4.ftimeLastWrite, info.fsts4.fdateLastWrite);
    141123    if (   FTIMEZEROP(info.fsts4.ftimeCreation)
    142124        && FDATEZEROP(info.fsts4.fdateCreation))
    143125        pStat->st_birthtime = pStat->st_mtime;
    144126    else
    145         pStat->st_birthtime = _sys_p2t(info.fsts4.ftimeCreation, info.fsts4.fdateCreation);
     127        pStat->st_birthtime = __libc_back_timeFileTime2Unix(info.fsts4.ftimeCreation, info.fsts4.fdateCreation);
    146128    if (   FTIMEZEROP(info.fsts4.ftimeLastAccess)
    147129        && FDATEZEROP(info.fsts4.fdateLastAccess))
    148130        pStat->st_atime = pStat->st_mtime;
    149131    else
    150         pStat->st_atime = _sys_p2t(info.fsts4.ftimeLastAccess, info.fsts4.fdateLastAccess);
     132        pStat->st_atime = __libc_back_timeFileTime2Unix(info.fsts4.ftimeLastAccess, info.fsts4.fdateLastAccess);
    151133
    152134#if OFF_MAX > LONG_MAX
  • trunk/libc/src/kNIX/os2/b_fsNativeFileTimesSet.c

    r2913 r2914  
    2525 */
    2626
    27 
    28 /*******************************************************************************
    29 *   Header Files                                                               *
    30 *******************************************************************************/
    31 #include "libc-alias.h"
    32 #define INCL_BASE
    33 #define INCL_FSMACROS
    34 #include <os2emx.h>
    35 #include "b_fs.h"
    36 #include "b_time.h"
    37 #include <string.h>
    38 #include <errno.h>
    39 #include <stdlib.h>
    40 #include <limits.h>
    41 #include <sys/types.h>
    42 #include <sys/stat.h>
    43 #include <sys/timeb.h>
    44 #include "syscalls.h"
    45 #include <emx/syscalls.h>
    46 #include <emx/time.h>
    47 #include <InnoTekLIBC/libc.h>
     27#include "kNIX.h"
    4828#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_FS
    49 #include <InnoTekLIBC/logstrict.h>
    50 
     29#include <klibc/logstrict.h>
    5130
    5231/**
     
    8968    time_t aTimes[2]; /* seconds since 1970 */
    9069    if (!paTimes)
    91     {
    92         struct timeb TimeBuf;
    93         __ftime(&TimeBuf);
    94         aTimes[0] = TimeBuf.time;
    95         aTimes[1] = TimeBuf.time;
    96     }
     70        aTimes[0] = aTimes[1] = fibGetUnixSeconds();
    9771    else
    9872    {
    99         if (!_tzset_flag)
     73        if (!__libc_gfTZInfoOk)
    10074            tzset();
    10175        aTimes[0] = paTimes[0].tv_sec;
  • trunk/libc/src/kNIX/os2/b_ioFileControl.c

    r2913 r2914  
    100100    /* failure! */
    101101    if (rc > 0)
    102         rc = -__libc_native2errno(rc);
     102        rc = -__libc_back_native2errno(rc);
    103103    *prc = -1;
    104104    LIBCLOG_ERROR_RETURN_INT(rc);
  • trunk/libc/src/kNIX/os2/b_ioFileOpen.c

    r2913 r2914  
    22/** @file
    33 *
    4  * kNIX - open.
    5  *
    6  * Copyright (c) 2003-2005 knut st. osmundsen <bird-src-spam@innotek.de>
     4 * kNIX - open, OS/2.
     5 *
     6 * Copyright (c) 2003-2006 knut st. osmundsen <bird-src-spam@innotek.de>
    77 * Copyright (c) 1992-1996 by Eberhard Mattes
    88 *
     
    3030*   Header Files                                                               *
    3131*******************************************************************************/
    32 #include "libc-alias.h"
    33 #define INCL_DOSERRORS
    34 #define INCL_FSMACROS
    35 #include <os2emx.h>
    36 #include "b_fs.h"
    37 #include "b_dir.h"
    38 #include <string.h>
    39 #include <errno.h>
    40 #include <limits.h>
    41 #include <share.h>
    42 #include <sys/stat.h>
    43 #include <sys/fcntl.h>
    44 #include <emx/umalloc.h>
    45 #include <emx/syscalls.h>
    46 #include <emx/io.h>
    47 #include "syscalls.h"
    48 #include <InnoTekLIBC/backend.h>
    49 #include <InnoTekLIBC/libc.h>
     32#include "kNIX.h"
    5033#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_IO
    51 #include <InnoTekLIBC/logstrict.h>
     34#include <klibc/logstrict.h>
    5235
    5336#define SH_MASK 0x70
     
    6649 *                      for the opened file.
    6750 */
    68 int __libc_Back_ioFileOpen(const char *pszFile, unsigned fLibc, int fShare, off_t cbInitial, mode_t Mode, PLIBCFH *ppFH)
     51int __libc_Back_ioFileOpen(const char *pszFile, unsigned fLibc, int fShare, off_t cbInitial, mode_t Mode, __LIBC_PFH *ppFH)
    6952{
    7053    LIBCLOG_ENTER("pszFile=%p:{%s} fLibc=%#x fShare=%#x cbInitial=%lld Mode=0%o ppFH=%p\n",
     
    157140    ino_t   Inode = 0;
    158141    PEAOP2 pEaOp2 = NULL;
    159     if (!__libc_gfNoUnix)
     142    /*
     143     * Stat the file to see if it's there, and if it is what kind of file it is.
     144     * For some of the file types there are race conditions involved, but we don't care.
     145     */
     146    struct stat st;
     147    rc = __libc_back_fsNativeFileStat(szNativePath, &st);
     148    if (!rc)
    160149    {
    161150        /*
    162          * Stat the file to see if it's there, and if it is what kind of file it is.
    163          * For some of the file types there are race conditions involved, but we don't care.
     151         * If we're truncating a file and no Mode bits are specified, we'll
     152         * use the ones from the original file.
    164153         */
    165         struct stat st;
    166         rc = __libc_back_fsNativeFileStat(szNativePath, &st);
    167         if (!rc)
    168         {
    169             /*
    170              * If we're truncating a file and no Mode bits are specified, we'll
    171              * use the ones from the original file.
    172              */
    173             /** @todo Check if O_TRUNC and the OS/2 semantics really match.. I don't think O_TRUNC mean replace really. */
    174             Mode &= ALLPERMS;
    175             if (!Mode && (fLibc & (O_CREAT | O_TRUNC)) == O_TRUNC)
    176                 Mode = st.st_mode;
    177 
    178             /*
    179              * Take action based on the type of file we're facing.
    180              */
    181             switch (st.st_mode & S_IFMT)
    182             {
    183                 /*
    184                  * Regular file:    Presently we don't have to do anything special.
    185                  */
    186                 case S_IFREG:
     154        /** @todo Check if O_TRUNC and the OS/2 semantics really match.. I don't think O_TRUNC mean replace really. */
     155        Mode &= ALLPERMS;
     156        if (!Mode && (fLibc & (O_CREAT | O_TRUNC)) == O_TRUNC)
     157            Mode = st.st_mode;
     158
     159        /*
     160         * Take action based on the type of file we're facing.
     161         */
     162        switch (st.st_mode & S_IFMT)
     163        {
     164            /*
     165             * Regular file:    Presently we don't have to do anything special.
     166             */
     167            case S_IFREG:
     168            {
     169                /** @todo handle st_flags. */
     170                break;
     171            }
     172
     173            /*
     174             * Directory:       Open it as a directory.
     175             */
     176            case S_IFDIR:
     177            {
     178                /** @todo add ppFH to the argument list of __libc_Back_dirOpenNative() */
     179                rc = __libc_Back_dirOpenNative(szNativePath, fInUnixTree, fLibc, &st);
     180                if (rc >= 0)
    187181                {
    188                     /** @todo handle st_flags. */
    189                     break;
     182                    if (ppFH)
     183                        __libc_FHGet(rc, ppFH);
     184                    LIBCLOG_RETURN_INT(rc);
    190185                }
    191 
    192                 /*
    193                  * Directory:       Open it as a directory.
    194                  */
    195                 case S_IFDIR:
    196                 {
    197                     rc = __libc_Back_dirOpenNative(szNativePath, fInUnixTree, fLibc, &st);
    198                     if (rc >= 0)
    199                     {
    200                         if (ppFH)
    201                             *ppFH = __libc_FH(rc);
    202                         LIBCLOG_RETURN_INT(rc);
    203                     }
    204                     LIBCLOG_ERROR_RETURN_INT(rc);
    205                     break;
    206                 }
    207 
    208                 /*
    209                  * Named Pipe:      Open / create the named pipe.
    210                  */
    211                 case S_IFIFO:
    212                 {
    213                     /** @todo implement named pipes. */
    214                     LIBCLOG_ERROR_RETURN_INT(-ENOTSUP);
    215                 }
    216 
    217                 /*
    218                  * Character device or Block device:
    219                  *                  Translate the major/minor to an OS/2 device name and open that.
    220                  */
    221                 case S_IFCHR:
    222                 case S_IFBLK:
    223                 {
    224                     /** @todo assign major & minor numbers and do translations. */
    225                     LIBCLOG_ERROR_RETURN_INT(-ENOTSUP);
    226                 }
    227 
    228                 /*
    229                  * Symbolic link:   These cannot be opened by open().
    230                  */
    231                 case S_IFLNK:
    232                     LIBCLOG_ERROR_RETURN_INT(-EMLINK);
    233 
    234 
    235                 /*
    236                  * Local socket:    Open the local socket.
    237                  */
    238                 case S_IFSOCK:
    239                 {
    240                     /** @todo integrate sockets with libc. */
    241                     LIBCLOG_ERROR_RETURN_INT(-ENOTSUP);
    242                 }
    243 
    244                 /*
    245                  * Stat cannot return anything else.
    246                  */
    247                 default:
    248                     __libc_Back_panic(0, NULL, "Invalid file type returned in st_mode=%x for '%s'\n", st.st_mode, szNativePath);
    249                     break;
    250             }
    251         }
    252         /* else: didn't find it, just go ahead. */
    253 
    254         /*
    255          * Create Unix attributes for a file which is potentially created / replaced.
    256          */
    257         Mode &= ~__libc_gfsUMask;
    258         Mode &= ACCESSPERMS;
    259         Mode |= S_IFREG;
    260         if (    (flOpenFlags & (OPEN_ACTION_CREATE_IF_NEW | OPEN_ACTION_REPLACE_IF_EXISTS))
    261             &&  __libc_back_fsInfoSupportUnixEAs(szNativePath))
    262         {
    263             pEaOp2 = alloca(sizeof(EAOP2) + sizeof(__libc_gFsUnixAttribsCreateFEA2List));
    264             struct __LIBC_FSUNIXATTRIBSCREATEFEA2LIST *pFEas = (struct __LIBC_FSUNIXATTRIBSCREATEFEA2LIST *)(pEaOp2 + 1);
    265             *pFEas = __libc_gFsUnixAttribsCreateFEA2List;
    266             Dev = __libc_back_fsUnixAttribsInit(pFEas, szNativePath, Mode);
    267             Inode = pFEas->u64INO;
    268             pEaOp2->fpGEA2List = NULL;
    269             pEaOp2->fpFEA2List = (PFEA2LIST)pFEas;
    270             pEaOp2->oError     = 0;
    271         }
    272     }
    273     else
    274     {
    275         /* Normalize the mode mask and calc the file attributes. */
    276         Mode &= ~__libc_gfsUMask;
    277         Mode &= ACCESSPERMS;
    278         Mode |= S_IFREG;
     186                LIBCLOG_ERROR_RETURN_INT(rc);
     187                break;
     188            }
     189
     190            /*
     191             * Named Pipe:      Open / create the named pipe.
     192             */
     193            case S_IFIFO:
     194            {
     195                /** @todo implement named pipes. */
     196                LIBCLOG_ERROR_RETURN_INT(-ENOTSUP);
     197            }
     198
     199            /*
     200             * Character device or Block device:
     201             *                  Translate the major/minor to an OS/2 device name and open that.
     202             */
     203            case S_IFCHR:
     204            case S_IFBLK:
     205            {
     206                /** @todo assign major & minor numbers and do translations. */
     207                LIBCLOG_ERROR_RETURN_INT(-ENOTSUP);
     208            }
     209
     210            /*
     211             * Symbolic link:   These cannot be opened by open().
     212             */
     213            case S_IFLNK:
     214                LIBCLOG_ERROR_RETURN_INT(-EMLINK);
     215
     216            /*
     217             * Local socket:    Open the local socket.
     218             */
     219            case S_IFSOCK:
     220            {
     221                /** @todo integrate sockets with libc. */
     222                LIBCLOG_ERROR_RETURN_INT(-ENOTSUP);
     223            }
     224
     225            /*
     226             * Stat cannot return anything else.
     227             */
     228            default:
     229                __libc_Back_panic(0, NULL, "Invalid file type returned in st_mode=%x for '%s'\n", st.st_mode, szNativePath);
     230                break;
     231        }
     232    }
     233    /* else: didn't find it, just go ahead. */
     234
     235    /*
     236     * Create Unix attributes for a file which is potentially created / replaced.
     237     */
     238    Mode &= ~__libc_gfsUMask;
     239    Mode &= ACCESSPERMS;
     240    Mode |= S_IFREG;
     241    if (    (flOpenFlags & (OPEN_ACTION_CREATE_IF_NEW | OPEN_ACTION_REPLACE_IF_EXISTS))
     242        &&  __libc_back_fsInfoSupportUnixEAs(szNativePath))
     243    {
     244        pEaOp2 = alloca(sizeof(EAOP2) + sizeof(__libc_gFsUnixAttribsCreateFEA2List));
     245        struct __LIBC_FSUNIXATTRIBSCREATEFEA2LIST *pFEas = (struct __LIBC_FSUNIXATTRIBSCREATEFEA2LIST *)(pEaOp2 + 1);
     246        *pFEas = __libc_gFsUnixAttribsCreateFEA2List;
     247        Dev = __libc_back_fsUnixAttribsInit(pFEas, szNativePath, Mode);
     248        Inode = pFEas->u64INO;
     249        pEaOp2->fpGEA2List = NULL;
     250        pEaOp2->fpFEA2List = (PFEA2LIST)pFEas;
     251        pEaOp2->oError     = 0;
    279252    }
    280253
     
    402375            rc = rcOpenFailed;
    403376        else
    404             rc = -__libc_native2errno(rc);
     377            rc = -__libc_back_native2errno(rc);
    405378        LIBCLOG_ERROR_RETURN_INT(rc);
    406379    }
  • trunk/libc/src/kNIX/os2/b_ldrClose.c

    r2913 r2914  
    22/** @file
    33 *
    4  * kNIX - dlclose.
     4 * kNIX - dlclose, OS/2.
    55 *
    6  * Copyright (c) 2004 knut st. osmundsen <bird-src-spam@innotek.de>
     6 * Copyright (c) 2004-2006 knut st. osmundsen <bird-src-spam@innotek.de>
    77 *
    88 *
     
    2929*   Header Files                                                               *
    3030*******************************************************************************/
    31 #include "libc-alias.h"
    32 #define INCL_BASE
    33 #define INCL_EXAPIS
    34 #define INCL_FSMACROS
    35 #include <os2emx.h>
    36 #include <InnoTekLIBC/backend.h>
     31#include "kNIX.h"
    3732#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_LDR
    38 #include <InnoTekLIBC/logstrict.h>
     33#include <klibc/logstrict.h>
    3934
    4035
     
    4641 * @param   pvModule        Module handle.
    4742 */
    48 int  __libc_Back_ldrClose(void *pvModule)
     43int __libc_Back_ldrClose(void *pvModule)
    4944{
    5045    LIBCLOG_ENTER("pvModule=%p\n", pvModule);
     
    5853}
    5954
    60 
    61 
  • trunk/libc/src/kNIX/os2/b_ldrOpen.c

    r2913 r2914  
    22/** @file
    33 *
    4  * kNIX - dlopen.
     4 * kNIX - dlopen, OS/2.
    55 *
    6  * Copyright (c) 2004 knut st. osmundsen <bird-src-spam@innotek.de>
     6 * Copyright (c) 2004-2006 knut st. osmundsen <bird-src-spam@innotek.de>
    77 *
    88 *
     
    2525 */
    2626
    27 
    28 /*******************************************************************************
    29 *   Header Files                                                               *
    30 *******************************************************************************/
    31 #include "libc-alias.h"
    32 #define INCL_BASE
    33 #define INCL_FSMACROS
    34 #define INCL_EXAPIS
    35 #include <os2emx.h>
    36 #include <InnoTekLIBC/backend.h>
     27#include "kNIX.h"
    3728#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_LDR
    38 #include <InnoTekLIBC/logstrict.h>
    39 
     29#include <klibc/logstrict.h>
    4030
    4131/**
     
    6656}
    6757
    68 
    69 
  • trunk/libc/src/kNIX/os2/b_ldrSymbol.c

    r2913 r2914  
    22/** @file
    33 *
    4  * kNIX - dlsym.
     4 * kNIX - dlsym, OS/2.
    55 *
    6  * Copyright (c) 2004 knut st. osmundsen <bird-src-spam@innotek.de>
     6 * Copyright (c) 2004-2006 knut st. osmundsen <bird-src-spam@innotek.de>
    77 *
    88 *
     
    2525 */
    2626
    27 
    28 /*******************************************************************************
    29 *   Header Files                                                               *
    30 *******************************************************************************/
    31 #include "libc-alias.h"
    32 #define INCL_BASE
    33 #define INCL_FSMACROS
    34 #include <os2emx.h>
    35 #include <InnoTekLIBC/backend.h>
     27#include "kNIX.h"
    3628#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_LDR
    37 #include <InnoTekLIBC/logstrict.h>
    38 
     29#include <klibc/logstrict.h>
    3930
    4031/**
     
    6859}
    6960
    70 
    71 
  • trunk/libc/src/kNIX/os2/b_miscLoadAvg.c

    r2913 r2914  
    44 * kNIX - System Load Averages.
    55 *
    6  * Copyright (c) 2004 knut st. osmundsen <bird-srcspam@anduin.net>
     6 * Copyright (c) 2004-2006 knut st. osmundsen <bird-srcspam@anduin.net>
    77 *
    88 *
     
    2929*   Header Files                                                               *
    3030*******************************************************************************/
    31 #include "libc-alias.h"
    32 #include <stdlib.h>
    33 #include <errno.h>
     31#include "kNIX.h"
    3432#include <math.h>
    35 #include <emx/umalloc.h>
    36 #include <InnoTekLIBC/backend.h>
    37 #include <InnoTekLIBC/sharedpm.h>
    38 #define __LIBC_LOG_GROUP    __LIBC_LOG_GRP_MISC
    39 #include <InnoTekLIBC/logstrict.h>
    40 
    41 #define INCL_DOSPROFILE
    42 #define INCL_DOSERRORS
    43 #define INCL_FSMACROS
    44 #include <os2emx.h>
    45 
     33#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_MISC
     34#include <klibc/logstrict.h>
    4635
    4736/*
     
    5544*   Internal Functions                                                         *
    5645*******************************************************************************/
     46static int miscUpdateLoadAvg(__LIBC_PSPMLOADAVG pLoadAvg, unsigned uTimestamp);
    5747
    5848/**
  • trunk/libc/src/kNIX/os2/b_mmanProtect.c

    r2913 r2914  
    22/** @file
    33 *
    4  * kNIX - mprotect().
     4 * kNIX - mprotect(), OS/2.
    55 *
    6  * Copyright (c) 2004 knut st. osmundsen <bird-srcspam@anduin.net>
     6 * Copyright (c) 2004-2006 knut st. osmundsen <bird-srcspam@anduin.net>
    77 *
    88 *
     
    2525 */
    2626
    27 
    28 /*******************************************************************************
    29 *   Header Files                                                               *
    30 *******************************************************************************/
    31 #include "libc-alias.h"
    32 #define INCL_FSMACROS
    33 #define INCL_BASE
    34 #include <os2emx.h>
    35 #include "b_mman.h"
    36 #include <string.h>
    37 #include <errno.h>
    38 #include <sys/mman.h>
    39 #include <InnoTekLIBC/backend.h>
    40 #define __LIBC_LOG_GROUP    __LIBC_LOG_GRP_BACK_MMAN
    41 #include <InnoTekLIBC/logstrict.h>
    42 
    43 
     27#include "kNIX.h"
     28#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_MMAN
     29#include <klibc/logstrict.h>
    4430
    4531/**
     
    114100            {
    115101                FS_RESTORE();
    116                 rc = -__libc_native2errno(rc);
     102                rc = -__libc_back_native2errno(rc);
    117103                LIBCLOG_ERROR_RETURN_MSG(rc, "ret %d (pvChunk=%p)\n", rc, pvChunk);
    118104            }
     
    147133            {
    148134                FS_RESTORE();
    149                 rc = -__libc_native2errno(rc);
     135                rc = -__libc_back_native2errno(rc);
    150136                LIBCLOG_ERROR_RETURN_MSG(rc, "ret %d (pvChunk=%p)\n", rc, pvChunk);
    151137            }
     
    168154            {
    169155                FS_RESTORE();
    170                 rc = -__libc_native2errno(rc);
     156                rc = -__libc_back_native2errno(rc);
    171157                LIBCLOG_ERROR_RETURN_MSG(rc, "ret %d (pvChunk=%p)\n", rc, pvChunk);
    172158            }
  • trunk/libc/src/kNIX/os2/b_nativeSymlinkCreate.c

    r2913 r2914  
    2929*   Header Files                                                               *
    3030*******************************************************************************/
    31 #include "libc-alias.h"
    32 #define INCL_FSMACROS
    33 #define INCL_ERRORS
    34 #include <os2emx.h>
    35 #include "b_fs.h"
    36 #include "syscalls.h"
    37 #include <errno.h>
    38 #include <string.h>
    39 #include <sys/stat.h>
    40 #include <InnoTekLIBC/libc.h>
    41 #include <InnoTekLIBC/backend.h>
     31#include "kNIX.h"
    4232#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_FS
    43 #include <InnoTekLIBC/logstrict.h>
     33#include <klibc/logstrict.h>
    4434
    4535
     
    10696
    10797    /*
    108      * This call isn't available in Non-Unix mode - we don't handle symlinks there.
    109      */
    110     if (__predict_false(__libc_gfNoUnix != 0))
    111         LIBCLOG_ERROR_RETURN(-ENOSYS, "ret -ENOSYS - __libc_gfNoUnix=%d\n", __libc_gfNoUnix);
    112 
    113     /*
    11498     * Do we have UnixEAs on this path?
    11599     */
     
    160144        rc = -EEXIST;
    161145    else
    162         rc = -__libc_native2errno(rc);
     146        rc = -__libc_back_native2errno(rc);
    163147    LIBCLOG_ERROR_RETURN_INT(rc);
    164148}
  • trunk/libc/src/kNIX/os2/b_panic.c

    r2913 r2914  
    22/** @file
    33 *
    4  * kNIX - panic.
    5  *
    6  * Copyright (c) 2005 knut st. osmundsen <bird@anduin.net>
     4 * kNIX - panic, OS/2.
     5 *
     6 * Copyright (c) 2005-2006 knut st. osmundsen <bird@anduin.net>
    77 *
    88 *
     
    3030*   Header Files                                                               *
    3131*******************************************************************************/
     32#include "kNIX.h"
    3233#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_NOGROUP
    33 #define INCL_BASE
    34 #define INCL_ERRORS
    35 #define INCL_FSMACROS
    36 #define INCL_DOSUNDOCUEMENTED
    37 #define _GNU_SOURCE
    38 #include <string.h>
    39 #include <InnotekLIBC/backend.h>
    40 #include <InnotekLIBC/sharedpm.h>
    41 #include <InnotekLIBC/logstrict.h>
    42 #include <os2emx.h>
     34#include <klibc/logstrict.h>
    4335
    4436
  • trunk/libc/src/kNIX/os2/b_processCredentials.c

    r2913 r2914  
    44 * kNIX - [sg]et.*[ug]id().
    55 *
    6  * Copyright (c) 2004 knut st. osmundsen <bird-srcspam@anduin.net>
     6 * Copyright (c) 2004-2006 knut st. osmundsen <bird-srcspam@anduin.net>
    77 *
    88 *
     
    3030*   Header Files                                                               *
    3131*******************************************************************************/
    32 #include "libc-alias.h"
    33 #include "syscalls.h"
    34 #include <errno.h>
    35 #include <InnoTekLIBC/sharedpm.h>
    36 #include <InnoTekLIBC/backend.h>
     32#include "kNIX.h"
    3733#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_PROCESS
    38 #include <InnoTekLIBC/logstrict.h>
     34#include <klibc/logstrict.h>
    3935
    4036
     
    174170    LIBCLOG_ENTER("\n");
    175171    pid_t sid;
    176     if (pid == 0 || pid == _sys_pid)
     172    if (pid == 0 || pid == fibGetPid())
    177173        sid = __libc_spmGetId(__LIBC_SPMID_SID);
    178174    else
     
    195191    LIBCLOG_ENTER("pid=%d\n", pid);
    196192    pid_t pgrp;
    197     if (pid == 0 || pid == _sys_pid)
     193    if (pid == 0 || pid == fibGetPid())
    198194        pgrp = __libc_spmGetId(__LIBC_SPMID_PGRP);
    199195    else
  • trunk/libc/src/kNIX/os2/b_processSetPriority.c

    r2913 r2914  
    119119                    rc = DosSetPriority(PRTYS_PROCESS, Args.uClass, Args.uLevel, pid);
    120120                    if (rc)
    121                         rc = __libc_native2errno(rc);
     121                        rc = __libc_back_native2errno(rc);
    122122                }
    123123            }
     
    204204                    rc = -EPERM;
    205205                else
    206                     rc = -__libc_native2errno(rc);
     206                    rc = -__libc_back_native2errno(rc);
    207207            }
    208208            else
  • trunk/libc/src/kNIX/os2/b_processWait.c

    r2913 r2914  
    275275        return 0;
    276276    LIBC_ASSERTM_FAILED("_fmutex_request -> %d\n", rc);
    277     return -__libc_native2errno(rc);
     277    return -__libc_back_native2errno(rc);
    278278}
    279279
  • trunk/libc/src/kNIX/os2/b_signalTimer.c

    r2913 r2914  
    496496            rc = -EAGAIN;
    497497        else
    498             rc = -__libc_native2errno(rc);
     498            rc = -__libc_back_native2errno(rc);
    499499    }
    500500    LIBCLOG_ERROR_RETURN_INT(rc);
  • trunk/libc/src/kNIX/os2/b_time.c

    r2910 r2914  
    2929*******************************************************************************/
    3030#include "kNIX.h"
     31#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_TIME
     32#include <klibc/logstrict.h>
    3133
    3234/**
     
    4143    struct tm Tm;
    4244    gmtime_r(&Time, &Tm);
    43 #if 0                                   /* This didn't work in GCC versions <= 2.4 */
    44     time->twosecs   = Tm.tm_sec / 2;
    45     time->minutes   = Tm.tm_min;
    46     time->hours     = Tm.tm_hour;
    47     date->day       = Tm.tm_mday;
    48     date->month     = Tm.tm_mon + 1;
    49     date->year      = Tm.tm_year - 1980 + 1900;
    50 #else
    51     USHORT us = (Tm.tm_sec / 2) + (Tm.tm_min << 5) + (Tm.tm_hour << 11);
    52     *(PUSHORT)pTime = us;
    53     us = Tm.tm_mday + ((Tm.tm_mon + 1) << 5) + ((Tm.tm_year - 80) << 9);
    54     *(PUSHORT)pDate = us;
    55 #endif
     45    pTime->twosecs   = Tm.tm_sec / 2;
     46    pTime->minutes   = Tm.tm_min;
     47    pTime->hours     = Tm.tm_hour;
     48    pDate->day       = Tm.tm_mday;
     49    pDate->month     = Tm.tm_mon + 1;
     50    pDate->year      = Tm.tm_year - 1980 + 1900;
    5651}
    5752
     53
     54/**
     55 * Converts file time (local) to UCT unix time.
     56 *
     57 * @returns UCT unix time.
     58 * @param   Time    File time.
     59 * @param   Date    File date.
     60 */
     61time_t __libc_back_timeFileTime2Unix(FTIME Time, FDATE Date)
     62{
     63    struct tm Tm = {0};
     64    Tm.tm_sec     = Time.twosecs * 2;
     65    Tm.tm_min     = Time.minutes;
     66    Tm.tm_hour    = Time.hours;
     67    Tm.tm_mday    = Date.day;
     68    Tm.tm_mon     = Date.month ? Date.month - 1 : 0;
     69    Tm.tm_year    = Date.year + 1980 - 1900;
     70    time_t UnixTime = mktime(&Tm);              LIBC_ASSERT(UnixTime != -1);
     71    int rc = _loc2gmt(&UnixTime, -1); (void)rc; LIBC_ASSERT(rc != -1);
     72    return UnixTime;
     73}
     74
  • trunk/libc/src/kNIX/os2/b_timeHighResNano.c

    r2913 r2914  
    22/** @file
    33 *
    4  * kNIX - gethrtime().
     4 * kNIX - gethrtime(), OS/2.
    55 *
    6  * Copyright (c) 2005 knut st. osmundsen <bird@anduin.net>
     6 * Copyright (c) 2005-2006 knut st. osmundsen <bird@anduin.net>
    77 *
    88 *
     
    2525 */
    2626
    27 
    28 /*******************************************************************************
    29 *   Header Files                                                               *
    30 *******************************************************************************/
    31 #define  INCL_FSMACROS
    32 #define  INCL_BASE
    33 #include <os2emx.h>
    34 #include <InnoTekLIBC/backend.h>
    35 
     27#include "kNIX.h"
    3628
    3729/**
  • trunk/libc/src/kNIX/os2/fhOS2File.c

    r2805 r2914  
    2929*   Header Files                                                               *
    3030*******************************************************************************/
    31 #define __LIBC_LOG_GROUP    __LIBC_LOG_GRP_BACK_OS2FILE
    32 #include <klibc/os2/os2.h>
    33 #include "../kNIX.h"
     31#include "kNIX.h"
     32#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_OS2FILE
     33#include <klibc/logstrict.h>
    3434
    3535
     
    134134static int fhOs2FileWrite(__LIBC_PFH pFH, const void *pvBuf, size_t cbToWrite, size_t *pcbWritten)
    135135{
    136     LIBCLOG_ENTER("pFH=%p:{.fh=%d} pvBuf=%p cbToWrite=%zu pcbWritten=%p\n", pFH, pFH->fh, pvBuf, cbToWrite, pcbWritte);
     136    LIBCLOG_ENTER("pFH=%p:{.fh=%d} pvBuf=%p cbToWrite=%zu pcbWritten=%p\n", pFH, pFH->fh, pvBuf, cbToWrite, (void *)pcbWritten);
    137137    FS_VAR_SAVE_LOAD();
    138138    FSCW_VAR();
     
    322322static int fhOS2FileSizeSet(__LIBC_PFH pFH, off_t cbFile, int fZero)
    323323{
    324     LIBCLOG_ENTER("fh=%d cbFile=%lld fZero=%d\n", fh, cbFile, fZero);
     324    LIBCLOG_ENTER("pFH=%p cbFile=%lld fZero=%d\n", (void *)pFH, cbFile, fZero);
    325325    FS_VAR_SAVE_LOAD();
    326326
  • trunk/libc/src/kNIX/os2/kNIX-os2.h

    r2913 r2914  
    2828#define __os2_kNIX_os2_h__
    2929
    30 #include "../backend.h" /** @todo remove backend.h! */
    3130#include <InnoTekLIBC/sharedpm.h>
    3231
     
    237236 * @{ */
    238237void __libc_back_timeUnix2FileTime(time_t Time, PFTIME pTime, PFDATE pDate);
     238time_t __libc_back_timeFileTime2Unix(FTIME Time, FDATE Date);
     239/** @} */
     240
     241int __libc_back_priorityUnixFromOS2(int iPrio);
     242int __libc_back_priorityOS2FromUnix(int iNice);
     243
     244void __libc_back_processWaitNotifyTerm(void);
     245void __libc_back_processWaitNotifyExec(pid_t pid);
     246void __libc_back_processWaitNotifyChild(siginfo_t *pSigInfo);
     247void __libc_back_processWaitNotifyNoWait(int fNoWaitStatus);
     248
     249
     250/** @name Signals on OS/2.
     251 * @{
     252 */
     253
     254/** Signal set for the signals which are pending on a process scope.
     255 * These signals are blocked by all threads and waiting to be delivered
     256 * to a thread. */
     257extern sigset_t     __libc_gSignalPending;
     258
     259int         __libc_back_signalInit(void);
     260int         __libc_back_signalInitExe(void *pvRegRec);
     261int         __libc_back_signalSemRequest(void);
     262void        __libc_back_signalSemRelease(void);
     263unsigned    __libc_back_signalSemIsOwner(void);
     264void        __libc_back_signalPokeThread(__LIBC_PTHREAD pThrd);
     265void        __libc_back_signalPokeProcess(void);
     266int         __libc_back_signalReschedule(__LIBC_PTHREAD pThrd);
     267int         __libc_back_signalQueueSelf(int iSignalNo, siginfo_t *pSigInfo);
     268int         __libc_back_signalSuspend(void);
     269int         __libc_back_signalAccept(__LIBC_PTHREAD pThrd, int iSignalNo, sigset_t *pSigSet, siginfo_t *pSigInfo);
     270int         __libc_back_signalWait(__LIBC_PTHREAD pThrd, volatile int *pfDone, const struct timespec *pTimeout);
     271int         __libc_back_signalSendPidOther(pid_t pid, int iSignalNo, const siginfo_t *pSigInfo);
     272int         __libc_back_signalAction(int iSignalNo, const struct sigaction *pSigAct, struct sigaction *pSigActOld);
     273int         __libc_back_signalRaisePoked(void *pvXcptParams, int tidPoker);
     274void        __libc_back_signalOS2V1Handler16bit(unsigned short uSignal, unsigned short uArg);
     275void        __libc_back_signalOS2V1Handler32bit(unsigned uSignal, unsigned uArg);
     276int         __libc_back_signalInheritPack(__LIBC_PSPMINHSIG *ppSig, size_t *pcbSig);
     277void        __libc_back_signalTimerNotifyTerm(void);
     278int         __libc_back_signalRaiseInternal(__LIBC_PTHREAD pThrd, int iSignalNo, const siginfo_t *pSigInfo, void *pvQueued, unsigned fFlags);
     279
    239280/** @} */
    240281
  • trunk/libc/src/kNIX/os2/libcfork.c

    r2913 r2914  
    670670    if (rc)
    671671    {
    672         rc = -__libc_native2errno(rc);
     672        rc = -__libc_back_native2errno(rc);
    673673        LIBCLOG_ERROR_RETURN_INT(rc);
    674674    }
     
    13121312        {
    13131313            LIBC_ASSERTM_FAILED("DosExecPgm(,,,%s,,,%s..) failed with rc=%d, szErr=%s\n", szPgm, fibGetCmdLine(), rc, szErr);
    1314             rc = -__libc_native2errno(rc);
     1314            rc = -__libc_back_native2errno(rc);
    13151315        }
    13161316    }
     
    13181318    {
    13191319        LIBC_ASSERTM_FAILED("DosQueryModuleName(%lx,,) failed with rc=%d\n", fibGetExeHandle(), rc);
    1320         rc = -__libc_native2errno(rc);
     1320        rc = -__libc_back_native2errno(rc);
    13211321    }
    13221322
     
    14931493                           PAG_READ | PAG_WRITE | PAG_COMMIT);
    14941494        if (rc)
    1495             forkChlFatalError(pForkHandle, -__libc_native2errno(rc), NULL);
     1495            forkChlFatalError(pForkHandle, -__libc_back_native2errno(rc), NULL);
    14961496    }
    14971497    else
     
    19201920                    LIBC_ASSERTM_FAILED("DosQueryMem(%p, ..:{%x}, ..:{%x}) failed with rc=%d\n", pvStart, cbRange,
    19211921                                        PAG_READ | PAG_WRITE | PAG_EXECUTE | PAG_GUARD | PAG_COMMIT | PAG_DECOMMIT | PAG_FREE, rc);
    1922                     rc = -__libc_native2errno(rc);
     1922                    rc = -__libc_back_native2errno(rc);
    19231923                    LIBCLOG_RETURN_INT(rc);
    19241924                }
     
    19771977                        {
    19781978                            LIBC_ASSERTM_FAILED("DosQueryMemState(%p,..:{0x1000},..) failed with rc=%d\n", pvState, rc);
    1979                             rc = -__libc_native2errno(rc);
     1979                            rc = -__libc_back_native2errno(rc);
    19801980                            LIBCLOG_RETURN_INT(rc);
    19811981                        }
     
    23262326    {
    23272327        LIBC_ASSERTM_FAILED("DosResetEventSem(%#lx,) -> %d\n", hevWait, rc);
    2328         rc = -__libc_native2errno(rc);
     2328        rc = -__libc_back_native2errno(rc);
    23292329        LIBCLOG_RETURN_INT(rc);
    23302330    }
     
    23332333    {
    23342334        LIBC_ASSERTM_FAILED("DosPostEventSem(%#lx) -> %d\n", hevSignal, rc);
    2335         rc = -__libc_native2errno(rc);
     2335        rc = -__libc_back_native2errno(rc);
    23362336        LIBCLOG_RETURN_INT(rc);
    23372337    }
     
    23402340    {
    23412341        LIBC_ASSERTM_FAILED("DosReleaseMutexSem(%#lx) -> %d\n", pForkHandle->hmtx, rc);
    2342         rc = -__libc_native2errno(rc);
     2342        rc = -__libc_back_native2errno(rc);
    23432343        LIBCLOG_RETURN_INT(rc);
    23442344    }
     
    23852385    {
    23862386        LIBC_ASSERTM_FAILED("DosWaitEventSem(%#lx, %lu) -> %d\n", hevWait, pForkHandle->cmsecTimeout, rc);
    2387         rc = -__libc_native2errno(rc);
     2387        rc = -__libc_back_native2errno(rc);
    23882388        LIBCLOG_RETURN_INT(rc);
    23892389    }
     
    23922392    {
    23932393        LIBC_ASSERTM_FAILED("DosRequestMutexSem(%#lx, %lu) -> %d\n", pForkHandle->hmtx, pForkHandle->cmsecTimeout, rc);
    2394         rc = -__libc_native2errno(rc);
     2394        rc = -__libc_back_native2errno(rc);
    23952395        LIBCLOG_RETURN_INT(rc);
    23962396    }
     
    23992399    {
    24002400        LIBC_ASSERTM_FAILED("DosPostEventSem(%#lx) -> %d\n", hevSignal, rc);
    2401         rc = -__libc_native2errno(rc);
     2401        rc = -__libc_back_native2errno(rc);
    24022402        LIBCLOG_RETURN_INT(rc);
    24032403    }
     
    25332533                    forkBthDumpMemFlags(pChunk->pv);
    25342534                    LIBC_ASSERTM_FAILED("DosSetMem(%p, %08x, %08lx) failed with rc=%d\n", pChunk->pv, pChunk->cbVirt, flFlags, rc);
    2535                     rc = -__libc_native2errno(rc);
     2535                    rc = -__libc_back_native2errno(rc);
    25362536                    break;
    25372537                }
  • trunk/libc/src/kNIX/os2/priority.c

    r2913 r2914  
    2828*   Header Files                                                               *
    2929*******************************************************************************/
    30 #include "libc-alias.h"
    31 #include "priority.h"
    32 #include <InnoTekLIBC/backend.h>
     30#include "kNIX.h"
    3331#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_PROCESS
    34 #include <InnoTekLIBC/logstrict.h>
     32#include <klibc/logstrict.h>
    3533
    36 #define INCL_DOSPROCESS
    37 #include <os2emx.h>
    3834
    3935/** @page Priority Convertion Matrix
  • trunk/libc/src/kNIX/os2/resource.c

    r2913 r2914  
    2626 */
    2727
    28 
    29 /*******************************************************************************
    30 *   Header Files                                                               *
    31 *******************************************************************************/
    32 #include <klibc/os2/os2.h>
    33 #include "../kNIX.h"
    34 
     28#include "kNIX.h"
    3529
    3630/**
  • trunk/libc/src/kNIX/os2/safesems.c

    r2913 r2914  
    22/** @file
    33 *
    4  * kNIX - Internal Signal-Safe Semaphores.
    5  *
    6  * Copyright (c) 2005 knut st. osmundsen <bird@anduin.net>
     4 * kNIX - Internal Signal-Safe Semaphores, OS/2.
     5 *
     6 * Copyright (c) 2005-2006 knut st. osmundsen <bird@anduin.net>
    77 *
    88 *
     
    2525 */
    2626
    27 
    2827/*******************************************************************************
    2928*   Header Files                                                               *
    3029*******************************************************************************/
    31 #define INCL_DOSSEMAPHORES
    32 #define INCL_DOSEXCEPTIONS
    33 #define INCL_DOSERRORS
    34 #define INCL_DOSPROCESS
    35 #define INCL_FSMACROS
    36 #define INCL_EXAPIS
    37 #include <os2emx.h>
    38 #include <sys/errno.h>
    39 #include "syscalls.h"
    40 #include <sys/builtin.h>
    41 #include <klibc/fib.h>
    42 #include <InnoTekLIBC/thread.h>
    43 #include <InnoTekLIBC/backend.h>
     30#include "kNIX.h"
    4431#define __LIBC_LOG_GROUP    __LIBC_LOG_GRP_BACK_IPC
    45 #include <InnoTekLIBC/logstrict.h>
     32#include <klibc/logstrict.h>
    4633
    4734
     
    8067{
    8168    LIBCLOG_ENTER("pmtx=%p fShared=%d\n", (void *)pmtx, fShared);
     69    FS_VAR_SAVE_LOAD();
     70
    8271    pmtx->hmtx = NULLHANDLE;
    8372    pmtx->fShared = fShared;
     
    8574    if (rc)
    8675        rc = -__libc_native2errno(rc);
     76
     77    FS_RESTORE();
    8778    LIBCLOG_RETURN_MSG(rc, "ret %d hmtx=%#lx\n", rc, pmtx->hmtx);
    8879}
     
    9990{
    10091    LIBCLOG_ENTER("pmtx=%p:{.hmtx=%#lx}\n", (void *)pmtx, pmtx->hmtx);
     92    FS_VAR_SAVE_LOAD();
     93
    10194    int rc = DosOpenMutexSemEx(NULL, &pmtx->hmtx);
    10295    if (rc)
    10396        rc = -__libc_native2errno(rc);
     97
     98    FS_RESTORE();
    10499    LIBCLOG_RETURN_INT(rc);
    105100}
     
    116111{
    117112    LIBCLOG_ENTER("pmtx=%p:{.hmtx=%#lx}\n", (void *)pmtx, pmtx->hmtx);
     113    FS_VAR_SAVE_LOAD();
     114
    118115    int rc = DosCloseMutexSemEx(pmtx->hmtx);
    119116    if (rc)
    120117        rc = -__libc_native2errno(rc);
     118
     119    FS_RESTORE();
    121120    LIBCLOG_RETURN_INT(rc);
    122121}
     
    273272{
    274273    LIBCLOG_ENTER("pmtx=%p:{.hmtx=%#lx}\n", (void *)pmtx, pmtx->hmtx);
     274    FS_VAR_SAVE_LOAD();
    275275    ULONG       ul = 0;
    276276    int         rc;
    277     FS_VAR();
    278277
    279278    /*
    280279     * Release the semaphore.
    281280     */
    282     FS_SAVE_LOAD();
    283281    rc = DosReleaseMutexSem(pmtx->hmtx);
    284282    if (__predict_false(rc != NO_ERROR))
     
    306304{
    307305    LIBCLOG_ENTER("phev=%p pmtx=%p:{.hmtx=%#lx} fShared=%d\n", (void *)pev, (void *)pmtx, pmtx->hmtx, fShared);
     306    FS_VAR_SAVE_LOAD();
    308307
    309308    pev->hev        = NULLHANDLE;
     
    316315        rc = -__libc_native2errno(rc);
    317316
     317    FS_RESTORE();
    318318    LIBCLOG_RETURN_MSG(rc, "ret %d pev->hev=%#lx\n", rc, pev->hev);
    319319}
     
    334334    LIBCLOG_ENTER("pev=%p:{.hev=%#lx .cWaiters=%d .pmtx=%p .fShared=%d}\n",
    335335                  (void *)pev, pev->hev, pev->cWaiters, (void *)pev->pmtx, pev->fShared);
     336    FS_VAR_SAVE_LOAD();
    336337
    337338    int rc = DosOpenEventSemEx(NULL, &pev->hev);
     
    339340        rc = -__libc_native2errno(rc);
    340341
     342    FS_RESTORE();
    341343    LIBCLOG_RETURN_INT(rc);
    342344}
     
    354356    LIBCLOG_ENTER("pev=%p:{.hev=%#lx .cWaiters=%d .pmtx=%p .fShared=%d}\n",
    355357                  (void *)pev, pev->hev, pev->cWaiters, (void *)pev->pmtx, pev->fShared);
     358    FS_VAR_SAVE_LOAD();
    356359
    357360    int rc = DosCloseEventSemEx(pev->hev);
     
    359362        rc = -__libc_native2errno(rc);
    360363
     364    FS_RESTORE();
    361365    LIBCLOG_RETURN_INT(rc);
    362366}
  • trunk/libc/src/kNIX/os2/sharedpm.c

    r2913 r2914  
    5252*   Header Files                                                               *
    5353*******************************************************************************/
    54 #include "libc-alias.h"
    55 
    56 #define NO_EXAPIS_MAPPINGS
    57 #define INCL_BASE
    58 #define INCL_FSMACROS
    59 #define INCL_FPCWMACROS
    60 #define INCL_ERRORS
    61 #define INCL_DOSINFOSEG
    62 #include <os2emx.h>
    63 #include <stdlib.h>
    64 #include <stddef.h>
    65 #include <string.h>
    66 #include <errno.h>
    67 #include <stdio.h>
    68 #include <sys/types.h>
    69 #include <sys/ipc.h>
    70 #include <emx/startup.h>
    71 #include <386/builtin.h>
    72 #include <InnoTekLIBC/sharedpm.h>
    73 #include <InnoTekLIBC/fork.h>
    74 #define __LIBC_LOG_GROUP    __LIBC_LOG_GRP_BACK_SPM
    75 #include <InnoTekLIBC/logstrict.h>
    76 #include "b_process.h"
    77 #include "b_signal.h"
    78 #include "syscalls.h"
     54#include "kNIX.h"
     55#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_SPM
     56#include <klibc/logstrict.h>
    7957
    8058
     
    21302108        /* @todo recover from owner died. */
    21312109        LIBC_ASSERTM_FAILED("DosRequestMutexSem(%lu) failed with rc=%d!\n", ghmtxSPM, rc);
    2132         rc = -__libc_native2errno(rc);
     2110        rc = -__libc_back_native2errno(rc);
    21332111    }
    21342112
     
    22562234                LIBC_ASSERTM_FAILED("Failed to open mutex. rc=%d rc2=%d\n", rc, rc2);
    22572235                ghmtxSPM = NULLHANDLE;
    2258                 rc = -__libc_native2errno(rc);
     2236                rc = -__libc_back_native2errno(rc);
    22592237                LIBCLOG_RETURN_INT(rc);
    22602238            }
     
    23792357    gpSPMSelf = NULL;
    23802358    FS_RESTORE();
    2381     rc = -__libc_native2errno(rc);
     2359    rc = -__libc_back_native2errno(rc);
    23822360    LIBCLOG_RETURN_INT(rc);
    23832361}
  • trunk/libc/src/kNIX/os2/signals.c

    r2913 r2914  
    662662    }
    663663    LIBC_ASSERTM_FAILED("DosSetSigHandler failed with rc=%d\n", rc);
    664     rc = -__libc_native2errno(rc);
     664    rc = -__libc_back_native2errno(rc);
    665665    LIBCLOG_ERROR_RETURN_INT(rc);
    666666}
     
    22552255    if (!rc)
    22562256        LIBCLOG_RETURN_INT(0);
    2257     rc = -__libc_native2errno(rc);
     2257    rc = -__libc_back_native2errno(rc);
    22582258    LIBCLOG_ERROR_RETURN_INT(rc);
    22592259}
     
    23532353    if (!rc)
    23542354        LIBCLOG_RETURN_INT(0);
    2355     rc = -__libc_native2errno(rc);
     2355    rc = -__libc_back_native2errno(rc);
    23562356    LIBCLOG_ERROR_RETURN_INT(rc);
    23572357}
     
    30983098                {
    30993099                    LIBC_ASSERTM_FAILED("DosSetSigHandler failed with rc=%d\n", rc);
    3100                     rc = -__libc_native2errno(rc);
     3100                    rc = -__libc_back_native2errno(rc);
    31013101                }
    31023102                ULONG cTimes = 0;
  • trunk/libc/src/kNIX/os2/syscalls.h

    r2913 r2914  
    3939EXTERN unsigned long _sys_clock0_ms INIT (0);
    4040EXTERN long _sys_ino INIT (0x100000);
    41 EXTERN int _sys_pid;
    42 EXTERN int _sys_ppid;
     41/*EXTERN int _sys_pid;
     42EXTERN int _sys_ppid;*/
    4343
    4444/** Virtual address limit and high memory indicator.
     
    5252EXTERN unsigned long    _sys_gcbVirtualAddressLimit;
    5353
    54 
    55 
    56 #if defined (_OS2EMX_H)
    57 
    58 long _sys_p2t(FTIME t, FDATE d);
    59 
    60 #endif /* _OS2EMX_H */
    6154
    6255void _sys_get_clock (unsigned long *ms);
  • trunk/libc/src/kNIX/os2/sysv_sem.c

    r2732 r2914  
    369369    if (!rc)
    370370        LIBCLOG_RETURN_INT(rc);
    371     rc = -__libc_native2errno(rc);
     371    rc = -__libc_back_native2errno(rc);
    372372    LIBCLOG_ERROR_RETURN_INT(rc);
    373373}
  • trunk/libc/src/kNIX/os2/sysv_shm.c

    r2732 r2914  
    474474        FS_RESTORE();
    475475        if (error) {
    476                 error = __libc_native2errno(error);
     476                error = __libc_back_native2errno(error);
    477477                goto done2;
    478478        }
     
    718718        FS_RESTORE();
    719719        if (error)
    720             return -__libc_native2errno(error);
     720            return -__libc_back_native2errno(error);
    721721
    722722        /*
     
    10031003    if (!rc)
    10041004        LIBCLOG_ERROR_RETURN_INT(rc);
    1005     rc = -__libc_native2errno(rc);
     1005    rc = -__libc_back_native2errno(rc);
    10061006    LIBCLOG_RETURN_INT(rc);
    10071007}
  • trunk/libc/src/kNIX/os2/tcpip.c

    r2913 r2914  
    9797        else
    9898            LIBC_ASSERTM_FAILED("DosQueryModuleName(%#lx,,) -> %d\n", hmodLoad, rc);
    99         rc = -__libc_native2errno(rc);
     99        rc = -__libc_back_native2errno(rc);
    100100    }
    101101    else
  • trunk/libc/src/libc/misc/Makefile.kmk

    r2907 r2914  
    145145    $(PATH_LIBC_SRC)/libc/misc/_getdrive.c \
    146146    $(PATH_LIBC_SRC)/libc/misc/_realrealpath.c \
     147    $(PATH_LIBC_SRC)/libc/misc/_scrsize.c \
    147148    $(PATH_LIBC_SRC)/libc/misc/_uflags.c \
    148149
Note: See TracChangeset for help on using the changeset viewer.