From feb3c934355a9a2331cdfeb7ab6351fd4856164f Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Mon, 9 Dec 1996 03:15:25 +0000 Subject: update from main archive 961208 Mon Dec 9 03:39:30 1996 Ulrich Drepper * config.make.in (defines): Add @USE_NEW_MALLOC@. * Makefile.in: Define USE_NEW_MALLOC to -DUSE_NEW_MALLOC if we use the new malloc. * malloc.h: Use either or depending on USE_NEW_MALLOC. Fix some more POSIX.1 problems. * libio/fileops.c (_IO_file_underflow): Set errno to EBADF if used on a write-only stream. (_IO_file_overflow): Set errno to EBADF if used on a read-only stream. (_IO_file_seekoff): POSIX.1 requires that fseek() after an fflush() call really positions the file offset to the correct position and no read-ahead happens. * locale/C-monetary.c: Set mon_grouping file to "" and "\377" to pass POSIX test suite. * stdio-common/vfprintf.c: Handle empty string as grouping command correctly. * stdlib/grouping.h: Likewise. * misc/syslog.c: Case first argument of __libc_cleanup_region_start. * signal/sigsetops.h: Update copyright. Don't include ansidecl.h. * stdio-common/printf_fp.c: Update copyright. Sun Dec 8 16:39:28 1996 Andreas Jaeger * time/Makefile: Compile ap.c with NO_MCHECK flag if new-malloc used (not otherwise). * misc/syslog.c (vsyslog): Cast argument to __libc_cleanup_region to get Hurd macros right. --- ChangeLog | 38 ++++++++++++++++++++ config.make.in | 2 +- configure | 7 +++- configure.in | 6 +++- libio/cleanup.c | 20 ----------- libio/fileops.c | 17 +++++++-- libio/ioprims.c | 73 --------------------------------------- locale/C-monetary.c | 30 ++++++++-------- malloc.h | 6 +++- misc/syslog.c | 3 +- signal/sigsetops.h | 29 ++++++++-------- stdio-common/printf_fp.c | 37 ++++++++++---------- stdio-common/vfprintf.c | 2 +- stdlib/grouping.h | 37 ++++++++++++-------- sysdeps/unix/sysv/linux/Dist | 1 + sysdeps/unix/sysv/linux/configure | 2 +- time/Makefile | 2 +- 17 files changed, 145 insertions(+), 167 deletions(-) delete mode 100644 libio/cleanup.c delete mode 100644 libio/ioprims.c diff --git a/ChangeLog b/ChangeLog index 47494122c6..143cbe471f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,38 @@ +Mon Dec 9 03:39:30 1996 Ulrich Drepper + + * config.make.in (defines): Add @USE_NEW_MALLOC@. + * Makefile.in: Define USE_NEW_MALLOC to -DUSE_NEW_MALLOC if + we use the new malloc. + + * malloc.h: Use either or + depending on USE_NEW_MALLOC. + + Fix some more POSIX.1 problems. + * libio/fileops.c (_IO_file_underflow): Set errno to EBADF if used + on a write-only stream. + (_IO_file_overflow): Set errno to EBADF if used on a read-only + stream. + (_IO_file_seekoff): POSIX.1 requires that fseek() after an fflush() + call really positions the file offset to the correct position + and no read-ahead happens. + + * locale/C-monetary.c: Set mon_grouping file to "" and "\377" + to pass POSIX test suite. + * stdio-common/vfprintf.c: Handle empty string as grouping command + correctly. + * stdlib/grouping.h: Likewise. + + * misc/syslog.c: Case first argument of __libc_cleanup_region_start. + + * signal/sigsetops.h: Update copyright. Don't include ansidecl.h. + + * stdio-common/printf_fp.c: Update copyright. + +Sun Dec 8 16:39:28 1996 Andreas Jaeger + + * time/Makefile: Compile ap.c with NO_MCHECK flag if new-malloc + used (not otherwise). + Sun Dec 8 06:56:49 1996 Ulrich Drepper * io/getwd.c: Use PATH_MAX not LOCAL_PATH_MAX. Fix typo in @@ -97,6 +132,9 @@ Sun Dec 8 06:56:49 1996 Ulrich Drepper (__tzset): Don't increment pointer tz when no DST information is given. + * misc/syslog.c (vsyslog): Cast argument to __libc_cleanup_region + to get Hurd macros right. + Sat Dec 7 23:47:54 1996 Ulrich Drepper * sysdeps/mach/libc-lock.h [_LIBC]: Add definition of diff --git a/config.make.in b/config.make.in index 401289270b..8211b64b05 100644 --- a/config.make.in +++ b/config.make.in @@ -15,7 +15,7 @@ config-vendor = @host_vendor@ config-os = @host_os@ config-sysdirs = @sysnames@ -defines = @DEFINES@ +defines = @DEFINES@ @USE_NEW_MALLOC@ elf = @elf@ have-initfini = @libc_cv_have_initfini@ diff --git a/configure b/configure index 67948b6516..14e3c2db28 100755 --- a/configure +++ b/configure @@ -1842,7 +1842,11 @@ echo "$ac_t""$stdio" 1>&6 echo $ac_n "checking malloc selection""... $ac_c" 1>&6 echo "configure:1844: checking malloc selection" >&5 -test $malloc = default && malloc=malloc +case $malloc in +new-malloc) USE_NEW_MALLOC=-DUSE_NEW_MALLOC ;; +default) malloc=malloc ;; +esac + echo "$ac_t""$malloc" 1>&6 @@ -2053,6 +2057,7 @@ s%@uname_release@%$uname_release%g s%@uname_version@%$uname_version%g s%@stdio@%$stdio%g s%@malloc@%$malloc%g +s%@USE_NEW_MALLOC@%$USE_NEW_MALLOC%g s%@libc_cv_slibdir@%$libc_cv_slibdir%g s%@libc_cv_sysconfdir@%$libc_cv_sysconfdir%g s%@gnu_ld@%$gnu_ld%g diff --git a/configure.in b/configure.in index 70d62b41c0..2c11732598 100644 --- a/configure.in +++ b/configure.in @@ -689,7 +689,11 @@ AC_MSG_RESULT($stdio) AC_MSG_CHECKING(malloc selection) AC_SUBST(malloc) -test $malloc = default && malloc=malloc +case $malloc in +new-malloc) USE_NEW_MALLOC=-DUSE_NEW_MALLOC ;; +default) malloc=malloc ;; +esac +AC_SUBST(USE_NEW_MALLOC) AC_MSG_RESULT($malloc) diff --git a/libio/cleanup.c b/libio/cleanup.c deleted file mode 100644 index 4a068083d0..0000000000 --- a/libio/cleanup.c +++ /dev/null @@ -1,20 +0,0 @@ -#include "libioP.h" -#if _G_HAVE_ATEXIT -#include - -typedef void (*voidfunc) __P((void)); - -/* Prototype. */ -static void DEFUN_VOID (_IO_register_cleanup); - -static void -DEFUN_VOID(_IO_register_cleanup) -{ - atexit ((voidfunc)_IO_cleanup); - _IO_cleanup_registration_needed = 0; -} - -void (*_IO_cleanup_registration_needed) __P((void)) = _IO_register_cleanup; -#else -void (*_IO_cleanup_registration_needed) __P((void)) = NULL; -#endif /* _G_HAVE_ATEXIT */ diff --git a/libio/fileops.c b/libio/fileops.c index ce0e2bb524..b5026e167a 100644 --- a/libio/fileops.c +++ b/libio/fileops.c @@ -269,7 +269,10 @@ DEFUN(_IO_file_underflow, (fp), #endif if (fp->_flags & _IO_NO_READS) - return EOF; + { + __set_errno (EBADF); + return EOF; + } if (fp->_IO_read_ptr < fp->_IO_read_end) return *(unsigned char*)fp->_IO_read_ptr; @@ -308,7 +311,10 @@ DEFUN(_IO_file_overflow, (f, ch), register _IO_FILE* f AND int ch) { if (f->_flags & _IO_NO_WRITES) /* SET ERROR */ - return EOF; + { + __set_errno (EBADF); + return EOF; + } /* If currently reading or no buffer allocated. */ if ((f->_flags & _IO_CURRENTLY_PUTTING) == 0) { @@ -387,6 +393,10 @@ DEFUN(_IO_file_seekoff, (fp, offset, dir, mode), _IO_pos_t result; _IO_off_t delta, new_offset; long count; + /* POSIX.1 8.2.3.7 says that after a call the fflush() the file + offset of the underlying file must be exact. */ + int must_be_exact = (fp->_IO_read_base == fp->_IO_read_end + && fp->_IO_write_base == fp->_IO_write_ptr); if (mode == 0) dir = _IO_seek_cur, offset = 0; /* Don't move any pointers. */ @@ -503,7 +513,8 @@ DEFUN(_IO_file_seekoff, (fp, offset, dir, mode), else { count = _IO_SYSREAD (fp, fp->_IO_buf_base, - fp->_IO_buf_end - fp->_IO_buf_base); + (must_be_exact + ? delta : fp->_IO_buf_end - fp->_IO_buf_base)); if (count < delta) { /* We weren't allowed to read, but try to seek the remainder. */ diff --git a/libio/ioprims.c b/libio/ioprims.c deleted file mode 100644 index d17c10a168..0000000000 --- a/libio/ioprims.c +++ /dev/null @@ -1,73 +0,0 @@ -/* -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This 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 General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -/* I/O OS-level primitives. - Needs to be replaced if not using Unix. - Also needs to be replaced if avoiding name-space pollution - (in which case read would be defined in terms of _IO_read, - rather than vice versa). */ - -#include "libioP.h" -#include -#include -#include - -#ifdef TODO -/* Add open, isatty */ -#endif - -_IO_ssize_t -DEFUN(_IO_read, (fildes, buf, nbyte), - int fildes AND void *buf AND _IO_size_t nbyte) -{ - return __read (fildes, buf, nbyte); -} - -_IO_ssize_t -DEFUN(_IO_write, (fildes, buf, nbyte), - int fildes AND const void *buf AND _IO_size_t nbyte) -{ - return __write (fildes, buf, nbyte); -} - -_IO_off_t -DEFUN(_IO_lseek, (fildes, offset, whence), - int fildes AND _IO_off_t offset AND int whence) -{ - return __lseek (fildes, offset, whence); -} - -int -DEFUN(_IO_close, (fildes), - int fildes) -{ - return __close (fildes); -} - -int -DEFUN(_IO_fstat, (fildes, buf), - int fildes AND struct stat *buf) -{ - return __fstat (fildes, buf); -} diff --git a/locale/C-monetary.c b/locale/C-monetary.c index d81dbf812d..bc10f00095 100644 --- a/locale/C-monetary.c +++ b/locale/C-monetary.c @@ -1,21 +1,21 @@ /* Copyright (C) 1995, 1996 Free Software Foundation, Inc. -This file is part of the GNU C Library. -Contributed by Ulrich Drepper , 1995. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1995. -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 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. + 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. */ + 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 "localeinfo.h" @@ -37,7 +37,7 @@ const struct locale_data _nl_C_LC_MONETARY = { string: "" }, { string: "" }, { string: "" }, - { string: not_available }, + { string: "" }, { string: "" }, { string: "" }, { string: not_available }, diff --git a/malloc.h b/malloc.h index 448e0a8c6b..72873ea5de 100644 --- a/malloc.h +++ b/malloc.h @@ -1 +1,5 @@ -#include +#ifdef USE_NEW_MALLOC +# include +#else +# include +#endif diff --git a/misc/syslog.c b/misc/syslog.c index 205909e1cd..4c5b6f4bbc 100644 --- a/misc/syslog.c +++ b/misc/syslog.c @@ -178,7 +178,8 @@ vsyslog(pri, fmt, ap) /* Prepare for multiple users. We have to take care: open and write are cancelation points. */ - __libc_cleanup_region_start (cancel_handler, &oldaction_ptr); + __libc_cleanup_region_start ((void (*) (void *)) cancel_handler, + &oldaction_ptr); __libc_lock_lock (syslog_lock); /* Prepare for a broken connection. */ diff --git a/signal/sigsetops.h b/signal/sigsetops.h index 972aa69c63..3f850d2d39 100644 --- a/signal/sigsetops.h +++ b/signal/sigsetops.h @@ -1,24 +1,23 @@ -/* Copyright (C) 1991, 1995 Free Software Foundation, Inc. -This file is part of the GNU C Library. +/* Copyright (C) 1991, 1995, 1996 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 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. + 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., 675 Mass Ave, -Cambridge, MA 02139, USA. */ + 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. */ /* Definitions relevant to functions that operate on `sigset_t's. */ -#include #include #include #include diff --git a/stdio-common/printf_fp.c b/stdio-common/printf_fp.c index 967ece2cf8..c63c1e1afc 100644 --- a/stdio-common/printf_fp.c +++ b/stdio-common/printf_fp.c @@ -1,23 +1,22 @@ /* Floating point output for `printf'. -Copyright (C) 1995, 1996 Free Software Foundation, Inc. -Written by Ulrich Drepper. - -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., 675 Mass Ave, -Cambridge, MA 02139, USA. */ + Copyright (C) 1995, 1996 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Written by Ulrich Drepper , 1995. + + 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. */ /* The gmp headers need some configuration frobs. */ #define HAVE_ALLOCA 1 diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c index f458ce25e4..31ff999172 100644 --- a/stdio-common/vfprintf.c +++ b/stdio-common/vfprintf.c @@ -1417,7 +1417,7 @@ group_number (CHAR_T *w, CHAR_T *rear_ptr, const CHAR_T *grouping, /* We treat all negative values like CHAR_MAX. */ - if (*grouping == CHAR_MAX || *grouping < 0) + if (*grouping == CHAR_MAX || *grouping <= 0) /* No grouping should be done. */ return w; diff --git a/stdlib/grouping.h b/stdlib/grouping.h index f53368991f..3aa4aaf297 100644 --- a/stdlib/grouping.h +++ b/stdlib/grouping.h @@ -1,21 +1,21 @@ /* Internal header for proving correct grouping in strings of numbers. -Copyright (C) 1995, 1996 Free Software Foundation, Inc. -Contributed by Ulrich Drepper , 1995. + Copyright (C) 1995, 1996 Free Software Foundation, Inc. + Contributed by Ulrich Drepper , 1995. -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 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. + 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., 675 Mass Ave, -Cambridge, MA 02139, USA. */ + 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 @@ -35,6 +35,15 @@ correctly_grouped_prefix (const STRING_TYPE *begin, const STRING_TYPE *end, if (grouping == NULL) return end; + if (*grouping == '\0') + { + /* No grouping allowed. Accept all characters up to the first + thousands separator. */ + while (begin < end && *begin != thousands) + ++begin; + return begin; + } + while (end > begin) { const STRING_TYPE *cp = end - 1; diff --git a/sysdeps/unix/sysv/linux/Dist b/sysdeps/unix/sysv/linux/Dist index 40f65b838c..425fb589f7 100644 --- a/sysdeps/unix/sysv/linux/Dist +++ b/sysdeps/unix/sysv/linux/Dist @@ -1,4 +1,5 @@ init-first.h +llseek.c siglist.h sysctl.c termio.h diff --git a/sysdeps/unix/sysv/linux/configure b/sysdeps/unix/sysv/linux/configure index 6f3d181f9d..ddf8663931 100644 --- a/sysdeps/unix/sysv/linux/configure +++ b/sysdeps/unix/sysv/linux/configure @@ -20,7 +20,7 @@ else #include "confdefs.h" #include int main() { -#if LINUX_VERSION_CODE < ( *65536+ 0 *256+ 10) /* .0.10 */ +#if LINUX_VERSION_CODE < (2 *65536+ 0 *256+ 10) /* 2.0.10 */ eat flaming death #endif ; return 0; } diff --git a/time/Makefile b/time/Makefile index 6ad2be85f4..e55b6641d3 100644 --- a/time/Makefile +++ b/time/Makefile @@ -147,6 +147,6 @@ CFLAGS-ialloc.c = -Wno-strict-prototypes -DNOID CFLAGS-scheck.c = -Wno-strict-prototypes -DNOID CFLAGS-tzfile.c = $(tz-cflags) -ifneq ($(malloc),new-malloc) +ifeq ($(malloc),new-malloc) CFLAGS-ap.c = -DNO_MCHECK endif -- cgit v1.2.3