Changeset 2917


Ignore:
Timestamp:
Dec 28, 2006, 5:06:32 PM (19 years ago)
Author:
bird
Message:

cleanup in progress (dinner time)

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

Legend:

Unmodified
Added
Removed
  • trunk/libc/include/io.h

    r2229 r2917  
    107107int      _ftruncate(int, off_t);
    108108#endif
    109 int _imphandle (int);
     109int _imphandle (__uintptr_t);
    110110int _ioctl (int, unsigned long request, ...);
    111111int _isatty (int);
  • trunk/libc/include/klibc/backend.h

    r2916 r2917  
    161161
    162162
     163/** @defgroup __libc_Back_fs   kLIBC Backend - File Handle
     164 * @{ */
     165
     166/**
     167 * Imports a standard file/pipe/that-kind-of-thing handle.
     168 *
     169 * @returns kLIBC file descriptor number on success.
     170 * @returns -1 and errno on failure.
     171 *
     172 * @param   hNative     The native handle value.
     173 * @param   fh          The requested file handle. -1 if any will do.
     174 */
     175int __libc_Back_fhImport(intptr_t hNative, int fh);
     176
     177/** @} */
     178
     179
     180
    163181/** @defgroup __libc_Back_fs   LIBC Backend - File System
    164182 * @{ */
  • trunk/libc/src/kNIX/Makefile.kmk

    r2915 r2917  
    3535libc_kNIX_INCS = $(PATH_LIBC_SRC)/kNIX
    3636libc_kNIX_SOURCES = \
     37    $(PATH_LIBC_SRC)/kNIX/b_fhImport.c \
    3738    $(PATH_LIBC_SRC)/kNIX/b_fsPathResolve.c \
    3839    $(PATH_LIBC_SRC)/kNIX/b_fsSymlinkModeSet.c \
     
    170171    $(PATH_LIBC_SRC)/kNIX/os2/__dup.c \
    171172    $(PATH_LIBC_SRC)/kNIX/os2/__dup2.c \
    172     $(PATH_LIBC_SRC)/kNIX/os2/__imphandle.c \
    173173    $(PATH_LIBC_SRC)/kNIX/os2/__init.c \
    174174    $(PATH_LIBC_SRC)/kNIX/os2/__initdll.c \
  • trunk/libc/src/kNIX/kNIX.h

    r2916 r2917  
    234234/** @} */
    235235
     236
     237/** @name File Handles
     238 * @{
     239 */
     240int __libc_FHImportFile(uintptr_t hNative, int fh, __LIBC_PFH *ppFH);
     241/** @} */
     242
     243
    236244/** @name ??
    237245 * @{
  • trunk/libc/src/libc/io/Makefile.kmk

    r2906 r2917  
    149149    $(PATH_LIBC_SRC)/libc/io/_fsetmod.c \
    150150    $(PATH_LIBC_SRC)/libc/io/_fsopen.c \
    151     $(PATH_LIBC_SRC)/libc/io/_imphand.c \
     151    $(PATH_LIBC_SRC)/libc/io/_imphandle.c \
    152152    $(PATH_LIBC_SRC)/libc/io/_input.c \
    153153    $(PATH_LIBC_SRC)/libc/io/_isterm.c \
  • trunk/libc/src/libc/io/_imphandle.c

    r2899 r2917  
    1 /* _imphand.c (emx+gcc) -- Copyright (c) 1994-1996 by Eberhard Mattes */
     1/* $Id: $ */
     2/** @file
     3 *
     4 * kNIX - _imphandle().
     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"
    428#include <io.h>
    5 #include <emx/syscalls.h>
     29#include <errno.h>
     30#include <klibc/backend.h>
     31#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_IO
     32#include <klibc/logstrict.h>
    633
    7 int _imphandle (int handle)
     34/**
     35 * Imports a standard file/pipe/that-kind-of-thing handle.
     36 *
     37 * @returns kLIBC file descriptor number on success.
     38 * @returns -1 and errno on failure.
     39 *
     40 * @param   hHandle     The handle value.
     41 */
     42int _imphandle(__uintptr_t hHandle)
    843{
    9     return __imphandle(handle);
     44    LIBCLOG_ENTER("hHandle=%td (%#tx)\n", hHandle, hHandle);
     45    int rc = __libc_Back_fhImport(hHandle, -1);
     46    if (rc >= 0)
     47        LIBCLOG_RETURN_INT(rc);
     48    errno = -rc;
     49    LIBCLOG_ERROR_RETURN_INT(-1);
    1050}
     51
Note: See TracChangeset for help on using the changeset viewer.