source: rtems/contrib/crossrpms/patches/newlib-1.17.0-rtems4.10-20090220.diff @ facca98

4.104.115
Last change on this file since facca98 was 273b931, checked in by Ralf Corsepius <ralf.corsepius@…>, on 02/20/09 at 10:03:21

Split ttyname.c/ttyname_r.c

  • Property mode set to 100644
File size: 21.7 KB
  • newlib/ChangeLog.rtems

    diff -Naur newlib-1.17.0.orig/newlib/ChangeLog.rtems newlib-1.17.0/newlib/ChangeLog.rtems
    old new  
     12009-02-16      Ralf Corsépius <ralf.corsepius@rtems.org>
     2
     3        * libc/sys/rtems/sys/param.h:
     4        Update copyright notice from FreeBSD.
     5        Remove HZ.
     6        Add #include <sys/priority.h>
     7        Remove priority handling (moved to sys/priority.h).
     8        Remove CLBYTES (Unused, abandoned in BSD).
     9
     102009-02-06      Ralf Corsépius <ralf.corsepius@rtems.org>
     11
     12        * libc/include/sched.h:
     13        Remove (collides with RTEMS's schedul.h).
     14
  • newlib/libc/include/inttypes.h

    diff -Naur newlib-1.17.0.orig/newlib/libc/include/inttypes.h newlib-1.17.0/newlib/libc/include/inttypes.h
    old new  
    163163
    164164
    165165/* 64-bit types */
    166 #if __have_longlong64
    167 #define __PRI64(x) __STRINGIFY(ll##x)
    168 #define __SCN64(x) __STRINGIFY(ll##x)
    169 #elif __have_long64
     166#if __have_long64
    170167#define __PRI64(x) __STRINGIFY(l##x)
    171168#define __SCN64(x) __STRINGIFY(l##x)
     169#elif __have_longlong64
     170#define __PRI64(x) __STRINGIFY(ll##x)
     171#define __SCN64(x) __STRINGIFY(ll##x)
    172172#else
    173173#define __PRI64(x) __STRINGIFY(x)
    174174#define __SCN64(x) __STRINGIFY(x)
     
    217217#endif
    218218
    219219/* max-bit types */
    220 #if __have_longlong64
    221 #define __PRIMAX(x) __STRINGIFY(ll##x)
    222 #define __SCNMAX(x) __STRINGIFY(ll##x)
    223 #elif __have_long64
     220#if __have_long64
    224221#define __PRIMAX(x) __STRINGIFY(l##x)
    225222#define __SCNMAX(x) __STRINGIFY(l##x)
     223#elif __have_longlong64
     224#define __PRIMAX(x) __STRINGIFY(ll##x)
     225#define __SCNMAX(x) __STRINGIFY(ll##x)
    226226#else
    227227#define __PRIMAX(x) __STRINGIFY(x)
    228228#define __SCNMAX(x) __STRINGIFY(x)
     
    242242#define SCNxMAX         __SCNMAX(x)
    243243
    244244/* ptr types */
    245 #if __have_longlong64
    246 #define __PRIPTR(x) __STRINGIFY(ll##x)
    247 #define __SCNPTR(x) __STRINGIFY(ll##x)
    248 #elif __have_long64
     245#if __have_long64
    249246#define __PRIPTR(x) __STRINGIFY(l##x)
    250247#define __SCNPTR(x) __STRINGIFY(l##x)
     248#elif __have_longlong64
     249#define __PRIPTR(x) __STRINGIFY(ll##x)
     250#define __SCNPTR(x) __STRINGIFY(ll##x)
    251251#else
    252252#define __PRIPTR(x) __STRINGIFY(x)
    253253#define __SCNPTR(x) __STRINGIFY(x)
  • newlib/libc/include/machine/ieeefp.h

    diff -Naur newlib-1.17.0.orig/newlib/libc/include/machine/ieeefp.h newlib-1.17.0/newlib/libc/include/machine/ieeefp.h
    old new  
    6262#  define __IEEE_BIG_ENDIAN
    6363# endif
    6464#else
    65 # define __IEEE_BIG_ENDIAN
    6665# ifdef __ARMEL__
     66#  define __IEEE_LITTLE_ENDIAN
     67# else
     68#  define __IEEE_BIG_ENDIAN
     69# endif
     70# ifdef __ARMWEL__
    6771#  define __IEEE_BYTES_LITTLE_ENDIAN
    6872# endif
    6973#endif
  • newlib/libc/include/machine/setjmp.h

    diff -Naur newlib-1.17.0.orig/newlib/libc/include/machine/setjmp.h newlib-1.17.0/newlib/libc/include/machine/setjmp.h
    old new  
    2727
    2828/* necv70 was 9 as well. */
    2929
    30 #ifdef __mc68000__
     30#if defined(__m68k__) || defined(__mc68000__)
    3131/*
    3232 * onsstack,sigmask,sp,pc,psl,d2-d7,a2-a6,
    3333 * fp2-fp7      for 68881.
  • newlib/libc/include/sched.h

    diff -Naur newlib-1.17.0.orig/newlib/libc/include/sched.h newlib-1.17.0/newlib/libc/include/sched.h
    old new  
    1 #ifndef _SCHED_H_
    2 #define _SCHED_H_
    3 
    4 #ifdef __cplusplus
    5 extern "C" {
    6 #endif
    7 
    8 #include <sys/sched.h>
    9 
    10 #ifdef __cplusplus
    11 }
    12 #endif
    13 
    14 #endif /* _SCHED_H_ */
  • newlib/libc/include/stdint.h

    diff -Naur newlib-1.17.0.orig/newlib/libc/include/stdint.h newlib-1.17.0/newlib/libc/include/stdint.h
    old new  
    475475#define UINTMAX_C(x)    x##UL
    476476#endif
    477477
     478#ifdef __rtems__
     479#include <machine/stdint.h>
     480#endif
    478481
    479482#ifdef __cplusplus
    480483}
  • newlib/libc/include/sys/_types.h

    diff -Naur newlib-1.17.0.orig/newlib/libc/include/sys/_types.h newlib-1.17.0/newlib/libc/include/sys/_types.h
    old new  
    8484typedef void *_iconv_t;
    8585#endif
    8686
     87typedef long * __intptr_t;
     88typedef unsigned long* __uintptr_t;
     89
    8790#endif  /* _SYS__TYPES_H */
  • newlib/libc/machine/arm/machine/endian.h

    diff -Naur newlib-1.17.0.orig/newlib/libc/machine/arm/machine/endian.h newlib-1.17.0/newlib/libc/machine/arm/machine/endian.h
    old new  
    1 /* ARM configuration file */
    2 
    3 #ifndef _MACHINE_ENDIAN_H
    4 # define _MACHINE_ENDIAN_H
    5 
    6 #ifdef __ARMEB__
    7 #define BYTE_ORDER BIG_ENDIAN
    8 #else
    9 #define BYTE_ORDER LITTLE_ENDIAN
    10 #endif
    11 
    12 #endif
  • newlib/libc/sys/rtems/machine/stdint.h

    diff -Naur newlib-1.17.0.orig/newlib/libc/sys/rtems/machine/stdint.h newlib-1.17.0/newlib/libc/sys/rtems/machine/stdint.h
    old new  
     1/*
     2 *
     3 */
     4#ifndef _MACHINE_STDINT_H
     5#define _MACHINE_STDINT_H
     6
     7#ifndef _STDINT_H
     8#error machine/stdint.h is an internal file and must not be directly included
     9#endif
     10
     11#ifndef __rtems__
     12#error machine/stdint.h is an RTEMS specific internal file and must not be used otherwise
     13#endif
     14
     15#if defined(__m32c__) || defined(__m32r__)
     16#if (__SIZEOF_PTRDIFF_T__ == __SIZEOF_LONG__)
     17#define __ptrint_t_long_defined 1
     18#endif
     19#if (__SIZEOF_PTRDIFF_T__ == __SIZEOF_INT__)
     20#define __ptrint_t_int_defined 1
     21#endif
     22#endif
     23
     24#if defined(__sparc__) \
     25  || defined(__powerpc__) || defined(__PPC__) \
     26  || defined(__mips__) \
     27  || defined(__sh__) \
     28  || defined(__AVR__) \
     29  || defined(_C4x) || defined(_C3x) \
     30  || defined(__H8300__)
     31/* PTRDIFF_TYPE = int */
     32#define __ptrint_t_int_defined 1
     33#endif
     34
     35#if defined(__i386__) \
     36  || defined(__m68k__) \
     37  || defined(__bfin__) \
     38  || defined(__arm__) \
     39  || defined(__H8300S__) || defined(__H8300H__) || defined(__H8300SX__) \
     40/* PTRDIFF_TYPE = long */
     41#define __ptrint_t_long_defined 1
     42#endif
     43
     44#if !defined(__ptrint_t_int_defined) && !defined(__ptrint_t_long_defined)
     45#error Failed to determine ptrint_t
     46#endif
     47
     48#endif
  • newlib/libc/sys/rtems/sys/param.h

    diff -Naur newlib-1.17.0.orig/newlib/libc/sys/rtems/sys/param.h newlib-1.17.0/newlib/libc/sys/rtems/sys/param.h
    old new  
    1515 * 2. Redistributions in binary form must reproduce the above copyright
    1616 *    notice, this list of conditions and the following disclaimer in the
    1717 *    documentation and/or other materials provided with the distribution.
    18  * 3. All advertising materials mentioning features or use of this software
    19  *    must display the following acknowledgement:
    20  *      This product includes software developed by the University of
    21  *      California, Berkeley and its contributors.
    2218 * 4. Neither the name of the University nor the names of its contributors
    2319 *    may be used to endorse or promote products derived from this software
    2420 *    without specific prior written permission.
     
    4743#include <sys/config.h>
    4844#include <machine/endian.h>
    4945
    50 # define HZ (60)
    5146# define PATHSIZE (1024)
    5247
    5348/* end of from newlib's <sys/param.h> */
     
    8681#define MAXHOSTNAMELEN  256             /* max hostname size */
    8782
    8883/* More types and definitions used throughout the kernel. */
    89 #ifdef KERNEL
     84#if defined(KERNEL) || defined(_KERNEL)
    9085#include <sys/cdefs.h>
    9186#include <sys/errno.h>
    9287#include <sys/time.h>
    9388#include <sys/resource.h>
    94 #include <sys/ucred.h>
    9589#include <sys/uio.h>
     90#include <sys/priority.h>
    9691
    9792#ifndef FALSE
    9893#define FALSE   0
     
    109104#include <machine/param.h>
    110105#include <machine/limits.h>
    111106
    112 /*
    113  * Priorities.  Note that with 32 run queues, differences less than 4 are
    114  * insignificant.
    115  */
    116 #define PSWP    0
    117 #define PVM     4
    118 #define PINOD   8
    119 #define PRIBIO  16
    120 #define PVFS    20
    121 #define PZERO   22              /* No longer magic, shouldn't be here.  XXX */
    122 #define PSOCK   24
    123 #define PWAIT   32
    124 #define PLOCK   36
    125 #define PPAUSE  40
    126 #define PUSER   50
    127 #define MAXPRI  127             /* Priorities range from 0 through MAXPRI. */
    128 
    129107#define PRIMASK 0x0ff
    130108#define PCATCH  0x100           /* OR'd with pri for tsleep to check signals */
    131109
     
    136114#define CMASK   022             /* default file mask: S_IWGRP|S_IWOTH */
    137115#define NODEV   (dev_t)(-1)     /* non-existent device */
    138116
    139 /*
    140  * Clustering of hardware pages on machines with ridiculously small
    141  * page sizes is done here.  The paging subsystem deals with units of
    142  * CLSIZE pte's describing PAGE_SIZE (from machine/machparam.h) pages each.
    143  */
    144 #if 0
    145 #define CLBYTES         (CLSIZE*PAGE_SIZE)
    146 #endif
    147 
    148117#define CBLOCK  128             /* Clist block size, must be a power of 2. */
    149118#define CBQSIZE (CBLOCK/NBBY)   /* Quote bytes/cblock - can do better. */
    150119                                /* Data chars/clist. */
     
    200169#define powerof2(x)     ((((x)-1)&(x))==0)
    201170
    202171/* Macros for min/max. */
    203 #ifndef KERNEL
     172#if !(defined(KERNEL) || defined(_KERNEL))
    204173#define MIN(a,b) (((a)<(b))?(a):(b))
    205174#define MAX(a,b) (((a)>(b))?(a):(b))
    206175#endif
  • newlib/libc/unix/Makefile.am

    diff -Naur newlib-1.17.0.orig/newlib/libc/unix/Makefile.am newlib-1.17.0/newlib/libc/unix/Makefile.am
    old new  
    1212
    1313## Distinguish different EL/IX level interfaces
    1414ELIX_2_SOURCES = \
    15         ttyname.c
     15        ttyname.c \
     16        ttyname_r.c
    1617
    1718ELIX_4_SOURCES = \
    1819        basename.c      \
  • newlib/libc/unix/Makefile.in

    diff -Naur newlib-1.17.0.orig/newlib/libc/unix/Makefile.in newlib-1.17.0/newlib/libc/unix/Makefile.in
    old new  
    5959lib_a_LIBADD =
    6060am__objects_1 = lib_a-getcwd.$(OBJEXT) lib_a-pread.$(OBJEXT) \
    6161        lib_a-pwrite.$(OBJEXT) lib_a-sigset.$(OBJEXT)
    62 am__objects_2 = lib_a-ttyname.$(OBJEXT)
     62am__objects_2 = lib_a-ttyname.$(OBJEXT) lib_a-ttyname_r.$(OBJEXT)
    6363am__objects_3 = lib_a-basename.$(OBJEXT) lib_a-dirname.$(OBJEXT) \
    6464        lib_a-getlogin.$(OBJEXT) lib_a-getpass.$(OBJEXT) \
    6565        lib_a-getpwent.$(OBJEXT) lib_a-getut.$(OBJEXT)
     
    7474LTLIBRARIES = $(noinst_LTLIBRARIES)
    7575libunix_la_LIBADD =
    7676am__objects_5 = getcwd.lo pread.lo pwrite.lo sigset.lo
    77 am__objects_6 = ttyname.lo
     77am__objects_6 = ttyname.lo ttyname_r.lo
    7878am__objects_7 = basename.lo dirname.lo getlogin.lo getpass.lo \
    7979        getpwent.lo getut.lo
    8080@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@am__objects_8 = $(am__objects_6) \
     
    278278        sigset.c
    279279
    280280ELIX_2_SOURCES = \
    281         ttyname.c
     281        ttyname.c \
     282        ttyname_r.c
    282283
    283284ELIX_4_SOURCES = \
    284285        basename.c      \
     
    402403lib_a-ttyname.obj: ttyname.c
    403404        $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ttyname.obj `if test -f 'ttyname.c'; then $(CYGPATH_W) 'ttyname.c'; else $(CYGPATH_W) '$(srcdir)/ttyname.c'; fi`
    404405
     406lib_a-ttyname_r.o: ttyname_r.c
     407        $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ttyname_r.o `test -f 'ttyname_r.c' || echo '$(srcdir)/'`ttyname_r.c
     408
     409lib_a-ttyname_r.obj: ttyname_r.c
     410        $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ttyname_r.obj `if test -f 'ttyname_r.c'; then $(CYGPATH_W) 'ttyname_r.c'; else $(CYGPATH_W) '$(srcdir)/ttyname_r.c'; fi`
     411
    405412lib_a-basename.o: basename.c
    406413        $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-basename.o `test -f 'basename.c' || echo '$(srcdir)/'`basename.c
    407414
  • newlib/libc/unix/ttyname.c

    diff -Naur newlib-1.17.0.orig/newlib/libc/unix/ttyname.c newlib-1.17.0/newlib/libc/unix/ttyname.c
    old new  
    11#ifndef _NO_TTYNAME
    2 /*
    3  * Copyright (c) 1988 The Regents of the University of California.
    4  * All rights reserved.
    5  *
    6  * Redistribution and use in source and binary forms, with or without
    7  * modification, are permitted provided that the following conditions
    8  * are met:
    9  * 1. Redistributions of source code must retain the above copyright
    10  *    notice, this list of conditions and the following disclaimer.
    11  * 2. Redistributions in binary form must reproduce the above copyright
    12  *    notice, this list of conditions and the following disclaimer in the
    13  *    documentation and/or other materials provided with the distribution.
    14  * 4. Neither the name of the University nor the names of its contributors
    15  *    may be used to endorse or promote products derived from this software
    16  *    without specific prior written permission.
    17  *
    18  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
    19  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    21  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
    22  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    23  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    24  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    25  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    26  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    27  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    28  * SUCH DAMAGE.
    29  */
    302
    31 #include <sys/types.h>
    32 #include <sys/stat.h>
    33 #include <fcntl.h>
     3#include "ttyname.h"
     4
    345#include <dirent.h>
    356#include <unistd.h>
    36 #include <string.h>
    377#include <paths.h>
    38 #include <_syslist.h>
    398#include <errno.h>
    409
    41 static char ttyname_buf[sizeof (_PATH_DEV) + MAXNAMLEN] = _PATH_DEV;
    42 
    43 /*
    44  *  ttyname_r() - POSIX 1003.1b 4.7.2 - Determine Terminal Device Name
    45  */
    46 int
    47 _DEFUN( ttyname_r,(fd, name, namesize),
    48         int fd _AND
    49         char   *name _AND
    50         size_t  namesize)
    51 {
    52   struct stat sb;
    53   struct dirent *dirp;
    54   DIR *dp;
    55   struct stat dsb;
    56   char buf[sizeof(ttyname_buf)];
    57 
    58   /* Must be a terminal. */
    59   if (!isatty(fd))
    60     return ENOTTY;
    61 
    62   /* Must be a character device. */
    63   if (fstat (fd, &sb) || !S_ISCHR (sb.st_mode))
    64     return ENOTTY;
    65 
    66   if ((dp = opendir (_PATH_DEV)) == NULL)
    67     return EBADF;
    68 
    69   strcpy(buf, _PATH_DEV);
    70   while ((dirp = readdir (dp)) != NULL)
    71     {
    72       if (dirp->d_ino != sb.st_ino)
    73         continue;
    74       strcpy (buf + sizeof (_PATH_DEV) - 1, dirp->d_name);
    75       if (stat (buf, &dsb) || sb.st_dev != dsb.st_dev ||
    76           sb.st_ino != dsb.st_ino)
    77         continue;
    78       (void) closedir (dp);
    79       if(strlen(buf) < namesize)  /* < to account for terminating null */
    80         {
    81         strcpy(name, buf);
    82         return 0;
    83         }
    84       else
    85         {
    86         return ERANGE;
    87         }
    88     }
    89   (void) closedir (dp);
    90   return EBADF;
    91 }
     10static char ttyname_buf[TTYNAME_BUFSIZE] = _PATH_DEV;
    9211
    9312/*
    9413 *  ttyname() - POSIX 1003.1b 4.7.2 - Determine Terminal Device Name
  • newlib/libc/unix/ttyname.h

    diff -Naur newlib-1.17.0.orig/newlib/libc/unix/ttyname.h newlib-1.17.0/newlib/libc/unix/ttyname.h
    old new  
     1/* Common defines for ttyname.c and ttyname_r.c */
     2 
     3#include <dirent.h>     /* For MAXNAMLEN */
     4#include <paths.h>      /* For _PATH_DEV */
     5
     6#define TTYNAME_BUFSIZE (sizeof (_PATH_DEV) + MAXNAMLEN)
  • newlib/libc/unix/ttyname_r.c

    diff -Naur newlib-1.17.0.orig/newlib/libc/unix/ttyname_r.c newlib-1.17.0/newlib/libc/unix/ttyname_r.c
    old new  
     1#ifndef _NO_TTYNAME
     2/*
     3 * Copyright (c) 1988 The Regents of the University of California.
     4 * All rights reserved.
     5 *
     6 * Redistribution and use in source and binary forms, with or without
     7 * modification, are permitted provided that the following conditions
     8 * are met:
     9 * 1. Redistributions of source code must retain the above copyright
     10 *    notice, this list of conditions and the following disclaimer.
     11 * 2. Redistributions in binary form must reproduce the above copyright
     12 *    notice, this list of conditions and the following disclaimer in the
     13 *    documentation and/or other materials provided with the distribution.
     14 * 4. Neither the name of the University nor the names of its contributors
     15 *    may be used to endorse or promote products derived from this software
     16 *    without specific prior written permission.
     17 *
     18 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     21 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     28 * SUCH DAMAGE.
     29 */
     30
     31#include "ttyname.h"
     32
     33#include <sys/types.h>
     34#include <sys/stat.h>
     35#include <fcntl.h>
     36#include <dirent.h>
     37#include <unistd.h>
     38#include <string.h>
     39#include <paths.h>
     40#include <_syslist.h>
     41#include <errno.h>
     42
     43/*
     44 *  ttyname_r() - POSIX 1003.1b 4.7.2 - Determine Terminal Device Name
     45 */
     46int
     47_DEFUN( ttyname_r,(fd, name, namesize),
     48        int fd _AND
     49        char   *name _AND
     50        size_t  namesize)
     51{
     52  struct stat sb;
     53  struct dirent *dirp;
     54  DIR *dp;
     55  struct stat dsb;
     56  char buf[TTYNAME_BUFSIZE];
     57
     58  /* Must be a terminal. */
     59  if (!isatty(fd))
     60    return ENOTTY;
     61
     62  /* Must be a character device. */
     63  if (fstat (fd, &sb) || !S_ISCHR (sb.st_mode))
     64    return ENOTTY;
     65
     66  if ((dp = opendir (_PATH_DEV)) == NULL)
     67    return EBADF;
     68
     69  strcpy(buf, _PATH_DEV);
     70  while ((dirp = readdir (dp)) != NULL)
     71    {
     72      if (dirp->d_ino != sb.st_ino)
     73        continue;
     74      strcpy (buf + sizeof (_PATH_DEV) - 1, dirp->d_name);
     75      if (stat (buf, &dsb) || sb.st_dev != dsb.st_dev ||
     76          sb.st_ino != dsb.st_ino)
     77        continue;
     78      (void) closedir (dp);
     79      if(strlen(buf) < namesize)  /* < to account for terminating null */
     80        {
     81        strcpy(name, buf);
     82        return 0;
     83        }
     84      else
     85        {
     86        return ERANGE;
     87        }
     88    }
     89  (void) closedir (dp);
     90  return EBADF;
     91}
     92
     93#endif /* !_NO_TTYNAME  */
  • newlib/Makefile.am

    diff -Naur newlib-1.17.0.orig/newlib/Makefile.am newlib-1.17.0/newlib/Makefile.am
    old new  
    8181        libc.a
    8282endif
    8383
    84 noinst_DATA = stmp-targ-include
     84BUILT_SOURCES = stmp-targ-include
    8585
    8686toollib_DATA = $(CRT0) $(CRT1)
    8787
     
    186186
    187187$(CRT1_DIR)$(CRT1): ; @true
    188188
    189 
    190 all-recursive: stmp-targ-include
    191 
    192189# The targ-include directory just holds the includes files for the
    193190# particular system and machine we have been configured for.  It is
    194191# used while building.
  • newlib/Makefile.in

    diff -Naur newlib-1.17.0.orig/newlib/Makefile.in newlib-1.17.0/newlib/Makefile.in
    old new  
    106106        pdf-recursive ps-recursive uninstall-info-recursive \
    107107        uninstall-recursive
    108108toollibDATA_INSTALL = $(INSTALL_DATA)
    109 DATA = $(noinst_DATA) $(toollib_DATA)
     109DATA = $(toollib_DATA)
    110110ETAGS = etags
    111111CTAGS = ctags
    112112DEJATOOL = $(PACKAGE)
     
    350350@USE_LIBTOOL_FALSE@toollib_LIBRARIES = libm.a \
    351351@USE_LIBTOOL_FALSE@     libc.a
    352352
    353 noinst_DATA = stmp-targ-include
     353BUILT_SOURCES = stmp-targ-include
    354354toollib_DATA = $(CRT0) $(CRT1)
    355355
    356356# The functions ldexp, frexp and modf are traditionally supplied in
     
    409409
    410410# dejagnu support
    411411RUNTESTFLAGS =
    412 all: newlib.h
     412all: $(BUILT_SOURCES) newlib.h
    413413        $(MAKE) $(AM_MAKEFLAGS) all-recursive
    414414
    415415.SUFFIXES:
     
    714714        done
    715715check-am:
    716716        $(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU
    717 check: check-recursive
     717check: $(BUILT_SOURCES)
     718        $(MAKE) $(AM_MAKEFLAGS) check-recursive
    718719all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(DATA) newlib.h
    719720installdirs: installdirs-recursive
    720721installdirs-am:
    721722        for dir in "$(DESTDIR)$(toollibdir)" "$(DESTDIR)$(toollibdir)" "$(DESTDIR)$(toollibdir)"; do \
    722723          test -z "$$dir" || $(mkdir_p) "$$dir"; \
    723724        done
    724 install: install-recursive
     725install: $(BUILT_SOURCES)
     726        $(MAKE) $(AM_MAKEFLAGS) install-recursive
    725727install-exec: install-exec-recursive
    726728install-data: install-data-recursive
    727729uninstall: uninstall-recursive
     
    746748maintainer-clean-generic:
    747749        @echo "This command is intended for maintainers to use"
    748750        @echo "it deletes files that may require special tools to rebuild."
     751        -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
    749752clean: clean-recursive
    750753
    751754clean-am: clean-generic clean-libtool clean-toollibLIBRARIES \
     
    864867
    865868$(CRT1_DIR)$(CRT1): ; @true
    866869
    867 all-recursive: stmp-targ-include
    868 
    869870# The targ-include directory just holds the includes files for the
    870871# particular system and machine we have been configured for.  It is
    871872# used while building.
Note: See TracBrowser for help on using the repository browser.