Changeset 2920


Ignore:
Timestamp:
Dec 29, 2006, 4:41:12 PM (19 years ago)
Author:
bird
Message:

cleanup in progress (afternoon).

Location:
trunk/libc
Files:
5 added
5 deleted
8 edited
1 moved

Legend:

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

    r2918 r2920  
    465465int __libc_Back_fsUnlink(const char *pszPath);
    466466
     467/**
     468 * Sets the umask to mask & 0777.
     469 *
     470 * The umask is used by open(), creat(), mkdir(), mkfifo(),
     471 * mknod(), mq_open() and sem_open() to set the initial permissions
     472 * for an newly created object.
     473 *
     474 * @returns The old umask. (Will never fail!)
     475 * @param   mask    The new umask.
     476 */
     477mode_t __libc_Back_fsUMask(mode_t mask);
     478
    467479
    468480/** @defgroup __libc_Back_io   LIBC Backend - I/O and File Management.
     
    485497
    486498/**
     499 * Creates an anonymous pipe.
     500 *
     501 * @returns 0 and *pfhRead and *pfhWrite on success.
     502 * @returns Negated error code (errno.h) on failure.
     503 * @param   pfhRead         Where to store the read end handle.
     504 * @param   pfhWrite        Where to store the write end handle.
     505 * @param   cbSuggestion    The suggested buffer size. 0 means default.
     506 * @param   fBinaryText     0=text; 1=binary.
     507 */
     508int __libc_Back_ioPipe(int *pfhRead, int *pfhWrite, size_t cbSuggestion, int fBinaryText);
     509
     510/**
    487511 * Closes a file handle.
    488512 *
     
    542566 */
    543567int __libc_Back_ioFileSizeSet(int fh, __off_t cbFile, int fZero);
     568
     569/**
     570 * Execute all pending I/O operations and flush buffers associated with a file handle.
     571 *
     572 * @returns 0 on success.
     573 * @returns Negated errno on failure.
     574 * @param   fh          The file handle.
     575 */
     576int __libc_Back_ioSync(int fh);
     577
     578/**
     579 * Duplicate handle.
     580 *
     581 * @returns 0 on success.
     582 * @returns Negated errno on failure.
     583 * @param   fh          The file handle to duplicate.
     584 * @param   pfhNew      Where to store the duplicate filehandle.
     585 *                      The input value describe how the handle is to be
     586 *                      duplicated. If it's -1 a new handle is allocated.
     587 *                      Any other value will result in that value to be
     588 *                      used as handle. Any existing handle with that
     589 *                      value will be closed.
     590 * @param   fClose      Whether or not to close *pfhNew.
     591 */
     592int __libc_Back_ioDuplicate(int fh, int *pfhNew, int fClose);
    544593
    545594/**
  • trunk/libc/include/klibc/io.h

    r2909 r2920  
    8686{
    8787    /** Handle type. */
    88     __LIBC_FHTYPE       enmType;
    89     /** Close operation.
     88    __LIBC_FHTYPE enmType;
     89
     90    /**
     91     * Close operation.
     92     *
    9093     * @returns 0 on success.
    9194     * @returns Negated errno on failure.
     
    9396     */
    9497    int (*pfnClose)(struct __libc_FileHandle *pFH);
    95     /** Read operation.
     98
     99    /**
     100     * Read operation.
     101     *
    96102     * @returns 0 on success.
    97103     * @returns Negated errno on failure.
     
    102108     */
    103109    int (*pfnRead)(struct __libc_FileHandle *pFH, void *pvBuf, size_t cbRead, size_t *pcbRead);
    104     /** Write operation.
     110
     111    /**
     112     * Write operation.
     113     *
    105114     * @returns 0 on success.
    106115     * @returns Negated errno on failure.
     
    111120     */
    112121    int (*pfnWrite)(struct __libc_FileHandle *pFH, const void *pvBuf, size_t cbWrite, size_t *pcbWritten);
    113     /** Seek operation.
     122
     123    /**
     124     * Seek operation.
     125     *
    114126     * @returns 0 on success.
    115127     * @returns Negated errno on failure.
     
    120132     */
    121133    int (*pfnSeek)(struct __libc_FileHandle *pFH, off_t off, int iMethod, off_t *poffActual);
     134
    122135    /**
    123136     * Sets the size of an open file.
     
    130143     */
    131144    int (*pfnSizeSet)(struct __libc_FileHandle *pFH, off_t cbFile, int fZero);
    132     /** Duplicate handle operation.
     145
     146    /**
     147     * Execute all pending I/O operations and flush buffers associated with a file handle.
     148     *
     149     * @returns 0 on success.
     150     * @returns Negative error code (errno.h) on failure.
     151     * @param   pFH     The file handle structure.
     152     */
     153    int (*pfnSync)(struct __libc_FileHandle *pFH);
     154
     155    /**
     156     * Duplicate handle operation.
     157     *
    133158     * @returns 0 on success.
    134159     * @returns Negated errno on failure.
     
    142167     */
    143168    int (*pfnDuplicate)(struct __libc_FileHandle *pFH, int *pfhNew);
    144     /** File Control operation.
     169
     170    /**
     171     * File Control operation.
     172     *
    145173     * @returns 0 on success.
    146174     * @returns Negated errno on failure.
     
    153181     */
    154182    int (*pfnFileControl)(struct __libc_FileHandle *pFH, int iRequest, int iArg, int *prc);
    155     /** I/O Control operation.
     183
     184    /**
     185     * I/O Control operation.
     186     *
    156187     * @returns 0 on success.
    157188     * @returns Negated errno on failure.
     
    164195     */
    165196    int (*pfnIOControl)(struct __libc_FileHandle *pFH, int iIOControl, int iArg, int *prc);
    166     /** Select operation.
     197
     198    /**
     199     * Select operation.
     200     *
    167201     * The select operation is only performed if all handles have the same
    168202     * select routine (the main worker checks this).
     
    179213     */
    180214    int (*pfnSelect)(int cFHs, struct fd_set *pRead, struct fd_set *pWrite, struct fd_set *pExcept, struct timeval *tv, int *prc);
    181     /** Fork notification - parent context.
     215
     216    /**
     217     * Fork notification - parent context.
     218     *
    182219     * If NULL it's assumed that no notifiction is needed.
    183220     *
     
    189226     */
    190227    int (*pfnForkParent)(struct __libc_FileHandle *pFH, __LIBC_PFORKHANDLE pForkHandle, __LIBC_FORKOP enmOperation);
    191     /** Fork notification - child context.
     228
     229    /**
     230     * Fork notification - child context.
     231     *
    192232     * Only the __LIBC_FORK_OP_FORK_CHILD operation is forwarded atm.
    193233     * If NULL it's assumed that no notifiction is needed.
  • trunk/libc/src/kNIX/Makefile.kmk

    r2918 r2920  
    4646    $(PATH_LIBC_SRC)/kNIX/b_fsSymlinkStat.c \
    4747    $(PATH_LIBC_SRC)/kNIX/b_fsSymlinkTimesSet.c \
     48    $(PATH_LIBC_SRC)/kNIX/b_fsUMask.c \
    4849    $(PATH_LIBC_SRC)/kNIX/b_ioClose.c \
    4950    $(PATH_LIBC_SRC)/kNIX/b_ioDirGetEntries.c \
     51    $(PATH_LIBC_SRC)/kNIX/b_ioDuplicate.c \
    5052    $(PATH_LIBC_SRC)/kNIX/b_ioFileSizeSet.c \
    5153    $(PATH_LIBC_SRC)/kNIX/b_ioFHToPath.c \
    5254    $(PATH_LIBC_SRC)/kNIX/b_ioRead.c \
    5355    $(PATH_LIBC_SRC)/kNIX/b_ioSeek.c \
     56    $(PATH_LIBC_SRC)/kNIX/b_ioSync.c \
    5457    $(PATH_LIBC_SRC)/kNIX/b_ioTTYName.c \
    5558    $(PATH_LIBC_SRC)/kNIX/b_ioWrite.c \
     
    6770    $(PATH_LIBC_SRC)/kNIX/_os_version.c \
    6871
    69 #    $(PATH_LIBC_SRC)/kNIX/b_ioDuplicate.c \
    7072
    7173
     
    9294    $(PATH_LIBC_SRC)/kNIX/os2/b_ioFileControl.c \
    9395    $(PATH_LIBC_SRC)/kNIX/os2/b_ioFileOpen.c \
     96    $(PATH_LIBC_SRC)/kNIX/os2/b_ioPipe.c \
    9497    $(PATH_LIBC_SRC)/kNIX/os2/b_ldrClose.c \
    9598    $(PATH_LIBC_SRC)/kNIX/os2/b_ldrExeName.c \
     
    144147    $(PATH_LIBC_SRC)/kNIX/os2/fhOS2File.c \
    145148    $(PATH_LIBC_SRC)/kNIX/os2/fs-os2.c \
    146     $(PATH_LIBC_SRC)/kNIX/os2/fsync.c \
    147149    $(PATH_LIBC_SRC)/kNIX/os2/heaphigh.c \
    148150    $(PATH_LIBC_SRC)/kNIX/os2/hooks.c \
     
    168170    $(PATH_LIBC_SRC)/kNIX/os2/386/unwind.s \
    169171    $(PATH_LIBC_SRC)/kNIX/os2/386/__init_environ.s \
    170     $(PATH_LIBC_SRC)/kNIX/os2/umask.c \
    171     $(PATH_LIBC_SRC)/kNIX/os2/__chmod.c \
    172172    $(PATH_LIBC_SRC)/kNIX/os2/__spawnve.c \
    173173    $(PATH_LIBC_SRC)/kNIX/os2/__read_kbd.c
     
    175175    $(PATH_LIBC_SRC)/kNIX/os2/__init.c \
    176176    $(PATH_LIBC_SRC)/kNIX/os2/__initdll.c \
    177     $(PATH_LIBC_SRC)/kNIX/os2/__dup.c \
    178     $(PATH_LIBC_SRC)/kNIX/os2/__dup2.c \
    179177    $(PATH_LIBC_SRC)/kNIX/os2/__ioctl1.c \
    180178    $(PATH_LIBC_SRC)/kNIX/os2/__ioctl2.c \
    181     $(PATH_LIBC_SRC)/kNIX/os2/__pipe.c \
    182179    $(PATH_LIBC_SRC)/kNIX/os2/__select.c \
    183180
  • trunk/libc/src/kNIX/b_fsUMask.c

    r2916 r2920  
    22/** @file
    33 *
    4  * kNIX - umask.
     4 * kNIX - umask().
    55 *
    6  * Copyright (c) 2004 knut st. osmundsen <bird-src-spam@innotek.de>
     6 * Copyright (c) 2004-2006 knut st. osmundsen <bird-src-spam@anduin.net>
    77 *
    88 *
     
    2525 */
    2626
    27 /*******************************************************************************
    28 *   Header Files                                                               *
    29 *******************************************************************************/
    3027#include "kNIX.h"
    31 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_IO
     28#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_FS
    3229#include <klibc/logstrict.h>
    33 
    3430
    3531/**
     
    4339 * @param   mask    The new umask.
    4440 */
    45 mode_t _STD(umask)(mode_t mask)
     41mode_t __libc_Back_fsUMask(mode_t mask)
    4642{
    4743    LIBCLOG_ENTER("mask=0%o\n", mask);
  • trunk/libc/src/kNIX/os2/fhOS2File.c

    r2914 r2920  
    6767    if (!rc)
    6868        LIBCLOG_RETURN_INT(0);
    69     rc = -__libc_native2errno(rc);
     69    rc = -__libc_back_native2errno(rc);
    7070    LIBCLOG_ERROR_RETURN_INT(rc);
    7171}
     
    119119    *pcbRead = 0;
    120120    if (rc > 0)
    121         rc = -__libc_native2errno(rc);
     121        rc = -__libc_back_native2errno(rc);
    122122    LIBCLOG_ERROR_RETURN_INT(rc);
    123123}
     
    170170    *pcbWritten = 0;
    171171    if (rc > 0)
    172         rc = -__libc_native2errno(rc);
     172        rc = -__libc_back_native2errno(rc);
    173173    LIBCLOG_ERROR_RETURN_INT(rc);
    174174}
     
    219219        LIBCLOG_RETURN_INT(0);
    220220    }
    221     rc = -__libc_native2errno(rc);
     221    rc = -__libc_back_native2errno(rc);
    222222    LIBCLOG_ERROR_RETURN_INT(rc);
    223223}
     
    391391    FS_RESTORE();
    392392    if (rc > 0)
    393         rc = -__libc_native2errno(rc);
    394     LIBCLOG_ERROR_RETURN_INT(rc);
    395 }
    396 
    397 
    398 /** Duplicate handle operation.
    399  * @returns 0 on success.
    400  * @returns Negated errno on failure.
    401  * @param   pFH         Pointer to the handle structure to operate on.
    402  * @param   pfhNew      Where to store the duplicate filehandle.
    403  *                      The input value describe how the handle is to be
    404  *                      duplicated. If it's -1 a new handle is allocated.
    405  *                      Any other value will result in that value to be
    406  *                      used as handle. Any existing handle with that
    407  *                      value will be closed.
    408  */
     393        rc = -__libc_back_native2errno(rc);
     394    LIBCLOG_ERROR_RETURN_INT(rc);
     395}
     396
     397
     398/** @copydoc __LIBC_FHOPS::pfnSync */
     399static int fhOS2FileSync(__LIBC_PFH pFH)
     400{
     401    LIBCLOG_ENTER("pFH=%p:{.fh=%d}\n", (void *)pFH, pFH->fh);
     402    FS_VAR_SAVE_LOAD();
     403
     404    int rc = DosResetBuffer(pFH->fh);
     405    FS_RESTORE();
     406    if (__predict_true(!rc))
     407        LIBCLOG_RETURN_INT(0);
     408    rc = -__libc_back_native2errno(rc);
     409    LIBCLOG_ERROR_RETURN_INT(rc);
     410}
     411
     412
     413/** @copydoc __LIBC_FHOPS::pfnDuplicate */
    409414static int fhOs2FileDuplicate(__LIBC_PFH pFH, int *pfhNew)
    410415{
    411     return -ENOSYS;
     416    LIBCLOG_ENTER("pFH=%p:{.fh=%d} pfhNew=%p:{%d}\n", (void *)pFH, pFH->fh, (void *)pfhNew, *pfhNew);
     417    FS_VAR_SAVE_LOAD();
     418
     419    HFILE hNew;
     420    int rc;
     421    if (*pfhNew < 0)
     422    {
     423        /* new handle */
     424        unsigned cExpandRetries = 0;
     425        for (;;)
     426        {
     427            hNew = ~0;
     428            rc = DosDupHandle(pFH->fh, &hNew);
     429            if (rc != ERROR_TOO_MANY_OPEN_FILES)
     430                break;
     431            if (cExpandRetries++ >= 3)
     432                break;
     433            /* autoincrement. */
     434            __libc_FHMoreHandles();
     435        }   /* ... retry 3 times ... */
     436    }
     437    else
     438    {
     439        /* specific handle */
     440        hNew = *pfhNew;
     441        rc = DosDupHandle(pFH->fh, &hNew);
     442    }
     443    if (!rc)
     444    {
     445        __LIBC_PFH pFHNew;
     446        rc = __libc_FHAllocate(sizeof(__LIBC_FH), &__libc_back_gFileOps, hNew, hNew, pFH->fFlags, &pFHNew);
     447        if (!rc)
     448        {
     449            pFHNew->fFlags      = pFH->fFlags;
     450            pFHNew->iLookAhead  = pFH->iLookAhead;
     451            pFHNew->Inode       = pFH->Inode;
     452            pFHNew->Dev         = pFH->Dev;
     453            pFHNew->pFsInfo     = __libc_back_fsInfoObjAddRef(pFH->pFsInfo);
     454            pFHNew->pszNativePath = _hstrdup(pFH->pszNativePath);
     455
     456            /*
     457             * OS/2 does, as SuS specifies, clear the noinherit flag. So, we update
     458             * the flags of the new handle and in strict mode call __libc_FHSetFlags
     459             * to invoke the out of sync check in there.
     460             */
     461            pFHNew->fFlags &= ~((FD_CLOEXEC << __LIBC_FH_FDFLAGS_SHIFT) | O_NOINHERIT);
     462            LIBC_ASSERT(!__libc_FHSetFlags(pFHNew, pFHNew->fFlags));
     463
     464            /* set the return value */
     465            *pfhNew = hNew;
     466            FS_RESTORE();
     467            LIBCLOG_RETURN_MSG(0, "ret 0 - *pfhNew=%d\n", *pfhNew);
     468        }
     469        else
     470            DosClose(hNew);
     471    }
     472    else
     473        rc = -__libc_back_native2errno(rc);
     474    LIBCLOG_ERROR_RETURN_INT(rc);
    412475}
    413476
     
    465528
    466529/** Operations on sockets. */
    467 static const __LIBC_FHOPS       gSocketOps =
     530const __LIBC_FHOPS gOS2FileOps =
    468531{
    469532    enmFH_File,             /* Handle type. */
     
    473536    fhOs2FileSeek,
    474537    fhOS2FileSizeSet,
     538    fhOS2FileSync,
    475539    fhOs2FileDuplicate,
    476540    fhOs2FileFileControl,
  • trunk/libc/src/libc/io/Makefile.kmk

    r2918 r2920  
    7373    $(PATH_LIBC_SRC)/libc/io/fsetpos.c \
    7474    $(PATH_LIBC_SRC)/libc/io/fstat.c \
     75    $(PATH_LIBC_SRC)/libc/io/fsync.c \
    7576    $(PATH_LIBC_SRC)/libc/io/ftell.c \
    7677    $(PATH_LIBC_SRC)/libc/io/ftruncat.c \
     
    126127    $(PATH_LIBC_SRC)/libc/io/ttyname.c \
    127128    $(PATH_LIBC_SRC)/libc/io/ttyname_r.c \
     129    $(PATH_LIBC_SRC)/libc/io/umask.c \
    128130    $(PATH_LIBC_SRC)/libc/io/ungetc.c \
    129131    $(PATH_LIBC_SRC)/libc/io/unlink.c \
  • trunk/libc/src/libc/io/dup.c

    r871 r2920  
    1 /* dup.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes
    2                    -- Copyright (c) 2003 by Knut St. Osmunden */
     1/* $Id: $ */
     2/** @file
     3 *
     4 * kLIBC - dup().
     5 *
     6 * Copyright (c) 2006 knut st. osmundsen <bird-srcspam@anduin.net>
     7 *
     8 *
     9 * This file is part of kLIBC.
     10 *
     11 * kLIBC is free software; you can redistribute it and/or modify
     12 * it under the terms of the GNU Lesser General Public License as published
     13 * by the Free Software Foundation; either version 2 of the License, or
     14 * (at your option) any later version.
     15 *
     16 * kLIBC is distributed in the hope that it will be useful,
     17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     19 * GNU Lesser General Public License for more details.
     20 *
     21 * You should have received a copy of the GNU Lesser General Public License
     22 * along with kLIBC; if not, write to the Free Software
     23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     24 *
     25 */
    326
    427#include "libc-alias.h"
     28#include <unistd.h>
    529#include <io.h>
    6 #include <emx/syscalls.h>
     30#include <errno.h>
     31#include <klibc/backend.h>
     32#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_IO
     33#include <klibc/logstrict.h>
    734
    835int _STD(dup)(int fh)
    936{
    10     return __dup(fh);
     37    LIBCLOG_ENTER("fh=%d\n", fh);
     38
     39    int fhNew = -1;
     40    int rc = __libc_Back_ioDuplicate(fh, &fhNew, 0 /* no closing */);
     41    if (!rc)
     42        LIBCLOG_RETURN_INT(fhNew);
     43
     44    errno = -rc;
     45    LIBCLOG_ERROR_RETURN_INT(-1);
    1146}
     47
  • trunk/libc/src/libc/io/dup2.c

    r871 r2920  
    1 /* dup2.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes
    2                     -- Copyright (c) 2003 by Knut St. Osmunden */
     1/* $Id: $ */
     2/** @file
     3 *
     4 * kLIBC - dup().
     5 *
     6 * Copyright (c) 2006 knut st. osmundsen <bird-srcspam@anduin.net>
     7 *
     8 *
     9 * This file is part of kLIBC.
     10 *
     11 * kLIBC is free software; you can redistribute it and/or modify
     12 * it under the terms of the GNU Lesser General Public License as published
     13 * by the Free Software Foundation; either version 2 of the License, or
     14 * (at your option) any later version.
     15 *
     16 * kLIBC is distributed in the hope that it will be useful,
     17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     19 * GNU Lesser General Public License for more details.
     20 *
     21 * You should have received a copy of the GNU Lesser General Public License
     22 * along with kLIBC; if not, write to the Free Software
     23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     24 *
     25 */
    326
    427#include "libc-alias.h"
     28#include <unistd.h>
    529#include <io.h>
    6 #include <emx/syscalls.h>
     30#include <errno.h>
     31#include <klibc/backend.h>
     32#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_IO
     33#include <klibc/logstrict.h>
    734
    8 int _STD(dup2)(int handle1, int handle2)
     35int _STD(dup2)(int fh, int fhNew)
    936{
    10   /* TODO: Block signals */
    11   if (__dup2(handle1, handle2) < 0)
    12     return -1;
    13   return handle2;
     37    LIBCLOG_ENTER("fh=%d fhNew=%d\n", fh, fhNew);
     38    int rc;
     39
     40    if (fhNew >= 0)
     41    {
     42        rc = __libc_Back_ioDuplicate(fh, &fhNew, 1 /* close */);
     43        if (!rc)
     44            LIBCLOG_RETURN_INT(fhNew);
     45    }
     46    else
     47        rc = -EBADF;
     48    errno = -rc;
     49    LIBCLOG_ERROR_RETURN_INT(-1);
    1450}
     51
  • trunk/libc/src/libc/io/pipe.c

    r2739 r2920  
    1 /* pipe.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */
     1/* $Id: $ */
     2/** @file
     3 *
     4 * kLIBC - pipe().
     5 *
     6 * Copyright (c) 2006 knut st. osmundsen <bird-srcspam@anduin.net>
     7 *
     8 *
     9 * This file is part of kLIBC.
     10 *
     11 * kLIBC is free software; you can redistribute it and/or modify
     12 * it under the terms of the GNU Lesser General Public License as published
     13 * by the Free Software Foundation; either version 2 of the License, or
     14 * (at your option) any later version.
     15 *
     16 * kLIBC is distributed in the hope that it will be useful,
     17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     19 * GNU Lesser General Public License for more details.
     20 *
     21 * You should have received a copy of the GNU Lesser General Public License
     22 * along with kLIBC; if not, write to the Free Software
     23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     24 *
     25 */
    226
    327#include "libc-alias.h"
     28#include <unistd.h>
    429#include <io.h>
    5 #include <fcntl.h>
    630#include <errno.h>
    7 #include <klibc/io.h>
    8 #include <emx/syscalls.h>
     31#include <klibc/backend.h>
     32#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_IO
     33#include <klibc/logstrict.h>
    934
    1035extern int _fmode_bin;
    1136
    12 /** The default pipe size. */
    13 int     _pipe_size;
     37int _STD(pipe)(int *paFHs)
     38{
     39    LIBCLOG_ENTER("paFHs=%p\n", (void *)paFHs);
    1440
    15 int _STD(pipe)(int *two_handles)
    16 {
    17     __LIBC_PFH pFHRead, pFHWrite;
     41    int fhRead;
     42    int fhWrite;
     43    int rc = __libc_Back_ioPipe(&fhRead, &fhWrite, 0 /* default size */, !!_fmode_bin);
     44    if (!rc)
     45    {
     46        paFHs[0] = fhRead;
     47        paFHs[1] = fhWrite;
     48        LIBCLOG_RETURN_MSG(0, "ret 0 - paFH=%p:{%d,%d}\n", (void *)paFHs, paFHs[0], paFHs[1]);
     49    }
    1850
    19     if (__pipe(two_handles, _pipe_size != 0 ? _pipe_size : 8192, &pFHRead, &pFHWrite) != 0)
    20         return -1;
     51    errno = -rc;
     52    LIBCLOG_ERROR_RETURN_INT(-1);
     53}
    2154
    22     /** @todo move _fmode_bin check to __pipe()? */
    23     if (!_fmode_bin)
    24     {
    25         pFHRead->fFlags  |= O_TEXT;
    26         pFHWrite->fFlags |= O_TEXT;
    27     }
    28     __libc_FHPut(pFHRead);
    29     __libc_FHPut(pFHWrite);
    30 
    31     return 0;
    32 }
Note: See TracChangeset for help on using the changeset viewer.