diff options
| author | Ulrich Drepper <drepper@redhat.com> | 1996-12-15 02:15:29 +0000 |
|---|---|---|
| committer | Ulrich Drepper <drepper@redhat.com> | 1996-12-15 02:15:29 +0000 |
| commit | 68dbb3a69e78e24a778c6602c8cc91d715839d08 (patch) | |
| tree | 2201a2cfe38cf2817b6dfd37415dac21c7a41b2f /libio | |
| parent | f8b87ef0d47ea0db7304a9c59d5479aebdaea347 (diff) | |
| download | glibc-68dbb3a69e78e24a778c6602c8cc91d715839d08.tar.xz glibc-68dbb3a69e78e24a778c6602c8cc91d715839d08.zip | |
update from main archive 961214cvs/libc-961215
Sun Dec 15 01:53:20 1996 Ulrich Drepper <drepper@cygnus.com>
* Makefile (subdirs): Change crypt to md5-crypt.
* crypt/Makefile, crypt/md5-crypt.c, crypt/md5.c, crypt/md5.h,
crypt/md5c-test.c, crypt/md5test.c: Move to new directory
md5-crypt.
* sysdeps/unix/sysv/linux/configure.in: Refer to linuxthreads and
crypt instead of LinuxThreads and des-crypt.
* Makefile (subdirs): Add nss back.
* sysdeps/unix/inet/Subdirs: Move nis to end of file to fulfill
dependencies.
* libio/iofclose.c: Implement fclose(NULL) as closing all streams.
* stdio-common/Makefile (routines): Add fcloseall.
* stdio-common/fcloseall.c: New file.
* sysdeps/generic/abort.c: Make implementation POSIX.1 compatible.
* sysdeps/mach/libc-lock.h: Add definition of __libc_lock_trylock.
* sysdeps/stub/libc-lock.h: Define __libc_lock_trylock to always
return 0.
* stdio-common/printf.h: Define MIN and MAX only if not already
defined.
* stdio-common/vfprintf.c: Set errno to EBADF if stream does not
allow writing. Required by POSIX.1.
* libio/libioP.h (CHECK_FILE): Use MAYBE_SET_EINVAL instead of
assignment.
* interp.c: Update copyright.
* libio/clearerr.c: Likewise.
* libio/ioseekoff.c: Likewise.
* libio/ioseekpos.c: Likewise.
* stdio/fclose.c: Likewise.
* stdio/fflus.c: Likewise.
* libio/libio.h [!_IO_MTSAFE_IO]: Define _IO_cleanup_region_start
and _IO_cleanup_region_end as empty.
* libio/fgetc.c: Use _IO_cleanup_region_start and
_IO_cleanup_region_end instead of __libc_cleanup_region_start and
__libc_cleanup_region_end.
* libio/fputc.c: Likewise.
* libio/freopen.c: Likewise.
* libio/fseek.c: Likewise.
* libio/getc.c: Likewise.
* libio/getchar.c: Likewise.
* libio/iofclose.c: Likewise.
* libio/iofflush.c: Likewise.
* libio/iofgetpos.c: Likewise.
* libio/iofgets.c: Likewise.
* libio/iofputs.c: Likewise.
* libio/iofread.c: Likewise.
* libio/iofsetpos.c: Likewise.
* libio/ioftell.c: Likewise.
* libio/iofwrite.c: Likewise.
* libio/iogetdelim.c: Likewise.
* libio/iogets.c: Likewise.
* libio/ioputs.c: Likewise.
* libio/iosetbuffer.c: Likewise.
* libio/iosetvbuf.c: Likewise.
* libio/ioungetc.c: Likewise.
* libio/iovspintf.c: Use cleanup handler to make sure no dangling
locks can stay over.
* libio/iovsscanf.c: Likewise.
* libio/genops.c: Use _IO_lock_init_recursive and _IO_lock_fini
instead of __libc_lock_init_recursive and __libc_lock_fini.
* libio/filedoalloc.c: Only use __isatty when compiling GNU libc.
Otherwise use isatty.
* libio/fileops.c: Likewise for __open and open.
* login/utmp_file.c (getutent_r_file): Use fcntl instead of
flock.
* nis/ypclnt.h: Add more casts to prevent warnings.
* nss/Makefile (services): Remove dns.
(libnss_dns, libnss_dns-inhibit-o): Remove definition.
($(objpfx)libnss_dns.so): Removed.
* nss/nss_dns/dns-host.c, nss/nss_dns/dns-network.c: Moved to...
* resolv/nss_dns: ...here.
* resolv/Makefile (extra-libs): Add libnss_dns.
(libnss_dns-routines, libnss_dns-inhibit-o): Define as in
nss/Makefile.
* nss/XXX-lookup.c: Call __nss_database_lookup with new argument
specifying alternate name for entry in /etc/nsswitch.conf
* nss/nsswitch.c: If no entry with primary name is found in
/etc/nsswitch.conf try alternate name if given.
* nss/nsswitch.h: Add new parameter in prototype for
__nss_database_lookup.
* nss/spwd-lookup.c: Provide alternative entry name to look for.
This makes our NSS compatible with Solaris' nsswitch.conf files.
* string/tst-strlen.c: Change all counting variables to type size_t
to prevent warnings.
* sysdeps/posix/fpathconf.c: Update copyright.
* sysdeps/posix/pathconf.c: Don't call fpathconf to do the work.
Opening the file at this path may fail if it is a FIFO or pipe.
These changes make the time implementation POSIX.1 compliant.
* time/localtime.c (__localtime_r): Always call __tzset not only
if __tzset_run is zero.
* time/strftime.c: Add definition of memset_space to help to
reduce for systems which have memset.
(strftime): Don't use tm_zone member of argument for zone name.
Instead always use tzname[].
Call tzset() as required by POSIX.1 before any action.
* time/tzset.c (tzset): Set tzname[] as required by POSIX.1.
Remove global variable __tzset_run. __tzset is now called always
when a dependent function is used.
(__tzset): Caching happens based on the contents of the
environment variable TZ.
Fri Dec 13 01:06:52 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/unix/sysv/linux/paths.h: Add _PATH_KLOG.
Thu Dec 12 09:16:35 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* rellns-sh: Correctly handle a relative source file name.
Wed Dec 11 19:18:40 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* login/utmp_file.c (setutent_file): Seek back to beginning of the
file if resetting.
Thu Dec 12 16:39:12 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
* hurd/hurdinit.c (map0): Delete function. Don't do this on
_hurd_preinit_hook.
* hurd/hurdstartup.c (_hurd_startup): Map page zero redzone here.
Diffstat (limited to 'libio')
| -rw-r--r-- | libio/clearerr.c | 26 | ||||
| -rw-r--r-- | libio/fgetc.c | 4 | ||||
| -rw-r--r-- | libio/filedoalloc.c | 7 | ||||
| -rw-r--r-- | libio/fileops.c | 17 | ||||
| -rw-r--r-- | libio/fputc.c | 4 | ||||
| -rw-r--r-- | libio/freopen.c | 4 | ||||
| -rw-r--r-- | libio/fseek.c | 4 | ||||
| -rw-r--r-- | libio/genops.c | 4 | ||||
| -rw-r--r-- | libio/getc.c | 4 | ||||
| -rw-r--r-- | libio/getchar.c | 5 | ||||
| -rw-r--r-- | libio/iofclose.c | 34 | ||||
| -rw-r--r-- | libio/iofflush.c | 5 | ||||
| -rw-r--r-- | libio/iofgetpos.c | 4 | ||||
| -rw-r--r-- | libio/iofgets.c | 4 | ||||
| -rw-r--r-- | libio/iofputs.c | 4 | ||||
| -rw-r--r-- | libio/iofread.c | 4 | ||||
| -rw-r--r-- | libio/iofsetpos.c | 4 | ||||
| -rw-r--r-- | libio/ioftell.c | 4 | ||||
| -rw-r--r-- | libio/iofwrite.c | 4 | ||||
| -rw-r--r-- | libio/iogetdelim.c | 4 | ||||
| -rw-r--r-- | libio/iogets.c | 8 | ||||
| -rw-r--r-- | libio/iopadn.c | 6 | ||||
| -rw-r--r-- | libio/ioputs.c | 4 | ||||
| -rw-r--r-- | libio/ioseekoff.c | 6 | ||||
| -rw-r--r-- | libio/ioseekpos.c | 6 | ||||
| -rw-r--r-- | libio/iosetbuffer.c | 4 | ||||
| -rw-r--r-- | libio/iosetvbuf.c | 4 | ||||
| -rw-r--r-- | libio/ioungetc.c | 4 | ||||
| -rw-r--r-- | libio/iovsprintf.c | 3 | ||||
| -rw-r--r-- | libio/iovsscanf.c | 11 | ||||
| -rw-r--r-- | libio/libio.h | 2 | ||||
| -rw-r--r-- | libio/libioP.h | 2 |
32 files changed, 123 insertions, 87 deletions
diff --git a/libio/clearerr.c b/libio/clearerr.c index 9dfdb11530..7c7fb93dc0 100644 --- a/libio/clearerr.c +++ b/libio/clearerr.c @@ -1,20 +1,20 @@ /* Copyright (C) 1995, 1996 Free Software Foundation, Inc. -This file is part of the GNU C Library. + 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., 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 "libioP.h" #include "stdio.h" diff --git a/libio/fgetc.c b/libio/fgetc.c index a754c4b78b..25bfed5596 100644 --- a/libio/fgetc.c +++ b/libio/fgetc.c @@ -31,9 +31,9 @@ fgetc (fp) { int result; CHECK_FILE (fp, EOF); - __libc_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); + _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); _IO_flockfile (fp); result = _IO_getc_unlocked (fp); - __libc_cleanup_region_end (1); + _IO_cleanup_region_end (1); return result; } diff --git a/libio/filedoalloc.c b/libio/filedoalloc.c index f36bfb3e32..836c56b63b 100644 --- a/libio/filedoalloc.c +++ b/libio/filedoalloc.c @@ -49,9 +49,12 @@ the executable file might be covered by the GNU General Public License. */ #include <sys/stat.h> #ifdef __STDC__ #include <stdlib.h> +#include <unistd.h> #endif + #ifdef _LIBC -# include <unistd.h> +# undef isatty +# define isatty(Fd) __isatty (Fd) #endif /* @@ -100,7 +103,7 @@ DEFUN(_IO_file_doallocate, (fp), } ALLOC_BUF(p, size, EOF); _IO_setb(fp, p, p+size, 1); - if (couldbetty && __isatty (fp->_fileno)) + if (couldbetty && isatty(fp->_fileno)) fp->_flags |= _IO_LINE_BUF; return 1; } diff --git a/libio/fileops.c b/libio/fileops.c index 3294befbd2..dd1f573400 100644 --- a/libio/fileops.c +++ b/libio/fileops.c @@ -37,6 +37,11 @@ the executable file might be covered by the GNU General Public License. */ extern int errno; #endif + +#ifdef _LIBC +# define open(Name, Flags, Prot) __open ((Name), (Flags), (Prot)) +#endif + /* An fstream can be in at most one of put mode, get mode, or putback mode. Putback mode is a variant of get mode. @@ -177,7 +182,7 @@ DEFUN(_IO_file_fopen, (fp, filename, mode), omode = O_RDWR; read_write &= _IO_IS_APPENDING; } - fdesc = __open (filename, omode|oflags, oprot); + fdesc = open(filename, omode|oflags, oprot); if (fdesc < 0) return NULL; fp->_fileno = fdesc; @@ -223,7 +228,7 @@ DEFUN(_IO_file_setbuf, (fp, p, len), } /* Write TO_DO bytes from DATA to FP. - Then mark FP has having empty buffers. */ + Then mark FP as having empty buffers. */ int DEFUN(_IO_do_write, (fp, data, to_do), @@ -548,6 +553,10 @@ DEFUN(_IO_file_read, (fp, buf, size), { _IO_ssize_t count = _IO_read(fp->_fileno, buf, size); #if 0 && defined EINTR + /* We must not do this optimization since POSIX.1 explicitly + requests that the stream operations must return with the + error EINTR if this happens. There must be the possibility + that stream operations time out. --drepper */ if (count == -1 && errno == EINTR) continue; #endif @@ -587,6 +596,10 @@ DEFUN(_IO_file_write, (f, data, n), if (count == EOF) { #if 0 && defined EINTR + /* We must not do this optimization since POSIX.1 explicitly + requests that the stream operations must return with the + error EINTR if this happens. There must be the + possibility that stream operations time out. --drepper */ if (errno == EINTR) continue; else diff --git a/libio/fputc.c b/libio/fputc.c index 865ac8cde0..89359dc46d 100644 --- a/libio/fputc.c +++ b/libio/fputc.c @@ -32,10 +32,10 @@ fputc (c, fp) { int result; CHECK_FILE (fp, EOF); - __libc_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); + _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); _IO_flockfile (fp); result = _IO_putc_unlocked (c, fp); - __libc_cleanup_region_end (1); + _IO_cleanup_region_end (1); return result; } diff --git a/libio/freopen.c b/libio/freopen.c index 0b782dd770..bb0c59788f 100644 --- a/libio/freopen.c +++ b/libio/freopen.c @@ -35,9 +35,9 @@ freopen (filename, mode, fp) CHECK_FILE (fp, NULL); if (!(fp->_flags & _IO_IS_FILEBUF)) return NULL; - __libc_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); + _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); _IO_flockfile (fp); result = _IO_freopen (filename, mode, fp); - __libc_cleanup_region_end (1); + _IO_cleanup_region_end (1); return result; } diff --git a/libio/fseek.c b/libio/fseek.c index 61f2e9205e..3d4e4925b9 100644 --- a/libio/fseek.c +++ b/libio/fseek.c @@ -33,9 +33,9 @@ fseek (fp, offset, whence) { int result; CHECK_FILE (fp, -1); - __libc_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); + _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); _IO_flockfile (fp); result = _IO_fseek (fp, offset, whence); - __libc_cleanup_region_end (1); + _IO_cleanup_region_end (1); return result; } diff --git a/libio/genops.c b/libio/genops.c index 52b8fc312a..7679445c2b 100644 --- a/libio/genops.c +++ b/libio/genops.c @@ -466,7 +466,7 @@ DEFUN(_IO_init, (fp, flags), fp->_markers = NULL; fp->_cur_column = 0; #ifdef _IO_MTSAFE_IO - __libc_lock_init_recursive (*fp->_lock); + _IO_lock_init_recursive (*fp->_lock); #endif } @@ -501,7 +501,7 @@ DEFUN(_IO_default_finish, (fp), } #ifdef _IO_MTSAFE_IO - __libc_lock_fini (*fp->_lock); + _IO_lock_fini (*fp->_lock); #endif _IO_un_link(fp); diff --git a/libio/getc.c b/libio/getc.c index 0c0b6b84d3..eede63984f 100644 --- a/libio/getc.c +++ b/libio/getc.c @@ -33,10 +33,10 @@ _IO_getc (fp) { int result; CHECK_FILE (fp, EOF); - __libc_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); + _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); _IO_flockfile (fp); result = _IO_getc_unlocked (fp); - __libc_cleanup_region_end (1); + _IO_cleanup_region_end (1); return result; } #undef getc diff --git a/libio/getchar.c b/libio/getchar.c index d54ec58c1e..aa675591ad 100644 --- a/libio/getchar.c +++ b/libio/getchar.c @@ -31,11 +31,10 @@ int getchar () { int result; - __libc_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, - stdin); + _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, stdin); _IO_flockfile (stdin); result = _IO_getc_unlocked (stdin); - __libc_cleanup_region_end (1); + _IO_cleanup_region_end (1); return result; } diff --git a/libio/iofclose.c b/libio/iofclose.c index 77c7b50088..79a0543471 100644 --- a/libio/iofclose.c +++ b/libio/iofclose.c @@ -33,21 +33,31 @@ _IO_fclose (fp) { int status; - CHECK_FILE(fp, EOF); - - __libc_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); - _IO_flockfile (fp); - if (fp->_IO_file_flags & _IO_IS_FILEBUF) - status = _IO_file_close_it (fp); + if (fp == NULL) + { + /* Close all streams. */ + _IO_cleanup (); + status = 0; + } else - status = fp->_flags & _IO_ERR_SEEN ? -1 : 0; - _IO_FINISH (fp); - __libc_cleanup_region_end (1); - if (fp != _IO_stdin && fp != _IO_stdout && fp != _IO_stderr) { - fp->_IO_file_flags = 0; - free(fp); + CHECK_FILE(fp, EOF); + + _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); + _IO_flockfile (fp); + if (fp->_IO_file_flags & _IO_IS_FILEBUF) + status = _IO_file_close_it (fp); + else + status = fp->_flags & _IO_ERR_SEEN ? -1 : 0; + _IO_FINISH (fp); + _IO_cleanup_region_end (1); + if (fp != _IO_stdin && fp != _IO_stdout && fp != _IO_stderr) + { + fp->_IO_file_flags = 0; + free(fp); + } } + return status; } diff --git a/libio/iofflush.c b/libio/iofflush.c index 385c9629eb..af69486164 100644 --- a/libio/iofflush.c +++ b/libio/iofflush.c @@ -35,11 +35,10 @@ _IO_fflush (fp) { int result; CHECK_FILE (fp, EOF); - __libc_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, - fp); + _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); _IO_flockfile (fp); result = _IO_SYNC (fp) ? EOF : 0; - __libc_cleanup_region_end (1); + _IO_cleanup_region_end (1); return result; } } diff --git a/libio/iofgetpos.c b/libio/iofgetpos.c index 07128c16a3..cae5df7b39 100644 --- a/libio/iofgetpos.c +++ b/libio/iofgetpos.c @@ -33,10 +33,10 @@ _IO_fgetpos (fp, posp) { _IO_fpos_t pos; CHECK_FILE (fp, EOF); - __libc_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); + _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); _IO_flockfile (fp); pos = _IO_seekoff (fp, 0, _IO_seek_cur, 0); - __libc_cleanup_region_end (1); + _IO_cleanup_region_end (1); if (pos == _IO_pos_BAD) { #ifdef EIO diff --git a/libio/iofgets.c b/libio/iofgets.c index 79ba1a9cd6..7a1044f801 100644 --- a/libio/iofgets.c +++ b/libio/iofgets.c @@ -36,7 +36,7 @@ _IO_fgets (buf, n, fp) CHECK_FILE (fp, NULL); if (n <= 0) return NULL; - __libc_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); + _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); _IO_flockfile (fp); count = _IO_getline (fp, buf, n - 1, '\n', 1); if (count == 0 || (fp->_IO_file_flags & _IO_ERR_SEEN)) @@ -46,7 +46,7 @@ _IO_fgets (buf, n, fp) buf[count] = '\0'; result = buf; } - __libc_cleanup_region_end (1); + _IO_cleanup_region_end (1); return result; } diff --git a/libio/iofputs.c b/libio/iofputs.c index 6e94223a5c..9ce3caa194 100644 --- a/libio/iofputs.c +++ b/libio/iofputs.c @@ -33,13 +33,13 @@ _IO_fputs (str, fp) _IO_size_t len = strlen (str); int result; CHECK_FILE (fp, EOF); - __libc_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); + _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); _IO_flockfile (fp); if (_IO_sputn (fp, str, len) != len) result = EOF; else result = 1; - __libc_cleanup_region_end (1); + _IO_cleanup_region_end (1); return result; } |
