]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
update from main archive 960906 cvs/libc-960907
authorUlrich Drepper <drepper@redhat.com>
Sat, 7 Sep 1996 04:10:57 +0000 (04:10 +0000)
committerUlrich Drepper <drepper@redhat.com>
Sat, 7 Sep 1996 04:10:57 +0000 (04:10 +0000)
Sat Sep  7 05:15:45 1996  Ulrich Drepper  <drepper@cygnus.com>

  * libio/iofdopen: Initialize _lock field only if _IO_MTSAFE_IO.
* libio/iofopen: Likewise.
* libio/iofopncook.c: Likewise.
* libio/iopopen.c: Likewise.
* libio/iovsprintf.c: Likewise.
* libio/iovsscanf.c: Likewise.
* libio/memstream.c: Likewise.
* libio/vasprintf.c: Likewise.
* libio/vdprintf.c: Likewise.
* libio/vsnprintf.c: Likewise.

Sat Sep  7 03:55:47 1996  Ulrich Drepper  <drepper@cygnus.com>

* Makeconfig (soversions.mk): Also use shlib-versions files
in add-on directories.
* config.make.in (config-defines): Remove.  Not used anymore.
(defines): New variable.  Initiliazed by @DEFINES@.
* configure.in: Add AC_SUBST(DEFINES).

* libio/Makefile (routines): When compiling reentrant libc add
  clearerr_u, feof_u, ferror_u, fputc_u, getc_u, getchar_u,
  iofflush_u, putc_u, putchar_u, ioflockfile.
(CPPFLAGS): Add -D_IO_MTSAFE_IO for reentrant libc.

* sysdeps/stub/libc-lock.h: Add stubs for __libc_cleanup_region_start
and __libc_cleanup_region_end.

* sysdeps/unix/i386/sysdep.S [_LIBC_REENTRANT]: Set errno
  using __errno_location function.
* sysdeps/unix/sysv/linux/i386/sysdep.S [_LIBC_REENTRANT]: Set errno
using __errno_location function.
(__errno_location): New function.
* sysdeps/unix/sysv/linux/i386/sysdep.h [PIC]: Add second
  syscall_error handler for reentrant libc.

* sysdeps/unix/opendir.c: Remove unneeded `;'.

* libio.h [_IO_MTSAFE_IO]: Include <pthread.h>.
[!_IO_MTSAFE_IO]: Define _IO_flockfile and _IO_funlockfile
as empty macros.
* libioP.h: Include <libc-lock.h>.
* libio/stdio.h: Add prototypes for *_locked and *_unlocked
functions.

* libio/clearerr.c: Use _IO_ protected versions of flockfile
and funlockfile to be namespace clean.

* libio/genops.c: Use __libc_lock_* macros for handling lock.

* libio/iofdopen: Add initialization of _lock in _IO_FILE.
* libio/iofopen: Likewise.
* libio/iofopncook.c: Likewise.
* libio/iopopen.c: Likewise.
* libio/iovsprintf.c: Likewise.
* libio/iovsscanf.c: Likewise.
* libio/memstream.c: Likewise.
* libio/vasprintf.c: Likewise.
* libio/vdprintf.c: Likewise.
* libio/vsnprintf.c: Likewise.

* libio/fgetc.c: Use __libc_cleanup_region_* macros instead
of flockfile etc.
* 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/putc.c: Likewise.
* libio/putchar.c: Likewise.
* libio/rewind.c: Likewise.
* stdio-common/vfprintf.c: Likewise.
* stdio-common/vfscanf.c: Likewise.

* libio/clearerr_u.c: Correct alias name.
* libio/ferror_u.c: Likewise.
* libio/fileno.c: Likewise.
* libio/fputc_u.c: Likewise.
* libio/getc.c: Likewise.
* libio/getc_u.c: Likewise.
* libio/getchar.c: Likewise.
* libio/getchar_u.c: Likewise.
* libio/putc.c: Likewise.
* libio/putchar.c: Likewise.

* libio/feof_u.c: Undefine macro with name of function before
  definition of function itself.

* libio/ioflockfile.c: New file.  Implementation of flockfile and
  funlockfile.

* libio/putchar_u.c: Fix typo.  Use stdout instead of fp.

* malloc/malloc.h: Don't include <libc-lock.h> and don't declare
  _malloc_loc.

* malloc/free.c: Include <libc-lock.h>.
* malloc/realloc.c: Likewise.
* malloc/malloc-find.c: Likewise.
* malloc/malloc-size.c: Likewise.
* malloc/malloc-walk.c: Likewise.
* malloc/memalign.c: Likewise.
* malloc/malloc.c: Likewise.

* sysdeps/i386/dl-machine.h: Correct clearing of _dl_starting_up.

Fri Sep  6 19:38:49 1996  Ulrich Drepper  <drepper@cygnus.com>

* sysdeps/stub/libc-lock.h: Define __libc_lock_critical_start
and __libc_lock_critical_end as empty macros.

* malloc/malloc.h: Don't include <libc-lock.h> and don't declare
__libc_malloc_lock.
* malloc/free.c: Include <libc-lock.h>.
* malloc/malloc-find.c: Likewise.
* malloc/malloc-size.c: Likewise.
* malloc/malloc-walk.c: Likewise.
* malloc/malloc.c: Likewise.
* malloc/memalign.c: Likewise.
* malloc/realloc.c: Likewise.

* Makefile: Undo change from Mon Sep  2 22:15:14 1996.  No more
extra_solibs pass.
* Rules: Likewise.
* extra-lib.mk: Likewise.
* manual/Makefile: Likewise.

* db/Makefile (makedb): Choose dependecies based on build-shared.
Patch by Andres Schwab.

* sysdeps/posix/sysconf.c: Don't use PTHREAD_DESTRUCTOR_ITERATIONS
  but _POSIX_THREAD_DESTRUCTOR_ITERATIONS.

* sysdeps/unix/sysv/linux/errnos.h: New file.
* sysdeps/unix/sysv/linux/schedbits.h: New file.
* sysdeps/unix/sysv/linux/waitflags.h: New file.

* sysdeps/unix/sysv/linux/gnu/types.h: Add definition of `key_t'.

Fri Sep  6 08:26:31 1996  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

* rpm/template: Fix typo in %build section.

Fri Sep  6 03:31:07 1996  Ulrich Drepper  <drepper@cygnus.com>

* sysdeps/unix/sysv/linux/errnos.h: Don't define errno macro when
building libc without thread support.
* resolv/netdb.h: Likewise for h_errno macro.

Thu Sep  5 23:01:48 1996  Ulrich Drepper  <drepper@cygnus.com>

* libc-symbols.h: Add new macro weak_const_function.  It's like
weak_function, but the function is additionally marked as const.
* features.h: Only include <sys/cdefs.h> if !__ASSEMBLER__.

Thu Sep  5 22:55:49 1996  Richard Henderson  <rth@tamu.edu>

* inet/herrno.c (__h_errno_location): New function.
(h_errno): Make strong_alias __h_errno so that we can access
the variable even if `h_errno' is a macro.
* resolv/netdb.h: Define macro h_errno to access thread specific
version of h_errno variable.  Declare alias __h_errno for h_errno.
* resolv/res_query (h_errno): Remove definition.
* sysdeps/unix/sysv/linux/errnos.h [!__ASSEMBLER__ && __USE_REENTRANT]:
  Add macro `errno' to get thread specific variable.
* sysdeps/unix/alpha/sysdep.S [_LIBC_REENTRANT]: Set errno using
  __errno_location function.
(__errno_location): New function.

Thu Sep  5 21:08:44 1996  Ulrich Drepper  <drepper@cygnus.com>

* posix/gnu/types.h: Remove definition of key_t.
* sysdeps/generic/gnu/types.h: Move it to here.
* sysdeps/unix/sysv/linux/gnu/types.h: Add Linux specific
definition of key_t.

* sysdeps/unix/sysv/linux/waitflags.h: New file.  Linux specific
definitions.
* sysdeps/unix/sysv/linux/schedbits.h: New file.  Include
clone prototypes and associated flags.

Thu Sep  5 08:58:47 1996  Richard Henderson  <rth@tamu.edu>

* sysdeps/alpha/elf/start.S: Make _start global again.

hertz.
here.

Wed Sep  4 16:16:13 1996  Ulrich Drepper  <drepper@cygnus.com>

* sysdeps/mach/hurd/send.c (__send): De-ANSI-fy.
* sysdeps/mach/hurd/sendto.c (sendto): Likewise.

84 files changed:
ChangeLog
Makeconfig
Makefile
Rules
config.make.in
configure
configure.in
db/Makefile
extra-lib.mk
features.h
inet/herrno.c
libc-symbols.h
libio/Makefile
libio/clearerr.c
libio/clearerr_u.c
libio/feof_u.c
libio/ferror_u.c
libio/fgetc.c
libio/fileno.c
libio/fputc.c
libio/fputc_u.c
libio/freopen.c
libio/fseek.c
libio/genops.c
libio/getc.c
libio/getc_u.c
libio/getchar.c
libio/getchar_u.c
libio/iofclose.c
libio/iofdopen.c
libio/iofflush.c
libio/iofgetpos.c
libio/iofgets.c
libio/ioflockfile.c [new file with mode: 0644]
libio/iofopen.c
libio/iofopncook.c
libio/iofputs.c
libio/iofread.c
libio/iofsetpos.c
libio/ioftell.c
libio/iofwrite.c
libio/iogetdelim.c
libio/iogets.c
libio/iopopen.c
libio/ioputs.c
libio/iosetbuffer.c
libio/iosetvbuf.c
libio/ioungetc.c
libio/iovsprintf.c
libio/iovsscanf.c
libio/libio.h
libio/libioP.h
libio/memstream.c
libio/putc.c
libio/putchar.c
libio/putchar_u.c
libio/rewind.c
libio/stdio.h
libio/vasprintf.c
libio/vdprintf.c
libio/vsnprintf.c
manual/Makefile
posix/sys/types.h
resolv/netdb.h
resolv/res_query.c
rpm/template
stdio-common/vfprintf.c
stdio-common/vfscanf.c
sysdeps/alpha/elf/start.S
sysdeps/generic/gnu/types.h
sysdeps/generic/prof-freq.c
sysdeps/i386/dl-machine.h
sysdeps/mach/hurd/prof-freq.c
sysdeps/posix/sysconf.c
sysdeps/stub/libc-lock.h
sysdeps/unix/alpha/sysdep.S
sysdeps/unix/i386/sysdep.S
sysdeps/unix/opendir.c
sysdeps/unix/sysv/linux/errnos.h
sysdeps/unix/sysv/linux/gnu/types.h
sysdeps/unix/sysv/linux/i386/sysdep.S
sysdeps/unix/sysv/linux/i386/sysdep.h
sysdeps/unix/sysv/linux/schedbits.h [new file with mode: 0644]
sysdeps/unix/sysv/linux/waitflags.h [new file with mode: 0644]

