]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Update from main branch.
authorUlrich Drepper <drepper@redhat.com>
Sun, 13 Jun 1999 09:23:55 +0000 (09:23 +0000)
committerUlrich Drepper <drepper@redhat.com>
Sun, 13 Jun 1999 09:23:55 +0000 (09:23 +0000)
21 files changed:
ChangeLog
ctype/ctype.h
grp/fgetgrent.c
inet/arpa/tftp.h
locale/lc-time.c
malloc/malloc.h
manual/stdio.texi
misc/daemon.c
pwd/fgetpwent_r.c
resolv/nss_dns/dns-host.c
shadow/fgetspent.c
shadow/fgetspent_r.c
stdio-common/printf-parse.h
stdlib/longlong.h
sysdeps/arm/dl-machine.h
sysdeps/libm-ieee754/s_truncl.c
sysdeps/posix/getcwd.c
sysdeps/unix/sysv/linux/i386/sigaction.c
sysdeps/unix/sysv/linux/if_index.c
sysdeps/unix/sysv/linux/net/if_arp.h
sysdeps/unix/sysv/linux/sys/sysmacros.h

index a249d61e363809a7b30a2c545c5df461aa6aa4ec..2401e9941ed449866fae345adc6f0627ece72471 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,110 @@
+1999-06-12  Ulrich Drepper  <drepper@cygnus.com>
+
+       * locale/lc-time.c: Add free_mem function to free if necessary
+       statically allocated memory.
+
+1999-06-10  Jakub Jelinek   <jj@ultra.linux.cz>
+
+       * sysdeps/libm-ieee754/s_truncl.c: Subtract exponent
+       bias from the raw exponent.
+
+1999-06-11  Ulrich Drepper  <drepper@cygnus.com>
+
+       * inet/arpa/tftp.h: Move attribute declaration in right position.
+
+1999-06-11  Ulrich Drepper  <drepper@cygnus.com>
+
+       * resolv/nss_dns/dns-host.c (getanswer_r): Correctly track usage
+       of user-provided buffer.
+
+1999-06-10  Ulrich Drepper  <drepper@cygnus.com>
+
+       * stdio-common/printf-parse.h (parse_one_spec): Add support for a
+       and A format.
+
+       * shadow/fgetspent_r.c (__fgetspent_r): Set errno to ENOENT for
+       returning after last entry.
+       * pwd/fgetpwent_r.c (__fgetpwent_r): Likewise.
+
+1999-06-09  Ulrich Drepper  <drepper@cygnus.com>
+
+       * pwd/fgetpwent_r.c: Set errno in the correct way.
+       * shadow/fgetspent_r.c: Likewise.
+       * pwd/fgetpwent.c: Handle long lines correctly.  Little
+       optimizations.  Free static buffer when debugging memory handling.
+       * shadow/fgetspent.c: Likewise.
+
+       * grp/fgetgrent.c: Little optimization in loop.
+
+1999-06-09  Jakub Jelinek   <jj@ultra.linux.cz>
+
+       * stdlib/longlong.h: gas changed sethi handling when without
+       %hi(). Fix assembly.
+
+1999-06-08  Ulrich Drepper  <drepper@cygnus.com>
+
+       * misc/daemon.c: Call fork.
+
+       * grp/fgetgrent.c (buffer): Make file local variable.
+       (free_mem): New function.  Call for malloc debugging.
+
+1999-06-08  Ulrich Drepper  <drepper@cygnus.com>
+
+       * ctype/ctype.h: Protect __tobody code by __extension__.
+
+1999-06-13  Andreas Jaeger  <aj@arthur.rhein-neckar.de>
+
+       * sysdeps/unix/sysv/linux/if_index.c: Replace SIOG* with SIOCG*.
+
+1999-06-07  Ulrich Drepper  <drepper@cygnus.com>
+
+       * sysdeps/unix/sysv/linux/sys/sysmacros.h (makedev): Handle signed
+       parameters.
+
+1999-06-06  Ulrich Drepper  <drepper@cygnus.com>
+
+       * sysdeps/unix/sysv/linux/i386/sigaction.c: Correct restorer
+       function handling.
+
+       * sysdeps/unix/sysv/linux/i386/sigaction.c (SA_RESTORER): New #define.
+
+1999-06-06  Andi Kleen  <ak@muc.de>
+
+       * sysdeps/unix/sysv/linux/i386/sigaction.c (__sigaction): Set
+       SA_RESTORER flag.
+
+1999-06-05  Philip Blundell  <philb@gnu.org>
+
+       * sysdeps/arm/dl-machine.h (elf_machine_load_address): Fix
+       problems with GOT addressing.
+
+1999-06-02  Jakub Jelinek  <jj@ultra.linux.cz>
+
+       * stdlib/longlong.h: Define UDIV_TIME on sparc64.
+
+1999-06-01  Andreas Jaeger  <aj@arthur.rhein-neckar.de>
+
+       * sysdeps/unix/sysv/linux/net/if_arp.h (ARPHRD_DDCMP): Add it
+       (from Linux 2.3.4).
+
+1999-05-30  Andreas Jaeger  <aj@arthur.rhein-neckar.de>
+
+       * manual/stdio.texi: Fix some typos.
+
+1999-05-29  Andreas Jaeger  <aj@arthur.rhein-neckar.de>
+
+       * manual/stdio.texi (Formatted Output Functions): Mention
+       semantics of snprintf in glibc 2.0.
+       Reported by Ben Pfaff <pfaffben@msu.edu>.
+
+1999-05-27  Andreas Schwab  <schwab@issan.cs.uni-dortmund.de>
+
+       * malloc/malloc.h: Properly handle future GCC versions.
+
+1999-05-25  Ulrich Drepper  <drepper@cygnus.com>
+
+       * sysdeps/posix/getcwd.c (__getcwd): Fix potential memory leaks.
+
 1999-06-11  Mark Kettenis  <kettenis@gnu.org>
 
        * hurd/hurdsock.c (max_domain): Initialize to `-1'.
index 11f92068d453d6073403f97e21c5656b0d5d495d..a0d840162e67937d5bf7fc675cf28bdd91f079e6 100644 (file)
@@ -165,20 +165,21 @@ toupper (int __c) __THROW
 
 #if __GNUC__ >= 2 && defined __OPTIMIZE__ && !defined __cplusplus
 # define __tobody(c, f, a) \
-  ({ int __res;                                                                      \
-     if (sizeof (c) > 1)                                                     \
-       {                                                                     \
-        if (__builtin_constant_p (c))                                        \
-          {                                                                  \
-            int __c = (c);                                                   \
-            __res = __c < -128 || __c > 255 ? __c : a[__c];                  \
-          }                                                                  \
-        else                                                                 \
-          __res = f (c);                                                     \
-       }                                                                     \
-     else                                                                    \
-       __res = a[(int) (c)];                                                 \
-     __res; })
+  (__extension__                                                             \
+   ({ int __res;                                                             \
+      if (sizeof (c) > 1)                                                    \
+       {                                                                     \
+         if (__builtin_constant_p (c))                                       \
+           {                                                                 \
+             int __c = (c);                                                  \
+             __res = __c < -128 || __c > 255 ? __c : a[__c];                 \
+           }                                                                 \
+         else                                                                \
+           __res = f (c);                                                    \
+       }                                                                     \
+      else                                                                   \
+       __res = a[(int) (c)];                                                 \
+      __res; }))
 
 # define tolower(c) __tobody (c, tolower, __ctype_tolower)
 # define toupper(c) __tobody (c, toupper, __ctype_toupper)
index ac8d093f05afa727ad590dd6e147f7ddabeb7cae..d2e3de69a7111b5bc83c036d92c66a2d54f5f71b 100644 (file)
 /* We need to protect the dynamic buffer handling.  */
 __libc_lock_define_initialized (static, lock);
 
+static char *buffer;
+
 /* Read one entry from the given stream.  */
 struct group *
 fgetgrent (FILE *stream)
 {
-  static char *buffer;
   static size_t buffer_size;
   static struct group resbuf;
   fpos_t pos;
@@ -85,3 +86,14 @@ fgetgrent (FILE *stream)
 
   return result;
 }
+
+
+/* Free all resources if necessary.  */
+static void __attribute__ ((unused))
+free_mem (void)
+{
+  if (buffer != NULL)
+    free (buffer);
+}
+
+text_set_element (__libc_subfreeres, free_mem);
index 15bfc656c2d3860594a664251a3aa598d4ad0134..69187da0829720081a16ae7190f8b1479b07292e 100644 (file)
@@ -56,7 +56,7 @@ struct        tftphdr {
                unsigned short  tu_block;       /* block # */
                short   tu_code;                /* error code */
                char    tu_stuff[1];            /* request packet stuff */
-       } th_u __attribute__ ((__packed__));
+       } __attribute__ ((__packed__)) th_u;
        char    th_data[1];                     /* data or error string */
 } __attribute__ ((__packed__));
 
index 5090e6d90534db52f1a837c22e1f6ff14f227001..a9344fcd33cc4e9c414003865f4e96c41d5080c6 100644 (file)
@@ -1,5 +1,5 @@
 /* Define current locale data for LC_TIME category.
-   Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 1997, 1999 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -174,3 +174,16 @@ _nl_get_alt_digit (unsigned int number)
 
   return result;
 }
+
+
+/* Free all resources if necessary.  */
+static void __attribute__ ((unused))
+free_mem (void)
+{
+  if (eras != NULL)
+    free (eras);
+  if (alt_digits != NULL)
+    free (alt_digits);
+}
+
+text_set_element (__libc_subfreeres, free_mem);
index a93c77a853380490e572152599358a1a5f2bfd1a..eeb33a29492af59cf5bdb2db1072a0b4cedf9c08 100644 (file)
@@ -60,7 +60,7 @@
 /* GCC can always grok prototypes.  For C++ programs we add throw()
    to help it optimize the function calls.  But this works only with
    gcc 2.8.x and egcs.  */
-# if defined __cplusplus && __GNUC_MINOR__ >= 8
+# if defined __cplusplus && (__GNUC__ >= 3 || __GNUC_MINOR__ >= 8)
 #  define __THROW      throw ()
 # else
 #  define __THROW
index 3449a51d2b6414a7fcbc9cf4426eac225a2fecc6..8c6c009c4c98d8d0e4bf278c76d1bf99a5f5b494 100644 (file)
@@ -1616,6 +1616,12 @@ make_message (char *name, char *value)
 @end smallexample
 
 In practice, it is often easier just to use @code{asprintf}, below.
+
+@strong{Attention:} In the GNU C library version 2.0 the return value
+is the number of characters stored, not including the terminating null.
+If this value equals @code{@var{size} - 1}, then there was not enough
+space in @var{s} for all the output.  This change was necessary with
+the adoption of snprintf by ISO C9x.
 @end deftypefun
 
 @node Dynamic Output
@@ -2205,7 +2211,7 @@ width.  The value is @code{'0'} if the @samp{0} flag was specified, and
 Now let's look at how to define the handler and arginfo functions
 which are passed as arguments to @code{register_printf_function}.
 
-@strong{Compatibility Note:} The interface change in the GNU libc
+@strong{Compatibility Note:} The interface changed in the GNU libc
 version 2.0.  Previously the third argument was of type
 @code{va_list *}.
 
@@ -4347,7 +4353,7 @@ form.  The string must contain two fields, separated by a colon
 produced no output since the class with the numeric value @code{6} is
 not defined.  Although a class with numeric value @code{5} is also not
 defined by default, the call the @code{addseverity} introduces it and
-the second call to @code{fmtmsg} produces the above outout.
+the second call to @code{fmtmsg} produces the above output.
 
 When we change the environment of the program to contain
 @code{SEV_LEVEL=XXX,6,NOTE} when running it we get a different result:
index 7bab9f5965239139865e46156ad87ddf27f68d04..6918b2ba31673cdf11abf37f482c9bce11518ce7 100644 (file)
@@ -45,7 +45,7 @@ daemon(nochdir, noclose)
 {
        int fd;
 
-       switch (__fork()) {
+       switch (fork()) {
        case -1:
                return (-1);
        case 0:
index 4986e7452cee70eba1b1c5ea35e7c241fc58a41e..33f49ea1ae999335434f9500fb1852b29e9212cf 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1996, 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -86,13 +86,15 @@ __fgetpwent_r (FILE *stream, struct passwd *resbuf, char *buffer,
        {
          funlockfile (stream);
          *result = NULL;
+         __set_errno (ENOENT);
          return errno;
        }
       if (p == NULL || buffer[buflen - 1] != '\xff')
        {
          funlockfile (stream);
          *result = NULL;
-         return errno = ERANGE;
+         __set_errno (ERANGE);
+         return errno;
        }
 
       /* Skip leading blanks.  */
index 078d452fd6d9c2432d95d18755f7aeccfb3d2bdb..b982481349a8af035282af4c663a1f80635ff564 100644 (file)
@@ -323,6 +323,15 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
   int (*name_ok) __P ((const char *));
   u_char packtmp[NS_MAXCDNAME];
 
+  if (linebuflen < 0)
+    {
+      /* The buffer is too small.  */
+    too_small:
+      *errnop = ERANGE;
+      *h_errnop = NETDB_INTERNAL;
+      return NSS_STATUS_TRYAGAIN;
+    }
+
   tname = qname;
   result->h_name = NULL;
   end_of_message = answer->buf + anslen;
@@ -358,11 +367,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
   if (n != -1 && __ns_name_ntop (packtmp, bp, linebuflen) == -1)
     {
       if (errno == EMSGSIZE)
-       {
-         *errnop = ERANGE;
-         *h_errnop = NETDB_INTERNAL;
-         return NSS_STATUS_TRYAGAIN;
-       }
+       goto too_small;
 
       n = -1;
     }
@@ -393,6 +398,8 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
       result->h_name = bp;
       bp += n;
       linebuflen -= n;
+      if (linebuflen < 0)
+       goto too_small;
       /* The qname can be abbreviated, but h_name is now absolute. */
       qname = result->h_name;
     }
@@ -606,6 +613,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
              linebuflen -= nn;
            }
 
+         linebuflen -= sizeof (align) - ((u_long) bp % sizeof (align));
          bp += sizeof (align) - ((u_long) bp % sizeof (align));
 
          if (n >= linebuflen)
index 902c95eb045366a724a84bb165a0e4151049360f..66a5452678d2fbc4f1509fc3bb56e6a0e51a30b2 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -19,6 +19,7 @@
 #include <errno.h>
 #include <bits/libc-lock.h>
 #include <shadow.h>
+#include <stdio.h>
 #include <stdlib.h>
 
 
 /* We need to protect the dynamic buffer handling.  */
 __libc_lock_define_initialized (static, lock);
 
+static char *buffer;
+
 /* Read one shadow entry from the given stream.  */
 struct spwd *
 fgetspent (FILE *stream)
 {
-  static char *buffer;
   static size_t buffer_size;
   static struct spwd resbuf;
+  fpos_t pos;
   struct spwd *result;
   int save;
 
+  if (fgetpos (stream, &pos) != 0)
+    return NULL;
+
   /* Get lock.  */
   __libc_lock_lock (lock);
 
@@ -49,8 +55,8 @@ fgetspent (FILE *stream)
     }
 
   while (buffer != NULL
-        && __fgetspent_r (stream, &resbuf, buffer, buffer_size, &result) != 0
-        && errno == ERANGE)
+        && (__fgetspent_r (stream, &resbuf, buffer, buffer_size, &result)
+            == ERANGE))
     {
       char *new_buf;
       buffer_size += BUFLEN_SPWD;
@@ -64,6 +70,10 @@ fgetspent (FILE *stream)
          __set_errno (save);
        }
       buffer = new_buf;
+
+      /* Reset the stream.  */
+      if (fsetpos (stream, &pos) != 0)
+       buffer = NULL;
     }
 
   if (buffer == NULL)
@@ -76,3 +86,14 @@ fgetspent (FILE *stream)
 
   return result;
 }
+
+
+/* Free all resources if necessary.  */
+static void __attribute__ ((unused))
+free_mem (void)
+{
+  if (buffer != NULL)
+    free (buffer);
+}
+
+text_set_element (__libc_subfreeres, free_mem);
index 50d1fd9972b037043ab7cd6936d6093417be953a..8f7e303e07f6e4e21e021ff2ef4c302ec1bb6add 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -53,13 +53,15 @@ __fgetspent_r (FILE *stream, struct spwd *resbuf, char *buffer, size_t buflen,
        {
          funlockfile (stream);
          *result = NULL;
+         __set_errno (ENOENT);
          return errno;
        }
       if (p == NULL || buffer[buflen - 1] != '\xff')
        {
          funlockfile (stream);
          *result = NULL;
-         return errno = ERANGE;
+         __set_errno (ERANGE);
+         return errno;
        }
 
       /* Skip leading blanks.  */
index 4f217abfd35cc723eda758d50bf3a5f63027ceab..2e6f0dcd99ed7a74b8ee7c25becadb7208431286 100644 (file)
@@ -1,5 +1,5 @@
 /* Internal header for parsing printf format strings.
-   Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
    This file is part of th GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -358,6 +358,8 @@ parse_one_spec (const UCHAR_T *format, size_t posn, struct printf_spec *spec,
        case L'f':
        case L'g':
        case L'G':
+       case L'a':
+       case L'A':
          if (spec->info.is_long_double)
            spec->data_arg_type = PA_DOUBLE|PA_FLAG_LONG_DOUBLE;
          else
index 7ac63bf4c80b40d464487e7bfeb2a8140e5562e7..37ea646b34c1db48fdc2ebb03b184b4f42225251 100644 (file)
@@ -1220,7 +1220,7 @@ extern USItype __udiv_qrnnd __P ((USItype *, USItype, USItype, USItype));
                    srlx %7,32,%5
                    mulx %3,%5,%3
                    mulx %2,%5,%5
-                   sethi 0x80000000,%2
+                   sethi %%hi(0x80000000),%2
                    addcc %4,%3,%4
                    srlx %4,32,%4
                    add %2,%2,%2
@@ -1237,6 +1237,7 @@ extern USItype __udiv_qrnnd __P ((USItype *, USItype, USItype, USItype));
           : "cc");                                                     \
   } while (0)
 #define UMUL_TIME 96
+#define UDIV_TIME 230
 #endif /* __sparc_v9__ */
 
 #if defined (__vax__) && W_TYPE_SIZE == 32
index aff8df2238c9c23bf4ca08e8db2fd03ed7d3c135..754a6caa135907c4123df89c486cf4ecca73cf03 100644 (file)
@@ -52,22 +52,14 @@ elf_machine_dynamic (void)
 
 
 /* Return the run-time load address of the shared object.  */
-// patb
 static inline Elf32_Addr __attribute__ ((unused))
 elf_machine_load_address (void)
 {
-  Elf32_Addr addr;
-  asm (" ldr ip,.L1
-       ldr r3,.L3
-       add r3, r3, sl
-       ldr ip,[sl, ip]
-       sub ip, r3, ip
-       b .L2
-       .L1: .word _dl_start(GOT)
-       .L3: .word _dl_start(GOTOFF)
-       .L2: mov %0, ip"
-       : "=r" (addr) : : "ip", "r3");
-  return addr;
+  extern void __dl_start asm ("_dl_start");
+  Elf32_Addr got_addr = (Elf32_Addr) &__dl_start;
+  Elf32_Addr pcrel_addr;
+  asm ("adr %0, _dl_start" : "=r" (pcrel_addr));
+  return pcrel_addr - got_addr;
 }
 
 
index 206eab2f226080b9126e798b1385780e82fadc7a..59c3b9c1739aa3a5129485d456c00b8fa81a176f 100644 (file)
@@ -1,5 +1,5 @@
 /* Truncate argument to nearest integral value not larger than the argument.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -32,7 +32,7 @@ __truncl (long double x)
 
   GET_LDOUBLE_WORDS (se, i0, i1, x);
   sx = se & 0x8000;
-  j0 = se & 0x7fff;
+  j0 = (se & 0x7fff) - 0x3fff;
   if (j0 < 31)
     {
       if (j0 < 0)
index df48804f7a3ae397081a96b65a83316f2774ad31..fe094b5a35c90a66ae57c1889bfbe8834e4312e7 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,92,93,94,95,96,97,98 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,93,94,95,96,97,98,99 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -211,8 +211,9 @@ __getcwd (buf, size)
     = "../../../../../../../../../../../../../../../../../../../../../../../\
 ../../../../../../../../../../../../../../../../../../../../../../../../../../\
 ../../../../../../../../../../../../../../../../../../../../../../../../../..";
-  const char *dotp, *dotlist;
-  size_t dotsize;
+  const char *dotp = &dots[sizeof (dots)];
+  const char *dotlist = dots;
+  size_t dotsize = sizeof (dots) - 1;
   dev_t rootdev, thisdev;
   ino_t rootino, thisino;
   char *path;
@@ -244,18 +245,15 @@ __getcwd (buf, size)
   *--pathp = '\0';
 
   if (__lstat (".", &st) < 0)
-    return NULL;
+    goto lose2;
   thisdev = st.st_dev;
   thisino = st.st_ino;
 
   if (__lstat ("/", &st) < 0)
-    return NULL;
+    goto lose2;
   rootdev = st.st_dev;
   rootino = st.st_ino;
 
-  dotsize = sizeof (dots) - 1;
-  dotp = &dots[sizeof (dots)];
-  dotlist = dots;
   while (!(thisdev == rootdev && thisino == rootino))
     {
       register DIR *dirstream;
@@ -273,7 +271,7 @@ __getcwd (buf, size)
            {
              new = malloc (dotsize * 2 + 1);
              if (new == NULL)
-               return NULL;
+               goto lose;
 #ifdef HAVE_MEMPCPY
              dotp = mempcpy (new, dots, dotsize);
 #else
@@ -375,7 +373,6 @@ __getcwd (buf, size)
                  if (tmp == NULL)
                    {
                      (void) __closedir (dirstream);
-                     free (path);
                      __set_errno (ENOMEM);/* closedir might have changed it.*/
                      goto lose;
                    }
@@ -412,6 +409,9 @@ __getcwd (buf, size)
  lose:
   if (dotlist != dots)
     free ((__ptr_t) dotlist);
+ lose2:
+  if (buf == NULL)
+    free (path);
   return NULL;
 }
 
index 142eac6a75796f00fc6b2ef09b5f4696c5bf4234..57b2fa836d09b2ac02abc170258bc18205f27cae 100644 (file)
@@ -1,5 +1,5 @@
 /* POSIX.1 `sigaction' call for Linux/i386.
