1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00
2004-03-18  Jakub Jelinek  <jakub@redhat.com>

	* 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  <eggert@cs.ucla.edu>

	* posix/getopt.h (__GNUC_PREREQ) [!defined __THROW]: Define
	if not defined, fixing a typo (it used to be defined if
	__GNUC__ was not defined).
This commit is contained in:
Ulrich Drepper
2004-03-19 00:37:59 +00:00
parent 439ff07be0
commit 14c3586351
21 changed files with 179 additions and 322 deletions

View File

@ -1,3 +1,35 @@
2004-03-18 Jakub Jelinek <jakub@redhat.com>
* 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 <eggert@cs.ucla.edu>
* 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 <drepper@redhat.com>
* posix/sched.h: Change sched_getaffinity and sched_setaffinity

View File

@ -1,3 +1,26 @@
2004-03-18 Ulrich Drepper <drepper@redhat.com>
* 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 <roland@redhat.com>
* sysdeps/unix/sysv/linux/timer_create.c (timer_create): Pass missing

View File

@ -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)

View File

@ -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 <stdarg.h>
#include <stdio.h>
#ifdef USE_IN_LIBIO
# include <libio/libioP.h>
# define vasprintf(s, f, a) _IO_vasprintf (s, f, a)
#endif
#include <libio/libioP.h>
#define vasprintf(s, f, a) _IO_vasprintf (s, f, a)
#undef __asprintf
/* Write formatted output from FORMAT to a string which is

View File

@ -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 <stdarg.h>
#include <stdio.h>
#ifdef USE_IN_LIBIO
# include <libio/libioP.h>
# define vdprintf(d, f, a) _IO_vdprintf (d, f, a)
#endif
#include <libio/libioP.h>
#define vdprintf(d, f, a) _IO_vdprintf (d, f, a)
/* Write formatted output to D, according to the format string FORMAT. */
/* VARARGS2 */

View File

@ -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

View File

@ -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

View File

@ -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 <stdio.h>
#ifdef USE_IN_LIBIO
# include <libio/iolibio.h>
# define fread(p, m, n, s) INTUSE(_IO_fread) (p, m, n, s)
#endif
#include <libio/iolibio.h>
#define fread(p, m, n, s) INTUSE(_IO_fread) (p, m, n, s)
/* Read a word (int) from STREAM. */
int

View File

@ -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 <string.h>
#include <unistd.h>
#include <wchar.h>
#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);
}

View File

@ -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

View File

@ -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

View File

@ -23,30 +23,20 @@
#include <ieee754.h>
#include <math.h>
#include <printf.h>
#ifdef USE_IN_LIBIO
# include <libioP.h>
#else
# include <stdio.h>
#endif
#include <libioP.h>
/* 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. */

View File

@ -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 <signal.h>
#include <stdlib.h>
#include <libintl.h>
#ifdef USE_IN_LIBIO
# include <wchar.h>
#endif
#include <wchar.h>
#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);

View File

@ -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 <stdio.h>
#ifdef USE_IN_LIBIO
# include <libio/iolibio.h>
# define fwrite(p, n, m, s) INTUSE(_IO_fwrite) (p, n, m, s)
#endif
#include <libio/iolibio.h>
#define fwrite(p, n, m, s) INTUSE(_IO_fwrite) (p, n, m, s)
/* Write the word (int) W to STREAM. */
int

View File

@ -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 <stdarg.h>
#include <stdio.h>
#ifdef USE_IN_LIBIO
# include <libioP.h>
#endif
#include <libioP.h>
/* 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;

View File

@ -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 <stdarg.h>
#include <stdio.h>
#ifdef USE_IN_LIBIO
# include <libio/libioP.h>
# define __vsnprintf(s, l, f, a) _IO_vsnprintf (s, l, f, a)
#endif
#include <libio/libioP.h>
#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. */

View File

@ -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 <stdarg.h>
#include <stdio.h>
#ifdef USE_IN_LIBIO
# include <libio/iolibio.h>
# define vsprintf(s, f, a) INTUSE(_IO_vsprintf) (s, f, a)
#endif
#include <libio/iolibio.h>
#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

View File

@ -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 <stdarg.h>
#include <stdio.h>
#ifdef USE_IN_LIBIO
# include <libio/iolibio.h>
# define __vsscanf(s, f, a) _IO_vsscanf (s, f, a)
#endif
#include <libio/iolibio.h>
#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

View File

@ -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 <stdio.h>
#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[])

View File

@ -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 <libioP.h>
# define FILE _IO_FILE
# undef va_list
# define va_list _IO_va_list
# undef BUFSIZ
# define BUFSIZ _IO_BUFSIZ
# define ARGCHECK(S, Format) \
#include <libioP.h>
#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)
#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)\
return -1
# 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)
# include "_itowa.h"
# 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 CHAR_T char
# define UCHAR_T unsigned char
#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) isdigit (Ch)
# define ISDIGIT(Ch) ((unsigned int) ((Ch) - '0') < 10)
# 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)
# 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)\
return -1
#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)
/* 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 */
# include "_itowa.h"
# 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
#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 <gnu-stabs.h>
# ifdef weak_alias
# ifdef COMPILE_WPRINTF
# endif
#else
# if defined __ELF__ || defined __GNU_LIBRARY__
# include <gnu-stabs.h>
# ifdef weak_alias
# ifdef COMPILE_WPRINTF
weak_alias (_IO_vfwprintf, vfwprintf);
# else
# else
weak_alias (_IO_vfprintf, vfprintf);
# endif
# endif
# endif
# endif

View File

@ -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);
}