index 5169639b0e05fad79c58d5ef91abf41eb3659a01..dbec91baea4bc42fc993ee15b0c53a80c7995136 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,204 @@
+Sat Sep  7 05:15:45 1996  Ulrich Drepper  <drepper@cygnus.com>
+
+       * libio/iofdopen: Initialize _lock field only if _IO_MTSAFE_IO.
+       * libio/iofopen: Likewise.
+       * libio/iofopncook.c: Likewise.
+       * libio/iopopen.c: Likewise.
+       * libio/iovsprintf.c: Likewise.
+       * libio/iovsscanf.c: Likewise.
+       * libio/memstream.c: Likewise.
+       * libio/vasprintf.c: Likewise.
+       * libio/vdprintf.c: Likewise.
+       * libio/vsnprintf.c: Likewise.
+
+Sat Sep  7 03:55:47 1996  Ulrich Drepper  <drepper@cygnus.com>
+
+       * Makeconfig (soversions.mk): Also use shlib-versions files
+       in add-on directories.
+       * config.make.in (config-defines): Remove.  Not used anymore.
+       (defines): New variable.  Initiliazed by @DEFINES@.
+       * configure.in: Add AC_SUBST(DEFINES).
+
+       * libio/Makefile (routines): When compiling reentrant libc add
+       clearerr_u, feof_u, ferror_u, fputc_u, getc_u, getchar_u,
+       iofflush_u, putc_u, putchar_u, ioflockfile.
+       (CPPFLAGS): Add -D_IO_MTSAFE_IO for reentrant libc.
+
+       * sysdeps/stub/libc-lock.h: Add stubs for __libc_cleanup_region_start
+       and __libc_cleanup_region_end.
+
+       * sysdeps/unix/i386/sysdep.S [_LIBC_REENTRANT]: Set errno
+       using __errno_location function.
+       * sysdeps/unix/sysv/linux/i386/sysdep.S [_LIBC_REENTRANT]: Set errno
+       using __errno_location function.
+       (__errno_location): New function.
+       * sysdeps/unix/sysv/linux/i386/sysdep.h [PIC]: Add second
+       syscall_error handler for reentrant libc.
+
+       * sysdeps/unix/opendir.c: Remove unneeded `;'.
+
+       * libio.h [_IO_MTSAFE_IO]: Include <pthread.h>.
+       [!_IO_MTSAFE_IO]: Define _IO_flockfile and _IO_funlockfile
+       as empty macros.
+       * libioP.h: Include <libc-lock.h>.
+       * libio/stdio.h: Add prototypes for *_locked and *_unlocked
+       functions.
+
+       * libio/clearerr.c: Use _IO_ protected versions of flockfile
+       and funlockfile to be namespace clean.
+
+       * libio/genops.c: Use __libc_lock_* macros for handling lock.
+
+       * libio/iofdopen: Add initialization of _lock in _IO_FILE.
+       * libio/iofopen: Likewise.
+       * libio/iofopncook.c: Likewise.
+       * libio/iopopen.c: Likewise.
+       * libio/iovsprintf.c: Likewise.
+       * libio/iovsscanf.c: Likewise.
+       * libio/memstream.c: Likewise.
+       * libio/vasprintf.c: Likewise.
+       * libio/vdprintf.c: Likewise.
+       * libio/vsnprintf.c: Likewise.
+
+       * libio/fgetc.c: Use __libc_cleanup_region_* macros instead
+       of flockfile etc.
+       * 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/putc.c: Likewise.
+       * libio/putchar.c: Likewise.
+       * libio/rewind.c: Likewise.
+       * stdio-common/vfprintf.c: Likewise.
+       * stdio-common/vfscanf.c: Likewise.
+
+       * libio/clearerr_u.c: Correct alias name.
+       * libio/ferror_u.c: Likewise.
+       * libio/fileno.c: Likewise.
+       * libio/fputc_u.c: Likewise.
+       * libio/getc.c: Likewise.
+       * libio/getc_u.c: Likewise.
+       * libio/getchar.c: Likewise.
+       * libio/getchar_u.c: Likewise.
+       * libio/putc.c: Likewise.
+       * libio/putchar.c: Likewise.
+
+       * libio/feof_u.c: Undefine macro with name of function before
+       definition of function itself.
+
+       * libio/ioflockfile.c: New file.  Implementation of flockfile and
+       funlockfile.
+
+       * libio/putchar_u.c: Fix typo.  Use stdout instead of fp.
+
+       * malloc/malloc.h: Don't include <libc-lock.h> and don't declare
+       _malloc_loc.
+
+       * malloc/free.c: Include <libc-lock.h>.
+       * malloc/realloc.c: Likewise.
+       * malloc/malloc-find.c: Likewise.
+       * malloc/malloc-size.c: Likewise.
+       * malloc/malloc-walk.c: Likewise.
+       * malloc/memalign.c: Likewise.
+       * malloc/malloc.c: Likewise.
+
+       * sysdeps/i386/dl-machine.h: Correct clearing of _dl_starting_up.
+
+Fri Sep  6 19:38:49 1996  Ulrich Drepper  <drepper@cygnus.com>
+
+       * sysdeps/stub/libc-lock.h: Define __libc_lock_critical_start
+       and __libc_lock_critical_end as empty macros.
+
+       * malloc/malloc.h: Don't include <libc-lock.h> and don't declare
+       __libc_malloc_lock.
+       * malloc/free.c: Include <libc-lock.h>.
+       * malloc/malloc-find.c: Likewise.
+       * malloc/malloc-size.c: Likewise.
+       * malloc/malloc-walk.c: Likewise.
+       * malloc/malloc.c: Likewise.
+       * malloc/memalign.c: Likewise.
+       * malloc/realloc.c: Likewise.
+
+       * Makefile: Undo change from Mon Sep  2 22:15:14 1996.  No more
+       extra_solibs pass.
+       * Rules: Likewise.
+       * extra-lib.mk: Likewise.
+       * manual/Makefile: Likewise.
+
+       * db/Makefile (makedb): Choose dependecies based on build-shared.
+       Patch by Andres Schwab.
+
+       * sysdeps/posix/sysconf.c: Don't use PTHREAD_DESTRUCTOR_ITERATIONS
+       but _POSIX_THREAD_DESTRUCTOR_ITERATIONS.
+
+       * sysdeps/unix/sysv/linux/errnos.h: New file.
+       * sysdeps/unix/sysv/linux/schedbits.h: New file.
+       * sysdeps/unix/sysv/linux/waitflags.h: New file.
+
+       * sysdeps/unix/sysv/linux/gnu/types.h: Add definition of `key_t'.
+
+Fri Sep  6 08:26:31 1996  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+       * rpm/template: Fix typo in %build section.
+
+Fri Sep  6 03:31:07 1996  Ulrich Drepper  <drepper@cygnus.com>
+
+       * sysdeps/unix/sysv/linux/errnos.h: Don't define errno macro when
+       building libc without thread support.
+       * resolv/netdb.h: Likewise for h_errno macro.
+
+Thu Sep  5 23:01:48 1996  Ulrich Drepper  <drepper@cygnus.com>
+
+       * libc-symbols.h: Add new macro weak_const_function.  It's like
+       weak_function, but the function is additionally marked as const.
+       * features.h: Only include <sys/cdefs.h> if !__ASSEMBLER__.
+
+Thu Sep  5 22:55:49 1996  Richard Henderson  <rth@tamu.edu>
+
+       * inet/herrno.c (__h_errno_location): New function.
+       (h_errno): Make strong_alias __h_errno so that we can access
+       the variable even if `h_errno' is a macro.
+       * resolv/netdb.h: Define macro h_errno to access thread specific
+       version of h_errno variable.  Declare alias __h_errno for h_errno.
+       * resolv/res_query (h_errno): Remove definition.
+       * sysdeps/unix/sysv/linux/errnos.h [!__ASSEMBLER__ && __USE_REENTRANT]:
+       Add macro `errno' to get thread specific variable.
+       * sysdeps/unix/alpha/sysdep.S [_LIBC_REENTRANT]: Set errno using
+       __errno_location function.
+       (__errno_location): New function.
+
+Thu Sep  5 21:08:44 1996  Ulrich Drepper  <drepper@cygnus.com>
+
+       * posix/gnu/types.h: Remove definition of key_t.
+       * sysdeps/generic/gnu/types.h: Move it to here.
+       * sysdeps/unix/sysv/linux/gnu/types.h: Add Linux specific
+       definition of key_t.
+
+       * sysdeps/unix/sysv/linux/waitflags.h: New file.  Linux specific
+       definitions.
+       * sysdeps/unix/sysv/linux/schedbits.h: New file.  Include
+       clone prototypes and associated flags.
+
+Thu Sep  5 08:58:47 1996  Richard Henderson  <rth@tamu.edu>
+
+       * sysdeps/alpha/elf/start.S: Make _start global again.
+
 Thu Sep  5 13:18:25 1996  Thomas Bushnell, n/BSG  <thomas@gnu.ai.mit.edu>
 
        * sysdeps/mach/hurd/i386/init-first.c (__libc_argc, __libc_argv):
@@ -7,7 +208,7 @@ Thu Sep  5 13:18:25 1996  Thomas Bushnell, n/BSG  <thomas@gnu.ai.mit.edu>
        available, pass __libc_argv in call to __proc_set_arg_locations.
 
        * gmon/gmon.c (write_hist): Call __profile_frequency instead of
-       hertz. 
+       hertz.
        (hertz): Delete function.
        * gmon/Makefile (routines): Add `prof-freq'.
        * sysdeps/generic/prof-freq.c: New file.
@@ -22,10 +223,10 @@ Thu Sep  5 13:18:25 1996  Thomas Bushnell, n/BSG  <thomas@gnu.ai.mit.edu>
        * Rules (generated): Restore reference to $(generated).
 
        * mach/Machrules (mig.uh, mig.__h): Don't include $(user-MIGFLAGS)
-       here. 
+       here.
 
        * malloc/free.c (free): __lib_malloc_lock -> __libc_malloc_lock.
-       
+
        * malloc/free.c: Provide extern decl of __libc_malloc_lock.
        * malloc/realloc.c: Likewise.
        * malloc/malloc-find.c: Likewise.
@@ -162,6 +363,11 @@ Sat Aug 31 03:07:39 1996  Ulrich Drepper  <drepper@cygnus.com>
        * intl/l10nflist.c (_nl_normalize_codeset): We convert to lower
        case, so don't prepend uppercase `ISO' for only numeric arg.
 
+Wed Sep  4 16:16:13 1996  Ulrich Drepper  <drepper@cygnus.com>
+
+       * sysdeps/mach/hurd/send.c (__send): De-ANSI-fy.
+       * sysdeps/mach/hurd/sendto.c (sendto): Likewise.
+
 Tue Sep  3 11:16:07 1996  Thomas Bushnell/ n/BSG  <thomas@gnu.ai.mit.edu>
 
        * shadow/lckpwdf.c (__ulckpwdf): Don't take address of LOCK in
index e62608da45b968505b6be937a19143c71fc6c1bf..38589e7ebe414d0b005487e736247595b716e333 100644 (file)
@@ -523,17 +523,23 @@ ifeq (yes, $(build-shared))
 # version numbers to use when we install shared objects on this system.
 -include $(common-objpfx)soversions.mk
 $(common-objpfx)soversions.mk: $(..)shlib-versions $(..)Makeconfig \
+                              $(wildcard $(patsubst %, $(..)%/shlib-versions,\
+                                                       $(add-ons))) \
                               $(common-objpfx)config.make
-       sed 's/#.*$$//' $< | while read conf versions; do \
-         test -n "$$versions" || continue; \
-         case '$(config-machine)-$(config-vendor)-$(config-os)' in $$conf)\
-           for v in $$versions; do \
-             lib=`echo $$v | sed 's/=.*$$//'`; \
-             if eval "test -z \"\$$vers_lib$$lib\""; then \
-               eval vers_lib$${lib}=yes; \
-               echo $$v | sed "s/^.*=/$$lib.so-version=./";  \
-             fi; \
-         done ;; esac; done > $@T; exit 0
+       (file="$(..)shlib-versions \
+              $(wildcard $(patsubst %,$(..)%/shlib-versions,$(add-ons)))"; \
+        for f in $$file; do \
+        sed 's/#.*$$//' $$f | while read conf versions; do \
+          test -n "$$versions" || continue; \
+          case '$(config-machine)-$(config-vendor)-$(config-os)' in $$conf)\
+            for v in $$versions; do \
+              lib=`echo $$v | sed 's/=.*$$//'`; \
+              if eval "test -z \"\$$vers_lib$$lib\""; then \
+                eval vers_lib$${lib}=yes; \
+                echo $$v | sed "s/^.*=/$$lib.so-version=./";  \
+              fi; \
+          done ;; esac; done; \
+        done;) > $@T; exit 0
        mv -f $@T $@
 
 # Get $(version) defined with the release version number.
index b502895f09cce47ec065a049e4c43844402e5187..039e3c90bd2e830e8e35629899c8aec4301ea357 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -26,7 +26,7 @@ endif
 
 # This is the default target; it makes everything except the tests.
 .PHONY: all
-all: lib extra_solibs others
+all: lib others
 \f
 define autoconf-it
 @-rm -f $@.new
@@ -73,9 +73,9 @@ subdirs       := $(filter mach,$(subdirs)) $(filter hurd,$(subdirs)) \
 
 
 # These are the targets that are made by making them in each subdirectory.
