From ae2ddc98c17c17897398c8d960d984789ecab0d9 Mon Sep 17 00:00:00 2001 From: "Thomas Bushnell, BSG" Date: Thu, 12 Sep 1996 22:22:29 +0000 Subject: *** empty log message *** (vfprintf): Only call __libc_cleanup_region_end if USE_IN_LIBIO, thus matching the sense of the tests around __libc_cleanup_region_start at the front of the function. * stdio-common/vfscanf.c: Include . (UNLOCK_STREAM) [! USE_IN_LIBIO]: Call __libc_cleanup_region_end, not __libc_cleanup_region_start. --- ChangeLog | 9 ++++++--- stdio-common/vfprintf.c | 3 +++ stdio-common/vfscanf.c | 3 ++- sysdeps/mach/libc-lock.h | 14 ++++++++++++++ sysdeps/stub/intr-msg.h | 15 +++++++++++++++ 5 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 sysdeps/stub/intr-msg.h diff --git a/ChangeLog b/ChangeLog index 4b466de74d..2b90349234 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,14 +1,17 @@ Thu Sep 12 12:33:52 1996 Thomas Bushnell, n/BSG * stdio-common/vfprintf.c: Include . - * stdio-common/vfscanf.c: Likewise. + (vfprintf): Only call __libc_cleanup_region_end if USE_IN_LIBIO, + thus matching the sense of the tests around + __libc_cleanup_region_start at the front of the function. + * stdio-common/vfscanf.c: Include . + (UNLOCK_STREAM) [! USE_IN_LIBIO]: Call + __libc_cleanup_region_end, not __libc_cleanup_region_start. * sysdeps/mach/libc-lock.h (__libc_cleanup_region_start): New macro. (__libc_cleanup_region_end): New macro. - * stdio-common/vfscanf.c (UNLOCK_STREAM) [! USE_IN_LIBIO]: Call - __libc_cleanup_region_end, not __libc_cleanup_region_start. Thu Sep 12 03:35:27 1996 Ulrich Drepper diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c index d27bbdbf57..dc2983d264 100644 --- a/stdio-common/vfprintf.c +++ b/stdio-common/vfprintf.c @@ -1311,7 +1311,10 @@ do_positional: all_done: /* Unlock the stream. */ +#ifdef USE_IN_LIBIO + /* (stdio has no locking yet.) */ __libc_cleanup_region_end (1); +#endif return done; } diff --git a/stdio-common/vfscanf.c b/stdio-common/vfscanf.c index 903f5849cc..f83fd281a1 100644 --- a/stdio-common/vfscanf.c +++ b/stdio-common/vfscanf.c @@ -24,6 +24,7 @@ Cambridge, MA 02139, USA. */ #include #include #include +#include #ifdef __GNUC__ #define HAVE_LONGLONG @@ -119,7 +120,7 @@ Cambridge, MA 02139, USA. */ # define LOCK_STREAM(S) \ __libc_cleanup_region_start (&__funlockfile, (S)); \ __flockfile (S) -# define UNLOCK_STREAM __libc_cleanup_region_start (1) +# define UNLOCK_STREAM __libc_cleanup_region_end (1) #endif #endif diff --git a/sysdeps/mach/libc-lock.h b/sysdeps/mach/libc-lock.h index 2c39592717..ea3d306a52 100644 --- a/sysdeps/mach/libc-lock.h +++ b/sysdeps/mach/libc-lock.h @@ -56,5 +56,19 @@ typedef struct __libc_lock_opaque__ __libc_lock_t; /* Unlock the named lock variable. */ #define __libc_lock_unlock(NAME) __mutex_unlock (&(NAME)) +/* Start a critical region with a cleanup function */ +#define __libc_cleanup_region_start(FCT, ARG) \ +{ \ + (typeof FCT) __save_FCT = FCT; \ + (typeof ARG) __save_ARG = ARG; \ + /* close brace is in __libc_cleanup_region_end below. */ + +/* End a critical region started with __libc_cleanup_region_start. */ +#define __libc_cleanup_region_end(DOIT) \ + if (DOIT) \ + (* __save_FCT)(__save_ARG); \ +} + + #endif /* libc-lock.h */ diff --git a/sysdeps/stub/intr-msg.h b/sysdeps/stub/intr-msg.h new file mode 100644 index 0000000000..0186aa3323 --- /dev/null +++ b/sysdeps/stub/intr-msg.h @@ -0,0 +1,15 @@ +/* Stubby version of intr-msg.h. */ + +/* This file must be written in machine-dependent form for each hurd port. + and define the following: + + INTR_MSG_TRAP + INTR_MSG_BACK_OUT + SYSCALL_EXAMINE + struct mach_msg_trap_args + MSG_EXAMINE + + See sysdeps/mach/hurd/i386/intr-msg.h for an example. */ + + +#error Could not find machine-dependent intr-msg.h file. -- cgit 1.4.1