diff --git a/ChangeLog b/ChangeLog index 29e51c4969..34e56034dc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,33 @@ +1999-02-07 Ulrich Drepper + + * Versions.def: New version GLIBC_2.1.1 for libc. + * stdlib/Versions: Add _Exit, imaxdiv, and imaxdiv to GLIBC_2.1.1. + * stdlib/labs.c: Moved to... + * sysdeps/generic/labs.c: ...here. + * stdlib/llabs.c: Moved to... + * sysdeps/generic/llabs.c: ...here. + * stdlib/stdlib.h: Allow definition of ldiv_t and lldiv_t in other + header. Declare _Exit. + * sysdeps/generic/_exit.c: Add alias _Exit. + * sysdeps/mach/hurd/_exit.c: Likewise. + * sysdeps/standalone/i386/force_cpu386/_exit.c: Likewise. + * sysdeps/standalone/i960/nindy960/_exit.c: Likewise. + * sysdeps/standalone/m68k/m68020/mvme136/_exit.c: Likewise. + * sysdeps/unix/_exit.c: Likewise. + * sysdeps/wordsize-32/inttypes.h: Define imaxdiv_t and declare + imaxdiv and imaxabs. Declare lldiv_t if necessary. + * sysdeps/wordsize-64/inttypes.h: Likewise. + * sysdeps/wordsize-32/llabs.c: New file. + * sysdeps/wordsize-32/lldiv.c: New file. + * sysdeps/wordsize-64/labs.c: New file. + * sysdeps/wordsize-64/ldiv.c: New file. + * manual/arith.texi: Document imaxabs, imaxdiv_t, and imaxdiv. + * manual/startup.texi: Document _Exit. + +1999-02-07 Andreas Jaeger + + * nscd/cache.c: Include for inet_ntop. + 1999-02-06 Ulrich Drepper * Versions.def: Add versions for ld.so. diff --git a/NEWS b/NEWS index ffa79ef4fa..7c74a79360 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,4 @@ -GNU C Library NEWS -- history of user-visible changes. 1999-02-02 +GNU C Library NEWS -- history of user-visible changes. 1999-02-07 Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 99 Free Software Foundation, Inc. See the end for copying conditions. @@ -7,6 +7,10 @@ Please send GNU C library bug reports using the `glibcbug' script to . Questions and suggestions should be send to . +Version 2.1.1 + +* New ISO C 9x function _exit, imaxabs, and imaxdiv are added. + Version 2.1 * Richard Henderson corrected size of struct timeval on Linux/Alpha to diff --git a/Versions.def b/Versions.def index da36b547eb..246155be65 100644 --- a/Versions.def +++ b/Versions.def @@ -4,6 +4,7 @@ libBrokenLocale { libc { GLIBC_2.0 GLIBC_2.1 GLIBC_2.0 + GLIBC_2.1.1 GLIBC_2.1 } libcrypt { GLIBC_2.0 diff --git a/manual/arith.texi b/manual/arith.texi index 3cd298b3f3..a42267712d 100644 --- a/manual/arith.texi +++ b/manual/arith.texi @@ -826,6 +826,7 @@ whose imaginary part is @var{y}, the absolute value is @w{@code{sqrt @pindex math.h @pindex stdlib.h Prototypes for @code{abs}, @code{labs} and @code{llabs} are in @file{stdlib.h}; +@code{imaxabs} is declared in @file{inttypes.h}; @code{fabs}, @code{fabsf} and @code{fabsl} are declared in @file{math.h}. @code{cabs}, @code{cabsf} and @code{cabsl} are declared in @file{complex.h}. @@ -838,13 +839,16 @@ Prototypes for @code{abs}, @code{labs} and @code{llabs} are in @file{stdlib.h}; @comment stdlib.h @comment ISO @deftypefunx {long long int} llabs (long long int @var{number}) +@comment inttypes.h +@comment ISO +@deftypefunx intmax_t imaxabs (intmax_t @var{number}) These functions return the absolute value of @var{number}. Most computers use a two's complement integer representation, in which the absolute value of @code{INT_MIN} (the smallest possible @code{int}) cannot be represented; thus, @w{@code{abs (INT_MIN)}} is not defined. -@code{llabs} is new to @w{ISO C 9x} +@code{llabs} and @code{imaxdiv} are new to @w{ISO C 9x}. @end deftypefun @comment math.h @@ -1820,6 +1824,34 @@ a structure of type @code{lldiv_t}. The @code{lldiv} function was added in @w{ISO C 9x}. @end deftypefun +@comment inttypes.h +@comment ISO +@deftp {Data Type} imaxdiv_t +This is a structure type used to hold the result returned by the @code{imaxdiv} +function. It has the following members: + +@table @code +@item intmax_t quot +The quotient from the division. + +@item intmax_t rem +The remainder from the division. +@end table + +(This is identical to @code{div_t} except that the components are of +type @code{intmax_t} rather than @code{int}.) +@end deftp + +@comment inttypes.h +@comment ISO +@deftypefun imaxdiv_t imaxdiv (intmax_t @var{numerator}, intmax_t @var{denominator}) +The @code{imaxdiv} function is like the @code{div} function, but the +arguments are of type @code{intmax_t} and the result is returned as +a structure of type @code{imaxdiv_t}. + +The @code{imaxdiv} function was added in @w{ISO C 9x}. +@end deftypefun + @node Parsing of Numbers @section Parsing of Numbers diff --git a/manual/startup.texi b/manual/startup.texi index 1d903b49d7..1c75d3cabd 100644 --- a/manual/startup.texi +++ b/manual/startup.texi @@ -776,6 +776,18 @@ execute cleanup functions registered with @code{atexit} or @code{on_exit}. @end deftypefun +@comment stdlib.h +@comment ISO +@deftypefun void _Exit (int @var{status}) +The @code{_Exit} function is the @w{ISO C} equivalent to @code{_exit}. +The @w{ISO C} committee members were not sure whether the definitions of +@code{_exit} and @code{_Exit} were compatible so they have not used the +POSIX name. + +This function was introduced in @w{ISO C9x} and is declared in +@file{stdlib.h}. +@end deftypefun + When a process terminates for any reason---either by an explicit termination call, or termination as a result of a signal---the following things happen: diff --git a/nscd/cache.c b/nscd/cache.c index dbc89fb8ec..fc293a36f3 100644 --- a/nscd/cache.c +++ b/nscd/cache.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1998 Free Software Foundation, Inc. +/* Copyright (c) 1998, 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1998. @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include diff --git a/stdlib/Versions b/stdlib/Versions index 6e92552794..9536e3240e 100644 --- a/stdlib/Versions +++ b/stdlib/Versions @@ -83,4 +83,11 @@ libc { # s* strtoimax; strtoumax; swapcontext; } + GLIBC_2.1.1 { + # _* + _Exit; + + # i* + imaxabs; imaxdiv; + } } diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h index 3b9539e329..8a47b81ed9 100644 --- a/stdlib/stdlib.h +++ b/stdlib/stdlib.h @@ -45,19 +45,23 @@ typedef struct } div_t; /* Returned by `ldiv'. */ +#ifndef __ldiv_t_defined typedef struct { long int quot; /* Quotient. */ long int rem; /* Remainder. */ } ldiv_t; +# define __ldiv_t_defined 1 +#endif -#ifdef __USE_ISOC9X +#if defined __USE_ISOC9X && !defined __lldiv_t_defined /* Returned by `lldiv'. */ __extension__ typedef struct { long long int quot; /* Quotient. */ long long int rem; /* Remainder. */ } lldiv_t; +# define __lldiv_t_defined 1 #endif @@ -515,6 +519,12 @@ extern int on_exit __P ((void (*__func) (int __status, __ptr_t __arg), perform stdio cleanup, and terminate program execution with STATUS. */ extern void exit __P ((int __status)) __attribute__ ((__noreturn__)); +#ifdef __USE_ISOC9X +/* Terminate the program with STATUS without calling any of the + functions registered with `atexit' or `on_exit'. */ +extern void _Exit __P ((int __status)) __attribute__ ((__noreturn__)); +#endif + /* Return the value of envariable NAME, or NULL if it doesn't exist. */ extern char *getenv __P ((__const char *__name)); diff --git a/sysdeps/generic/_exit.c b/sysdeps/generic/_exit.c index 5fb4366e49..4bd6ddf4f2 100644 --- a/sysdeps/generic/_exit.c +++ b/sysdeps/generic/_exit.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1994, 1995, 1996, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1991, 94, 95, 96, 97, 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 @@ -29,6 +29,7 @@ _exit (status) status &= 0xff; abort (); } +weak_alias (_exit, _Exit) stub_warning (_exit) #include diff --git a/stdlib/labs.c b/sysdeps/generic/labs.c similarity index 100% rename from stdlib/labs.c rename to sysdeps/generic/labs.c diff --git a/stdlib/llabs.c b/sysdeps/generic/llabs.c similarity index 100% rename from stdlib/llabs.c rename to sysdeps/generic/llabs.c diff --git a/sysdeps/mach/hurd/_exit.c b/sysdeps/mach/hurd/_exit.c index 2780146e60..9d207b1267 100644 --- a/sysdeps/mach/hurd/_exit.c +++ b/sysdeps/mach/hurd/_exit.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1993, 94, 95, 96, 97, 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 @@ -52,3 +52,4 @@ _exit (status) { _hurd_exit (W_EXITCODE (status, 0)); } +weak_alias (_exit, _Exit) diff --git a/sysdeps/standalone/i386/force_cpu386/_exit.c b/sysdeps/standalone/i386/force_cpu386/_exit.c index 455dc0e7b8..5f9e5e3116 100644 --- a/sysdeps/standalone/i386/force_cpu386/_exit.c +++ b/sysdeps/standalone/i386/force_cpu386/_exit.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1997, 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil), On-Line Applications Research Corporation. @@ -36,6 +36,7 @@ _exit (status) /* status is ignored */ Bsp_cleanup(); } +weak_alias (_exit, _Exit) #ifdef HAVE_GNU_LD diff --git a/sysdeps/standalone/i960/nindy960/_exit.c b/sysdeps/standalone/i960/nindy960/_exit.c index e56dcc07a4..8ca6e78e80 100644 --- a/sysdeps/standalone/i960/nindy960/_exit.c +++ b/sysdeps/standalone/i960/nindy960/_exit.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1997, 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil), On-Line Applications Research Corporation. @@ -43,6 +43,7 @@ _exit (status) * application if the user types "go". */ } +weak_alias (_exit, _Exit) #ifdef HAVE_GNU_LD diff --git a/sysdeps/standalone/m68k/m68020/mvme136/_exit.c b/sysdeps/standalone/m68k/m68020/mvme136/_exit.c index d45e52d41d..ecd93db129 100644 --- a/sysdeps/standalone/m68k/m68020/mvme136/_exit.c +++ b/sysdeps/standalone/m68k/m68020/mvme136/_exit.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1994, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1994, 1997, 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil), On-Line Applications Research Corporation. @@ -47,3 +47,4 @@ _exit (status) M68Kvec[ 45 ] = __exit_trap; /* install exit_trap handler */ asm volatile( "trap #13" ); /* insures SUPV mode */ } +weak_alias (_exit, _Exit) diff --git a/sysdeps/unix/_exit.S b/sysdeps/unix/_exit.S index dfdeebd908..da502c76a6 100644 --- a/sysdeps/unix/_exit.S +++ b/sysdeps/unix/_exit.S @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1992, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992, 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 @@ -21,3 +21,4 @@ PSEUDO (_exit, exit, 1) /* Shouldn't get here. */ PSEUDO_END(_exit) +weak_alias (_exit, _Exit) diff --git a/sysdeps/wordsize-32/inttypes.h b/sysdeps/wordsize-32/inttypes.h index 5897fdab19..e80036bd24 100644 --- a/sysdeps/wordsize-32/inttypes.h +++ b/sysdeps/wordsize-32/inttypes.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998 Free Software Foundation, Inc. +/* Copyright (C) 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 @@ -251,6 +251,28 @@ __BEGIN_DECLS +/* We have to define the `uintmax_t' type using `lldiv_t'. */ +#ifndef _STDLIB_H +/* Returned by `lldiv'. */ +__extension__ typedef struct + { + long long int quot; /* Quotient. */ + long long int rem; /* Remainder. */ + } lldiv_t; +# define __lldiv_t_defined 1 +#endif + +/* Returned by `imaxdiv'. */ +typedef lldiv_t imaxdiv_t; + + +/* Compute absolute value of N. */ +extern intmax_t imaxabs __P ((intmax_t __n)) __attribute__ ((__const__)); + +/* Return the `imaxdiv_t' representation of the value of NUMER over DENOM. */ +extern imaxdiv_t imaxdiv __P ((intmax_t __numer, intmax_t __denom)) + __attribute__ ((__const__)); + /* Like `strtol' but convert to `intmax_t'. */ extern intmax_t strtoimax __P ((__const char *__restrict __nptr, char **__restrict __endptr, int __base)); @@ -269,6 +291,29 @@ extern uintmax_t wcstoumax __P ((__const wchar_t * __restrict __nptr, #ifdef __USE_EXTERN_INLINES +/* We ant to use the appropriate functions from but cannot + assume the header is read already. */ +__extension__ extern long long int llabs __P ((long long int __x)) + __attribute__ ((__const__)); +__extension__ extern lldiv_t lldiv __P ((long long int __numer, + long long int __denom)) + __attribute__ ((__const__)); + + +/* Compute absolute value of N. */ +extern __inline intmax_t +imaxabs (intmax_t __n) __THROW +{ + return llabs (__n); +} + +/* Return the `imaxdiv_t' representation of the value of NUMER over DENOM. */ +extern __inline imaxdiv_t +imaxdiv (intmax_t __numer, intmax_t __denom) __THROW +{ + return lldiv (__numer, __denom); +} + /* Like `strtol' but convert to `intmax_t'. */ # ifndef __strtoll_internal_defined __extension__ diff --git a/sysdeps/wordsize-32/llabs.c b/sysdeps/wordsize-32/llabs.c new file mode 100644 index 0000000000..f335fb0ec3 --- /dev/null +++ b/sysdeps/wordsize-32/llabs.c @@ -0,0 +1,23 @@ +/* Copyright (C) 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#include + +weak_alias (llabs, imaxabs) diff --git a/sysdeps/wordsize-32/lldiv.c b/sysdeps/wordsize-32/lldiv.c new file mode 100644 index 0000000000..f666ad8331 --- /dev/null +++ b/sysdeps/wordsize-32/lldiv.c @@ -0,0 +1,23 @@ +/* Copyright (C) 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#include + +weak_alias (lldiv, imaxdiv) diff --git a/sysdeps/wordsize-64/inttypes.h b/sysdeps/wordsize-64/inttypes.h index f37221b640..a3763c7880 100644 --- a/sysdeps/wordsize-64/inttypes.h +++ b/sysdeps/wordsize-64/inttypes.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998 Free Software Foundation, Inc. +/* Copyright (C) 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 @@ -251,6 +251,28 @@ __BEGIN_DECLS +/* We have to define the `uintmax_t' type using `ldiv_t'. */ +#ifndef _STDLIB_H +/* Returned by `ldiv'. */ +typedef struct + { + long int quot; /* Quotient. */ + long int rem; /* Remainder. */ + } ldiv_t; +# define __ldiv_t_defined 1 +#endif + +/* Returned by `imaxdiv'. */ +typedef ldiv_t imaxdiv_t; + + +/* Compute absolute value of N. */ +extern intmax_t imaxabs __P ((intmax_t __n)) __attribute__ ((__const__)); + +/* Return the `imaxdiv_t' representation of the value of NUMER over DENOM. */ +extern imaxdiv_t imaxdiv __P ((intmax_t __numer, intmax_t __denom)) + __attribute__ ((__const__)); + /* Like `strtol' but convert to `intmax_t'. */ extern intmax_t strtoimax __P ((__const char *__restrict __nptr, char **__restrict __endptr, int __base)); @@ -269,6 +291,28 @@ extern uintmax_t wcstoumax __P ((__const wchar_t * __restrict __nptr, #ifdef __USE_EXTERN_INLINES +/* We ant to use the appropriate functions from but cannot + assume the header is read already. */ +__extension__ extern long int labs __P ((long int __x)) + __attribute__ ((__const__)); +__extension__ extern ldiv_t ldiv __P ((long int __numer, long int __denom)) + __attribute__ ((__const__)); + + +/* Compute absolute value of N. */ +extern __inline intmax_t +imaxabs (intmax_t __n) __THROW +{ + return labs (__n); +} + +/* Return the `imaxdiv_t' representation of the value of NUMER over DENOM. */ +extern __inline imaxdiv_t +imaxdiv (intmax_t __numer, intmax_t __denom) __THROW +{ + return ldiv (__numer, __denom); +} + /* Like `strtol' but convert to `intmax_t'. */ # ifndef __strtol_internal_defined extern long int __strtol_internal __P ((__const char *__restrict __nptr, diff --git a/sysdeps/wordsize-64/labs.c b/sysdeps/wordsize-64/labs.c new file mode 100644 index 0000000000..6ff9835a38 --- /dev/null +++ b/sysdeps/wordsize-64/labs.c @@ -0,0 +1,23 @@ +/* Copyright (C) 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#include + +weak_alias (labs, imaxabs) diff --git a/sysdeps/wordsize-64/ldiv.c b/sysdeps/wordsize-64/ldiv.c new file mode 100644 index 0000000000..f42f327850 --- /dev/null +++ b/sysdeps/wordsize-64/ldiv.c @@ -0,0 +1,23 @@ +/* Copyright (C) 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +#include + +weak_alias (ldiv, imaxdiv)