-+subdir_targets        := subdir_lib extra_solibs objects objs others          \
-                  subdir_mostlyclean subdir_clean subdir_distclean     \
-                  subdir_realclean tests subdir_lint.out               \
++subdir_targets        := subdir_lib objects objs others subdir_mostlyclean    \
+                  subdir_clean subdir_distclean subdir_realclean       \
+                  tests subdir_lint.out                                \
                   subdir_distinfo                                      \
                   subdir_echo-headers subdir_echo-distinfo             \
                   subdir_install                                       \
diff --git a/Rules b/Rules
index 89849679472cb7241f21a2bbbec976c9f9ec4536..b6215f59e09449bfd18744816cbd22bf4f4a2c93 100644 (file)
--- a/Rules
+++ b/Rules
@@ -107,14 +107,13 @@ $(objpfx)%.out: /dev/null $(objpfx)%      # Make it 2nd arg for canned sequence.
 endif  # tests
 \f
 .PHONY: distclean realclean subdir_distclean subdir_realclean \
-       subdir_clean subdir_mostlyclean extra_solibs
+       subdir_clean subdir_mostlyclean
 subdir_mostlyclean: mostlyclean
 subdir_clean: clean
 subdir_distclean: distclean
 subdir_realclean: realclean
 realclean: distclean
 distclean: clean
-extra_solibs:
 
 .PHONY: subdir_echo-headers
 subdir_echo-headers: echo-headers
index 614d1d2ae54b13b9bbbeb5edd483e35ceeb90d43..c52910ea850563e493acca08b25fd6f725553d99 100644 (file)
@@ -13,7 +13,7 @@ config-vendor = @host_vendor@
 config-os = @host_os@
 config-sysdirs = @sysnames@
 
-config-defines = @DEFS@
+defines = @DEFINES@
 
 elf = @elf@
 have-initfini = @libc_cv_have_initfini@
index 68aa0d7053768b332e70319f7c6ee722792a31a3..d2f0c3c569cf4db571184f4a91e1f4757f34a66e 100755 (executable)
--- a/configure
+++ b/configure
@@ -1754,6 +1754,8 @@ fi
 
 
 
+
+
 if test "`(cd $srcdir; pwd)`" = "`pwd`"; then
   config_makefile=
 else
@@ -1912,6 +1914,7 @@ s%@elf@%$elf%g
 s%@shared@%$shared%g
 s%@profile@%$profile%g
 s%@omitfp@%$omitfp%g
+s%@DEFINES@%$DEFINES%g
 
 CEOF
 EOF
index d5370f897e748141f70a3a3b70ad455d39efd560..ce9f61d967a494d04a579ead598eb0ad8dafb658 100644 (file)
@@ -668,6 +668,8 @@ fi
 AC_SUBST(profile)
 AC_SUBST(omitfp)
 
+AC_SUBST(DEFINES)
+
 if test "`(cd $srcdir; pwd)`" = "`pwd`"; then
   config_makefile=
 else
index 9613c2e370df61c602038d5074d0949214467ba6..37dc28289305939a9982cd1a486696e269375504 100644 (file)
@@ -39,4 +39,8 @@ CFLAGS-hash_func.c := -Wno-unused
 # The db code outsmarts the compiler frequently.
 override CFLAGS += -Wno-uninitialized
 