-   Copyright (C) 1991, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1991, 95, 96, 97, 98, 99 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -30,6 +30,8 @@
    translate it here.  */
 #include <kernel_sigaction.h>
 
+/* We do not globally define the SA_RESTORER flag so do it here.  */
+#define SA_RESTORER 0x04000000
 
 extern int __syscall_rt_sigaction (int, const struct kernel_sigaction *,
                                   struct kernel_sigaction *, size_t);
@@ -38,6 +40,8 @@ extern int __syscall_rt_sigaction (int, const struct kernel_sigaction *,
    functions which have RT equivalents.  */
 int __libc_missing_rt_sigs;
 
+static void restore_rt (void) asm ("__restore_rt");
+static void restore (void) asm ("__restore");
 
 /* If ACT is not NULL, change the action for SIG to *ACT.
    If OACT is not NULL, put the old action for SIG in *OACT.  */
@@ -58,10 +62,10 @@ __sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
        {
          kact.k_sa_handler = act->sa_handler;
          memcpy (&kact.sa_mask, &act->sa_mask, sizeof (sigset_t));
-         kact.sa_flags = act->sa_flags;
+         kact.sa_flags = act->sa_flags | SA_RESTORER;
 
-         kact.sa_restorer = ((act->sa_flags & SA_NOMASK)
-                             ? &&restore_nomask : &&restore);
+         kact.sa_restorer = ((act->sa_flags & SA_SIGINFO)
+                             ? &restore_rt : &restore);
        }
 
       /* XXX The size argument hopefully will have to be changed to the
@@ -90,10 +94,9 @@ __sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
     {
       k_newact.k_sa_handler = act->sa_handler;
       k_newact.sa_mask = act->sa_mask.__val[0];
-      k_newact.sa_flags = act->sa_flags;
+      k_newact.sa_flags = act->sa_flags | SA_RESTORER;
 
-      k_newact.sa_restorer = ((act->sa_flags & SA_NOMASK)
-                             ? &&restore_nomask : &&restore);
+      k_newact.sa_restorer = &restore;
     }
 
   asm volatile ("pushl %%ebx\n"
@@ -119,41 +122,33 @@ __sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
     }
 
   return 0;
-
- restore:
-  asm (
-#ifdef PIC
-       "       pushl %%ebx\n"
-       "       call 0f\n"
-       "0:     popl %%ebx\n"
-       "       addl $_GLOBAL_OFFSET_TABLE_+[.-0b], %%ebx\n"
-       "       addl $8, %%esp\n"
-       "       call __sigsetmask@PLT\n"
-       "       addl $8, %%esp\n"
-       "       popl %%ebx\n"
-#else
-       "       addl $4, %%esp\n"
-       "       call __sigsetmask\n"
-       "       addl $4, %%esp\n"
-#endif
-       "       popl %%eax\n"
-       "       popl %%ecx\n"
-       "       popl %%edx\n"
-       "       popf\n"
-       "       ret"
-       : : );
-
- restore_nomask:
-  asm ("       addl $4, %%esp\n"
-       "       popl %%eax\n"
-       "       popl %%ecx\n"
-       "       popl %%edx\n"
-       "       popf\n"
-       "       ret"
-       : : );
-
-  /* NOTREACHED */
-  return -1;
 }
 
 weak_alias (__sigaction, sigaction)
