update from main archive 960907

Sat Sep  7 14:00:33 1996  David Mosberger-Tang  <davidm@azstarnet.com>

	* catgets/catgets.c (catopen): Allocate sizeof(*result) bytes
	instead of sizeof(nl_catd) (which is just a pointer!).

Sat Sep  7 19:39:19 1996  Ulrich Drepper  <drepper@cygnus.com>

	* Makefile ($(objpfx)version-info.h): Generate from Banner files.
	* version.c (banner): Add contents of version-info.h to string.

	* Makerules: If $($(subdir)-version) is available name versioned
	shared library according to this value instead of glibc's version.

	* libio/Banner: New file.

	* elf/eval.c (funcall): Write error message in case function is
	not found.
	(eval): Recognize `_' in names.
This commit is contained in:
Ulrich Drepper 1996-09-07 23:56:19 +00:00
parent edf5b2d716
commit 499e7464ed
20 changed files with 120 additions and 7 deletions

View file

@ -1,3 +1,22 @@
Sat Sep 7 14:00:33 1996 David Mosberger-Tang <davidm@azstarnet.com>
* catgets/catgets.c (catopen): Allocate sizeof(*result) bytes
instead of sizeof(nl_catd) (which is just a pointer!).
Sat Sep 7 19:39:19 1996 Ulrich Drepper <drepper@cygnus.com>
* Makefile ($(objpfx)version-info.h): Generate from Banner files.
* version.c (banner): Add contents of version-info.h to string.
* Makerules: If $($(subdir)-version) is available name versioned
shared library according to this value instead of glibc's version.
* libio/Banner: New file.
* elf/eval.c (funcall): Write error message in case function is
not found.
(eval): Recognize `_' in names.
Sat Sep 7 05:15:45 1996 Ulrich Drepper <drepper@cygnus.com>
* libio/iofdopen: Initialize _lock field only if _IO_MTSAFE_IO.

View file

@ -129,6 +129,23 @@ $(objpfx)sysd-dirs: $(+sysdir_pfx)config.make
echo endef) > $@-tmp
mv -f $@-tmp $@
$(objpfx)version-info.h: $(..)Makefile $(+sysdir_pfx)config.make
(first=yes; \
for dir in $(subdirs); do \
if [ -r $$dir/Banner ]; then \
if [ $$first = yes ]; then \
echo "\"Available extensions:"; \
first=no; \
fi; \
sed -e '/^#/d' -e 's/^[[:space:]]*/ /' $$dir/Banner; \
fi; \
done; \
[ $first = yes ] || echo "\"") > $@-tmp
mv -f $@-tmp $@
version.c-objects := $(addprefix $(objpfx)version,$(object-suffixes))
$(version.c-objects): $(objpfx)version-info.h
# Makerules creates a file `stub-$(subdir)' for each subdirectory, which
# contains `#define __stub_FUNCTION' for each function which is a stub.
# Here we paste all of these together into <stubs.h>.

View file

@ -643,6 +643,7 @@ object-suffixes-left := $(versioned)
include $(o-iterator)
ifeq (,$($(subdir)-version))
define o-iterator-doit
$(libdir)/$o$($o-version): $(libdir)/$(o:.so=)-$(version).so; $$(make-link)
endef
@ -654,6 +655,21 @@ $(libdir)/$(o:.so=)-$(version).so: $(objpfx)$o; $$(do-install-program)
endef
object-suffixes-left := $(versioned)
include $(o-iterator)
else
define o-iterator-doit
$(libdir)/$o$($o-version): $(libdir)/$(o:.so=)-$($(subdir)-version).so;
$$(make-link)
endef
object-suffixes-left := $(versioned)
include $(o-iterator)
define o-iterator-doit
$(libdir)/$(o:.so=)-$($(subdir)-version).so: $(objpfx)$o;
$$(do-install-program)
endef
object-suffixes-left := $(versioned)
include $(o-iterator)
endif
endif
define do-install-so

View file

@ -34,7 +34,7 @@ catopen (const char *cat_name, int flag)
__nl_catd result;
const char *env_var;
result = (__nl_catd) malloc (sizeof (__nl_catd));
result = (__nl_catd) malloc (sizeof (*result));
if (result == NULL)
/* We cannot get enough memory. */
return (nl_catd) -1;

View file