-LDLIBS-makedb := db/libdb
+ifeq ($(build_shared),yes)
+$(objpfx)makedb: $(objpfx)libdb.so$(libdb.so-version)
+else
+$(objpfx)makedb: $(objpfx)libdb.a
+endif
index 1db7520a349374b66942be64ce2cb480f1637495..e6088943e2f02df08fd8f01828951b2431045c8c 100644 (file)
@@ -28,7 +28,7 @@ alltypes-$(lib) := $(foreach o,$(object-suffixes-$(lib)),\
 ifeq (,$(filter $(lib),$(extra-libs-others)))
 lib-noranlib: $(alltypes-$(lib))
 ifeq (yes,$(build-shared))
-extra_solibs: $(objpfx)$(lib).so$($(lib).so-version)
+lib-noranlib: $(objpfx)$(lib).so$($(lib).so-version)
 endif
 else
 others: $(alltypes-$(lib))
@@ -37,7 +37,7 @@ endif
 # The linked shared library is never a dependent of lib-noranlib,
 # because linking it will depend on libc.so already being built.
 ifneq (,$(filter .so,$(object-suffixes-$(lib))))
-extra_solibs: $(objpfx)$(lib).so
+others: $(objpfx)$(lib).so
 endif
 
 
index 4aee806ba8cdffd1c7dfb968f456e74625e8665d..47a4124502ea8e64f4b4fc0440987d54a737f676 100644 (file)
@@ -160,7 +160,9 @@ Cambridge, MA 02139, USA.  */
 
 
 /* This is here only because every header file already includes this one.  */
+#ifndef __ASSEMBLER__
 #include <sys/cdefs.h>
+#endif
 
 /* This is here only because every header file already includes this one.  */
 #ifndef _LIBC
index 7e413adf7a3ab80b09236f84d5e6036b87e8fe65..312760e81df7f440170a5f71d187c7039f19458e 100644 (file)
@@ -16,7 +16,19 @@ 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 <features.h>
+
 /* We need to have the error status variable of the resolver
    accessible in the libc.  */
-int h_errno;
+int __h_errno;
+strong_alias (__h_errno, h_errno)
 
+/* When threaded, h_errno may be a per-process variable.  */
+#ifdef __USE_REENTRANT
+int
+weak_const_function
+__h_errno_location (void)
+{
+  return &__h_errno;
+}
+#endif
index 2f72d5fa7afa589d870789edf54e30ee441a9050..c64d8826f7be451aff4aa59aed9d6c65f2b5dd82 100644 (file)
@@ -202,6 +202,7 @@ extern const char _libc_intl_domainname[];
 /* This comes between the return type and function name in
    a function definition to make that definition weak.  */
 #define weak_function __attribute__ ((weak))
+#define weak_const_function __attribute__ ((weak, __const__))
 
 #endif /* HAVE_WEAK_SYMBOLS.  */
 #endif /* Not ASSEMBLER, and GCC 2.7 or later.  */
@@ -213,6 +214,7 @@ extern const char _libc_intl_domainname[];
    directive for the function symbol, and a `.weak' directive in addition
    will produce an error from the assembler.  */
 #define weak_function /* empty */
+#define weak_const_function /* empty */
 #endif
 
 
index e4df6b545e46ddb78633acaad84910fec03277d6..355a79a0e58d83fa9b8e22ea798af17ebaa59365 100644 (file)
@@ -36,6 +36,15 @@ routines     :=                                                            \
                                                                              \
        libc_fatal
 
+include ../Makeconfig
+
+ifneq (,$(filter %REENTRANT, $(defines)))
+routines += clearerr_u feof_u ferror_u fputc_u getc_u getchar_u                      \
+           iofflush_u putc_u putchar_u ioflockfile
+
+CPPFLAGS += -D_IO_MTSAFE_IO
+endif
+
 aux    :=                                                                    \
        cleanup fileops genops stdfiles stdio strops
 
index 669a9b0d74b8e38da06fb2a5522c2bee34456093..9dfdb11530ec0f402728b0d0e0a46c872717227d 100644 (file)
@@ -24,9 +24,9 @@ clearerr (fp)
      FILE *fp;
 {
   CHECK_FILE (fp, /*nothing*/);
-  flockfile (fp);
+  _IO_flockfile (fp);
   _IO_clearerr (fp);
-  funlockfile (fp);
+  _IO_funlockfile (fp);
 }
 
 #ifdef _IO_MTSAFE_IO
index 83ed65d8b18ba66c4ea7ca21369eee63dc940b55..4c8b6c29bdcaa2b3db0b0bea1f27059f1a245bcd 100644 (file)
@@ -27,4 +27,4 @@ __clearerr_unlocked (fp)
   _IO_clearerr (fp);
 }
 
-weak_alias (clearerr_unlocked, __clearerr_unlocked)
+weak_alias (__clearerr_unlocked, clearerr_unlocked)
index 5ce5583613fd90e15904d84c3b9062904b28457a..6ed8b7d4fe5b2e9782b6f91bd9f9b7ecf37b3c31 100644 (file)
@@ -24,6 +24,8 @@ the executable file might be covered by the GNU General Public License. */
 #include "libioP.h"
 #include "stdio.h"
 
+#undef feof_unlocked
+
 int
 feof_unlocked (fp)
      _IO_FILE* fp;
index bee668d6d98088f3ac2e6e3c15dbab110cf0f467..df550d9d4de3aabe5699da35b7c5b5d84a41b83d 100644 (file)
@@ -24,6 +24,8 @@ the executable file might be covered by the GNU General Public License. */
 #include "libioP.h"
 #include "stdio.h"
 
+#undef ferror_unlocked
+
 int
 ferror_unlocked (fp)
      _IO_FILE* fp;
index 2aaea05cfe82efeba7358c2a4911e32fee98af1d..07fd89a51614f19447e970de4a3112b14e4ed96d 100644 (file)
@@ -31,8 +31,9 @@ fgetc (fp)
 {
   int result;
   CHECK_FILE (fp, EOF);
-  flockfile (fp);
+  __libc_cleanup_region_start (_IO_funlockfile, fp);
+  _IO_flockfile (fp);
   result = _IO_getc_unlocked (fp);
-  funlockfile (fp);
+  __libc_cleanup_region_end (1);
   return result;
 }
index 2dc67149c8c2c2fe2db21a508236711d88defa40..08e657b9709766fd04fb455991652130329a5977 100644 (file)
@@ -42,6 +42,6 @@ fileno (fp)
    it only accesses once a single variable and this is already atomic
    (at least at thread level).  */
 
-weak_alias (fileno_unlocked, fileno)
-weak_alias (fileno_locked, fileno)
+weak_alias (fileno, fileno_unlocked)
+weak_alias (fileno, fileno_locked)
 #endif
index 339861119f700d2832e6d6170b8a84d1b5639692..bd871ab047f7b01e5b96660858b4bc1bec161138 100644 (file)
@@ -32,8 +32,11 @@ fputc (c, fp)
 {
   int result;
   CHECK_FILE (fp, EOF);
+  __libc_cleanup_region_start (&_IO_funlockfile, fp);
   _IO_flockfile (fp);
   result = _IO_putc_unlocked (c, fp);
-  _IO_funlockfile (fp);
+  __libc_cleanup_region_end (1);
   return result;
 }
+
+weak_alias (fputc, fputc_locked)
index 211e206605a00943e3ef3cf15bdde2734d3c7027..97e4d94eb30e1e89cf1005d999195c4ef2232888 100644 (file)
@@ -36,4 +36,4 @@ __fputc_unlocked (c, fp)
   return _IO_putc_unlocked (c, fp);
 }
 
-weak_alias (fputc_unlocked, __fputc_unlocked)
+weak_alias (__fputc_unlocked, fputc_unlocked)
index 829af31dc1a1be223d3f8f19cf7d86461171298c..5821e84c6f968ebf9ecf36e88e31c715af7374b2 100644 (file)
@@ -35,8 +35,9 @@ freopen (filename, mode, fp)
   CHECK_FILE (fp, NULL);
   if (!(fp->_flags & _IO_IS_FILEBUF))
     return NULL;
-  flockfile (fp);
+  __libc_cleanup_region_start (&_IO_funlockfile, fp);
+  _IO_flockfile (fp);
   result = _IO_freopen (filename, mode, fp);
-  funlockfile (fp);
+  __libc_cleanup_region_end (1);
   return result;
 }
index 5255e9defe7089090b4aa13cfa0ba680dec78acb..c33927a95f0da1c7000f581871a6c85ad4950b7c 100644 (file)
@@ -1,5 +1,5 @@
 /*
-Copyright (C) 1993, 1995 Free Software Foundation
+Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
 
 This file is part of the GNU IO Library.  This library is free
 software; you can redistribute it and/or modify it under the
@@ -22,8 +22,8 @@ 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. */
 
-#include "stdio.h"
 #include "libioP.h"
+#include "stdio.h"
 
 int
 fseek (fp, offset, whence)
@@ -33,8 +33,9 @@ fseek (fp, offset, whence)
 {
   int result;
   CHECK_FILE (fp, -1);
-  flockfile (fp);
+  __libc_cleanup_region_start (&_IO_funlockfile, fp);
+  _IO_flockfile (fp);
   result = _IO_fseek (fp, offset, whence);
-  funlockfile (fp);
+  __libc_cleanup_region_end (1);
   return result;
 }
index 98eef94b58ea6599df1d42aa3f2ca10fb66fccdb..818e740851d9636749b40c04b9131309de0d17bb 100644 (file)
@@ -466,7 +466,7 @@ DEFUN(_IO_init, (fp, flags),
   fp->_markers = NULL;
   fp->_cur_column = 0;
 #ifdef _IO_MTSAFE_IO
-  _IO_mutex_init (fp->_lock);
+  __libc_lock_init (fp->_lock);
 #endif
 }
 
@@ -501,7 +501,7 @@ DEFUN(_IO_default_finish, (fp),
     }
 
 #ifdef _IO_MTSAFE_IO
-  _IO_mutex_destroy (fp->_lock);
+  __libc_lock_fini (fp->_lock);
 #endif
 
   _IO_un_link(fp);
index 89abc0dac01dbb75b93673b65e0e2e89a813a7ab..82e5756ad3a01ab0c0a9863042d25e095e6165a6 100644 (file)
@@ -33,14 +33,15 @@ getc (fp)
 {
   int result;
   CHECK_FILE (fp, EOF);
+  __libc_cleanup_region_start (&_IO_funlockfile, fp);
   _IO_flockfile (fp);
   result = _IO_getc_unlocked (fp);
-  _IO_funlockfile (fp);
+  __libc_cleanup_region_end (1);
   return result;
 }
 
 #ifdef _IO_MTSAFE_IO
 # undef getc_locked
 
-weak_alias (getc_locked, getc)
+weak_alias (getc, getc_locked)
 #endif
index e6491bb9441c10b12f80fa698a033d6e50c9334f..4aa5cd5ccd1bc97e2df1ac5ac57760ed500fe1ca 100644 (file)
@@ -35,4 +35,4 @@ __getc_unlocked (fp)
   return _IO_getc_unlocked (fp);
 }
 
-weak_alias (getc_unlocked, __getc_unlocked)
+weak_alias (__getc_unlocked, getc_unlocked)
index fa5c11f73140881407f317e11acaf7bad2f866ff..e7a236cf2e19dfb74a8aefb35dec7a7d16051dc6 100644 (file)
@@ -31,14 +31,15 @@ int
 getchar ()
 {
   int result;
+  __libc_cleanup_region_start (&_IO_funlockfile, stdin);
   _IO_flockfile (stdin);
   result = _IO_getc_unlocked (stdin);
-  _IO_funlockfile (stdin);
+  __libc_cleanup_region_end (1);
   return result;
 }
 
 #ifdef _IO_MTSAFE_IO
 # undef getchar_locked
 
-weak_alias (getchar_locked, getchar)
+weak_alias (getchar, getchar_locked)
 #endif
index 40cfbf66250b08ed4b33a2c624b2885c557dbbd2..0430f8119c830fb4bb71dff7fb2adee75668630d 100644 (file)
@@ -33,4 +33,4 @@ __getchar_unlocked ()
   return _IO_getc_unlocked (stdin);
 }
 
-weak_alias (getchar_unlocked, __getchar_unlocked)
+weak_alias (__getchar_unlocked, getchar_unlocked)
index e5cae966fd6ad1ccc2c2b3460664661a758fbf35..9d537377a414878fc8cdfce4085e0e7812e12092 100644 (file)
@@ -35,6 +35,7 @@ _IO_fclose (fp)
 
   CHECK_FILE(fp, EOF);
 
+  __libc_cleanup_region_start (&_IO_funlockfile, fp);
   _IO_flockfile (fp);
   if (fp->_IO_file_flags & _IO_IS_FILEBUF)
     status = _IO_file_close_it (fp);
@@ -46,7 +47,7 @@ _IO_fclose (fp)
       fp->_IO_file_flags = 0;
       free(fp);
     }
-  _IO_funlockfile (fp);
+  __libc_cleanup_region_end (1);
   return status;
 }
 
index 6bb19fa2149e9f4a12e9e872624b6137cdc95462..c49387b1a0255af000bba5cfa83b2c89b0521347 100644 (file)
@@ -39,7 +39,11 @@ _IO_fdopen (fd, mode)
 {
   int read_write;
   int posix_mode = 0;
-  struct _IO_FILE_plus *fp;
+  struct locked_FILE
+  {
+    struct _IO_FILE_plus fp;
+    _IO_lock_t lock;
+  } *new_f;
   int fd_flags;
 
   switch (*mode++)
@@ -97,28 +101,29 @@ _IO_fdopen (fd, mode)
     }
 #endif
 
-  fp = (struct _IO_FILE_plus *) malloc (sizeof (struct _IO_FILE_plus));
-  if (fp == NULL)
+  new_f = (struct locked_FILE *) malloc (sizeof (struct locked_FILE));
+  if (new_f == NULL)
     return NULL;
-  _IO_init (&fp->file, 0);
-  _IO_JUMPS (&fp->file) = &_IO_file_jumps;
-  _IO_file_init (&fp->file);
+  new_f->fp.file._lock = &new_f->lock;
+  _IO_init (&new_f->fp.file, 0);
+  _IO_JUMPS (&new_f->fp.file) = &_IO_file_jumps;
+  _IO_file_init (&new_f->fp.file);
 #if  !_IO_UNIFIED_JUMPTABLES
-  fp->vtable = NULL;
+  new_f->fp.vtable = NULL;
 #endif
-  if (_IO_file_attach (&fp->file, fd) == NULL)
+  if (_IO_file_attach (&new_f->fp.file, fd) == NULL)
     {
-      _IO_un_link (&fp->file);
-      free (fp);
+      _IO_un_link (&new_f->fp.file);
+      free (new_f);
       return NULL;
     }
-  fp->file._flags &= ~_IO_DELETE_DONT_CLOSE;
+  new_f->fp.file._flags &= ~_IO_DELETE_DONT_CLOSE;
 
-  fp->file._IO_file_flags =
-    _IO_mask_flags (&fp->file, read_write,
+  new_f->fp.file._IO_file_flags =
+    _IO_mask_flags (&new_f->fp.file, read_write,
                    _IO_NO_READS+_IO_NO_WRITES+_IO_IS_APPENDING);
 
-  return (_IO_FILE *) fp;
+  return (_IO_FILE *) &new_f->fp;
 }
 
 weak_alias (_IO_fdopen, fdopen)
index 6fe2d5262df6c1872f51aa09a098a81e309304dc..cbc5b1f6d79157a0b010c38c87381903c8a4fdfc 100644 (file)
@@ -1,5 +1,5 @@
 /*
-Copyright (C) 1993, 1995 Free Software Foundation
+Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
 
 This file is part of the GNU IO Library.  This library is free
 software; you can redistribute it and/or modify it under the
@@ -33,10 +33,11 @@ _IO_fflush (fp)
   else
     {
       int result;
-      _IO_flockfile (fp);
       CHECK_FILE (fp, EOF);
+      __libc_cleanup_region_start (&_IO_funlockfile, fp);
+      _IO_flockfile (fp);
       result = _IO_SYNC (fp) ? EOF : 0;
-      _IO_funlockfile (fp);
+      __libc_cleanup_region_end (1);
       return result;
     }
 }
index 50014765f90bdf61ae8f7901e658a063ca1b379c..c45cfacb06e32052d420ab77ed3a10619a6f3e91 100644 (file)
@@ -1,5 +1,5 @@
 /*
-Copyright (C) 1993, 1995 Free Software Foundation
+Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
 
 This file is part of the GNU IO Library.  This library is free
 software; you can redistribute it and/or modify it under the
@@ -33,9 +33,10 @@ _IO_fgetpos (fp, posp)
 {
   _IO_fpos_t pos;
   CHECK_FILE (fp, EOF);
+  __libc_cleanup_region_start (&_IO_funlockfile, fp);
   _IO_flockfile (fp);
   pos = _IO_seekoff (fp, 0, _IO_seek_cur, 0);
-  _IO_funlockfile (fp);
+  __libc_cleanup_region_end (1);
   if (pos == _IO_pos_BAD)
     {
 #ifdef EIO
index 88d4bd518e64aafc39e89d8821278b4de48205e3..369251f22ae7a6d605df46862c1b134757dd74cd 100644 (file)
@@ -35,6 +35,7 @@ _IO_fgets (buf, n, fp)
   CHECK_FILE (fp, NULL);
   if (n <= 0)
     return NULL;
+  __libc_cleanup_region_start (&_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))
@@ -44,7 +45,7 @@ _IO_fgets (buf, n, fp)
       buf[count] = '\0';
       result = buf;
     }
-  _IO_funlockfile (fp);
+  __libc_cleanup_region_end (1);
   return result;
 }
 
diff --git a/libio/ioflockfile.c b/libio/ioflockfile.c
new file mode 100644 (file)
index 0000000..a68f4b6
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+Copyright (C) 1996 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 this library; see the file COPYING.  If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA  02111-1307, 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. */
+
+#include "libioP.h"
+#include <libc-lock.h>
+
+void
+_IO_flockfile (s)
+     _IO_FILE *s;
+{
+  __libc_lock_lock (s->_lock);
+}
+weak_alias (_IO_flockfile, flockfile)
+
+
+void
+_IO_funlockfile (s)
+     _IO_FILE *s;
+{
+  __libc_lock_unlock (s->_lock);
+}
+weak_alias (_IO_funlockfile, funlockfile)
index 14cce5336a854600a3f4059a48b4b31d6f40b3b6..334df4652ad9cefffe46fb95a1d7bcc0fe4edcaa 100644 (file)
@@ -32,20 +32,25 @@ _IO_fopen (filename, mode)
      const char *filename;
      const char *mode;
 {
-  struct _IO_FILE_plus *fp =
-    (struct _IO_FILE_plus *) malloc (sizeof (struct _IO_FILE_plus));
-  if (fp == NULL)
+  struct locked_FILE
+  {
+    struct _IO_FILE_plus fp;
+    _IO_lock_t lock;
+  } *new_f = (struct locked_FILE *) malloc (sizeof (struct locked_FILE));
+
+  if (new_f == NULL)
     return NULL;
-  _IO_init (&fp->file, 0);
-  _IO_JUMPS (&fp->file) = &_IO_file_jumps;
-  _IO_file_init (&fp->file);
+  new_f->fp.file._lock = &new_f->lock;
+  _IO_init (&new_f->fp.file, 0);
+  _IO_JUMPS (&new_f->fp.file) = &_IO_file_jumps;
+  _IO_file_init (&new_f->fp.file);
 #if  !_IO_UNIFIED_JUMPTABLES
-  fp->vtable = NULL;
+  new_f->fp.vtable = NULL;
 #endif
-  if (_IO_file_fopen (&fp->file, filename, mode) != NULL)
-        return (_IO_FILE *) fp;
-  _IO_un_link (&fp->file);
-  free (fp);
+  if (_IO_file_fopen (&new_f->fp.file, filename, mode) != NULL)
+        return (_IO_FILE *) &new_f->fp;
+  _IO_un_link (&new_f->fp.file);
+  free (new_f);
   return NULL;
 }
 
index 989f6d6fe74fb9c39c53fa56850e1471d3b71afa..4193c2447d9b41a1added2d26d182a8209809ae2 100644 (file)
@@ -128,7 +128,11 @@ fopencookie (cookie, mode, io_functions)
      _IO_cookie_io_functions_t io_functions;
 {
   int read_write;
-  struct _IO_cookie_file *cfile;
+  struct locked_FILE
+  {
+    struct _IO_cookie_file cfile;
+    _IO_lock_t lock;
+  } *new_f;
 
   switch (*mode++)
     {
@@ -147,21 +151,21 @@ fopencookie (cookie, mode, io_functions)
   if (mode[0] == '+' || (mode[0] == 'b' && mode[1] == '+'))
     read_write &= _IO_IS_APPENDING;
 
-  cfile  = (struct _IO_cookie_file *) malloc (sizeof (struct _IO_cookie_file));
-  if (cfile == NULL)
+  new_f = (struct locked_FILE *) malloc (sizeof (struct locked_FILE));
+  if (new_f == NULL)
     return NULL;
+  new_f->cfile.file._lock = &new_f->lock;
 
-  _IO_init (&cfile->file, 0);
-  _IO_JUMPS (&cfile->file) = &_IO_cookie_jumps;
-  cfile->cookie = cookie;
-  cfile->io_functions = io_functions;
+  _IO_init (&new_f->cfile.file, 0);
+  _IO_JUMPS (&new_f->cfile.file) = &_IO_cookie_jumps;
+  new_f->cfile.cookie = cookie;
+  new_f->cfile.io_functions = io_functions;
 
-  _IO_file_init(&cfile->file);
+  _IO_file_init(&new_f->cfile.file);
 
-  cfile->file._IO_file_flags =
-    _IO_mask_flags (&cfile->file, read_write,
+  new_f->cfile.file._IO_file_flags =
+    _IO_mask_flags (&new_f->cfile.file, read_write,
                    _IO_NO_READS+_IO_NO_WRITES+_IO_IS_APPENDING);
 
-  return &cfile->file;
+  return &new_f->cfile.file;
 }
-
index 3359515ac85fe2ff3e1ad44c24e2d884fb558fef..a9fd5f29a30f21ff895fae8ec779b2c883d75513 100644 (file)
@@ -33,12 +33,13 @@ _IO_fputs (str, fp)
   _IO_size_t len = strlen (str);
   int result;
   CHECK_FILE (fp, EOF);
+  __libc_cleanup_region_start (&_IO_funlockfile, fp);
   _IO_flockfile (fp);
   if (_IO_sputn (fp, str, len) != len)
     result = EOF;
   else
     result = 1;
-  _IO_funlockfile (fp);
+  __libc_cleanup_region_end (1);
   return result;
 }
 
index bad94ca17bb65614194f2a53533f46d9870520a0..af6bc33f240f03a2a8f4eaee77ba8ca06514e164 100644 (file)
@@ -36,9 +36,10 @@ _IO_fread (buf, size, count, fp)
   CHECK_FILE (fp, 0);
   if (bytes_requested == 0)
     return 0;
+  __libc_cleanup_region_start (&_IO_funlockfile, fp);
   _IO_flockfile (fp);
   bytes_read = _IO_sgetn (fp, (char *) buf, bytes_requested);
-  _IO_funlockfile (fp);
+  __libc_cleanup_region_end (1);
   return bytes_requested == bytes_read ? count : bytes_read / size;
 }
 weak_alias (_IO_fread, fread)
index c8897522d648c094d5b4a6fea3a2e77e103616e6..96c3a7a2a03df091dbf9d7e48c4b81f33ef8a053 100644 (file)
@@ -32,6 +32,7 @@ _IO_fsetpos (fp, posp)
 {
   int result;
   CHECK_FILE (fp, EOF);
+  __libc_cleanup_region_start (&_IO_funlockfile, fp);
   _IO_flockfile (fp);
   if (_IO_seekpos (fp, *posp, _IOS_INPUT|_IOS_OUTPUT) == _IO_pos_BAD)
     {
@@ -44,7 +45,7 @@ _IO_fsetpos (fp, posp)
     }
   else
     result = 0;
-  _IO_funlockfile (fp);
+  __libc_cleanup_region_end (1);
   return result;
 }
 
index d49f8c35531989abb9b504a16e3334aeade819be..12b90b37f52fca1713396b3dd4f060e9b3804263 100644 (file)
@@ -1,5 +1,5 @@
 /*
-Copyright (C) 1993, 1995 Free Software Foundation
+Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
 
 This file is part of the GNU IO Library.  This library is free
 software; you can redistribute it and/or modify it under the
@@ -32,9 +32,10 @@ _IO_ftell (fp)
 {
   _IO_pos_t pos;
   CHECK_FILE (fp, -1L);
+  __libc_cleanup_region_start (&_IO_funlockfile, fp);
   _IO_flockfile (fp);
   pos = _IO_seekoff (fp, 0, _IO_seek_cur, 0);
-  _IO_funlockfile (fp);
+  __libc_cleanup_region_end (1);
   if (pos == _IO_pos_BAD)
     {
 #ifdef EIO
index 0bbeef264670dd7881647f61f4d4872dae92980a..4ee489d2b17c598f1333a26d322390c8613edc04 100644 (file)
@@ -1,5 +1,5 @@
 /*
-Copyright (C) 1993 Free Software Foundation
+Copyright (C) 1993, 1996 Free Software Foundation, Inc.
 
 This file is part of the GNU IO Library.  This library is free
 software; you can redistribute it and/or modify it under the
@@ -36,9 +36,10 @@ _IO_fwrite (buf, size, count, fp)
   CHECK_FILE (fp, 0);
   if (request == 0)
     return 0;
+  __libc_cleanup_region_start (&_IO_funlockfile, fp);
   _IO_flockfile (fp);
   written = _IO_sputn (fp, (const char *) buf, request);
-  _IO_funlockfile (fp);
+  __libc_cleanup_region_end (1);
   /* Many traditional implementations return 0 if size==0 && count > 0,
      but ANSI seems to require us to return count in this case. */
   if (written == request)
index 1d14551615fb9bfe301aa4e52dc4fd19626dba65..0acd76e6c5d408796face37396293f29e8e06dad 100644 (file)
@@ -1,5 +1,5 @@
 /*
-Copyright (C) 1994 Free Software Foundation
+Copyright (C) 1994, 1996 Free Software Foundation, Inc.
 
 This file is part of the GNU IO Library.  This library is free
 software; you can redistribute it and/or modify it under the
@@ -54,6 +54,7 @@ _IO_getdelim (lineptr, n, delimiter, fp)
       return -1;
     }
   CHECK_FILE (fp, -1);
+  __libc_cleanup_region_start (&_IO_funlockfile, fp);
   _IO_flockfile (fp);
   if (_IO_ferror_unlocked (fp))
     {
@@ -115,7 +116,7 @@ _IO_getdelim (lineptr, n, delimiter, fp)
   result = cur_len;
 
 unlock_return:
-  _IO_funlockfile (fp);
+  __libc_cleanup_region_end (1);
   return result;
 }
 
index 352e80244b60cb37863a2bfe9d78dc83cb26de66..8fdc4350a9b285736396916d2ccc9ba1fb91c928 100644 (file)
@@ -1,5 +1,5 @@
 /*
-Copyright (C) 1993 Free Software Foundation
+Copyright (C) 1993, 1996 Free Software Foundation, Inc.
 
 This file is part of the GNU IO Library.  This library is free
 software; you can redistribute it and/or modify it under the
@@ -32,6 +32,7 @@ _IO_gets (buf)
   _IO_size_t count;
   int ch;
 
+  __libc_cleanup_region_start (&_IO_funlockfile, _IO_stdin);
   _IO_flockfile (_IO_stdin);
   ch = _IO_getc_unlocked (_IO_stdin);
   if (ch == EOF)
@@ -45,7 +46,7 @@ _IO_gets (buf)
       if (_IO_stdin->_IO_file_flags & _IO_ERR_SEEN)
        return NULL;
     }
-  _IO_funlockfile (_IO_stdin);
+  __libc_cleanup_region_end (1);
   buf[count] = 0;
   return buf;
 }
index 5b9bd4844d8f33e3eb35513b14ce1cc3e63cf585..ca2a18edac1cee11a6fe4ad7a274be3aaaf6d504 100644 (file)
@@ -149,10 +149,18 @@ _IO_FILE *
 DEFUN(_IO_popen, (command, mode),
       const char *command AND const char *mode)
 {
-  _IO_proc_file *fpx = (_IO_proc_file*)malloc(sizeof(_IO_proc_file));
-  _IO_FILE *fp = (_IO_FILE*)fpx;
-  if (fp == NULL)
+  struct locked_FILE
+  {
+    struct _IO_proc_file fpx;
+    _IO_lock_t lock;
+  } *new_f;
+  _IO_FILE *fp;
+
+  new_f = (struct locked_FILE *) malloc (sizeof (struct locked_FILE));
+  if (new_f == NULL)
     return NULL;
+  new_f->fpx.file.file._lock = &new_f->lock;
+  fp = (_IO_FILE*)&new_f->fpx;
   _IO_init(fp, 0);
   _IO_JUMPS(fp) = &_IO_proc_jumps;
   _IO_file_init(fp);
@@ -161,7 +169,7 @@ DEFUN(_IO_popen, (command, mode),
 #endif
   if (_IO_proc_open (fp, command, mode) != NULL)
     return fp;
-  free (fpx);
+  free (new_f);
   return NULL;
 }
 
index 6c52f7521cb4c62a7394e8165eadf65d6511beac..2770ab29358fda811bf03c4b270a404eda4597d0 100644 (file)
@@ -30,13 +30,14 @@ _IO_puts (str)
 {
   int result;
   _IO_size_t len = strlen (str);
-  _IO_flockfile (fp);
+  __libc_cleanup_region_start (&_IO_funlockfile, _IO_stdout);
+  _IO_flockfile (_IO_stdout);
   if (_IO_sputn (_IO_stdout, str, len) == len
       && _IO_putc_unlocked ('\n', _IO_stdout) != EOF)
     result = len + 1;
   else
     result = EOF;
-  _IO_funlockfile (fp);
+  __libc_cleanup_region_end (1);
   return result;
 }
 weak_alias (_IO_puts, puts)
index d3fc7e5917ff30601fd814b93f5a05c3c8f6b15f..e44f33962f24453547b63e63ca7405bab0046fef 100644 (file)
@@ -31,12 +31,13 @@ _IO_setbuffer (fp, buf, size)
      _IO_size_t size;
 {
   CHECK_FILE (fp, );
+  __libc_cleanup_region_start (&_IO_funlockfile, fp);
   _IO_flockfile (fp);
   fp->_flags &= ~_IO_LINE_BUF;
   if (!buf)
     size = 0;
   (void) _IO_SETBUF (fp, buf, size);
-  _IO_funlockfile (fp);
+  __libc_cleanup_region_end (1);
 }
 
 weak_alias (_IO_setbuffer, setbuffer)
index 6d4bcff2bc15df200eea90a3917b47894dc47a6d..e9dccae529209c027762a7e4ac878a8cb9d4f37c 100644 (file)
@@ -1,5 +1,5 @@
 /*
-Copyright (C) 1993 Free Software Foundation
+Copyright (C) 1993, 1996 Free Software Foundation, Inc.
 
 This file is part of the GNU IO Library.  This library is free
 software; you can redistribute it and/or modify it under the
@@ -37,6 +37,7 @@ _IO_setvbuf (fp, buf, mode, size)
 {
   int result;
   CHECK_FILE (fp, EOF);
+  __libc_cleanup_region_start (&_IO_funlockfile, fp);
   _IO_flockfile (fp);
   switch (mode)
     {
@@ -88,7 +89,7 @@ _IO_setvbuf (fp, buf, mode, size)
     }
   result = _IO_SETBUF (fp, buf, size) == NULL ? EOF : 0;
 unlock_return:
-  _IO_funlockfile (fp);
+  __libc_cleanup_region_end (1);
   return result;
 }
 
index c1237b5f9bca2f520a597481d8a6d32077ba26df..cc414083f8aafadad420656bd595ff8f86b3c037 100644 (file)
@@ -33,9 +33,10 @@ _IO_ungetc (c, fp)
   CHECK_FILE (fp, EOF);
   if (c == EOF)
     return EOF;
+  __libc_cleanup_region_start (&_IO_funlockfile, fp);
   _IO_flockfile (fp);
   result = _IO_sputbackc (fp, (unsigned char) c);
-  _IO_funlockfile (fp);
+  __libc_cleanup_region_end (1);
   return result;
 }
 
index 2c5d77503d17815de7c97d46272aa11cea3d42a2..916804f63d069765d46ceab45d5439804aedb118 100644 (file)
@@ -32,7 +32,10 @@ _IO_vsprintf (string, format, args)
       _IO_va_list args;
 {
   _IO_strfile sf;
+  _IO_lock_t lock;
   int ret;
+
+  sf._f._lock = &lock;
   _IO_init ((_IO_FILE *) &sf, 0);
   _IO_JUMPS ((_IO_FILE *) &sf) = &_IO_str_jumps;
   _IO_str_init_static ((_IO_FILE *) &sf, string, -1, string);
index dcd3e929024acd2fa12b744bc75589f533247cca..5b4c7905170628fd790c7d5d0de72f9cba71e1a5 100644 (file)
@@ -30,6 +30,8 @@ DEFUN(_IO_vsscanf, (string, format, args),
       const char *string AND const char *format AND _IO_va_list args)
 {
   _IO_strfile sf;
+  _IO_lock_t lock;
+  sf._f._lock = &lock;
   _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);
index b498f125ebd7fb2ed984c6274fbfc31f5261f5bd..17cef9112189a8331aa4b052eeb420a9128ba9e6 100644 (file)
@@ -150,6 +150,7 @@ typedef struct
 
 /* Handle lock.  */
 #ifdef _IO_MTSAFE_IO
+#include <pthread.h>
 typedef pthread_mutex_t _IO_lock_t;
 #else
 typedef void _IO_lock_t;
@@ -272,10 +273,10 @@ extern int _IO_putc_locked __P ((int, _IO_FILE *));
 extern void _IO_flockfile __P ((_IO_FILE *));
 extern void _IO_funlockfile __P ((_IO_FILE *));
 
-#if !defined(_REENTRANT) && !defined(_THREAD_SAFE)
+#ifndef _IO_MTSAFE_IO
 # define _IO_flockfile(FILE) /**/
 # define _IO_funlockfile(FILE) /**/
-#endif /* _REENTRANT || _THREAD_SAFE */
+#endif /* !_IO_MTSAFE_IO */
 
 
 extern int _IO_vfscanf __P((_IO_FILE*, const char*, _IO_va_list, int*));
index 8525b718277697e7985c8c98fe16e6069e17bfdd..ac4df17ce85eee566f152d39a93cb3feb6373ea5 100644 (file)
@@ -26,6 +26,7 @@ the executable file might be covered by the GNU General Public License. */
 #ifndef errno
 extern int errno;
 #endif
+#include <libc-lock.h>
 
 #include "iolibio.h"
 
index a2fe8447cb40649c78d6a1267870c23cb3c5d91d..1a4f4b9e9669e107c3470bed4ed9df631f18bc08 100644 (file)
@@ -16,8 +16,8 @@ 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 "strfile.h"
 #include "libioP.h"
+#include "strfile.h"
 #include <stdio.h>
 #include <stdlib.h>
 
@@ -64,26 +64,30 @@ open_memstream (bufloc, sizeloc)
      char **bufloc;
      _IO_size_t *sizeloc;
 {
-  struct _IO_FILE_memstream *fp;
+  struct locked_FILE
+  {
+    struct _IO_FILE_memstream fp;
+    _IO_lock_t lock;
+  } *new_f;
   char *buf;
 
-  fp = (struct _IO_FILE_memstream *)
-    malloc (sizeof (struct _IO_FILE_memstream));
-  if (fp == NULL)
+  new_f = (struct locked_FILE *) malloc (sizeof (struct locked_FILE));
+  if (new_f == NULL)
     return NULL;
+  new_f->fp._sf._f._lock = &new_f->lock;
 
   buf = ALLOC_BUF (_IO_BUFSIZ);
-  _IO_init (&fp->_sf._f, 0);
-  _IO_JUMPS (&fp->_sf._f) = &_IO_mem_jumps;
-  _IO_str_init_static (&fp->_sf._f, buf, _IO_BUFSIZ, buf);
-  fp->_sf._f._flags &= ~_IO_USER_BUF;
-  fp->_sf._s._allocate_buffer = (_IO_alloc_type) malloc;
-  fp->_sf._s._free_buffer = (_IO_free_type) free;
+  _IO_init (&new_f->fp._sf._f, 0);
+  _IO_JUMPS (&new_f->fp._sf._f) = &_IO_mem_jumps;
+  _IO_str_init_static (&new_f->fp._sf._f, buf, _IO_BUFSIZ, buf);
+  new_f->fp._sf._f._flags &= ~_IO_USER_BUF;
+  new_f->fp._sf._s._allocate_buffer = (_IO_alloc_type) malloc;
+  new_f->fp._sf._s._free_buffer = (_IO_free_type) free;
 
-  fp->bufloc = bufloc;
-  fp->sizeloc = sizeloc;
+  new_f->fp.bufloc = bufloc;
+  new_f->fp.sizeloc = sizeloc;
 
-  return &fp->_sf._f;
+  return &new_f->fp._sf._f;
 }
 
 
index 23595ab7b5fe5c1f53eca4df1f02d194bc4df84c..5dff3de30416768bd3d784f90bf7a476bdf231e4 100644 (file)
@@ -28,14 +28,15 @@ putc (c, fp)
 {
   int result;
   CHECK_FILE (fp, EOF);
+  __libc_cleanup_region_start (&_IO_funlockfile, fp);
   _IO_flockfile (fp);
   result = _IO_putc_unlocked (c, fp);
-  _IO_funlockfile (fp);
+  __libc_cleanup_region_end (1);
   return result;
 }
 
 #ifdef _IO_MTSAFE_IO
 # undef putc_locked
 
-weak_alias (putc_locked, putc)
+weak_alias (putc, putc_locked)
 #endif
index d4d52f60d28746feb92665cf7aa4fa1e1bd65f40..a7891a5a2a8103617ebc9bad6808e8d80099dd10 100644 (file)
@@ -26,14 +26,15 @@ putchar (c)
      int c;
 {
   int result;
+  __libc_cleanup_region_start (&_IO_funlockfile, _IO_stdout);
   _IO_flockfile (_IO_stdout);
   result = _IO_putc_unlocked (c, _IO_stdout);
-  _IO_funlockfile (_IO_stdout);
+  __libc_cleanup_region_end (1);
   return result;
 }
 
 #ifdef _IO_MTSAFE_IO
 # undef putchar_locked
 
-weak_alias (putchar_locked, putchar)
+weak_alias (putchar, putchar_locked)
 #endif
index d29652aadca6b4c69ff038db6b024cb1b539af2f..4c52d638b7d8f16ed1c191b1fccce708f7d89ad9 100644 (file)
@@ -25,6 +25,6 @@ int
 putchar_unlocked (c)
      int c;
 {
-  CHECK_FILE (fp, EOF);
-  return _IO_putc_unlocked (c, fp);
+  CHECK_FILE (stdout, EOF);
+  return _IO_putc_unlocked (c, stdout);
 }
index 2f57e0de833c574ce2565b8012ac61bd64cfc78b..d30233e17ee7eedcada42fe2ca4f75107da3cdbb 100644 (file)
@@ -21,15 +21,16 @@ 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. */
 
-#include "stdio.h"
 #include "libioP.h"
+#include "stdio.h"
 
 void
 rewind (fp)
      _IO_FILE* fp;
 {
   CHECK_FILE (fp, );
+  __libc_cleanup_region_start (&_IO_funlockfile, fp);
   _IO_flockfile (fp);
   _IO_rewind (fp);
-  _IO_funlockfile (fp);
+  __libc_cleanup_region_end (1);
 }
index 048a11d60cdb23f221efc09517a215728a1baf49..0d6c5e67411971f7f9aace815c3f638e90918a9f 100644 (file)
@@ -206,39 +206,51 @@ extern const char *const _sys_errlist[];
 #endif
 
 /* Handle locking of streams.  */
-#if defined(_REENTRANT) || defined(_THREAD_SAFE)
+#ifdef __USE_REENTRANT
+extern void clearerr_locked __P ((FILE *));
 extern void clearerr_unlocked __P ((FILE *));
-extern void fileno_unlocked __P ((FILE *));
+extern int feof_locked __P ((FILE *));
+extern int feof_unlocked __P ((FILE *));
+extern int ferror_locked __P ((FILE*));
+extern int ferror_unlocked __P ((FILE*));
+extern int fileno_locked __P ((FILE *));
+extern int fileno_unlocked __P ((FILE *));
 extern void flockfile __P ((FILE *));
 extern void funlockfile __P ((FILE *));
 extern int fclose_unlocked __P ((FILE *));
+extern int fflush_locked __P ((FILE *));
 extern int fflush_unlocked __P ((FILE *));
 extern size_t fread_unlocked __P ((void *, size_t, size_t, FILE *));
 extern size_t fwrite_unlocked __P ((const void *, size_t, size_t, FILE *));
 
+extern int fputc_locked __P ((int, FILE*));
+extern int fputc_unlocked __P ((int, FILE*));
+extern int getc_locked __P ((FILE *));
+extern int getc_unlocked __P ((FILE *));
+extern int getchar_locked __P ((void));
+extern int getchar_unlocked __P ((void));
+extern int putc_locked __P ((int, FILE *));
+extern int putc_unlocked __P ((int, FILE *));
+extern int putchar_locked __P ((int));
+extern int putchar_unlocked __P ((int));
+
 # define getc_unlocked(fp) _IO_getc_unlocked (fp)
-# define getc_locked(fp) _IO_fgetc (fp)
+# define getc_locked(fp) fgetc (fp)
 # define getchar_unlocked() getc_unlocked (stdin)
 # define getchar_locked() getc_locked (stdin)
 # define getc(fp) getc_locked (fp)
 
-# define putc_unlocked(c, fp) _IO_putc_unlocked (c, fp)
-# define putc_locked(c, fp) _IO_putc_locked (c, fp)
+# define putc_unlocked(c, fp) putc_unlocked (c, fp)
+# define putc_locked(c, fp) putc_locked (c, fp)
 # define putchar_unlocked(c) putc_unlocked (c, stdout)
 # define putchar_locked(c) putc_locked (c, stdout)
 # define putc(c, fp) putc_locked (c, fp)
 
-# define feof_unlocked(fp) _IO_feof_unlocked (fp)
-# define ferror_unlocked(fp) _IO_ferror_unlocked (fp)
-
 #else
 # define getc(fp) _IO_getc_unlocked (fp)
 # define putc(c, fp) _IO_putc_unlocked (c, fp)
 
-#endif /* _REENTRANT || _THREAD_SAFE */
-
-#define flockfile(FILE) _IO_flockfile (FILE)
-#define funlockfile(FILE) _IO_funlockfile (FILE)
+#endif /* __USE_REENTRANT */
 
 #define putchar(c) putc (c, stdout)
 #define getchar() getc (stdin)
index ee92f83b1cf06baaf3141d0dede99517042fb78f..cf50603f0dd67b170dad54cfdcf9b4f66c6b34e5 100644 (file)
@@ -38,10 +38,12 @@ _IO_vasprintf (result_ptr, format, args)
   const _IO_size_t init_string_size = 100;
   char *string;
   _IO_strfile sf;
+  _IO_lock_t lock;
   int ret;
   string = ALLOC_BUF(init_string_size);
   if (string == NULL)
     return -1;
+  sf._f._lock = &lock;
   _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);
index b92251eada901d0502ca39cf280669b5e2766141..8c5833ccbf643488ef97acadcb2341fa33df42e2 100644 (file)
@@ -32,8 +32,10 @@ _IO_vdprintf (d, format, arg)
      _IO_va_list arg;
 {
   struct _IO_FILE_plus tmpfil;
+  _IO_lock_t lock;
   int done;
 
+  tmpfil.file._lock = &lock;
   _IO_init (&tmpfil.file, 0);
   _IO_JUMPS (&tmpfil.file) = &_IO_file_jumps;
   _IO_file_init (&tmpfil.file);
index 38f91c9c07e6501b8bb1d29ab208e721fa85ce47..174640daac6059e367d2c7d6d6b266a4d5bc946b 100644 (file)
@@ -33,7 +33,9 @@ _IO_vsnprintf (string, maxlen, format, args)
      _IO_va_list args;
 {
   _IO_strfile sf;
+  _IO_lock_t lock;
   int ret;
+  sf._f._lock = &lock;
   _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);
index f8bd1cd87c8cf8221f2f9834bce8f38d67d4c026..c0a5782ea7acea6ddfef48825174131c1279661e 100644 (file)
@@ -155,7 +155,7 @@ subdir_%: ;
 # ../Rules defines them for code subdirectories; for us, they are no-ops.
 # None of these should be `subdir_TARGET'; those targets are transformed
 # by the implicit rule above into `TARGET' deps.
-glibc-targets  := lib extra_solibs objects objs others tests lint.out \
+glibc-targets  := lib objects objs others tests lint.out \
                   echo-headers echo-distinfo stubs
 .PHONY: $(glibc-targets)
 $(glibc-targets):
index e8d382d64dfb1f04a0efafcf118e726b95a156fb..55b6fd0f80d4fcb6a8b6b8042d760998de1e415e 100644 (file)
@@ -114,12 +114,6 @@ typedef int register_t __attribute__ ((__mode__ (__word__)));
 #endif
 
 
-#ifdef __USE_SVID
-/* Data type for key value used in System V IPC functions.  */
-typedef long int key_t;
-#endif
-
-
 #ifdef __USE_BSD
 /* In BSD <sys/types.h> is expected to define BYTE_ORDER.  */
 #include <endian.h>
index cca3060826cb7ee91afd33dd94e9b3b6351315b6..1269443cb9cb4be9088978fd20c2f80e2373f26e 100644 (file)
@@ -43,6 +43,17 @@ __BEGIN_DECLS
 /* Error status for non-reentrant lookup functions.  */
 extern int h_errno;
 
+#if defined __USE_REENTRANT && (!defined _LIBC || defined _LIBC_REENTRANT)
+/* Function to access thread specific `h_errno' variable.  */
+extern int *__h_errno_location __P ((void)) __attribute__ ((__const__));
+
+/* An alias name for above variable.  */
+extern int __h_errno;
+
+/* Use a macro to access always the thread specific `h_errno' variable.  */
+#define h_errno (*__h_errno_location ())
+#endif
+
 /* Possible values left in `h_errno'.  */
 #define        NETDB_INTERNAL  -1      /* See errno.  */
 #define        NETDB_SUCCESS   0       /* No problem.  */
index 7ee6be76630db5ab3ebf9aa474b55d6e17fe10c0..135c6aa5c0245671c31d01f4a0a97ffe892025b1 100644 (file)
@@ -87,7 +87,7 @@ static char rcsid[] = "$Id$";
 #endif
 
 char *__hostalias __P((const char *));
-int h_errno;
+
 
 /*
  * Formulate a normal query, send, and await answer.
index 7b03ed5ab20d5b9767d2b02b4df669a9f5bd5797..7b24ac1d82da6b19273ec63c4f697a1f7fa86c39 100644 (file)
@@ -11,7 +11,7 @@ Source: glibc-@VERSION@.tar.gz
 
 %build
 configure --prefix=@prefix@
-if test x@prefix@ = /usr; then
+if test x@prefix@ = x/usr; then
   cat >configparms <<EOF
 slibdir=/lib
 sysconfdir=/etc
index 9a9e583faa7402767664f6f2a93561e04764ae20..7c6a498a751cf25b3628fb7f76e5caa89162e84d 100644 (file)
@@ -101,6 +101,9 @@ ssize_t __wprintf_pad __P ((FILE *, wchar_t pad, size_t n));
        }                                                                     \
     } while (0)
 # define UNBUFFERED_P(S) ((S)->_IO_file_flags & _IO_UNBUFFERED)
+# define flockfile(S) _IO_flockfile (S)
+/* This macro must be without parameter!  Don't change it.  */
+# define funlockfile _IO_funlockfile
 #else /* ! USE_IN_LIBIO */
 /* This code is for use in the GNU C library.  */
 # include <stdio.h>
@@ -398,7 +401,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
 
 
 #define process_arg(fspec)                                                   \
-      /* Start real work.  We know about all flag and modifiers and          \
+      /* Start real work.  We know about all flags and modifiers and         \
         now process the wanted format specifier.  */                         \
     LABEL (form_percent):                                                    \
       /* Write a literal "%".  */                                            \
@@ -846,6 +849,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
   f = lead_str_end = find_spec (format, &mbstate);
 
   /* Lock stream.  */
+  __libc_cleanup_region_start ((void (*) (void *)) &funlockfile, s);
   flockfile (s);
 
   /* Write the literal text before the first format.  */
@@ -854,10 +858,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
 
   /* If we only have to print a simple string, return now.  */
   if (*f == L_('\0'))
-    {
-      funlockfile (s);
-      return done;
-    }
+    goto all_done;
 
   /* Process whole format string.  */
   do
@@ -1025,8 +1026,8 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
          if (spec == L_('\0'))
            {
              /* The format string ended before the specifier is complete.  */
-             funlockfile (s);
-             return -1;
+             done = -1;
+             goto all_done;
            }
 
          /* If we are in the fast loop force entering the complicated
@@ -1042,11 +1043,8 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
     }
   while (*f != L_('\0'));
 
-  /* Unlock stream.  */
-  funlockfile (s);
-
-  /* We processed the whole format without any positional parameters.  */
-  return done;
+  /* Unlock stream and return.  */
+  goto all_done;
 
   /* Here starts the more complex loop to handle positional parameters.  */
 do_positional:
@@ -1289,8 +1287,8 @@ do_positional:
                 of chars.  */
              if (function_done < 0)
                {
-                 funlockfile (s);
-                 return -1;
+                 done = -1;
+                 goto all_done;
                }
 
              done += function_done;
@@ -1305,8 +1303,9 @@ do_positional:
       }
   }
 