+
+#define RESTORE(name, syscall) RESTORE2 (name, syscall)
+#define RESTORE2(name, syscall) \
+asm                                            \
+  (                                            \
+   ".align 16\n"                               \
+   "__" #name ":\n"                                    \
+   "   movl $" #syscall ", %eax\n"             \
+   "   int  $0x80"                             \
+   );
+
+/* The return code for realtime-signals.  */
+RESTORE (restore_rt, __NR_rt_sigreturn)
+
+/* For the boring old signals.  */
+# undef RESTORE2
+# define RESTORE2(name, syscall) \
+asm                                            \
+  (                                            \
+   ".align 8\n"                                \
+   "__" #name ":\n"                                    \
+   "   popl %eax\n"                            \
+   "   movl $" #syscall ", %eax\n"             \
+   "   int  $0x80"                             \
+   );
+
+RESTORE (restore, __NR_sigreturn)
index 9b3db6abfb4cbe243539e575bde5fe69feec770e..17f93bae33ebb09aa0c541f82ff416f94ff9e14d 100644 (file)
@@ -27,7 +27,7 @@
 #include <bits/libc-lock.h>
 
 /* Try to get a socket to talk to the kernel.  */
-#if defined SIOGIFINDEX || defined SIOGIFNAME
+#if defined SIOCGIFINDEX || defined SIOCGIFNAME
 static int
 internal_function
 opensock (void)
