From: Ulrich Drepper Date: Sun, 13 Jun 1999 09:23:55 +0000 (+0000) Subject: Update from main branch. X-Git-Tag: cvs/glibc_2-1-2~412 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b77ab157d4bbccd7b67fb59e6b22d925be065169;p=thirdparty%2Fglibc.git Update from main branch. --- diff --git a/ChangeLog b/ChangeLog index a249d61e363..2401e9941ed 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,110 @@ +1999-06-12 Ulrich Drepper + + * locale/lc-time.c: Add free_mem function to free if necessary + statically allocated memory. + +1999-06-10 Jakub Jelinek + + * sysdeps/libm-ieee754/s_truncl.c: Subtract exponent + bias from the raw exponent. + +1999-06-11 Ulrich Drepper + + * inet/arpa/tftp.h: Move attribute declaration in right position. + +1999-06-11 Ulrich Drepper + + * resolv/nss_dns/dns-host.c (getanswer_r): Correctly track usage + of user-provided buffer. + +1999-06-10 Ulrich Drepper + + * 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 + + * 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 + + * stdlib/longlong.h: gas changed sethi handling when without + %hi(). Fix assembly. + +1999-06-08 Ulrich Drepper + + * 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 + + * ctype/ctype.h: Protect __tobody code by __extension__. + +1999-06-13 Andreas Jaeger + + * sysdeps/unix/sysv/linux/if_index.c: Replace SIOG* with SIOCG*. + +1999-06-07 Ulrich Drepper + + * sysdeps/unix/sysv/linux/sys/sysmacros.h (makedev): Handle signed + parameters. + +1999-06-06 Ulrich Drepper + + * 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 + + * sysdeps/unix/sysv/linux/i386/sigaction.c (__sigaction): Set + SA_RESTORER flag. + +1999-06-05 Philip Blundell + + * sysdeps/arm/dl-machine.h (elf_machine_load_address): Fix + problems with GOT addressing. + +1999-06-02 Jakub Jelinek + + * stdlib/longlong.h: Define UDIV_TIME on sparc64. + +1999-06-01 Andreas Jaeger + + * sysdeps/unix/sysv/linux/net/if_arp.h (ARPHRD_DDCMP): Add it + (from Linux 2.3.4). + +1999-05-30 Andreas Jaeger + + * manual/stdio.texi: Fix some typos. + +1999-05-29 Andreas Jaeger + + * manual/stdio.texi (Formatted Output Functions): Mention + semantics of snprintf in glibc 2.0. + Reported by Ben Pfaff . + +1999-05-27 Andreas Schwab + + * malloc/malloc.h: Properly handle future GCC versions. + +1999-05-25 Ulrich Drepper + + * sysdeps/posix/getcwd.c (__getcwd): Fix potential memory leaks. + 1999-06-11 Mark Kettenis * hurd/hurdsock.c (max_domain): Initialize to `-1'. diff --git a/ctype/ctype.h b/ctype/ctype.h index 11f92068d45..a0d840162e6 100644 --- a/ctype/ctype.h +++ b/ctype/ctype.h @@ -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) diff --git a/grp/fgetgrent.c b/grp/fgetgrent.c index ac8d093f05a..d2e3de69a71 100644 --- a/grp/fgetgrent.c +++ b/grp/fgetgrent.c @@ -26,11 +26,12 @@ /* 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); diff --git a/inet/arpa/tftp.h b/inet/arpa/tftp.h index 15bfc656c2d..69187da0829 100644 --- a/inet/arpa/tftp.h +++ b/inet/arpa/tftp.h @@ -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__)); diff --git a/locale/lc-time.c b/locale/lc-time.c index 5090e6d9053..a9344fcd33c 100644 --- a/locale/lc-time.c +++ b/locale/lc-time.c @@ -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); diff --git a/malloc/malloc.h b/malloc/malloc.h index a93c77a8533..eeb33a29492 100644 --- a/malloc/malloc.h +++ b/malloc/malloc.h @@ -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 diff --git a/manual/stdio.texi b/manual/stdio.texi index 3449a51d2b6..8c6c009c4c9 100644 --- a/manual/stdio.texi +++ b/manual/stdio.texi @@ -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: diff --git a/misc/daemon.c b/misc/daemon.c index 7bab9f59652..6918b2ba316 100644 --- a/misc/daemon.c +++ b/misc/daemon.c @@ -45,7 +45,7 @@ daemon(nochdir, noclose) { int fd; - switch (__fork()) { + switch (fork()) { case -1: return (-1); case 0: diff --git a/pwd/fgetpwent_r.c b/pwd/fgetpwent_r.c index 4986e7452ce..33f49ea1ae9 100644 --- a/pwd/fgetpwent_r.c +++ b/pwd/fgetpwent_r.c @@ -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. */ diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c index 078d452fd6d..b982481349a 100644 --- a/resolv/nss_dns/dns-host.c +++ b/resolv/nss_dns/dns-host.c @@ -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) diff --git a/shadow/fgetspent.c b/shadow/fgetspent.c index 902c95eb045..66a5452678d 100644 --- a/shadow/fgetspent.c +++ b/shadow/fgetspent.c @@ -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 #include #include +#include #include @@ -28,16 +29,21 @@ /* 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); diff --git a/shadow/fgetspent_r.c b/shadow/fgetspent_r.c index 50d1fd9972b..8f7e303e07f 100644 --- a/shadow/fgetspent_r.c +++ b/shadow/fgetspent_r.c @@ -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. */ diff --git a/stdio-common/printf-parse.h b/stdio-common/printf-parse.h index 4f217abfd35..2e6f0dcd99e 100644 --- a/stdio-common/printf-parse.h +++ b/stdio-common/printf-parse.h @@ -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 diff --git a/stdlib/longlong.h b/stdlib/longlong.h index 7ac63bf4c80..37ea646b34c 100644 --- a/stdlib/longlong.h +++ b/stdlib/longlong.h @@ -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 diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h index aff8df2238c..754a6caa135 100644 --- a/sysdeps/arm/dl-machine.h +++ b/sysdeps/arm/dl-machine.h @@ -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; } diff --git a/sysdeps/libm-ieee754/s_truncl.c b/sysdeps/libm-ieee754/s_truncl.c index 206eab2f226..59c3b9c1739 100644 --- a/sysdeps/libm-ieee754/s_truncl.c +++ b/sysdeps/libm-ieee754/s_truncl.c @@ -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 , 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) diff --git a/sysdeps/posix/getcwd.c b/sysdeps/posix/getcwd.c index df48804f7a3..fe094b5a35c 100644 --- a/sysdeps/posix/getcwd.c +++ b/sysdeps/posix/getcwd.c @@ -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; } diff --git a/sysdeps/unix/sysv/linux/i386/sigaction.c b/sysdeps/unix/sysv/linux/i386/sigaction.c index 142eac6a757..57b2fa836d0 100644 --- a/sysdeps/unix/sysv/linux/i386/sigaction.c +++ b/sysdeps/unix/sysv/linux/i386/sigaction.c @@ -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 +/* 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) diff --git a/sysdeps/unix/sysv/linux/if_index.c b/sysdeps/unix/sysv/linux/if_index.c index 9b3db6abfb4..17f93bae33e 100644 --- a/sysdeps/unix/sysv/linux/if_index.c +++ b/sysdeps/unix/sysv/linux/if_index.c @@ -27,7 +27,7 @@ #include /* 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 { diff --git a/sysdeps/unix/sysv/linux/net/if_arp.h b/sysdeps/unix/sysv/linux/net/if_arp.h index c4ac8e84001..25d65702cd4 100644 --- a/sysdeps/unix/sysv/linux/net/if_arp.h +++ b/sysdeps/unix/sysv/linux/net/if_arp.h @@ -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. */ diff --git a/sysdeps/unix/sysv/linux/sys/sysmacros.h b/sysdeps/unix/sysv/linux/sys/sysmacros.h index 4c065393a65..63c13432844 100644 --- a/sysdeps/unix/sysv/linux/sys/sysmacros.h +++ b/sysdeps/unix/sysv/linux/sys/sysmacros.h @@ -27,11 +27,13 @@ #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 */