+all_done:
   /* Unlock the stream.  */
-  funlockfile (s);
+  __libc_cleanup_region_end (1);
 
   return done;
 }
index 41b9f51f08ee7540b6094dc931c50cfdaaa9a95c..903f5849cc8258db978028e6c4eee769e2441d81 100644 (file)
@@ -79,6 +79,10 @@ Cambridge, MA 02139, USA.  */
          return EOF;                                                         \
        }                                                                     \
     } while (0)
+# define LOCK_STREAM(S)                                                              \
+  __libc_cleanup_region_start ((void (*) (void *)) &_IO_funlockfile, (S));    \
+  _IO_flockfile (S)
+# define UNLOCK_STREAM __libc_cleanup_region_end (1)
 #else
 # define ungetc(c, s)  (--read_in, ungetc (c, s))
 # define inchar()      ((c = getc (s)), (void) ++read_in, c)
@@ -105,8 +109,18 @@ Cambridge, MA 02139, USA.  */
          return EOF;                                                         \
        }                                                                     \
     } while (0)
+#if 1
+      /* XXX For now !!! */
 # define flockfile(S) /* nothing */
 # define funlockfile(S) /* nothing */
+# define LOCK_STREAM(S)
+# define UNLOCK_STREAM
+#else
+# define LOCK_STREAM(S)                                                              \
+  __libc_cleanup_region_start (&__funlockfile, (S));                         \
+  __flockfile (S)
+# define UNLOCK_STREAM __libc_cleanup_region_start (1)
+#endif
 #endif
 
 
