From 14c3586351fdf3e123b000f95a1e83314f78babb Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 19 Mar 2004 00:37:59 +0000 Subject: [PATCH] Update. 2004-03-18 Jakub Jelinek * sysdeps/generic/dl-cache.c (_dl_load_cache_lookup): Remove hwcap variable and weak_extern for _dl_hwcap. (_DL_HWCAP_TLS_MASK): Define. (HWCAP_CHECK): Fix checking of non-platform hwcap bits. Use lib->osversion instead of cache_new->libs[middle].osversion. * stdio-common/asprintf.c: Remove USE_IN_LIBIO conditionals. * stdio-common/dprintf.c: Likewise. * stdio-common/fprintf.c: Likewise. * stdio-common/getline.c: Likewise. * stdio-common/getw.c: Likewise. * stdio-common/perror.c: Likewise. * stdio-common/printf-prs.c: Likewise. * stdio-common/printf.c: Likewise. * stdio-common/printf_size.c: Likewise. * stdio-common/psignal.c: Likewise. * stdio-common/putw.c: Likewise. * stdio-common/scanf.c: Likewise. * stdio-common/snprintf.c: Likewise. * stdio-common/sprintf.c: Likewise. * stdio-common/sscanf.c: Likewise. * stdio-common/tstgetln.c: Likewise. * stdio-common/vfprintf.c: Likewise. 2004-03-18 Paul Eggert * posix/getopt.h (__GNUC_PREREQ) [!defined __THROW]: Define if not defined, fixing a typo (it used to be defined if __GNUC__ was not defined). --- ChangeLog | 32 ++++++ nptl/ChangeLog | 23 +++++ posix/getopt.h | 2 +- stdio-common/asprintf.c | 9 +- stdio-common/dprintf.c | 8 +- stdio-common/fprintf.c | 4 +- stdio-common/getline.c | 13 ++- stdio-common/getw.c | 8 +- stdio-common/perror.c | 8 +- stdio-common/printf-prs.c | 25 +---- stdio-common/printf.c | 7 +- stdio-common/printf_size.c | 26 ++--- stdio-common/psignal.c | 11 +-- stdio-common/putw.c | 9 +- stdio-common/scanf.c | 11 +-- stdio-common/snprintf.c | 8 +- stdio-common/sprintf.c | 12 +-- stdio-common/sscanf.c | 14 +-- stdio-common/tstgetln.c | 10 +- stdio-common/vfprintf.c | 235 ++++++++++----------------------------------- sysdeps/generic/dl-cache.c | 18 ++-- 21 files changed, 175 insertions(+), 318 deletions(-) diff --git a/ChangeLog b/ChangeLog index 81df901..a91b641 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,35 @@ +2004-03-18 Jakub Jelinek + + * sysdeps/generic/dl-cache.c (_dl_load_cache_lookup): Remove hwcap + variable and weak_extern for _dl_hwcap. + (_DL_HWCAP_TLS_MASK): Define. + (HWCAP_CHECK): Fix checking of non-platform hwcap bits. Use + lib->osversion instead of cache_new->libs[middle].osversion. + + * stdio-common/asprintf.c: Remove USE_IN_LIBIO conditionals. + * stdio-common/dprintf.c: Likewise. + * stdio-common/fprintf.c: Likewise. + * stdio-common/getline.c: Likewise. + * stdio-common/getw.c: Likewise. + * stdio-common/perror.c: Likewise. + * stdio-common/printf-prs.c: Likewise. + * stdio-common/printf.c: Likewise. + * stdio-common/printf_size.c: Likewise. + * stdio-common/psignal.c: Likewise. + * stdio-common/putw.c: Likewise. + * stdio-common/scanf.c: Likewise. + * stdio-common/snprintf.c: Likewise. + * stdio-common/sprintf.c: Likewise. + * stdio-common/sscanf.c: Likewise. + * stdio-common/tstgetln.c: Likewise. + * stdio-common/vfprintf.c: Likewise. + +2004-03-18 Paul Eggert + + * posix/getopt.h (__GNUC_PREREQ) [!defined __THROW]: Define + if not defined, fixing a typo (it used to be defined if + __GNUC__ was not defined). + 2004-03-18 Ulrich Drepper * posix/sched.h: Change sched_getaffinity and sched_setaffinity diff --git a/nptl/ChangeLog b/nptl/ChangeLog index 4734c73..4670867 100644 --- a/nptl/ChangeLog +++ b/nptl/ChangeLog @@ -1,3 +1,26 @@ +2004-03-18 Ulrich Drepper + + * sysdeps/unix/sysv/linux/internaltypes.h (struct pthread_attr): Add + cpusetsize field, remove next. + * sysdeps/pthread/pthread.h (pthread_getaffinity_np): Add new second + parameter for size of the CPU set. + (pthread_setaffinity_np): Likewise. + (pthread_attr_getaffinity_np): Likewise. + (pthread_attr_setaffinity_np): Likewise. + * sysdeps/unix/sysv/linux/pthread_attr_getaffinity.c: Implement + interface change, keep compatibility code. + * sysdeps/unix/sysv/linux/pthread_attr_setaffinity.c: Likewise. + * sysdeps/unix/sysv/linux/pthread_getaffinity.c: Likewise. + * sysdeps/unix/sysv/linux/pthread_setaffinity.c: Likewise. + * pthreadP.h: Remove hidden_proto for pthread_getaffinity_np. Declare + __pthread_getaffinity_np. + * Versions: Add version for changed interfaces. + * tst-attr3.c: Adjust test for interface change. + * pthread_getattr_np.c: Query the kernel about the affinity mask with + increasing buffer sizes. + * pthread_attr_destroy.c: Remove unused list handling. + * pthread_attr_init.c: Likewise. + 2004-03-17 Roland McGrath * sysdeps/unix/sysv/linux/timer_create.c (timer_create): Pass missing diff --git a/posix/getopt.h b/posix/getopt.h index a1de242..b7a026c 100644 --- a/posix/getopt.h +++ b/posix/getopt.h @@ -36,7 +36,7 @@ #endif #ifndef __THROW -# ifndef __GNUC__ +# ifndef __GNUC_PREREQ # define __GNUC_PREREQ(maj, min) (0) # endif # if defined __cplusplus && __GNUC_PREREQ (2,8) diff --git a/stdio-common/asprintf.c b/stdio-common/asprintf.c index 3b211d6..2c466d2 100644 --- a/stdio-common/asprintf.c +++ b/stdio-common/asprintf.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1991, 1995, 1997, 1998, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1995, 1997, 1998, 2002, 2004 + 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 @@ -19,10 +20,8 @@ #include #include -#ifdef USE_IN_LIBIO -# include -# define vasprintf(s, f, a) _IO_vasprintf (s, f, a) -#endif +#include +#define vasprintf(s, f, a) _IO_vasprintf (s, f, a) #undef __asprintf /* Write formatted output from FORMAT to a string which is diff --git a/stdio-common/dprintf.c b/stdio-common/dprintf.c index 534b3f0..b362e5f 100644 --- a/stdio-common/dprintf.c +++ b/stdio-common/dprintf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991,95,97,98,2002 Free Software Foundation, Inc. +/* Copyright (C) 1991,95,97,98,2002,2004 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 @@ -19,10 +19,8 @@ #include #include -#ifdef USE_IN_LIBIO -# include -# define vdprintf(d, f, a) _IO_vdprintf (d, f, a) -#endif +#include +#define vdprintf(d, f, a) _IO_vdprintf (d, f, a) /* Write formatted output to D, according to the format string FORMAT. */ /* VARARGS2 */ diff --git a/stdio-common/fprintf.c b/stdio-common/fprintf.c index 9243a4e..0b99fc8 100644 --- a/stdio-common/fprintf.c +++ b/stdio-common/fprintf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991,97,2002 Free Software Foundation, Inc. +/* Copyright (C) 1991,97,2002,2004 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,9 +36,7 @@ fprintf (FILE *stream, const char *format, ...) } libc_hidden_def (fprintf) -#ifdef USE_IN_LIBIO /* We define the function with the real name here. But deep down in libio the original function _IO_fprintf is also needed. So make an alias. */ weak_alias (fprintf, _IO_fprintf) -#endif diff --git a/stdio-common/getline.c b/stdio-common/getline.c index 4acb41d..198983c 100644 --- a/stdio-common/getline.c +++ b/stdio-common/getline.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1991, 1992, 1995, 1996, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992, 1995, 1996, 1997, 2004 + 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 @@ -21,12 +22,10 @@ #undef __getline -#ifdef USE_IN_LIBIO -# include "../libio/libioP.h" -# undef ssize_t -# define ssize_t _IO_ssize_t -# define __getdelim _IO_getdelim -#endif +#include "../libio/libioP.h" +#undef ssize_t +#define ssize_t _IO_ssize_t +#define __getdelim _IO_getdelim /* Like getdelim, but always looks for a newline. */ ssize_t diff --git a/stdio-common/getw.c b/stdio-common/getw.c index 81156e6..423da40 100644 --- a/stdio-common/getw.c +++ b/stdio-common/getw.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1997, 1998, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1997, 1998, 2002, 2004 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 @@ -18,10 +18,8 @@ #include -#ifdef USE_IN_LIBIO -# include -# define fread(p, m, n, s) INTUSE(_IO_fread) (p, m, n, s) -#endif +#include +#define fread(p, m, n, s) INTUSE(_IO_fread) (p, m, n, s) /* Read a word (int) from STREAM. */ int diff --git a/stdio-common/perror.c b/stdio-common/perror.c index 8db3ca4..f075137 100644 --- a/stdio-common/perror.c +++ b/stdio-common/perror.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-1993,1997,1998,2000-2003 Free Software Foundation, Inc. +/* Copyright (C) 1991-1993,1997,1998,2000-2004 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 @@ -21,9 +21,7 @@ #include #include #include -#ifdef USE_IN_LIBIO -# include "libioP.h" -#endif +#include "libioP.h" static void perror_internal (FILE *fp, const char *s, int errnum) @@ -39,11 +37,9 @@ perror_internal (FILE *fp, const char *s, int errnum) errstring = __strerror_r (errnum, buf, sizeof buf); -#ifdef USE_IN_LIBIO if (_IO_fwide (fp, 0) > 0) (void) __fwprintf (fp, L"%s%s%s\n", s, colon, errstring); else -#endif (void) fprintf (fp, "%s%s%s\n", s, colon, errstring); } diff --git a/stdio-common/printf-prs.c b/stdio-common/printf-prs.c index 7aef42d..f3b27d6 100644 --- a/stdio-common/printf-prs.c +++ b/stdio-common/printf-prs.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1991,92,95,96,99,2000,2002,2003 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992, 1995, 1996, 1999, 2000, 2002, 2003, 2004 + 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 @@ -34,19 +35,10 @@ # define ISASCII(Ch) isascii (Ch) # define MBRLEN(Cp, L, St) __mbrlen (Cp, L, St) -# ifdef USE_IN_LIBIO -# define PUT(F, S, N) _IO_sputn (F, S, N) -# define PAD(Padchar) \ - if (width > 0) \ - done += INTUSE(_IO_padn) (s, Padchar, width) -# else -# define PUTC(C, F) putc (C, F) -ssize_t __printf_pad __P ((FILE *, char pad, size_t n)); +# define PUT(F, S, N) _IO_sputn (F, S, N) # define PAD(Padchar) \ if (width > 0) \ - { if (__printf_pad (s, Padchar, width) == -1) \ - return -1; else done += width; } -# endif + done += INTUSE(_IO_padn) (s, Padchar, width) #else # define vfprintf vfwprintf # define CHAR_T wchar_t @@ -55,19 +47,10 @@ ssize_t __printf_pad __P ((FILE *, char pad, size_t n)); # define L_(Str) L##Str # define ISDIGIT(Ch) iswdigit (Ch) -# ifdef USE_IN_LIBIO # define PUT(F, S, N) _IO_sputn (F, S, N) # define PAD(Padchar) \ if (width > 0) \ done += _IO_wpadn (s, Padchar, width) -# else -# define PUTC(C, F) wputc (C, F) -ssize_t __wprintf_pad __P ((FILE *, wchar_t pad, size_t n)); -# define PAD(Padchar) \ - if (width > 0) \ - { if (__wprintf_pad (s, Padchar, width) == -1) \ - return -1; else done += width; } -# endif #endif #define DONT_NEED_READ_INT diff --git a/stdio-common/printf.c b/stdio-common/printf.c index fa013bb..e28c583 100644 --- a/stdio-common/printf.c +++ b/stdio-common/printf.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1991, 1995, 1996, 1997, 2001 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1995, 1996, 1997, 2001, 2004 + 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,8 +37,6 @@ printf (const char *format, ...) return done; } -#ifdef USE_IN_LIBIO -# undef _IO_printf +#undef _IO_printf /* This is for libg++. */ strong_alias (printf, _IO_printf); -#endif diff --git a/stdio-common/printf_size.c b/stdio-common/printf_size.c index d4cbdbf..3c7ac35 100644 --- a/stdio-common/printf_size.c +++ b/stdio-common/printf_size.c @@ -23,30 +23,20 @@ #include #include #include -#ifdef USE_IN_LIBIO -# include -#else -# include -#endif +#include /* This defines make it possible to use the same code for GNU C library and the GNU I/O library. */ -#ifdef USE_IN_LIBIO -# define PUT(f, s, n) _IO_sputn (f, s, n) -# define PAD(f, c, n) (wide ? _IO_wpadn (f, c, n) : INTUSE(_IO_padn) (f, c, n)) +#define PUT(f, s, n) _IO_sputn (f, s, n) +#define PAD(f, c, n) (wide ? _IO_wpadn (f, c, n) : INTUSE(_IO_padn) (f, c, n)) /* We use this file GNU C library and GNU I/O library. So make names equal. */ -# undef putc -# define putc(c, f) (wide \ - ? (int)_IO_putwc_unlocked (c, f) : _IO_putc_unlocked (c, f)) -# define size_t _IO_size_t -# define FILE _IO_FILE -#else /* ! USE_IN_LIBIO */ -# define PUT(f, s, n) fwrite (s, 1, n, f) -# define PAD(f, c, n) __printf_pad (f, c, n) -ssize_t __printf_pad __P ((FILE *, char pad, int n)); /* In vfprintf.c. */ -#endif /* USE_IN_LIBIO */ +#undef putc +#define putc(c, f) (wide \ + ? (int)_IO_putwc_unlocked (c, f) : _IO_putc_unlocked (c, f)) +#define size_t _IO_size_t +#define FILE _IO_FILE /* Macros for doing the actual output. */ diff --git a/stdio-common/psignal.c b/stdio-common/psignal.c index c756394..0764af5 100644 --- a/stdio-common/psignal.c +++ b/stdio-common/psignal.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1991,1992,1995-1997,2001,2002 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992, 1995, 1996, 1997, 2001, 2002, 2004 + 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 @@ -20,9 +21,7 @@ #include #include #include -#ifdef USE_IN_LIBIO -# include -#endif +#include #ifndef HAVE_GNU_LD @@ -49,11 +48,9 @@ psignal (int sig, const char *s) if (sig >= 0 && sig < NSIG && (desc = INTUSE(_sys_siglist)[sig]) != NULL) { -#ifdef USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) (void) __fwprintf (stderr, L"%s%s%s\n", s, colon, _(desc)); else -#endif (void) fprintf (stderr, "%s%s%s\n", s, colon, _(desc)); } else @@ -62,11 +59,9 @@ psignal (int sig, const char *s) (void) __asprintf (&buf, _("%s%sUnknown signal %d\n"), s, colon, sig); -#ifdef USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) (void) __fwprintf (stderr, L"%s", buf); else -#endif (void) fputs (buf, stderr); free (buf); diff --git a/stdio-common/putw.c b/stdio-common/putw.c index ddf9ced..66a36fa 100644 --- a/stdio-common/putw.c +++ b/stdio-common/putw.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1997, 1998, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1997, 1998, 2002, 2004 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 @@ -17,11 +17,8 @@ 02111-1307 USA. */ #include - -#ifdef USE_IN_LIBIO -# include -# define fwrite(p, n, m, s) INTUSE(_IO_fwrite) (p, n, m, s) -#endif +#include +#define fwrite(p, n, m, s) INTUSE(_IO_fwrite) (p, n, m, s) /* Write the word (int) W to STREAM. */ int diff --git a/stdio-common/scanf.c b/stdio-common/scanf.c index 268aa90..62c9959 100644 --- a/stdio-common/scanf.c +++ b/stdio-common/scanf.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1991, 1995, 1996, 1997, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1995, 1996, 1997, 2002, 2004 + 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 @@ -19,9 +20,7 @@ #include #include -#ifdef USE_IN_LIBIO -# include -#endif +#include /* Read formatted input from stdin according to the format string FORMAT. */ @@ -33,11 +32,7 @@ scanf (const char *format, ...) int done; va_start (arg, format); -#ifdef USE_IN_LIBIO done = INTUSE(_IO_vfscanf) (stdin, format, arg, NULL); -#else - done = vfscanf (stdin, format, arg); -#endif va_end (arg); return done; diff --git a/stdio-common/snprintf.c b/stdio-common/snprintf.c index a880c4a..ce392f0 100644 --- a/stdio-common/snprintf.c +++ b/stdio-common/snprintf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1995, 1997, 1998 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1995, 1997, 1998, 2004 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 @@ -19,10 +19,8 @@ #include #include -#ifdef USE_IN_LIBIO -# include -# define __vsnprintf(s, l, f, a) _IO_vsnprintf (s, l, f, a) -#endif +#include +#define __vsnprintf(s, l, f, a) _IO_vsnprintf (s, l, f, a) /* Write formatted output into S, according to the format string FORMAT, writing no more than MAXLEN characters. */ diff --git a/stdio-common/sprintf.c b/stdio-common/sprintf.c index 07e2654..249fcb0 100644 --- a/stdio-common/sprintf.c +++ b/stdio-common/sprintf.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1991, 1995, 1997, 1998, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1995, 1997, 1998, 2002, 2004 + 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 @@ -18,11 +19,8 @@ #include #include - -#ifdef USE_IN_LIBIO -# include -# define vsprintf(s, f, a) INTUSE(_IO_vsprintf) (s, f, a) -#endif +#include +#define vsprintf(s, f, a) INTUSE(_IO_vsprintf) (s, f, a) /* Write formatted output into S, according to the format string FORMAT. */ /* VARARGS2 */ @@ -40,6 +38,4 @@ sprintf (char *s, const char *format, ...) } libc_hidden_def (sprintf) -#ifdef USE_IN_LIBIO strong_alias(sprintf, _IO_sprintf) -#endif diff --git a/stdio-common/sscanf.c b/stdio-common/sscanf.c index ed4cb1d..b369767 100644 --- a/stdio-common/sscanf.c +++ b/stdio-common/sscanf.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1991,1995,1996,1998,2002,2003 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1995, 1996, 1998, 2002, 2003, 2004 + 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 @@ -18,11 +19,8 @@ #include #include - -#ifdef USE_IN_LIBIO -# include -# define __vsscanf(s, f, a) _IO_vsscanf (s, f, a) -#endif +#include +#define __vsscanf(s, f, a) _IO_vsscanf (s, f, a) /* Read formatted input from S, according to the format string FORMAT. */ /* VARARGS2 */ @@ -40,8 +38,6 @@ sscanf (const char *s, const char *format, ...) } libc_hidden_def (sscanf) -#ifdef USE_IN_LIBIO -# undef _IO_sscanf +#undef _IO_sscanf /* This is for libg++. */ strong_alias (sscanf, _IO_sscanf) -#endif diff --git a/stdio-common/tstgetln.c b/stdio-common/tstgetln.c index d328d57..e3080fa 100644 --- a/stdio-common/tstgetln.c +++ b/stdio-common/tstgetln.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1992, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. +/* Copyright (C) 1992, 1995, 1996, 1997, 1998, 2004 + 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 @@ -17,11 +18,8 @@ 02111-1307 USA. */ #include - -#ifdef USE_IN_LIBIO -# undef ssize_t -# define ssize_t _IO_ssize_t -#endif +#undef ssize_t +#define ssize_t _IO_ssize_t int main (int argc, char *argv[]) diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c index 8465680..ee0326e 100644 --- a/stdio-common/vfprintf.c +++ b/stdio-common/vfprintf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2002, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1991-2002, 2003, 2004 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 @@ -39,15 +39,13 @@ implementation as defined in ISO/IEC 9899:1990/Amendment 1:1995. */ -#ifdef USE_IN_LIBIO -/* This code is for use in libio. */ -# include -# define FILE _IO_FILE -# undef va_list -# define va_list _IO_va_list -# undef BUFSIZ -# define BUFSIZ _IO_BUFSIZ -# define ARGCHECK(S, Format) \ +#include +#define FILE _IO_FILE +#undef va_list +#define va_list _IO_va_list +#undef BUFSIZ +#define BUFSIZ _IO_BUFSIZ +#define ARGCHECK(S, Format) \ do \ { \ /* Check file argument for consistence. */ \ @@ -63,95 +61,46 @@ return -1; \ } \ } while (0) -# define UNBUFFERED_P(S) ((S)->_IO_file_flags & _IO_UNBUFFERED) - -# ifndef COMPILE_WPRINTF -# define vfprintf _IO_vfprintf -# define CHAR_T char -# define UCHAR_T unsigned char -# define INT_T int -# define L_(Str) Str -# define ISDIGIT(Ch) ((unsigned int) ((Ch) - '0') < 10) - -# define PUT(F, S, N) _IO_sputn ((F), (S), (N)) -# define PAD(Padchar) \ +#define UNBUFFERED_P(S) ((S)->_IO_file_flags & _IO_UNBUFFERED) + +#ifndef COMPILE_WPRINTF +# define vfprintf _IO_vfprintf +# define CHAR_T char +# define UCHAR_T unsigned char +# define INT_T int +# define L_(Str) Str +# define ISDIGIT(Ch) ((unsigned int) ((Ch) - '0') < 10) + +# define PUT(F, S, N) _IO_sputn ((F), (S), (N)) +# define PAD(Padchar) \ if (width > 0) \ done += INTUSE(_IO_padn) (s, (Padchar), width) -# define PUTC(C, F) _IO_putc_unlocked (C, F) -# define ORIENT if (_IO_vtable_offset (s) == 0 && _IO_fwide (s, -1) != -1)\ +# define PUTC(C, F) _IO_putc_unlocked (C, F) +# define ORIENT if (_IO_vtable_offset (s) == 0 && _IO_fwide (s, -1) != -1)\ return -1 -# else -# define vfprintf _IO_vfwprintf -# define CHAR_T wchar_t +#else +# define vfprintf _IO_vfwprintf +# define CHAR_T wchar_t /* This is a hack!!! There should be a type uwchar_t. */ -# define UCHAR_T unsigned int /* uwchar_t */ -# define INT_T wint_t -# define L_(Str) L##Str -# define ISDIGIT(Ch) ((unsigned int) ((Ch) - L'0') < 10) +# define UCHAR_T unsigned int /* uwchar_t */ +# define INT_T wint_t +# define L_(Str) L##Str +# define ISDIGIT(Ch) ((unsigned int) ((Ch) - L'0') < 10) -# include "_itowa.h" +# include "_itowa.h" -# define PUT(F, S, N) _IO_sputn ((F), (S), (N)) -# define PAD(Padchar) \ +# define PUT(F, S, N) _IO_sputn ((F), (S), (N)) +# define PAD(Padchar) \ if (width > 0) \ done += _IO_wpadn (s, (Padchar), width) -# define PUTC(C, F) _IO_putwc_unlocked (C, F) -# define ORIENT if (_IO_fwide (s, 1) != 1) return -1 - -# define _itoa(Val, Buf, Base, Case) _itowa (Val, Buf, Base, Case) -# define _itoa_word(Val, Buf, Base, Case) _itowa_word (Val, Buf, Base, Case) -# undef EOF -# define EOF WEOF -# endif -#else /* ! USE_IN_LIBIO */ -/* This code is for use in the GNU C library. */ -# define ARGCHECK(S, Format) \ - do \ - { \ - /* Check file argument for consistence. */ \ - if (!__validfp (S) || !S->__mode.__write) \ - { \ - __set_errno (EBADF); \ - return -1; \ - } \ - if (Format == NULL) \ - { \ - __set_errno (EINVAL); \ - return -1; \ - } \ - if (!S->__seen) \ - { \ - if (__flshfp (S, EOF) == EOF) \ - return -1; \ - } \ - } \ - while (0) -# define UNBUFFERED_P(s) ((s)->__buffer == NULL) +# define PUTC(C, F) _IO_putwc_unlocked (C, F) +# define ORIENT if (_IO_fwide (s, 1) != 1) return -1 -# define CHAR_T char -# define UCHAR_T unsigned char -# define INT_T int -# define L_(Str) Str -# define ISDIGIT(Ch) isdigit (Ch) - -# define PUT(F, S, N) fwrite (S, 1, N, F) -ssize_t __printf_pad __P ((FILE *, char pad, size_t n)); -# define PAD(Padchar) \ - if (width > 0) \ - { ssize_t __res = __printf_pad (s, (Padchar), width); \ - if (__res == -1) \ - { \ - done = -1; \ - goto all_done; \ - } \ - done += __res; } -# define PUTC(C, F) putc (C, F) - -/* XXX These declarations should go as soon as the stdio header files - have these prototypes. */ -extern void __flockfile (FILE *); -extern void __funlockfile (FILE *); -#endif /* USE_IN_LIBIO */ +# define _itoa(Val, Buf, Base, Case) _itowa (Val, Buf, Base, Case) +# define _itoa_word(Val, Buf, Base, Case) _itowa_word (Val, Buf, Base, Case) +# undef EOF +# define EOF WEOF +#endif #include "_i18n_number.h" @@ -1266,10 +1215,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap) #ifdef ORIENT /* Check for correct orientation. */ - if ( -# ifdef USE_IN_LIBIO - _IO_vtable_offset (s) == 0 && -# endif + if (_IO_vtable_offset (s) == 0 && _IO_fwide (s, sizeof (CHAR_T) == 1 ? -1 : 1) != (sizeof (CHAR_T) == 1 ? -1 : 1)) /* The stream is already oriented otherwise. */ @@ -1305,13 +1251,8 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap) #endif /* Lock stream. */ -#ifdef USE_IN_LIBIO _IO_cleanup_region_start ((void (*) (void *)) &_IO_funlockfile, s); _IO_flockfile (s); -#else - __libc_cleanup_region_start (1, (void (*) (void *)) &__funlockfile, s); - __flockfile (s); -#endif /* Write the literal text before the first format. */ outstring ((const UCHAR_T *) format, @@ -1906,13 +1847,8 @@ all_done: if (__builtin_expect (workstart != NULL, 0)) free (workstart); /* Unlock the stream. */ -#ifdef USE_IN_LIBIO _IO_funlockfile (s); _IO_cleanup_region_end (0); -#else - __funlockfile (s); - __libc_cleanup_region_end (0); -#endif return done; } @@ -2041,7 +1977,6 @@ group_number (CHAR_T *w, CHAR_T *rear_ptr, const char *grouping, return w; } -#ifdef USE_IN_LIBIO /* Helper "class" for `fprintf to unbuffered': creates a temporary buffer. */ struct helper_file { @@ -2159,7 +2094,7 @@ buffered_vfprintf (register _IO_FILE *s, const CHAR_T *format, _IO_JUMPS (&helper._f) = (struct _IO_jump_t *) &_IO_helper_jumps; /* Now print to helper instead. */ -#if defined USE_IN_LIBIO && !defined COMPILE_WPRINTF +#ifndef COMPILE_WPRINTF result = INTUSE(_IO_vfprintf) (hp, format, args); #else result = vfprintf (hp, format, args); @@ -2193,91 +2128,25 @@ buffered_vfprintf (register _IO_FILE *s, const CHAR_T *format, return result; } -#else /* !USE_IN_LIBIO */ - -static int -internal_function -buffered_vfprintf (register FILE *s, const CHAR_T *format, va_list args) -{ - char buf[BUFSIZ]; - int result; - - /* Orient the stream. */ -#ifdef ORIENT - ORIENT; -#endif - - s->__bufp = s->__buffer = buf; - s->__bufsize = sizeof buf; - s->__put_limit = s->__buffer + s->__bufsize; - s->__get_limit = s->__buffer; - - /* Now use buffer to print. */ - result = vfprintf (s, format, args); - - if (fflush (s) == EOF) - result = -1; - s->__buffer = s->__bufp = s->__get_limit = s->__put_limit = NULL; - s->__bufsize = 0; - - return result; -} - -/* Pads string with given number of a specified character. - This code is taken from iopadn.c of the GNU I/O library. */ -#define PADSIZE 16 -static const CHAR_T blanks[PADSIZE] = -{ L_(' '), L_(' '), L_(' '), L_(' '), L_(' '), L_(' '), L_(' '), L_(' '), - L_(' '), L_(' '), L_(' '), L_(' '), L_(' '), L_(' '), L_(' '), L_(' ') }; -static const CHAR_T zeroes[PADSIZE] = -{ L_('0'), L_('0'), L_('0'), L_('0'), L_('0'), L_('0'), L_('0'), L_('0'), - L_('0'), L_('0'), L_('0'), L_('0'), L_('0'), L_('0'), L_('0'), L_('0') }; - -ssize_t -#ifndef COMPILE_WPRINTF -__printf_pad (FILE *s, char pad, size_t count) -#else -__wprintf_pad (FILE *s, wchar_t pad, size_t count) -#endif -{ - const CHAR_T *padptr; - register size_t i; - - padptr = pad == L_(' ') ? blanks : zeroes; - - for (i = count; i >= PADSIZE; i -= PADSIZE) - if (PUT (s, padptr, PADSIZE) != PADSIZE) - return -1; - if (i > 0) - if (PUT (s, padptr, i) != i) - return -1; - - return count; -} -#undef PADSIZE -#endif /* USE_IN_LIBIO */ - -#ifdef USE_IN_LIBIO -# undef vfprintf -# ifdef strong_alias +#undef vfprintf +#ifdef strong_alias /* This is for glibc. */ -# ifdef COMPILE_WPRINTF +# ifdef COMPILE_WPRINTF strong_alias (_IO_vfwprintf, __vfwprintf); weak_alias (_IO_vfwprintf, vfwprintf); -# else +# else strong_alias (_IO_vfprintf, vfprintf); libc_hidden_def (vfprintf) INTDEF(_IO_vfprintf) -# endif -# else -# if defined __ELF__ || defined __GNU_LIBRARY__ -# include -# ifdef weak_alias -# ifdef COMPILE_WPRINTF +# endif +#else +# if defined __ELF__ || defined __GNU_LIBRARY__ +# include +# ifdef weak_alias +# ifdef COMPILE_WPRINTF weak_alias (_IO_vfwprintf, vfwprintf); -# else +# else weak_alias (_IO_vfprintf, vfprintf); -# endif # endif # endif # endif diff --git a/sysdeps/generic/dl-cache.c b/sysdeps/generic/dl-cache.c index 2861dc2..29886e1 100644 --- a/sysdeps/generic/dl-cache.c +++ b/sysdeps/generic/dl-cache.c @@ -243,12 +243,7 @@ _dl_load_cache_lookup (const char *name) if (cache_new != (void *) -1) { - /* This file ends in static libraries where we don't have a hwcap. */ - unsigned long int *hwcap; uint64_t platform; -#ifndef SHARED - weak_extern (_dl_hwcap); -#endif /* This is where the strings start. */ cache_data = (const char *) cache_new; @@ -256,22 +251,25 @@ _dl_load_cache_lookup (const char *name) /* Now we can compute how large the string table is. */ cache_data_size = (const char *) cache + cachesize - cache_data; - hwcap = &GLRO(dl_hwcap); platform = _dl_string_platform (GLRO(dl_platform)); if (platform != (uint64_t) -1) platform = 1ULL << platform; /* Only accept hwcap if it's for the right platform. */ +#ifdef USE_TLS +# define _DL_HWCAP_TLS_MASK (1LL << 63) +#else +# define _DL_HWCAP_TLS_MASK 0 +#endif #define HWCAP_CHECK \ - if (GLRO(dl_osversion) \ - && cache_new->libs[middle].osversion > GLRO(dl_osversion)) \ + if (GLRO(dl_osversion) && lib->osversion > GLRO(dl_osversion)) \ continue; \ if (_DL_PLATFORMS_COUNT && platform != -1 \ && (lib->hwcap & _DL_HWCAP_PLATFORM) != 0 \ && (lib->hwcap & _DL_HWCAP_PLATFORM) != platform) \ continue; \ - if (hwcap \ - && ((lib->hwcap & *hwcap & ~_DL_HWCAP_PLATFORM) > *hwcap)) \ + if (lib->hwcap \ + & ~(GLRO(dl_hwcap) | _DL_HWCAP_PLATFORM | _DL_HWCAP_TLS_MASK)) \ continue SEARCH_CACHE (cache_new); } -- 2.7.4