From 5aa8ff620ef68811c5a7dd5d5bbac1c078730a2a Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 21 Apr 1998 18:15:51 +0000 Subject: Update. 1998-04-21 18:00 Ulrich Drepper * iconv/gconv.c (__gconv): Remove bogus input buffer size computation. * iconv/gconv_open.c (__gconv_open): Initialize outbufend element. * iconv/gconv_simple.c (__gconv_transform_internal_ascii): Don't use character in comparison with uint32_t. (__gconv_transform_internal_utf8): Specify MAX_NEEDED_TO. (__gconv_transform_utf8_internal): Specify MAX_NEEDED_FROM. Optimize BODY a bit. * iconv/loop.c: Require MIN_NEEDED_INPUT and MIN_NEEDED_OUTPUT to be defined. * iconv/skeleton.c: Also reset converted counter in case of an error. Call reset function using correct value for output buffer start. * iconvdata/Makefile: Re-enable tests. * iconvdata/iso8859-1.c: Swap MIN_NEEDED_INPUT and MIN_NEEDED_OUTPUT value for to-conversion. * iconvdata/TESTS: Add new third column. * iconvdata/run-iconv-test.sh: Add support for charsets which are not ASCII based. * iconvdata/testdata/suntzus: New file. * elf/dl-minimal.c (__strtol_internal): Increment pointer to string while reading. Correctly used base. Little optimization. (__strtoul_internal): Likewise. * elf/rtld.c (dl_main): Test to avoid duplicate call of _dl_init_paths was wrong. Use explicit variable. 1998-04-20 23:49 Zack Weinberg * configure.in: Check for awk. * config.make.in: Add AWK to be substituted. * manual/xtract-typefun.awk: Rewrite to eliminate gawk extensions. * manual/users.texi: Fix typo exposed by above rewrite. * Makefile: Invoke awk using AWK variable. * csu/Makefile: Likewise. * elf/Makefile: Likewise. * mach/Makefile: Likewise. * manual/Makefile: Likewise. * sysdeps/gnu/Makefile: Likewise. * sysdeps/mach/hurd/Makefile: Likewise. * sysdeps/unix/Makefile: Likewise. * timezone/Makefile: Likewise. 1998-04-10 Gordon Matzigkeit * sysdeps/gnu/errlist.awk (ERR_REMAP): Implement error code to array index translation. (SYS_ERRLIST_ALIAS, SYS_NERR_ALIAS): Make weak aliases only if these are defined. * sysdeps/mach/hurd/Dist: Add errlist.c to distribution. * sysdeps/mach/hurd/errlist.c: New file. (ERR_TRANSLATE): Map Hurd error codes into errlist indices. (_hurd_errlist): The Hurd error list doesn't have Unix sys_errlist semantics, so rename it. 1998-04-16 Andreas Schwab * iconvdata/run-iconv-test.sh: Make portable. Always test all conversions. 1998-04-21 12:30 H.J. Lu * wcsmbs/wcsrtombs.c (__wcsrtombs): Initialize result to 0. * wcsmbs/wcsnrtombs.c: Likewise. 1998-04-21 Ulrich Drepper * sysdeps/generic/dl-sysdep.c: Handle _dl_hwcap correctly. * wcsmbs/btowc.c (__btowc): Declare inptr as const char *. * time/strftime.c (my_strftime): Initialize pad variable in declaration. * iconvdata/big5.c: Don't use character constants in comparisons with unsigned value. * sysdeps/generic/setutxent.c: New file. * sysdeps/generic/getutxent.c: New file. * sysdeps/generic/endutxent.c: New file. * sysdeps/generic/getutxid.c: New file. * sysdeps/generic/getutxline.c: New file. * sysdeps/generic/pututxline.c: New file. * sysdeps/generic/utmpxname.c: New file. * sysdeps/generic/updwtmpx.c: New file. --- sysdeps/generic/dl-sysdep.c | 23 ++++++++++++----------- sysdeps/gnu/Makefile | 2 +- sysdeps/gnu/errlist.awk | 15 +++++++++++---- sysdeps/mach/hurd/Dist | 1 + sysdeps/mach/hurd/Makefile | 2 +- sysdeps/mach/hurd/errlist.c | 26 ++++++++++++++++++++++++++ sysdeps/unix/Makefile | 6 +++--- 7 files changed, 55 insertions(+), 20 deletions(-) create mode 100644 sysdeps/mach/hurd/errlist.c (limited to 'sysdeps') diff --git a/sysdeps/generic/dl-sysdep.c b/sysdeps/generic/dl-sysdep.c index 58c093e268..90beb8f269 100644 --- a/sysdeps/generic/dl-sysdep.c +++ b/sysdeps/generic/dl-sysdep.c @@ -38,7 +38,7 @@ extern char **_dl_argv; extern char **_environ; extern size_t _dl_pagesize; extern const char *_dl_platform; -extern unsigned long _dl_hwcap; +extern unsigned long int _dl_hwcap; extern size_t _dl_platformlen; extern void _end; extern void ENTRY_POINT (void); @@ -48,7 +48,6 @@ int __libc_enable_secure; int __libc_multiple_libcs; /* Defining this here avoids the inclusion of init-first. */ static ElfW(auxv_t) *_dl_auxv; -static unsigned long int hwcap; unsigned long int _dl_hwcap_mask = HWCAP_IMPORTANT; @@ -241,10 +240,11 @@ _dl_show_auxv (void) _dl_sysdep_message ("AT_PLATFORM: ", av->a_un.a_ptr, "\n", NULL); break; case AT_HWCAP: - hwcap = av->a_un.a_val; - if (_dl_procinfo (hwcap) < 0) + _dl_hwcap = av->a_un.a_val; + if (_dl_procinfo (_dl_hwcap) < 0) _dl_sysdep_message ("AT_HWCAP: ", - _itoa_word (hwcap, buf + sizeof buf - 1, 16, 0), + _itoa_word (_dl_hwcap, buf + sizeof buf - 1, + 16, 0), "\n", NULL); break; } @@ -284,7 +284,7 @@ _dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz, size_t *max_capstrlen) { /* Determine how many important bits are set. */ - unsigned long int mask = _dl_hwcap_mask; + unsigned long int masked = _dl_hwcap & _dl_hwcap_mask; size_t cnt = platform != NULL; size_t n, m; size_t total; @@ -293,8 +293,9 @@ _dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz, struct r_strlenpair *rp; char *cp; - for (n = 0; (~((1UL << n) - 1) & mask) != 0; ++n) - if ((mask & (1UL << n)) != 0) + /* Count the number of bits set in the masked value. */ + for (n = 0; (~((1UL << n) - 1) & masked) != 0; ++n) + if ((masked & (1UL << n)) != 0) ++cnt; if (cnt == 0) @@ -318,12 +319,12 @@ _dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz, /* Create temporary data structure to generate result table. */ temp = (struct r_strlenpair *) alloca (cnt * sizeof (*temp)); m = 0; - for (n = 0; mask != 0; ++n) - if ((mask & (1UL << n)) != 0) + for (n = 0; masked != 0; ++n) + if ((masked & (1UL << n)) != 0) { temp[m].str = _dl_hwcap_string (n); temp[m].len = strlen (temp[m].str); - mask ^= 1UL << n; + masked ^= 1UL << n; ++m; } if (platform != NULL) diff --git a/sysdeps/gnu/Makefile b/sysdeps/gnu/Makefile index 762f79b866..77f0b230fd 100644 --- a/sysdeps/gnu/Makefile +++ b/sysdeps/gnu/Makefile @@ -21,7 +21,7 @@ $(..)sysdeps/gnu/errlist.c: $(..)sysdeps/gnu/errlist.awk \ $(..)manual/errno.texi - awk -f $^ > $@-tmp + $(AWK) -f $^ > $@-tmp # Make it unwritable so noone will edit it by mistake. -chmod a-w $@-tmp mv -f $@-tmp $@ diff --git a/sysdeps/gnu/errlist.awk b/sysdeps/gnu/errlist.awk index a14c29cf98..b40606a696 100644 --- a/sysdeps/gnu/errlist.awk +++ b/sysdeps/gnu/errlist.awk @@ -34,9 +34,14 @@ BEGIN { print ""; print "#ifndef SYS_ERRLIST"; print "# define SYS_ERRLIST _sys_errlist"; + print "# define SYS_ERRLIST_ALIAS sys_errlist"; print "#endif"; print "#ifndef SYS_NERR"; print "# define SYS_NERR _sys_nerr"; + print "# define SYS_NERR_ALIAS sys_nerr"; + print "#endif"; + print "#ifndef ERR_REMAP"; + print "# define ERR_REMAP(n) n"; print "#endif"; print ""; print "const char *const SYS_ERRLIST[] ="; @@ -70,7 +75,7 @@ errnoh == 3 && $1 == "@comment" && $2 == "errno" \ errnoh == 4 && $1 == "@end" && $2 == "deftypevr" \ { printf "/*%s */\n", desc; - printf " [%s] = N_(\"%s\"),\n", e, etext; + printf " [ERR_REMAP (%s)] = N_(\"%s\"),\n", e, etext; print "#endif"; errnoh = 0; next; @@ -85,8 +90,10 @@ END { print " };"; print ""; print "const int SYS_NERR = sizeof SYS_ERRLIST / sizeof SYS_ERRLIST [0];"; - print "#if !defined HAVE_ELF || !defined PIC || !defined DO_VERSIONING"; - print "weak_alias (_sys_errlist, sys_errlist)"; - print "weak_alias (_sys_nerr, sys_nerr)"; + print "#ifdef SYS_ERRLIST_ALIAS"; + print "weak_alias (_sys_errlist, SYS_ERRLIST_ALIAS)"; + print "#endif"; + print "#ifdef SYS_NERR_ALIAS"; + print "weak_alias (_sys_nerr, SYS_NERR_ALIAS)"; print "#endif"; } diff --git a/sysdeps/mach/hurd/Dist b/sysdeps/mach/hurd/Dist index 084c314649..03f422d794 100644 --- a/sysdeps/mach/hurd/Dist +++ b/sysdeps/mach/hurd/Dist @@ -1,3 +1,4 @@ +errlist.c errnos.awk err_hurd.sub libc-ldscript diff --git a/sysdeps/mach/hurd/Makefile b/sysdeps/mach/hurd/Makefile index 454ac8f98c..b3161ca195 100644 --- a/sysdeps/mach/hurd/Makefile +++ b/sysdeps/mach/hurd/Makefile @@ -87,7 +87,7 @@ $(common-objpfx)errnos.d: $(mach-errnos-deps) $(hurd)/errnos.h: $(common-objpfx)stamp-errnos ; $(common-objpfx)stamp-errnos: $(hurd)/errnos.awk $(errno.texinfo) \ $(mach-errnos-deps) - gawk -f $^ > $(hurd)/errnos.h-tmp + $(AWK) -f $^ > $(hurd)/errnos.h-tmp # Make it unwritable so noone will edit it by mistake. -chmod a-w $(hurd)/errnos.h-tmp ./$(..)move-if-change $(hurd)/errnos.h-tmp $(hurd)/errnos.h diff --git a/sysdeps/mach/hurd/errlist.c b/sysdeps/mach/hurd/errlist.c new file mode 100644 index 0000000000..5cbc543ed1 --- /dev/null +++ b/sysdeps/mach/hurd/errlist.c @@ -0,0 +1,26 @@ +/* Copyright (C) 1998 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. */ + +/* SYS_ERRLIST cannot have Unix semantics on the Hurd, so it is easier + just to rename it. We also need to remap error codes to array + indices by taking their subcode. */ +#define SYS_ERRLIST _hurd_errlist +#define SYS_NERR _hurd_nerr +#define ERR_REMAP(n) (n & 0x3fff) + +#include diff --git a/sysdeps/unix/Makefile b/sysdeps/unix/Makefile index 4863556332..234caee5d4 100644 --- a/sysdeps/unix/Makefile +++ b/sysdeps/unix/Makefile @@ -54,7 +54,7 @@ $(common-objpfx)sys/param.h: $(sysincludedir)/sys/param.h (echo '#ifndef _SYS_PARAM_H'; \ echo '#define _SYS_PARAM_H 1'; \ echo '#include '; \ - awk < $< \ + $(AWK) < $< \ '/^#define[ ]*NULL/ { print "#ifndef NULL"; \ print $$0; \ print "#endif"; \ @@ -142,7 +142,7 @@ $(common-objpfx)make-errnos: $(common-objpfx)make-errnos.c $(common-objpfx)make-errnos.c: $(sysdep_dir)/unix/errnos-tmpl.c \ $(sysdep_dir)/unix/errnos.awk $(common-objpfx)errnos - awk -f $(word 2,$^) errnos="`tr '\012' ' ' < $(word 3,$^)`" $< > $@T + $(AWK) -f $(word 2,$^) errnos="`tr '\012' ' ' < $(word 3,$^)`" $< > $@T mv $@T $@ $(common-objpfx)errnos: $(wildcard $(sysincludedir)/errno.h \ @@ -176,7 +176,7 @@ $(common-objpfx)make-ioctls: $(common-objpfx)make-ioctls.c $(common-objpfx)make-ioctls.c: $(sysdep_dir)/unix/ioctls-tmpl.c \ $(sysdep_dir)/unix/ioctls.awk \ $(common-objpfx)ioctls - awk -f $(word 2,$^) requests="`cat $(word 3,$^)`" $< > $@T + $(AWK) -f $(word 2,$^) requests="`cat $(word 3,$^)`" $< > $@T mv $@T $@ -- cgit 1.4.1