@@ -194,7 +208,7 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
     thousands = (wchar_t) *_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP);
 
   /* Lock the stream.  */
-  flockfile (s);
+  LOCK_STREAM (s);
 
   /* Run through the format string.  */
   while (*f != '\0')
@@ -441,6 +455,10 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
          else
            while (--width > 0 && inchar () != EOF);
 
+         if (width > 0)
+           /* I.e., EOF was read.  */
+           --read_in;
+
          if (!(flags & SUPPRESS))
            ++done;
 
@@ -842,7 +860,7 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
     }
 
   /* Unlock stream.  */
-  funlockfile (s);
+  UNLOCK_STREAM;
 
   return done;
 }
index d20a009aa46ee4b8ffc8146e660a00e0de137148..c8b374afe592048e5e9112e42a18b6ecd54b15f7 100644 (file)
@@ -21,6 +21,7 @@ Cambridge, MA 02139, USA.  */
 
        .text
        .align 3
+       .globl _start
        .ent _start, 0
 _start:
        .frame fp, 0, zero
index decd26cac8e2e09e519324e5960c71c64ed4b1dc..614252aaaca754b0973d4f802daac2ef6c68b5b6 100644 (file)
@@ -83,5 +83,8 @@ typedef unsigned long __fd_mask;
 #define        __FD_CLR(d, set)        ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d))
 #define        __FD_ISSET(d, set)      ((set)->fds_bits[__FDELT(d)] & __FDMASK(d))
 
