Changeset 2906


Ignore:
Timestamp:
Dec 26, 2006, 3:00:06 AM (19 years ago)
Author:
bird
Message:

doing cleanup.

Location:
trunk/libc
Files:
2 added
5 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/libc/Makefile.kmk

    r2901 r2906  
    4242include $(wildcard $(PATH_LIBC_SRC)/Makefile.kmk)
    4343
    44 
    45 #
    46 # libc.a
    47 #
    48 LIBRARIES += libc
    49 libc_TEMPLATE = libc
    50 libc_SOURCES = \
     44               
     45#
     46# libc_frontend.a
     47#
     48LIBRARIES += libc_frontend
     49libc_frontend_TEMPLATE = libc
     50libc_frontend_SOURCES = \
    5151        $(TARGET_libc_libc) \
    5252        $(TARGET_libc_fbsdlibc) \
    5353        $(TARGET_libc_glibc) \
    54         $(TARGET_libc_msun) \
    55         $(TARGET_libc_kNIX)
     54        $(TARGET_libc_msun)
    5655libc_SOURCES.os2 = \
    5756        $(TARGET_libc_libsocket) \
     
    6059
    6160ifdef CFG_LIBC_LOGSTRICT_LIBS
    62 LIBRARIES += libc_l
    63 libc_l_TEMPLATE = libc.profiled
    64 libc_l_SOURCES = \
     61LIBRARIES += libc_frontend_l
     62libc_frontend_l_TEMPLATE = libc.profiled
     63libc_frontend_l_SOURCES = \
    6564        $(TARGET_libc_libc_l) \
    6665        $(TARGET_libc_fbsdlibc_l) \
    6766        $(TARGET_libc_glibc_l) \
    68         $(TARGET_libc_msun_l) \
    69         $(TARGET_libc_kNIX_l)
    70 libc_l_SOURCES.os2 = \
     67        $(TARGET_libc_msun_l)
     68libc_frontend_l_SOURCES.os2 = \
    7169        $(TARGET_libc_libsocket_l) \
    7270        $(TARGET_libc_libsyslog_l)
     
    7472
    7573ifdef CFG_LIBC_PROFILED_LIBS
    76 LIBRARIES += libc_p
    77 libc_p_TEMPLATE = libc.profiled
    78 libc_p_SOURCES = \
     74LIBRARIES += libc_frontend_p
     75libc_frontend_p_TEMPLATE = libc.profiled
     76libc_frontend_p_SOURCES = \
    7977        $(TARGET_libc_libc_p) \
    8078        $(TARGET_libc_fbsdlibc_p) \
    8179        $(TARGET_libc_glibc_p) \
    82         $(TARGET_libc_msun_p) \
    83         $(TARGET_libc_kNIX_p)
    84 libc_p_SOURCES.os2 = \
     80        $(TARGET_libc_msun_p)
     81libc_frontend_p_SOURCES.os2 = \
    8582        $(TARGET_libc_libsocket_p) \
    8683        $(TARGET_libc_libsyslog_p)
     
    9188# libc_asm.a
    9289#
    93 LIBRARIES += libc_asm
    94 libc_asm_TEMPLATE = libcasm
    95 libc_asm_SOURCES = \
     90LIBRARIES += libc_frontend_asm
     91libc_frontend_asm_TEMPLATE = libcasm
     92libc_frontend_asm_SOURCES = \
    9693        $(TARGET_libc_libc_asm) \
    9794        $(TARGET_libc_fbsdlibc_asm) \
    9895        $(TARGET_libc_glibc_asm) \
    99         $(TARGET_libc_msun_asm) \
    100         $(TARGET_libc_kNIX_asm)
     96        $(TARGET_libc_msun_asm)
    10197
    10298ifdef CFG_LIBC_LOGSTRICT_LIBS
    103 LIBRARIES += libc_asm_l
    104 libc_asm_l_TEMPLATE = libcasm.logstrict
    105 libc_asm_l_SOURCES = \
     99LIBRARIES += libc_frontend_asm_l
     100libc_frontend_asm_l_TEMPLATE = libcasm.logstrict
     101libc_frontend_asm_l_SOURCES = \
    106102        $(TARGET_libc_libc_asm_l) \
    107103        $(TARGET_libc_fbsdlibc_asm_l) \
     
    112108
    113109ifdef CFG_LIBC_PROFILED_LIBS
     110LIBRARIES += libc_frontend_asm_p
     111libc_frontend_asm_p_TEMPLATE = libcasm.profiled
     112libc_frontend_asm_p_SOURCES = \
     113        $(TARGET_libc_libc_asm_p) \
     114        $(TARGET_libc_fbsdlibc_asm_p) \
     115        $(TARGET_libc_glibc_asm_p) \
     116        $(TARGET_libc_msun_asm_p)
     117endif
     118
     119
     120#
     121# libc.a
     122#
     123LIBRARIES += libc
     124libc_TEMPLATE = libc
     125libc_SOURCES = \
     126        $(TARGET_libc_frontend) \
     127        $(TARGET_libc_kNIX)
     128libc_SOURCES.nt = $(TARGET_kNIX.nt)
     129
     130ifdef CFG_LIBC_LOGSTRICT_LIBS
     131LIBRARIES += libc_l
     132libc_l_TEMPLATE = libc.profiled
     133libc_l_SOURCES = \
     134        $(TARGET_libc_frontend_l) \
     135        $(TARGET_libc_kNIX_l)
     136libc_l_SOURCES.nt = $(TARGET_kNIX_l.nt)
     137endif
     138
     139ifdef CFG_LIBC_PROFILED_LIBS
     140LIBRARIES += libc_p
     141libc_p_TEMPLATE = libc.profiled
     142libc_p_SOURCES = \
     143        $(TARGET_libc_frontend_p) \
     144        $(TARGET_libc_kNIX_p)
     145libc_p_SOURCES.nt = $(TARGET_kNIX_p.nt)
     146endif
     147
     148
     149#
     150# libc_asm.a
     151#
     152LIBRARIES += libc_asm
     153libc_asm_TEMPLATE = libcasm
     154libc_asm_SOURCES = \
     155        $(TARGET_libc_frontend_asm) \
     156        $(TARGET_libc_kNIX_asm)
     157
     158ifdef CFG_LIBC_LOGSTRICT_LIBS
     159LIBRARIES += libc_asm_l
     160libc_asm_l_TEMPLATE = libcasm.logstrict
     161libc_asm_l_SOURCES = \
     162        $(TARGET_libc_frontend_asm_l) \
     163        $(TARGET_libc_kNIX_asm_l)
     164endif
     165
     166ifdef CFG_LIBC_PROFILED_LIBS
    114167LIBRARIES += libc_asm_p
    115168libc_asm_p_TEMPLATE = libcasm.profiled
    116169libc_asm_p_SOURCES = \
    117         $(TARGET_libc_libc_asm_p) \
    118         $(TARGET_libc_fbsdlibc_asm_p) \
    119         $(TARGET_libc_glibc_asm_p) \
    120         $(TARGET_libc_msun_asm_p) \
     170        $(TARGET_libc_frontend_asm_p) \
    121171        $(TARGET_libc_kNIX_asm_p)
    122172endif
     
    167217
    168218ifdef CFG_LIBC_PROFILED_LIBS
    169 DLLS.os2 += libc07.profiled
     219#DLLS.os2 += libc07.profiled
    170220libc07.profiled_TEMPLATE = libc.profiled
    171221libc07.profiled_TOOL = GCC3
  • trunk/libc/include/klibc/backend.h

    r2901 r2906  
    535535 */
    536536ssize_t __libc_Back_ioDirGetEntries(int fh, void *pvBuf, size_t cbBuf, __off_t *poff);
     537
     538/**
     539 * Get the TTY of a TTY device.
     540 *
     541 * @returns 0 on success.
     542 * @returns Negative error code (errno.h) on failure.
     543 *
     544 * @param   fh          The file handle.
     545 * @param   pszNameBuf  Where to store the name.
     546 * @param   cchNameBuf  The size of the name buf.
     547 */
     548int __libc_Back_ioTTYName(int fh, char *pszNameBuf, size_t cchNameBuf);
    537549
    538550/**
  • trunk/libc/include/klibc/logstrict.h

    r2805 r2906  
    169169/** Macro to log a pointer return and do the return. */
    170170#define LIBCLOG_RETURN_P(rc)            LIBCLOG_RETURN_MSG((rc), "ret %p\n", (void*)(rc))
     171/** Macro to log a string pointer return and do the return. */
     172#define LIBCLOG_RETURN_PSZ(psz)         LIBCLOG_RETURN_MSG((psz), "ret %p:{%s}\n", (void*)(psz), (psz))
    171173
    172174
  • trunk/libc/include/unistd.h

    r2672 r2906  
    578578char    *get_current_dir_name(void);
    579579#endif
    580 
     580int     ttyname_r(int, char *, size_t);
    581581
    582582/*
  • trunk/libc/src/kNIX/Makefile.kmk

    r2903 r2906  
    3535libc_kNIX_SOURCES = \
    3636    $(PATH_LIBC_SRC)/kNIX/b_ioClose.c \
     37    $(PATH_LIBC_SRC)/kNIX/b_ioFileSizeSet.c \
    3738    $(PATH_LIBC_SRC)/kNIX/b_ioRead.c \
     39    $(PATH_LIBC_SRC)/kNIX/b_ioSeek.c \
     40    $(PATH_LIBC_SRC)/kNIX/b_ioTTYName.c \
    3841    $(PATH_LIBC_SRC)/kNIX/b_ioWrite.c \
    39     $(PATH_LIBC_SRC)/kNIX/b_ioSeek.c \
    40     $(PATH_LIBC_SRC)/kNIX/b_ioFileSizeSet.c \
    4142    $(PATH_LIBC_SRC)/kNIX/b_mmanBrk.c \
    4243    $(PATH_LIBC_SRC)/kNIX/b_mmanSBrk.c \
     
    5556
    5657libc_kNIX_SOURCES.os2 = \
    57     $(PATH_LIBC_SRC)/kNIX/os2/brk.c \
    5858    $(PATH_LIBC_SRC)/kNIX/os2/b_dir.c \
    5959    $(PATH_LIBC_SRC)/kNIX/os2/b_fsDirChangeRoot.c \
     
    150150    $(PATH_LIBC_SRC)/kNIX/os2/resource.c \
    151151    $(PATH_LIBC_SRC)/kNIX/os2/safesems.c \
    152     $(PATH_LIBC_SRC)/kNIX/os2/sbrk.c \
    153152    $(PATH_LIBC_SRC)/kNIX/os2/scrsize.c \
    154153    $(PATH_LIBC_SRC)/kNIX/os2/seterrno.c \
  • trunk/libc/src/libc/io/Makefile.kmk

    r2717 r2906  
    125125    $(PATH_LIBC_SRC)/libc/io/truncate.c \
    126126    $(PATH_LIBC_SRC)/libc/io/ttyname.c \
     127    $(PATH_LIBC_SRC)/libc/io/ttyname_r.c \
    127128    $(PATH_LIBC_SRC)/libc/io/ungetc.c \
    128129    $(PATH_LIBC_SRC)/libc/io/unlink.c \
  • trunk/libc/src/libc/io/ttyname.c

    r1287 r2906  
    1 /* ttyname.c (emx+gcc) -- Copyright (c) 1995-1996 by Eberhard Mattes */
     1/* $Id: $ */
     2/** @file
     3 *
     4 * kLIBC - ttyname().
     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 <unistd.h>
    5 #include <emx/syscalls.h>
    6 #include <InnoTekLIBC/thread.h>
     29#include <errno.h>
     30#include <klibc/backend.h>
     31#include <klibc/thread.h>
     32#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_IO
     33#include <klibc/logstrict.h>
    734
    8 char *_STD(ttyname) (int handle)
     35char *_STD(ttyname)(int fd)
    936{
    10   __LIBC_PTHREAD pThrd = __libc_threadCurrent ();
     37    LIBCLOG_ENTER("fd=%d\n", fd);
     38    __LIBC_PTHREAD pThrd = __libc_threadCurrent();
     39    int rc = __libc_Back_ioTTYName(fd, pThrd->szTTYNameBuf, sizeof(pThrd->szTTYNameBuf));
     40    if (!rc)
     41        LIBCLOG_RETURN_PSZ(pThrd->szTTYNameBuf);
     42    errno = -rc;
     43    LIBCLOG_ERROR_RETURN_P(NULL);
     44}
    1145
    12   if (__ttyname (handle, pThrd->szTTYNameBuf, sizeof (pThrd->szTTYNameBuf)) == 0)
    13     return pThrd->szTTYNameBuf;
    14   else
    15     return NULL;
    16 }
Note: See TracChangeset for help on using the changeset viewer.