From fafaa44ef0176da243b19e4d68bf2ffc3bbb4f88 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 13 Sep 1996 03:21:39 +0000 Subject: [PATCH] update from main archive 960912 Fri Sep 13 04:33:08 1996 Ulrich Drepper * sched.h: New file. helper to access posix/sched.h. * posix/sched.h: Change `sched_params' to `sched_param' to follow POSIX.4. Thu Sep 12 20:12:40 1996 Ulrich Drepper * db/makedb.c (usage): Print bug report address separately to ease translators task. * catgets/gencat.c (usage): Likewise. * locale/locale.c (usage): Likewise. * locale/localedef.c (usage): Likewise. 1996-09-12 Paul Eggert * time/strftime.c (my_localtime_r): Define if ! HAVE_LOCALTIME_R, and #define localtime_r to it. If _LIBC, use __localtime_r instead. (my_gmtime_r): Similar, except it's not needed if ! HAVE_TM_GMTOFF. Thu Sep 12 14:03:29 1996 Ulrich Drepper * crypt/Makefile: Include Makeconfig and add crypt object dir to rpath-link so that running the check finds the new library. * crypt/cert.c: provide correct prototypes to prevent warnings. Reported by Andreas Jaeger. * sysdeps/mach/hurd/Makefile (rpath-link): Don't use += because old and new value must be glued using `:'. Reported by Marcus Daniels. --- ChangeLog | 32 +++++++++++++++++++- catgets/gencat.c | 8 +++-- db/makedb.c | 12 ++++---- libio/Makefile | 2 +- libio/libio.h | 4 +-- locale/programs/locale.c | 10 ++++--- locale/programs/localedef.c | 10 ++++--- posix/sched.h | 12 ++++---- sched.h | 1 + stdio-common/Makefile | 5 ++++ stdio-common/vfprintf.c | 21 +++++++------- sysdeps/stub/lockfile.c | 45 +++++++++++++++++++++++++++++ sysdeps/unix/sysv/linux/schedbits.h | 2 +- time/strftime.c | 40 +++++++++++++++++++++++++ 14 files changed, 166 insertions(+), 38 deletions(-) create mode 100644 sched.h create mode 100644 sysdeps/stub/lockfile.c diff --git a/ChangeLog b/ChangeLog index 2b90349234..448e9aa5b7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,34 @@ +Fri Sep 13 04:33:08 1996 Ulrich Drepper + + * sched.h: New file. helper to access posix/sched.h. + * posix/sched.h: Change `sched_params' to `sched_param' to follow + POSIX.4. + +Thu Sep 12 20:12:40 1996 Ulrich Drepper + + * db/makedb.c (usage): Print bug report address separately to + ease translators task. + * catgets/gencat.c (usage): Likewise. + * locale/locale.c (usage): Likewise. + * locale/localedef.c (usage): Likewise. + +1996-09-12 Paul Eggert + + * time/strftime.c (my_localtime_r): Define if ! HAVE_LOCALTIME_R, + and #define localtime_r to it. If _LIBC, use __localtime_r instead. + (my_gmtime_r): Similar, except it's not needed if ! HAVE_TM_GMTOFF. + +Thu Sep 12 14:03:29 1996 Ulrich Drepper + + * crypt/Makefile: Include Makeconfig and add crypt object dir to + rpath-link so that running the check finds the new library. + * crypt/cert.c: provide correct prototypes to prevent warnings. + Reported by Andreas Jaeger. + + * sysdeps/mach/hurd/Makefile (rpath-link): Don't use += because + old and new value must be glued using `:'. + Reported by Marcus Daniels. + Thu Sep 12 12:33:52 1996 Thomas Bushnell, n/BSG * stdio-common/vfprintf.c: Include . @@ -12,7 +43,6 @@ Thu Sep 12 12:33:52 1996 Thomas Bushnell, n/BSG macro. (__libc_cleanup_region_end): New macro. - Thu Sep 12 03:35:27 1996 Ulrich Drepper * sysdeps/unix/sysv/linux/i386/Dist: Remove init-first.h. diff --git a/catgets/gencat.c b/catgets/gencat.c index e989a0f63d..55fea2ef4f 100644 --- a/catgets/gencat.c +++ b/catgets/gencat.c @@ -202,7 +202,8 @@ usage (int status) fprintf (stderr, gettext ("Try `%s --help' for more information.\n"), program_invocation_name); else - printf(gettext ("\ + { + printf(gettext ("\ Usage: %s [OPTION]... -o OUTPUT-FILE [INPUT-FILE]...\n\ %s [OPTION]... [OUTPUT-FILE [INPUT-FILE]...]\n\ Mandatory arguments to long options are mandatory for short options too.\n\ @@ -212,9 +213,10 @@ Mandatory arguments to long options are mandatory for short options too.\n\ -o, --output=NAME write output to file NAME\n\ -V, --version output version information and exit\n\ If INPUT-FILE is -, input is read from standard input. If OUTPUT-FILE\n\ -is -, output is written to standard output.\n\ -Report bugs to .\n"), +is -, output is written to standard output.\n"), program_invocation_name, program_invocation_name); + printf (gettext ("Report bugs to .\n")); + } exit (status); } diff --git a/db/makedb.c b/db/makedb.c index db99990195..a62e3d848b 100644 --- a/db/makedb.c +++ b/db/makedb.c @@ -198,7 +198,8 @@ usage (status) fprintf (stderr, gettext ("Try `%s --help' for more information.\n"), program_invocation_name); else - printf (gettext ("\ + { + printf (gettext ("\ Usage: %s [OPTION]... INPUT-FILE OUTPUT-FILE\n\ %s [OPTION]... -o OUTPUT-FILE INPUT-FILE\n\ %s [OPTION]... -u INPUT-FILE\n\ @@ -209,10 +210,11 @@ Mandatory arguments to long options are mandatory for short options too.\n\ --quiet don't print messages while building database\n\ -u, --undo print content of database file, one entry a line\n\ -V, --version output version information and exit\n\ -If INPUT-FILE is -, input is read from standard input.\n\ -Report bugs to .\n"), - program_invocation_name, program_invocation_name, - program_invocation_name); +If INPUT-FILE is -, input is read from standard input.\n"), + program_invocation_name, program_invocation_name, + program_invocation_name); + printf (gettext ("Report bugs to .\n")); + } exit (status); } diff --git a/libio/Makefile b/libio/Makefile index 1d0ec937bf..902d63f21c 100644 --- a/libio/Makefile +++ b/libio/Makefile @@ -40,7 +40,7 @@ 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 + iofflush_u putc_u putchar_u CPPFLAGS += -D_IO_MTSAFE_IO endif diff --git a/libio/libio.h b/libio/libio.h index 36e839fa32..e174ee183d 100644 --- a/libio/libio.h +++ b/libio/libio.h @@ -150,9 +150,7 @@ typedef struct /* Handle lock. */ #ifdef _IO_MTSAFE_IO -#include -typedef pthread_mutex_t _IO_lock_t; -#define _IO_lock_init PTHREAD_MUTEX_INITIALIZER +#include #else typedef void _IO_lock_t; #endif diff --git a/locale/programs/locale.c b/locale/programs/locale.c index a3ffd48998..df11e1efdf 100644 --- a/locale/programs/locale.c +++ b/locale/programs/locale.c @@ -234,7 +234,8 @@ usage (int status) fprintf (stderr, gettext ("Try `%s --help' for more information.\n"), __progname); else - printf (gettext ("\ + { + printf (gettext ("\ Usage: %s [OPTION]... name\n\ Mandatory arguments to long options are mandatory for short options too.\n\ -h, --help display this help and exit\n\ @@ -244,9 +245,10 @@ Mandatory arguments to long options are mandatory for short options too.\n\ -m, --charmaps write names of available charmaps\n\ \n\ -c, --category-name write names of selected categories\n\ - -k, --keyword-name write names of selected keywords\n\ -Report bugs to .\n"), - __progname); + -k, --keyword-name write names of selected keywords\n"), + __progname); + printf (gettext ("Report bugs to .\n")); + } exit (status); } diff --git a/locale/programs/localedef.c b/locale/programs/localedef.c index 8eab9c1fa9..9df5d128de 100644 --- a/locale/programs/localedef.c +++ b/locale/programs/localedef.c @@ -383,7 +383,8 @@ usage (int status) fprintf (stderr, _("Try `%s --help' for more information.\n"), program_invocation_name); else - printf (_("\ + { + printf (_("\ Usage: %s [OPTION]... name\n\ Mandatory arguments to long options are mandatory for short options too.\n\ -c, --force create output even if warning messages were issued\n\ @@ -396,9 +397,10 @@ Mandatory arguments to long options are mandatory for short options too.\n\ --posix be strictly POSIX conform\n\ \n\ System's directory for character maps: %s\n\ - locale files : %s\n\ -Report bugs to .\n"), - program_invocation_name, CHARMAP_PATH, LOCALE_PATH); + locale files : %s\n"), + program_invocation_name, CHARMAP_PATH, LOCALE_PATH); + printf (gettext ("Report bugs to .\n")); + } exit (status); } diff --git a/posix/sched.h b/posix/sched.h index 11f5740bac..026a5e2f20 100644 --- a/posix/sched.h +++ b/posix/sched.h @@ -33,19 +33,19 @@ __BEGIN_DECLS /* Set scheduling parameters for a process. */ extern int __sched_setparam __P ((__pid_t __pid, - __const struct sched_params *__param)); + __const struct sched_param *__param)); extern int sched_setparam __P ((__pid_t __pid, - __const struct sched_params *__param)); + __const struct sched_param *__param)); /* Retrieve scheduling parameters for a particular process. */ -extern int __sched_getparam __P ((__pid_t __pid, struct sched_params *__param)); -extern int sched_getparam __P ((__pid_t __pid, struct sched_params *__param)); +extern int __sched_getparam __P ((__pid_t __pid, struct sched_param *__param)); +extern int sched_getparam __P ((__pid_t __pid, struct sched_param *__param)); /* Set scheduling algorithm and/or parameters for a process. */ extern int __sched_setscheduler __P ((__pid_t __pid, int __policy, - __const struct sched_params *__param)); + __const struct sched_param *__param)); extern int sched_setscheduler __P ((__pid_t __pid, int __policy, - __const struct sched_params *__param)); + __const struct sched_param *__param)); /* Retrieve scheduling algorithm for a particular purpose. */ extern int __sched_getscheduler __P ((__pid_t __pid)); diff --git a/sched.h b/sched.h new file mode 100644 index 0000000000..b9bebc9dee --- /dev/null +++ b/sched.h @@ -0,0 +1 @@ +#include "posix/sched.h" diff --git a/stdio-common/Makefile b/stdio-common/Makefile index 7fe1987158..4b9ec71338 100644 --- a/stdio-common/Makefile +++ b/stdio-common/Makefile @@ -33,6 +33,11 @@ routines := \ tmpfile tmpnam tempnam tempname \ getline getw putw \ remove rename + +ifneq (,$(filter %REENTRANT, $(defines))) +routines += lockfile +endif + aux := errlist siglist distribute := _itoa.h printf-parse.h diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c index dc2983d264..1316adacbf 100644 --- a/stdio-common/vfprintf.c +++ b/stdio-common/vfprintf.c @@ -124,8 +124,6 @@ ssize_t __wprintf_pad __P ((FILE *, wchar_t pad, size_t n)); } \ while (0) # define UNBUFFERED_P(s) ((s)->__buffer == NULL) -# define __flockfile(S) /* nothing */ -# define __funlockfile(S) /* nothing */ #endif /* USE_IN_LIBIO */ @@ -155,6 +153,14 @@ ssize_t __wprintf_pad __P ((FILE *, wchar_t pad, size_t n)); #endif +#ifdef _LIBC_REENTRANT +extern void __flockfile (FILE *); +weak_extern (__flockfile); +extern void __funlockfile (FILE *); +weak_extern (__funlockfile); +#endif + + /* Global variables. */ static const char null[] = "(null)"; @@ -848,15 +854,10 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap) f = lead_str_end = find_spec (format, &mbstate); /* Lock stream. */ -#ifdef USE_IN_LIBIO - __libc_cleanup_region_start ((void (*) (void *)) &_IO_funlockfile, s); -#else -#if 0 - /* XXX For now stdio has no locking. */ __libc_cleanup_region_start ((void (*) (void *)) &__funlockfile, s); -#endif -#endif - __flockfile (s); + + if (__flockfile != NULL) + __flockfile (s); /* Write the literal text before the first format. */ outstring ((const UCHAR_T *) format, diff --git a/sysdeps/stub/lockfile.c b/sysdeps/stub/lockfile.c new file mode 100644 index 0000000000..0942e04de0 --- /dev/null +++ b/sysdeps/stub/lockfile.c @@ -0,0 +1,45 @@ +/* lockfile - Handle locking and unlocking of stream. +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 + + +void +__flockfile (FILE *stream) +{ + /* Do nothing. Using this version does not do any locking. */ +} +weak_alias (__flockfile, flockfile); + + +void +__funlockfile (FILE *stream) +{ + /* Do nothing. Using this version does not do any locking. */ +} +weak_alias (__funlockfile, funlockfile); + + +int +__ftrylockfile (FILE *stream) +{ + /* Do nothing. Using this version does not do any locking. */ + return 1; +} +weak_alias (__ftrylockfile, ftrylockfile); diff --git a/sysdeps/unix/sysv/linux/schedbits.h b/sysdeps/unix/sysv/linux/schedbits.h index ac27b9e2d2..2af419ec4e 100644 --- a/sysdeps/unix/sysv/linux/schedbits.h +++ b/sysdeps/unix/sysv/linux/schedbits.h @@ -27,7 +27,7 @@ Boston, MA 02111-1307, USA. */ #define SCHED_RR 2 /* Data structure to describe a process' schedulability. */ -struct sched_params +struct sched_param { int sched_priority; }; diff --git a/time/strftime.c b/time/strftime.c index 26f4b7f354..866a28065d 100644 --- a/time/strftime.c +++ b/time/strftime.c @@ -92,6 +92,46 @@ Cambridge, MA 02139, USA. */ #define TM_YEAR_BASE 1900 +#ifdef _LIBC +# define gmtime_r __gmtime_r +# define localtime_r __localtime_r +#else +# if ! HAVE_LOCALTIME_R +# if ! HAVE_TM_GMTOFF +/* Approximate gmtime_r as best we can in its absence. */ +#define gmtime_r my_gmtime_r +static struct tm *gmtime_r __P ((const time_t *, struct tm *)); +static struct tm * +gmtime_r (t, tp) + const time_t *t; + struct tm *tp; +{ + struct tm *l = gmtime (t); + if (! l) + return 0; + *tp = *l; + return tp; +} +# endif /* ! HAVE_TM_GMTOFF */ + +/* Approximate localtime_r as best we can in its absence. */ +#define localtime_r my_localtime_r +static struct tm *localtime_r __P ((const time_t *, struct tm *)); +static struct tm * +localtime_r (t, tp) + const time_t *t; + struct tm *tp; +{ + struct tm *l = localtime (t); + if (! l) + return 0; + *tp = *l; + return tp; +} +# endif /* ! HAVE_LOCALTIME_R */ +#endif /* ! defined (_LIBC) */ + + static unsigned int week __P ((const struct tm *const, int, int));