+#ifdef __USE_SVID
+typedef long int key_t;
+#endif
 
 #endif /* gnu/types.h */
index 4e952e781d0d8a7cd709cece314ed2c8319f3f40..c69b43ec098ec02b5bdf3bebe1a21a42687a341c 100644 (file)
@@ -55,5 +55,62 @@ __profile_frequency ()
     return 0;
   return (1000000 / tim.it_interval.tv_usec);
 }
+/* Return frequency of ticks reported by profil.  Generic version. */
+/*-
+ * Copyright (c) 1983, 1992, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+
+#include <sys/types.h>
+#include <sys/time.h>
+
+int
+__profile_frequency ()
+{
+  /*
+   * Discover the tick frequency of the machine if something goes wrong,
+   * we return 0, an impossible hertz.
+   */
+  struct itimerval tim;
+
+  tim.it_interval.tv_sec = 0;
+  tim.it_interval.tv_usec = 1;
+  tim.it_value.tv_sec = 0;
+  tim.it_value.tv_usec = 0;
+  setitimer(ITIMER_REAL, &tim, 0);
+  setitimer(ITIMER_REAL, 0, &tim);
+  if (tim.it_interval.tv_usec < 2)
+    return 0;
+  return (1000000 / tim.it_interval.tv_usec);
+}
 
 
index 83b6f8d165dd185ab6433d821050f4afe0662039..5bd0f8254bbcc55f78342202cef2129d21849e54 100644 (file)
@@ -133,7 +133,7 @@ _dl_start_user:\n\
        # See if we were run as a command with the executable file\n\
        # name as an extra leading argument.\n\
        movl _dl_skip_args@GOT(%ebx), %eax\n\
-       movl (%eax),%eax\n\
+       movl (%eax), %eax\n\
        # Pop the original argument count.\n\
        popl %ecx\n\
        # Subtract _dl_skip_args from it.\n\
@@ -151,7 +151,7 @@ _dl_start_user:\n\
        call _dl_init_next@PLT\n\
        addl $4, %esp # Pop argument.\n\
        # Check for zero return, when out of initializers.\n\
-       testl %eax,%eax\n\
+       testl %eax, %eax\n\
        jz 1f\n\
        # Call the shared object initializer function.\n\
        # NOTE: We depend only on the registers (%ebx, %esi and %edi)\n\
@@ -164,7 +164,8 @@ _dl_start_user:\n\
        # Loop to call _dl_init_next for the next initializer.\n\
        jmp 0b\n\
 1:     # Clear the startup flag.\n\
-       movl $0, _dl_starting_up@GOT(%ebx)\n\
+       movl _dl_starting_up@GOT(%ebx), %eax\n\
+       movl $0, (%eax)\n\
        # Pass our finalizer function to the user in %edx, as per ELF ABI.\n\
        movl _dl_fini@GOT(%ebx), %edx\n\
        # Jump to the user's entry point.\n\
index a3707033a6ad9716570d8c5bf2a7574acbe42b31..5c0d307bdb1cdbf39d1e0afdd87ce4cbd440c5dc 100644 (file)
@@ -1,2 +1,4 @@
 /* __profile_frequency is in sysdeps/mach/hurd/profil.c.  This file
 is here as a place-holder to prevent the use of sysdeps/generic/prof-freq.c. */
+/* __profile_frequency is in sysdeps/mach/hurd/profil.c.  This file
+is here as a place-holder to prevent the use of sysdeps/generic/prof-freq.c. */
index 5b2caf66f6be1d1457dea650653b7946b439cfd4..29d06135c6f29eda791084419a9f95de1d3380e3 100644 (file)
@@ -527,8 +527,8 @@ __sysconf (name)
 #endif
 
     case _SC_THREAD_DESTRUCTOR_ITERATIONS:
-#ifdef PTHREAD_DESTRUCTOR_ITERATIONS
-      return PTHREAD_DESTRUCTOR_ITERATIONS;
+#ifdef _POSIX_THREAD_DESTRUCTOR_ITERATIONS
+      return _POSIX_THREAD_DESTRUCTOR_ITERATIONS;
 #else
       return -1;
 #endif