@ -1,6 +1,7 @@
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <unistd.h>
#include <dlfcn.h>
static void *funcall (char **stringp);
@ -27,6 +28,13 @@ funcall (char **stringp)
/* Swallow closing paren. */
++*stringp;
if (args[0] == NULL)
{
static const char unknown[] = "Unknown function\n";
write (1, unknown, sizeof unknown - 1);
return NULL;
}
/* Do it to it. */
__builtin_return (__builtin_apply (args[0],
&argcookie,
@ -81,7 +89,7 @@ eval (char **stringp)
value = p;
do
++p;
while (*p != '\0' && !isspace (*p) && !ispunct (*p));
while (*p != '\0' && !isspace (*p) && (!ispunct (*p) || *p == '_'));
c = *p;
*p = '\0';
value = dlsym (NULL, value);

1
libio/Banner Normal file
View file

@ -0,0 +1 @@
GNU libio by Per Bothner

View file

@ -42,7 +42,9 @@ _IO_fdopen (fd, mode)
struct locked_FILE
{
struct _IO_FILE_plus fp;
#ifdef _IO_MTSAFE_IO
_IO_lock_t lock;
#endif
} *new_f;
int fd_flags;
@ -104,7 +106,9 @@ _IO_fdopen (fd, mode)
new_f = (struct locked_FILE *) malloc (sizeof (struct locked_FILE));
if (new_f == NULL)
return NULL;
#ifdef _IO_MTSAFE_IO
new_f->fp.file._lock = &new_f->lock;
#endif
_IO_init (&new_f->fp.file, 0);
_IO_JUMPS (&new_f->fp.file) = &_IO_file_jumps;
_IO_file_init (&new_f->fp.file);

View file

@ -35,12 +35,16 @@ _IO_fopen (filename, mode)
struct locked_FILE
{
struct _IO_FILE_plus fp;
#ifdef _IO_MTSAFE_IO
_IO_lock_t lock;
#endif
} *new_f = (struct locked_FILE *) malloc (sizeof (struct locked_FILE));
if (new_f == NULL)
return NULL;
#ifdef _IO_MTSAFE_IO
new_f->fp.file._lock = &new_f->lock;
#endif
_IO_init (&new_f->fp.file, 0);
_IO_JUMPS (&new_f->fp.file) = &_IO_file_jumps;
_IO_file_init (&new_f->fp.file);

View file

@ -131,7 +131,9 @@ fopencookie (cookie, mode, io_functions)
struct locked_FILE
{
struct _IO_cookie_file cfile;
#ifdef _IO_MTSAFE_IO
_IO_lock_t lock;
#endif
} *new_f;
switch (*mode++)
@ -154,7 +156,9 @@ fopencookie (cookie, mode, io_functions)
new_f = (struct locked_FILE *) malloc (sizeof (struct locked_FILE));
if (new_f == NULL)
return NULL;
#ifdef _IO_MTSAFE_IO
new_f->cfile.file._lock = &new_f->lock;
#endif
_IO_init (&new_f->cfile.file, 0);
_IO_JUMPS (&new_f->cfile.file) = &_IO_cookie_jumps;

View file

@ -152,14 +152,18 @@ DEFUN(_IO_popen, (command, mode),
struct locked_FILE
{
struct _IO_proc_file fpx;
#ifdef _IO_MTSAFE_IO
_IO_lock_t lock;
#endif
} *new_f;
_IO_FILE *fp;
new_f = (struct locked_FILE *) malloc (sizeof (struct locked_FILE));
if (new_f == NULL)
return NULL;
#ifdef _IO_MTSAFE_IO
new_f->fpx.file.file._lock = &new_f->lock;
#endif
fp = (_IO_FILE*)&new_f->fpx;
_IO_init(fp, 0);
_IO_JUMPS(fp) = &_IO_proc_jumps;

View file

@ -32,10 +32,14 @@ _IO_vsprintf (string, format, args)
_IO_va_list args;
{
_IO_strfile sf;
#ifdef _IO_MTSAFE_IO
_IO_lock_t lock;
#endif
int ret;
#ifdef _IO_MTSAFE_IO
sf._f._lock = &lock;
#endif
_IO_init ((_IO_FILE *) &sf, 0);
_IO_JUMPS ((_IO_FILE *) &sf) = &_IO_str_jumps;
_IO_str_init_static ((_IO_FILE *) &sf, string, -1, string);

View file

@ -30,8 +30,10 @@ DEFUN(_IO_vsscanf, (string, format, args),
const char *string AND const char *format AND _IO_va_list args)
{
_IO_strfile sf;
#ifdef _IO_MTSAFE_IO
_IO_lock_t lock;
sf._f._lock = &lock;
#endif
_IO_init((_IO_FILE*)&sf, 0);
_IO_JUMPS((_IO_FILE*)&sf) = &_IO_str_jumps;
_IO_str_init_static ((_IO_FILE*)&sf, (char*)string, 0, NULL);

View file

@ -152,6 +152,7 @@ typedef struct
#ifdef _IO_MTSAFE_IO
#include <pthread.h>
typedef pthread_mutex_t _IO_lock_t;
#define _IO_lock_init PTHREAD_MUTEX_INITIALIZER
#else
typedef void _IO_lock_t;
#endif

View file

@ -342,10 +342,18 @@ extern int _IO_vscanf __P((const char *, _IO_va_list));
#else
#define _IO_FJUMP &_IO_file_jumps,
#endif
#ifdef _IO_MTSAFE_IO
/* check following! */
#define FILEBUF_LITERAL(CHAIN, FLAGS, FD) \
{ _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CHAIN, _IO_FJUMP FD}
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CHAIN, _IO_FJUMP FD, \
0, 0, 0, 0, { 0 }, &_IO_stdfile_##FD##_lock }
#else
/* check following! */
#define FILEBUF_LITERAL(CHAIN, FLAGS, FD) \
{ _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CHAIN, _IO_FJUMP FD }
#endif
/* VTABLE_LABEL defines NAME as of the CLASS class.
CNLENGTH is strlen(#CLASS). */

View file

@ -67,14 +67,18 @@ open_memstream (bufloc, sizeloc)
struct locked_FILE
{
struct _IO_FILE_memstream fp;
#ifdef _IO_MTSAFE_IO
_IO_lock_t lock;
#endif
} *new_f;
char *buf;
new_f = (struct locked_FILE *) malloc (sizeof (struct locked_FILE));
if (new_f == NULL)
return NULL;
#ifdef _IO_MTSAFE_IO
new_f->fp._sf._f._lock = &new_f->lock;
#endif
buf = ALLOC_BUF (_IO_BUFSIZ);
_IO_init (&new_f->fp._sf._f, 0);

View file

@ -31,10 +31,16 @@ the executable file might be covered by the GNU General Public License. */
#include "libioP.h"
#ifdef _IO_MTSAFE_IO
#define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
static _IO_lock_t _IO_stdfile_##FD##_lock = _IO_lock_init; \
struct _IO_FILE_plus NAME \
= {FILEBUF_LITERAL(CHAIN, FLAGS, FD), &_IO_file_jumps}
#else
#define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
struct _IO_FILE_plus NAME \
= {FILEBUF_LITERAL(CHAIN, FLAGS, FD), &_IO_file_jumps}
#endif
DEF_STDFILE(_IO_stdin_, 0, 0, _IO_NO_WRITES);
DEF_STDFILE(_IO_stdout_, 1, &_IO_stdin_.file, _IO_NO_READS);

View file

@ -38,12 +38,16 @@ _IO_vasprintf (result_ptr, format, args)
const _IO_size_t init_string_size = 100;
char *string;
_IO_strfile sf;
#ifdef _IO_MTSAFE_IO
_IO_lock_t lock;
#endif
int ret;
string = ALLOC_BUF(init_string_size);
if (string == NULL)
return -1;
#ifdef _IO_MTSAFE_IO
sf._f._lock = &lock;
#endif
_IO_init((_IO_FILE*)&sf, 0);
_IO_JUMPS((_IO_FILE*)&sf) = &_IO_str_jumps;
_IO_str_init_static ((_IO_FILE*)&sf, string, init_string_size, string);

View file

@ -32,10 +32,14 @@ _IO_vdprintf (d, format, arg)
_IO_va_list arg;
{
struct _IO_FILE_plus tmpfil;
#ifdef _IO_MTSAFE_IO
_IO_lock_t lock;
#endif
int done;
#ifdef _IO_MTSAFE_IO
tmpfil.file._lock = &lock;
#endif
_IO_init (&tmpfil.file, 0);
_IO_JUMPS (&tmpfil.file) = &_IO_file_jumps;
_IO_file_init (&tmpfil.file);

View file

@ -33,9 +33,11 @@ _IO_vsnprintf (string, maxlen, format, args)
_IO_va_list args;
{
_IO_strfile sf;
_IO_lock_t lock;
int ret;
#ifdef _IO_MTSAFE_IO
_IO_lock_t lock;
sf._f._lock = &lock;
#endif
_IO_init ((_IO_FILE *) &sf, 0);
_IO_JUMPS ((_IO_FILE *) &sf) = &_IO_str_jumps;
_IO_str_init_static ((_IO_FILE *) &sf, string, maxlen - 1, string);

View file

@ -26,8 +26,9 @@ Compiled by GNU CC version "__VERSION__".\n\
Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.\n\
This is free software; see the source for copying conditions.\n\
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A\n\
PARTICULAR PURPOSE.\n\
Report bugs to <bug-glibc@gnu.ai.mit.edu>.\n";
PARTICULAR PURPOSE.\n"
#include "version-info.h"
"Report bugs to <bug-glibc@gnu.ai.mit.edu>.\n";
#include <unistd.h>