diff options
-rw-r--r-- | ChangeLog | 24 | ||||
-rw-r--r-- | elf/dlfcn.h | 100 | ||||
-rw-r--r-- | libio/fileno.c | 7 | ||||
-rw-r--r-- | libio/fileops.c | 2 | ||||
-rw-r--r-- | libio/iofopncook.c | 5 | ||||
-rw-r--r-- | libio/libioP.h | 4 | ||||
-rw-r--r-- | libio/oldfileops.c | 2 | ||||
-rw-r--r-- | manual/charset.texi | 10 | ||||
-rw-r--r-- | stdio-common/vfprintf.c | 4 |
9 files changed, 46 insertions, 112 deletions
diff --git a/ChangeLog b/ChangeLog index 57400df2d9..7e3d6fe841 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,27 @@ +1999-07-08 Andreas Schwab <schwab@suse.de> + + * libio/iofopncook.c (fopencookie): Set _fileno to -2. + + * libio/libioP.h (_IO_file_is_open): Only check for -1, not all + negative numbers. + + * libio/fileops.c (_IO_new_file_close_it): Set _fileno to -1, not + EOF. + * libio/oldfileops.c (_IO_old_file_close_it): Likewise. + +1999-07-08 Andreas Schwab <schwab@suse.de> + + * stdio-common/vfprintf.c (buffered_vfprintf): Initialize _mode. + +1999-07-08 Andreas Schwab <schwab@suse.de> + + * libio/fileno.c: Return -1 instead of EOF and set errno if the + stream is not a real file stream. + +1999-07-08 Andreas Schwab <schwab@suse.de> + + * manual/charset.texi: Fix typos. + 1999-07-07 Ulrich Drepper <drepper@cygnus.com> * sysdeps/gnu/Makefile (libdl-routines): Add eval. diff --git a/elf/dlfcn.h b/elf/dlfcn.h deleted file mode 100644 index 76fdc3c1c9..0000000000 --- a/elf/dlfcn.h +++ /dev/null @@ -1,100 +0,0 @@ -/* User functions for run-time dynamic loading. - Copyright (C) 1995, 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 - 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. */ - -#ifndef _DLFCN_H -#define _DLFCN_H 1 - -#include <features.h> -#define __need_NULL -#include <stddef.h> - -/* Collect various system dependent definitions and declarations. */ -#include <bits/dlfcn.h> - -/* If the first argument of `dlsym' or `dlvsym' is set to RTLD_NEXT - the run-time address of the symbol called NAME in the next shared - object is returned. The "next" relation is defined by the order - the shared objects were loaded. */ -#define RTLD_NEXT ((void *) -1l) - -/* If the first argument to `dlsym' or `dlvsym' is set to RTLD_DEFAULT - the run-time address of the symbol called NAME in the global scope - is returned. */ -#define RTLD_DEFAULT NULL - -__BEGIN_DECLS - -/* Open the shared object FILE and map it in; return a handle that can be - passed to `dlsym' to get symbol values from it. */ -extern void *dlopen __P ((__const char *__file, int __mode)); - -/* Unmap and close a shared object opened by `dlopen'. - The handle cannot be used again after calling `dlclose'. */ -extern int dlclose __P ((void *__handle)); - -/* Find the run-time address in the shared object HANDLE refers to - of the symbol called NAME. */ -extern void *dlsym __P ((void *__restrict __handle, - __const char *__restrict __name)); - -#ifdef __USE_GNU -/* Find the run-time address in the shared object HANDLE refers to - of the symbol called NAME with VERSION. */ -extern void *dlvsym __P ((void *__restrict __handle, - __const char *__restrict __name, - __const char *__restrict __version)); -#endif - -/* When any of the above functions fails, call this function - to return a string describing the error. Each call resets - the error string so that a following call returns null. */ -extern char *dlerror __P ((void)); - -#ifdef __USE_GNU -/* Fill in *INFO with the following information about ADDRESS. - Returns 0 iff no shared object's segments contain that address. */ -typedef struct - { - __const char *dli_fname; /* File name of defining object. */ - void *dli_fbase; /* Load address of that object. */ - __const char *dli_sname; /* Name of nearest symbol. */ - void *dli_saddr; /* Exact value of nearest symbol. */ - } Dl_info; -extern int dladdr __P ((const void *__address, Dl_info *__info)); - -/* To support profiling of shared objects it is a good idea to call - the function found using `dlsym' using the following macro since - these calls do not use the PLT. But this would mean the dynamic - loader has no chance to find out when the function is called. The - macro applies the necessary magic so that profiling is possible. - Rewrite - foo = (*fctp) (arg1, arg2); - into - foo = DL_CALL_FCT (fctp, (arg1, arg2)); -*/ -# define DL_CALL_FCT(fctp, args) \ - (_dl_mcount_wrapper_check (fctp), (*(fctp)) args) - -/* This function calls the profiling functions. */ -extern void _dl_mcount_wrapper_check __P ((void *__selfpc)); -#endif - -__END_DECLS - -#endif /* dlfcn.h */ diff --git a/libio/fileno.c b/libio/fileno.c index 7ff93e6a81..92334f1564 100644 --- a/libio/fileno.c +++ b/libio/fileno.c @@ -32,8 +32,11 @@ fileno (fp) { CHECK_FILE (fp, EOF); - if (!(fp->_flags & _IO_IS_FILEBUF)) - return EOF; + if (!(fp->_flags & _IO_IS_FILEBUF) || _IO_fileno (fp) < 0) + { + __set_errno (EBADF); + return -1; + } return _IO_fileno (fp); } diff --git a/libio/fileops.c b/libio/fileops.c index 8d480ad08b..8ced77b4c3 100644 --- a/libio/fileops.c +++ b/libio/fileops.c @@ -151,7 +151,7 @@ _IO_new_file_close_it (fp) _IO_un_link (fp); fp->_flags = _IO_MAGIC|CLOSED_FILEBUF_FLAGS; - fp->_fileno = EOF; + fp->_fileno = -1; fp->_offset = _IO_pos_BAD; return close_status ? close_status : write_status; diff --git a/libio/iofopncook.c b/libio/iofopncook.c index 85ea35c22e..7b76826031 100644 --- a/libio/iofopncook.c +++ b/libio/iofopncook.c @@ -167,5 +167,10 @@ fopencookie (cookie, mode, io_functions) _IO_mask_flags (&new_f->cfile.__file, read_write, _IO_NO_READS+_IO_NO_WRITES+_IO_IS_APPENDING); + /* We use a negative number different from -1 for _fileno to mark that + this special stream is not associated with a real file, but still has + to be treated as such. */ + new_f->cfile.__file._fileno = -2; + return &new_f->cfile.__file; } diff --git a/libio/libioP.h b/libio/libioP.h index 775f44588c..64256a9199 100644 --- a/libio/libioP.h +++ b/libio/libioP.h @@ -98,7 +98,7 @@ extern "C" { #endif /* The 'finish' function does any final cleaning up of an _IO_FILE object. - It does not delete (free) it, but does everything else to finalize it/ + It does not delete (free) it, but does everything else to finalize it. It matches the streambuf::~streambuf virtual destructor. */ typedef void (*_IO_finish_t) __PMT ((_IO_FILE *, int)); /* finalize */ #define _IO_FINISH(FP) JUMP1 (__finish, FP, 0) @@ -422,7 +422,7 @@ extern int _IO_file_stat __P ((_IO_FILE *, void *)); extern int _IO_file_close __P ((_IO_FILE *)); extern int _IO_file_underflow __P ((_IO_FILE *)); extern int _IO_file_overflow __P ((_IO_FILE *, int)); -#define _IO_file_is_open(__fp) ((__fp)->_fileno >= 0) +#define _IO_file_is_open(__fp) ((__fp)->_fileno != -1) extern void _IO_file_init __P ((_IO_FILE *)); extern _IO_FILE* _IO_file_attach __P ((_IO_FILE *, int)); extern _IO_FILE* _IO_file_open __P ((_IO_FILE *, const char *, int, int, diff --git a/libio/oldfileops.c b/libio/oldfileops.c index d65c272d48..02445215df 100644 --- a/libio/oldfileops.c +++ b/libio/oldfileops.c @@ -149,7 +149,7 @@ _IO_old_file_close_it (fp) _IO_un_link (fp); fp->_flags = _IO_MAGIC|CLOSED_FILEBUF_FLAGS; - fp->_fileno = EOF; + fp->_fileno = -1; fp->_old_offset = _IO_pos_BAD; return close_status ? close_status : write_status; diff --git a/manual/charset.texi b/manual/charset.texi index b44df4bc93..30bc74a83f 100644 --- a/manual/charset.texi +++ b/manual/charset.texi @@ -2137,7 +2137,7 @@ module. These lines must contain three or four more words. The first word specifies the source character set, the second word the destination character set of conversion implemented in this module. The third word is the name of the loadable module. The filename is -constructed by appending the usual shared object prefix (normally +constructed by appending the usual shared object suffix (normally @file{.so}) and this file is then supposed to be found in the same directory the @file{gconv-modules} file is in. The last word on the line, which is optional, is a numeric value representing the cost of the @@ -2202,11 +2202,11 @@ existing examples. It'll become clearer once it is. --drepper} A last remark about the @file{gconv-modules} is about the names not ending with @code{//}. There often is a character set named @code{INTERNAL} mentioned. From the discussion above and the chosen -name it should have become clear that this is the names for the +name it should have become clear that this is the name for the representation used in the intermediate step of the triangulation. We have said that this is UCS4 but actually it is not quite right. The UCS4 specification also includes the specification of the byte ordering -used. Since an UCS4 value consists of four bytes a stored value is +used. Since a UCS4 value consists of four bytes a stored value is effected by byte ordering. The internal representation is @emph{not} the same as UCS4 in case the byte ordering of the processor (or at least the running process) is not the same as the one required for UCS4. This @@ -2231,7 +2231,7 @@ is necessary to get an overview. From the perspective of the user of @code{iconv} the interface is quite simple: the @code{iconv_open} function returns a handle which can be -used in calls @code{iconv} and finally the handle is freed with a call +used in calls to @code{iconv} and finally the handle is freed with a call to @code{iconv_close}. The problem is: the handle has to be able to represent the possibly long sequences of conversion steps and also the state of each conversion since the handle is all which is passed to the @@ -2278,7 +2278,7 @@ The interface will be explained below. @itemx int max_needed_from @itemx int min_needed_to @itemx int max_needed_to; -These values have to be filled in the the init function of the module. +These values have to be filled in the init function of the module. The @code{min_needed_from} value specifies how many bytes a character of the source character set at least needs. The @code{max_needed_from} specifies the maximum value which also includes possible shift diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c index a65953d305..f167058d17 100644 --- a/stdio-common/vfprintf.c +++ b/stdio-common/vfprintf.c @@ -1861,15 +1861,17 @@ buffered_vfprintf (register _IO_FILE *s, const CHAR_T *format, { CHAR_T buf[_IO_BUFSIZ]; struct helper_file helper; - register _IO_FILE *hp = (_IO_FILE *) &helper; + register _IO_FILE *hp = &helper._f.file; int result, to_flush; /* Initialize helper. */ helper._put_stream = s; #ifdef COMPILE_WPRINTF _IO_wsetp (hp, buf, buf + sizeof buf / sizeof (CHAR_T)); + hp->_mode = 1; #else _IO_setp (hp, buf, buf + sizeof buf); + hp->_mode = -1; #endif hp->_IO_file_flags = _IO_MAGIC|_IO_NO_READS; #if _IO_JUMPS_OFFSET |