index a8608df791141e520fdb2a53b8f7b93f89bb68e1..ca2d77c220dc185d30b397efe79a054f158e510f 100644 (file)
@@ -48,5 +48,11 @@ Cambridge, MA 02139, USA.  */
 /* Unlock the named lock variable.  */
 #define __libc_lock_unlock(NAME)
 
+/* Start critical region with cleanup.  */
+#define __libc_cleanup_region_start(FCT, ARG)
+
+/* End critical region with cleanup.  */
+#define __libc_cleanup_region_end(DOIT)
+
 
 #endif /* libc-lock.h */
index 336eb0202991939f372edd7914e3bc5ae162c54e..8d70bda21e965e2abd4f839b31a6c3870d393cfa 100644 (file)
@@ -17,8 +17,7 @@ not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
 #include <sysdep.h>
-#define _ERRNO_H
-#include <errnos.h>
+#include <features.h>
 
        .section .bss
        .globl errno
@@ -30,15 +29,60 @@ errno:      .space 4
 #endif
 
        .text
-LEAF(__syscall_error, 0)
+       .align 2
+
+#ifdef _LIBC_REENTRANT
+
+       .globl __syscall_error
+       .ent __syscall_error
+__syscall_error:
        ldgp    gp, 0(t12)
+       lda     sp, -16(sp)
+       .frame  sp, 16, ra, 0
+       stq     ra, 0(sp)
+       stq     v0, 8(sp)
+       .mask   0x4000001, -16
        .prologue 1
 
-       /* Store return value in errno... */
-       stl     v0, errno
+       /* Find our pre-thread errno address  */
+       jsr     ra, __errno_location
+
+       /* Store the error value.  */
+       ldl     t0, 8(sp)
+       stl     t0, 0(v0)
 
-       /* And just kick back a -1.  */
+       /* And kick back a -1.  */
        ldi     v0, -1
+
+       ldq     ra, 0(sp)
+       lda     sp, 16(sp)
        ret
+       .end __syscall_error
+
+/* A default non-threaded version of __errno_location that just returns
+   the address of errno.  */
+
+       .weak   __errno_location
+       .ent    __errno_location
+__errno_location:
+       .frame  sp, 0, ra
+       ldgp    gp, 0(t12)
+       .mask   0, 0
+       .prologue 1
 
+       lda     v0, errno
+       ret
+       .end __errno_location
+
+#else
+
+ENTRY(__syscall_error)
+       ldgp    gp, 0(t12)
+       .prologue 1
+
+       stl     v0, errno
+       lda     v0, -1
+       ret
        END(__syscall_error)
+
+#endif /* _LIBC_REENTRANT */
index 95e2fd5c7acc68c853b791b35eb672009f3298ec..7dced7cda5025fa84c281cb04d200529d51aeec1 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 93, 94, 95, 96 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
@@ -36,17 +36,40 @@ syscall_error:
        cmpl $EWOULDBLOCK_sys, %eax /* Is it the old EWOULDBLOCK?  */
        jne notb                /* Branch if not.  */
        movl $EAGAIN, %eax      /* Yes; translate it to EAGAIN.  */
-#endif
 notb:
+#endif
 #ifndef        PIC
        movl %eax, C_SYMBOL_NAME(errno)
+#ifdef _LIBC_REENTRANT
+       pushl %eax
+       call __errno_location
+       popl %ecx
+       movl %ecx, (%eax)
+#endif
 #else
        /* The caller has pushed %ebx and then set it up to
           point to the GOT before calling us through the PLT.  */
        movl C_SYMBOL_NAME(errno@GOT)(%ebx), %ecx
+
+#ifndef        _LIBC_REENTRANT
        /* Pop %ebx value saved before jumping here.  */
        popl %ebx
        movl %eax, (%ecx)
+#else
+       movl %eax, (%ecx)
+       pushl %eax
+       call C_SYMBOL_NAME(__errno_location@PLT)
+       popl %ecx
+       /* Pop %ebx value saved before jumping here.  */
+       popl %ebx
+       movl %ecx, (%eax)
+#endif
 #endif
        movl $-1, %eax
        ret
+
+#ifdef __ELF__
+#undef __syscall_error
+.Lfe2:
+       .size   __syscall_error, .Lfe2-__syscall_error
+#endif
index 890d428086eae4fe1550377275d11a021b348e0c..7161cec6e91b40fcc8e5557f3243460167bb7096 100644 (file)
@@ -91,7 +91,7 @@ __opendir (const char *name)
 
   dirp->fd = fd;
 
-  __libc_lock_init (dirp->lock);
+  __libc_lock_init (dirp->lock)
 
   return dirp;
 }
index be1e4d3feb39a93a40efbcc5d4839518f535fdc1..868819e6b36ff5546aa6f027f7ef4164dd9c551a 100644 (file)
@@ -1 +1,33 @@
+/* errnos.h - error constants.  Linux specific version.
+Copyright (C) 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 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 <linux/errno.h>
+
+#ifndef __ASSEMBLER__
+#if defined __USE_REENTRANT && (!defined _LIBC || defined _LIBC_REENTRANT)
+/* Declare alias of `errno' variable so it is accessible even if macro
+   with name `errno' is defined.  */
+extern int __errno;
+
+/* When using threads, errno is a per-thread value.  */
+extern int *__errno_location __P ((void)) __attribute__ ((__const__));
+#define errno  (*__errno_location ())
+
+#endif
+#endif
index abfcb6e9c9881ca30df74899e95f058b372c6d6d..745d2d8e2ebc3c73264cde5bd378909b5d03db8c 100644 (file)
@@ -70,4 +70,8 @@ typedef __kernel_clock_t __clock_t;
    XPG4 seems to require `unsigned long'.  */
 typedef unsigned long __fd_mask;
 
+#ifdef __USE_SVID
+typedef int key_t;
+#endif
+
 #endif /* gnu/types.h */
index 0130ad02a9b08292ac5b5e5e80a4c286fbdaf11e..7d5444d6a6a38bb067fdb34ddc6c6dc44018ba1a 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995 Free Software Foundation, Inc.
+/* Copyright (C) 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
@@ -27,26 +27,46 @@ Cambridge, MA 02139, USA.  */
        .globl errno
        .type errno,@object
        .size errno,4
-errno: .space 4
+errno: .zero 4
        .globl _errno
        .type _errno,@object
 _errno = errno /* This name is expected by hj libc.so.5 startup code.  */
        .text
 
-/* The following code is not used at all in the shared library.
-   The PIC system call stubs set errno themselves.  */
+/* The following code is only used in the shared library when we
+   compile the reentrant version.  Otherwise each system call defines
+   each own version.  */
 
-#ifndef        PIC
+#ifndef PIC
 
 /* The syscall stubs jump here when they detect an error.
    The code for Linux is almost identical to the canonical Unix/i386
    code, except that the error number in %eax is negated.  */
 
-.globl __syscall_error
+       .globl  __syscall_error
+       .type   __syscall_error,@function
 __syscall_error:
        negl %eax
 
 #define __syscall_error __syscall_error_1
 #include <sysdeps/unix/i386/sysdep.S>
 
+#endif /* !PIC */
+
+
+#ifdef _LIBC_REENTRANT
+       .globl  __errno_location
+       .type   __errno_location,@function
+__errno_location:
+#ifdef PIC
+       call .L2
+.L2:   popl %ecx
+       addl $_GLOBAL_OFFSET_TABLE_+[.-.L2], %ecx
+       movl errno@GOT(%ecx), %eax
+#else
+       movl $errno, %eax
+#endif
+       ret
+.Lfe1:
+       .size   __errno_location, .Lfe1-__errno_location
 #endif
index c77bbbbf86a4c95fda087ab51e1f9adc4c9476f0..96470a19b9b79c9b7b86446cc421757f4d7b4cb4 100644 (file)
@@ -45,21 +45,44 @@ Cambridge, MA 02139, USA.  */
     testl %eax, %eax;                                                        \
     jl syscall_error;
 
-#ifndef        PIC
+#ifndef PIC
 #define SYSCALL_ERROR_HANDLER  /* Nothing here; code in sysdep.S is used.  */
 #else
 /* Store (- %eax) into errno through the GOT.  */
+#ifdef _LIBC_REENTRANT
 #define SYSCALL_ERROR_HANDLER                                                \
+  .type syscall_error,@function;                                             \
+syscall_error:                                                               \
+  pushl %ebx;                                                                \
+  call 0f;                                                                   \
+0:popl %ebx;                                                                 \
+  xorl %edx, %edx;                                                           \
+  addl $_GLOBAL_OFFSET_TABLE_+[.-0b], %ebx;                                  \
+  subl %eax, %edx;                                                           \
+  movl errno@GOT(%ebx), %ecx;                                                \
+  movl %edx, (%ecx);                                                         \
+  pushl %edx;                                                                \
+  call __errno_location@PLT;                                                 \
+  popl %ecx;                                                                 \
+  popl %ebx;                                                                 \
+  movl %ecx, (%eax);                                                         \
+  movl $-1, %eax;                                                            \
+  ret;
+#else
+#define SYSCALL_ERROR_HANDLER                                                \
+  .type syscall_error,@function;                                             \
 syscall_error:                                                               \
   call 0f;                                                                   \
 0:popl %ecx;                                                                 \
-  negl %eax;                                                                 \
+  xorl %edx, %edx;                                                           \
   addl $_GLOBAL_OFFSET_TABLE_+[.-0b], %ecx;                                  \
+  subl %eax, %edx;                                                           \
   movl errno@GOT(%ecx), %ecx;                                                \
-  movl %eax, (%ecx);                                                         \
+  movl %edx, (%ecx);                                                         \
   movl $-1, %eax;                                                            \
   ret;
-#endif
+#endif /* _LIBC_REENTRANT */
+#endif /* PIC */
 
 /* Linux takes system call arguments in registers:
 
diff --git a/sysdeps/unix/sysv/linux/schedbits.h b/sysdeps/unix/sysv/linux/schedbits.h
new file mode 100644 (file)
index 0000000..ac27b9e
--- /dev/null
@@ -0,0 +1,51 @@
+/* Definitions of constants and data structure for POSIX 1003.1b-1993
+   scheduling interface.
+Copyright (C) 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 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        _SCHEDBITS_H
+#define        _SCHEDBITS_H    1
+
+/* Scheduling algorithms.  */
+#define SCHED_OTHER    0
+#define SCHED_FIFO     1
+#define SCHED_RR       2
+
+/* Data structure to describe a process' schedulability.  */
+struct sched_params
+{
+  int sched_priority;
+};
+
+/* Cloning flags.  */
+#define        CSIGNAL       0x000000ff  /* Signal mask to be sent at exit.  */
+#define        CLONE_VM      0x00000100  /* Set if VM shared between processes.  */
+#define        CLONE_FS      0x00000200  /* Set if fs info shared between processes.*/
+#define CLONE_FILES   0x00000400  /* Set if open files shared between processes*/
+#define CLONE_SIGHAND 0x00000800  /* Set if signal handlers shared.  */
+#define CLONE_PID     0x00001000  /* Set if pid shared.  */
+
+
+/* Clone current process.  The parameter list of FN is not for true.  Only
+   dots is not allowed by ISO C and without argument the compiler would
+   complain about a missing parameter list.  */
+extern int clone __P ((int (*__fn) (void *, ...), void *__child_stack,
+                      int __flags, int __nargs, ...));
+
+
+#endif /* schedbits.h */
diff --git a/sysdeps/unix/sysv/linux/waitflags.h b/sysdeps/unix/sysv/linux/waitflags.h
new file mode 100644 (file)
index 0000000..0be2825
--- /dev/null
@@ -0,0 +1,30 @@
+/* Definitions of flag bits for `waitpid' et al.
+Copyright (C) 1992, 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 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.  */
+
+#ifndef        _WAITFLAGS_H
+
+#define        _WAITFLAGS_H    1
+
+/* Bits in the third argument to `waitpid'.  */
+#define        WNOHANG         1       /* Don't block waiting.  */
+#define        WUNTRACED       2       /* Report status of stopped children.  */
+
+#define __WCLONE       0x80000000 /* Wait for cloned process.  */
+
+#endif /* waitflags.h */