@@ -71,7 +71,7 @@ opensock (void)
 unsigned int
 if_nametoindex (const char *ifname)
 {
-#ifndef SIOGIFINDEX
+#ifndef SIOCGIFINDEX
   __set_errno (ENOSYS);
   return 0;
 #else
@@ -82,7 +82,7 @@ if_nametoindex (const char *ifname)
     return 0;
 
   strncpy (ifr.ifr_name, ifname, sizeof (ifr.ifr_name));
-  if (__ioctl (fd, SIOGIFINDEX, &ifr) < 0)
+  if (__ioctl (fd, SIOCGIFINDEX, &ifr) < 0)
     {
       int saved_errno = errno;
       __close (fd);
@@ -111,7 +111,7 @@ if_freenameindex (struct if_nameindex *ifn)
 struct if_nameindex *
 if_nameindex (void)
 {
-#ifndef SIOGIFINDEX
+#ifndef SIOCGIFINDEX
   __set_errno (ENOSYS);
   return NULL;
 #else
@@ -172,7 +172,7 @@ if_nameindex (void)
       struct ifreq *ifr = &ifc.ifc_req[i];
       idx[i].if_name = __strdup (ifr->ifr_name);
       if (idx[i].if_name == NULL
-         || __ioctl (fd, SIOGIFINDEX, ifr) < 0)
+         || __ioctl (fd, SIOCGIFINDEX, ifr) < 0)
        {
          int saved_errno = errno;
          unsigned int j;
@@ -199,7 +199,7 @@ if_nameindex (void)
 char *
 if_indextoname (unsigned int ifindex, char *ifname)
 {
-#ifndef SIOGIFINDEX
+#ifndef SIOCGIFINDEX
   __set_errno (ENOSYS);
   return NULL;
 #else
@@ -207,14 +207,14 @@ if_indextoname (unsigned int ifindex, char *ifname)
   struct if_nameindex *p;
   char *result = NULL;
 
-#ifdef SIOGIFNAME
+#ifdef SIOCGIFNAME
   /* We may be able to do the conversion directly, rather than searching a
      list.  This ioctl is not present in kernels before version 2.1.50.  */
   struct ifreq ifr;
   int fd;
-  static int siogifname_works_not;
+  static int siocgifname_works_not;
 
-  if (!siogifname_works_not)
+  if (!siocgifname_works_not)
     {
       int serrno = errno;
 
@@ -224,10 +224,10 @@ if_indextoname (unsigned int ifindex, char *ifname)
        return NULL;
 
       ifr.ifr_ifindex = ifindex;
-      if (__ioctl (fd, SIOGIFNAME, &ifr) < 0)
+      if (__ioctl (fd, SIOCGIFNAME, &ifr) < 0)
        {
          if (errno == EINVAL)
-           siogifname_works_not = 1; /* Don't make the same mistake twice. */
+           siocgifname_works_not = 1; /* Don't make the same mistake twice. */
        }
       else
        {
index c4ac8e84001073cda68b6d967834d94d17c2f05c..25d65702cd42d0c42394e6c290f3ea7d5a37da80 100644 (file)
@@ -92,6 +92,7 @@ struct arphdr
 #define ARPHRD_PPP     512
 #define ARPHRD_HDLC    513             /* (Cisco) HDLC.  */
 #define ARPHRD_LAPB    516             /* LAPB.  */
+#define ARPHRD_DDCMP   517             /* Digital's DDCMP.  */
 
 #define ARPHRD_TUNNEL  768             /* IPIP tunnel.  */
 #define ARPHRD_TUNNEL6 769             /* IPIP6 tunnel.  */
index 4c065393a6544fc582b732dc45c2a71a3af766b1..63c134328440e42c137b0c479a0e52062e106d7c 100644 (file)
 #if defined __GNUC__ && __GNUC__ >= 2
 # define major(dev) ((int)(((dev) >> 8) & 0xff))
 # define minor(dev) ((int)((dev) & 0xff))
-# define makedev(major, minor) (((major) << 8) | (minor))
+# define makedev(major, minor) ((((unsigned int) (major)) << 8) \
+                               | ((unsigned int) (minor)))
 #else
 # define major(dev) (((dev).__val[0] >> 8) & 0xff)
 # define minor(dev) ((dev).__val[0] & 0xff)
-# define makedev(major, minor) { (((major) << 8) | (minor)), 0 }
+# define makedev(major, minor) { ((((unsigned int) (major)) << 8) \
+                                 | ((unsigned int) (minor))), 0 }
 #endif
 
 #endif /* sys/sysmacros.h */