diff options
| author | Ulrich Drepper <drepper@redhat.com> | 1998-03-13 17:02:23 +0000 |
|---|---|---|
| committer | Ulrich Drepper <drepper@redhat.com> | 1998-03-13 17:02:23 +0000 |
| commit | 14c44e2ec42a3c973e268add83a11e3e5fb0b80c (patch) | |
| tree | 9b5d83d08dc977b0e6c97b7e977b591ef7bd47f3 | |
| parent | a7b591dc310c675cb325db9850f10c2e2fe1aba7 (diff) | |
| download | glibc-14c44e2ec42a3c973e268add83a11e3e5fb0b80c.tar.xz glibc-14c44e2ec42a3c973e268add83a11e3e5fb0b80c.zip | |
Update.
1998-03-13 16:55 Ulrich Drepper <drepper@cygnus.com>
* string/tester.c (test_strpbrk): Add more strpbrk tests.
(test_strsep): Likewise. Correct horrible bugs.
* string/bits/string2.h (strcspn): Optimize also reject string of
length 2 and 3.
(strspn): Likewise.
(strpbrk): Likewise.
(strsep): Likewise. Correct bug with successive separators and
separators at the end of the string.
* sysdeps/generic/strsep.c: Correct bug with successive separators
and separators at the end of the string.
1998-03-13 13:11 Tim Waugh <tim@cyberelk.demon.co.uk>
* posix/wordexp.c (parse_param): Positional parameters ($1, $2
etc) now handled, as well as $$ (pid).
* posix/Makefile (tests): Execute wordexp-test.sh for `make check'.
(distribute): Add wordexp-tst.sh.
* posix/wordexp-tst.sh: New file.
* posix/wordexp.c (parse_param): $# (or ${#}) expands to the
number of positional parameters. Renamed substitute_length to
seen_hash.
Don't free(env) is env is NULL.
1998-03-13 16:50 Ulrich Drepper <drepper@cygnus.com>
* libc.map: Add pthread_attr_init to GLIBC_2.1.
1998-03-13 15:01 Ulrich Drepper <drepper@cygnus.com>
* gmon/gmon.c: Allow GMON_OUT_PREFIX variable to specify filename
for output file replacing gmon.out.
Patch by Dean Gaudet <dgaudet@arctic.org>.
1998-03-12 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* elf/dl-misc.c (_dl_debug_message): Fix printing of pid. Clean
up namespace. Optimize finding end of line.
1998-03-12 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* elf/rtld.c (process_envvars): Ignore LD_DEBUG_OUTPUT if running
securely. Optimized.
(process_dl_debug): Add ':' to list of separators. Optimized.
1998-03-13 10:25 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
| -rw-r--r-- | ChangeLog | 52 | ||||
| -rw-r--r-- | elf/dl-misc.c | 17 | ||||
| -rw-r--r-- | elf/rtld.c | 318 | ||||
| -rw-r--r-- | gmon/gmon.c | 29 | ||||
| -rw-r--r-- | linuxthreads/ChangeLog | 4 | ||||
| -rw-r--r-- | linuxthreads/weaks.c | 10 | ||||
| -rw-r--r-- | posix/Makefile | 5 | ||||
| -rwxr-xr-x | posix/wordexp-tst.sh | 71 | ||||
| -rw-r--r-- | posix/wordexp.c | 135 | ||||
| -rw-r--r-- | string/bits/string2.h | 192 | ||||
| -rw-r--r-- | string/tester.c | 117 | ||||
| -rw-r--r-- | sysdeps/generic/strsep.c | 12 |
12 files changed, 679 insertions, 283 deletions
@@ -1,4 +1,54 @@ -Fri Mar 13 10:25:26 1998 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> +1998-03-13 16:55 Ulrich Drepper <drepper@cygnus.com> + + * string/tester.c (test_strpbrk): Add more strpbrk tests. + (test_strsep): Likewise. Correct horrible bugs. + + * string/bits/string2.h (strcspn): Optimize also reject string of + length 2 and 3. + (strspn): Likewise. + (strpbrk): Likewise. + (strsep): Likewise. Correct bug with successive separators and + separators at the end of the string. + * sysdeps/generic/strsep.c: Correct bug with successive separators + and separators at the end of the string. + +1998-03-13 13:11 Tim Waugh <tim@cyberelk.demon.co.uk> + + * posix/wordexp.c (parse_param): Positional parameters ($1, $2 + etc) now handled, as well as $$ (pid). + + * posix/Makefile (tests): Execute wordexp-test.sh for `make check'. + (distribute): Add wordexp-tst.sh. + + * posix/wordexp-tst.sh: New file. + + * posix/wordexp.c (parse_param): $# (or ${#}) expands to the + number of positional parameters. Renamed substitute_length to + seen_hash. + Don't free(env) is env is NULL. + +1998-03-13 16:50 Ulrich Drepper <drepper@cygnus.com> + + * libc.map: Add pthread_attr_init to GLIBC_2.1. + +1998-03-13 15:01 Ulrich Drepper <drepper@cygnus.com> + + * gmon/gmon.c: Allow GMON_OUT_PREFIX variable to specify filename + for output file replacing gmon.out. + Patch by Dean Gaudet <dgaudet@arctic.org>. + +1998-03-12 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> + + * elf/dl-misc.c (_dl_debug_message): Fix printing of pid. Clean + up namespace. Optimize finding end of line. + +1998-03-12 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> + + * elf/rtld.c (process_envvars): Ignore LD_DEBUG_OUTPUT if running + securely. Optimized. + (process_dl_debug): Add ':' to list of separators. Optimized. + +1998-03-13 10:25 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * sysdeps/m68k/fpu/bits/mathinline.h (isgreater, isgreaterequal, isless, islessequal, islessgreater, isunordered): Return zero or diff --git a/elf/dl-misc.c b/elf/dl-misc.c index d3b0f340c2..937aeac0c9 100644 --- a/elf/dl-misc.c +++ b/elf/dl-misc.c @@ -110,7 +110,7 @@ _dl_debug_message (int new_line, const char *msg, ...) va_list ap; if (pid == 0) - pid = getpid (); + pid = __getpid (); va_start (ap, msg); do @@ -125,17 +125,22 @@ _dl_debug_message (int new_line, const char *msg, ...) PID now if needed. */ if (new_line) { - char buf[7] = "00000:\t"; + char buf[7]; + char *p; assert (pid >= 0 && pid < 100000); - _itoa_word (pid, &buf[5], 10, 0); + p = _itoa_word (pid, &buf[5], 10, 0); + while (p > buf) + *--p = '0'; + buf[5] = ':'; + buf[6] = '\t'; __libc_write (_dl_debug_fd, buf, 7); new_line = 0; } - endp = strchr (msg, '\n'); - if (endp == NULL) + endp = msg + strcspn (msg, "\n"); + if (*endp == '\0') { - __libc_write (_dl_debug_fd, msg, strlen (msg)); + __libc_write (_dl_debug_fd, msg, endp - msg); msg = va_arg (ap, const char *); } else diff --git a/elf/rtld.c b/elf/rtld.c index 168fd1b3e8..b160522c0c 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -925,36 +925,25 @@ static int any_debug; /* Process the string given as the parameter which explains which debugging options are enabled. */ static void -process_dl_debug (char *dl_debug) +process_dl_debug (const char *dl_debug) { + size_t len; +#define separators " ,:" do { -#define issep(Ch) ((Ch) == ' ' || (Ch) == ',') + len = 0; /* Skip separating white spaces and commas. */ - while (issep (*dl_debug)) - ++dl_debug; + dl_debug += strspn (dl_debug, separators); if (*dl_debug != '\0') { - if (strncmp (dl_debug, "files", 5) == 0 - && (issep (dl_debug[5]) || dl_debug[5] == '\0')) - { - _dl_debug_files = 1; - _dl_debug_impcalls = 1; - any_debug = 1; - dl_debug += 5; - } - else if (strncmp (dl_debug, "bindings", 8) == 0 - && (issep (dl_debug[8]) || dl_debug[8] == '\0')) - { - _dl_debug_bindings = 1; - _dl_debug_impcalls = 1; - any_debug = 1; - dl_debug += 8; - } - else if (strncmp (dl_debug, "help", 4) == 0 - && (issep (dl_debug[4]) || dl_debug[4] == '\0')) + len = strcspn (dl_debug, separators); + + switch (len) { - _dl_sysdep_message ("\ + case 4: + if (memcmp (dl_debug, "help", 4) == 0) + { + _dl_sysdep_message ("\ Valid options for the LD_DEBUG environment variable are:\n\ \n\ bindings display information about symbol binding\n\ @@ -968,58 +957,77 @@ Valid options for the LD_DEBUG environment variable are:\n\ To direct the debugging output into a file instead of standard output\n\ a filename can be specified using the LD_DEBUG_OUTPUT environment variable.\n", NULL); - _exit (0); - } - else if (strncmp (dl_debug, "libs", 4) == 0 - && (issep (dl_debug[4]) || dl_debug[4] == '\0')) - { - _dl_debug_libs = 1; - _dl_debug_impcalls = 1; - any_debug = 1; - dl_debug += 4; - } - else if (strncmp (dl_debug, "reloc", 4) == 0 - && (issep (dl_debug[5]) || dl_debug[5] == '\0')) - { - _dl_debug_reloc = 1; - _dl_debug_impcalls = 1; - any_debug = 1; - dl_debug += 5; - } - else if (strncmp (dl_debug, "symbols", 7) == 0 - && (issep (dl_debug[7]) || dl_debug[7] == '\0')) - { - _dl_debug_symbols = 1; - _dl_debug_impcalls = 1; - any_debug = 1; - dl_debug += 7; - } - else if (strncmp (dl_debug, "versions", 8) == 0 - && (issep (dl_debug[8]) || dl_debug[8] == '\0')) - { - _dl_debug_versions = 1; - _dl_debug_impcalls = 1; - any_debug = 1; - dl_debug += 8; - } - else - { - /* Display a warning and skip everything until next - separator. */ - char *startp = dl_debug; + _exit (0); + } - do - ++dl_debug; - while (*dl_debug != '\0' && !issep (*dl_debug)); + if (memcmp (dl_debug, "libs", 4) == 0) + { + _dl_debug_libs = 1; + _dl_debug_impcalls = 1; + any_debug = 1; + continue; + } + break; + + case 5: + if (memcmp (dl_debug, "reloc", 5) == 0) + { + _dl_debug_reloc = 1; + _dl_debug_impcalls = 1; + any_debug = 1; + continue; + } + + if (memcmp (dl_debug, "files", 5) == 0) + { + _dl_debug_files = 1; + _dl_debug_impcalls = 1; + any_debug = 1; + continue; + } + break; - startp = strndupa (startp, dl_debug - startp); - _dl_sysdep_error ("warning: debug option `", startp, - "' unknown; try LD_DEBUG=help\n", NULL); + case 7: + if (memcmp (dl_debug, "symbols", 7) == 0) + { + _dl_debug_symbols = 1; + _dl_debug_impcalls = 1; + any_debug = 1; + continue; + } + break; + case 8: + if (memcmp (dl_debug, "bindings", 8) == 0) + { + _dl_debug_bindings = 1; + _dl_debug_impcalls = 1; + any_debug = 1; + continue; + } + + if (memcmp (dl_debug, "versions", 8) == 0) + { + _dl_debug_versions = 1; + _dl_debug_impcalls = 1; + any_debug = 1; + continue; + } + break; + + default: + break; } + + { + /* Display a warning and skip everything until next separator. */ + char *startp = strndupa (dl_debug, len); + _dl_sysdep_error ("warning: debug option `", startp, + "' unknown; try LD_DEBUG=help\n", NULL); + } } } - while (*dl_debug != '\0'); + while (*(dl_debug += len) != '\0'); } /* Process all environments variables the dynamic linker must recognize. @@ -1039,126 +1047,94 @@ process_envvars (enum mode *modep, int *lazyp) while ((envline = _dl_next_ld_env_entry (&runp)) != NULL) { - int result; + size_t len = strcspn (envline, "=") - 3; - /* Do we bind early? */ - result = strncmp (&envline[3], "BIND_NOW=", 9); - if (result == 0) + switch (len) { - bind_now = 1; - continue; - } - if (result < 0) - continue; + case 4: + /* Warning level, verbose or not. */ + if (memcmp (&envline[3], "WARN", 4) == 0) + _dl_verbose = envline[8] != '\0'; + break; - /* Debugging of the dynamic linker? */ - result = strncmp (&envline[3], "DEBUG=", 6); - if (result == 0) - { - process_dl_debug (&envline[9]); - continue; - } - if (result < 0) - continue; + case 5: + /* Debugging of the dynamic linker? */ + if (memcmp (&envline[3], "DEBUG", 5) == 0) + process_dl_debug (&envline[9]); + break; - /* Where to place the profiling data file. */ - result = strncmp (&envline[3], "DEBUG_OUTPUT=", 13); - if (result == 0) - { - debug_output = &envline[16]; - continue; - } - if (result < 0) - continue; + case 7: + /* Print information about versions. */ + if (memcmp (&envline[3], "VERBOSE", 7) == 0) + { + version_info = envline[11] != '\0'; + break; + } - /* The library search path. */ - result = strncmp (&envline[3], "LIBRARY_PATH=", 13); - if (result == 0) - { - library_path = &envline[16]; - continue; - } - if (result < 0) - continue; + /* List of objects to be preloaded. */ + if (memcmp (&envline[3], "PRELOAD", 7) == 0) + { + preloadlist = &envline[11]; + break; + } - /* List of objects to be preloaded. */ - result = strncmp (&envline[3], "PRELOAD=", 8); - if (result == 0) - { - preloadlist = &envline[11]; - continue; - } - if (result < 0) - continue; + /* Which shared object shall be profiled. */ + if (memcmp (&envline[3], "PROFILE", 7) == 0) + { + _dl_profile = &envline[11]; + if (*_dl_profile == '\0') + _dl_profile = NULL; + } + break; - /* Which shared object shall be profiled. */ - result = strncmp (&envline[3], "PROFILE=", 8); - if (result == 0) - { - _dl_profile = &envline[11]; - if (*_dl_profile == '\0') - _dl_profile = NULL; - continue; - } - if (result < 0) - continue; + case 8: + /* Do we bind early? */ + if (memcmp (&envline[3], "BIND_NOW", 8) == 0) + bind_now = 1; + break; - /* Where to place the profiling data file. */ - result = strncmp (&envline[3], "PROFILE_OUTPUT=", 15); - if (result == 0) - { - _dl_profile_output = &envline[18]; - if (*_dl_profile_output == '\0') - _dl_profile_output = "/var/tmp"; - continue; - } - if (result < 0) - continue; + case 9: + /* Test whether we want to see the content of the auxiliary + array passed up from the kernel. */ + if (memcmp (&envline[3], "SHOW_AUXV", 9) == 0) + _dl_show_auxv (); + break; - /* Test whether we want to see the content of the auxiliary - array passed up from the kernel. */ - result = strncmp (&envline[3], "SHOW_AUXV=", 10); - if (result == 0) - { - _dl_show_auxv (); - continue; - } - if (result < 0) - continue; + case 12: + /* Where to place the profiling data file. */ + if (memcmp (&envline[3], "DEBUG_OUTPUT", 12) == 0) + { + debug_output = &envline[16]; + break; + } - /* The mode of the dynamic linker can be set. */ - result = strncmp (&envline[3], "TRACE_LOADED_OBJECTS=", 21); - if (result == 0) - { - mode = trace; - continue; - } - if (result < 0) - continue; + /* The library search path. */ + if (memcmp (&envline[3], "LIBRARY_PATH", 12) == 0) + library_path = &envline[16]; + break; - /* Print information about versions. */ - result = strncmp (&envline[3], "VERBOSE=", 8); - if (result == 0) - { - version_info = envline[11] != '\0'; - continue; - } - if (result < 0) - continue; + case 14: + /* Where to place the profiling data file. */ + if (memcmp (&envline[3], "PROFILE_OUTPUT", 14) == 0) + { + _dl_profile_output = &envline[18]; + if (*_dl_profile_output == '\0') + _dl_profile_output = "/var/tmp"; + } + break; - /* Warning level, verbose or not. */ - result = strncmp (&envline[3], "WARN=", 5); - if (result == 0) - { - _dl_verbose = envline[8] != '\0'; - continue; + case 20: + /* The mode of the dynamic linker can be set. */ + if (memcmp (&envline[3], "TRACE_LOADED_OBJECTS", 20) == 0) + mode = trace; + break; } } /* If we have to run the dynamic linker in debugging mode and the LD_DEBUG_OUTPUT environment variable is given, we write the debug messages to this file. */ - if (any_debug && debug_output != NULL) + if (any_debug && debug_output != NULL && !__libc_enable_secure) { _dl_debug_fd = __open (debug_output, O_WRONLY | O_APPEND | O_CREAT, 0666); diff --git a/gmon/gmon.c b/gmon/gmon.c index c3e7c51b8c..0087e8c0f7 100644 --- a/gmon/gmon.c +++ b/gmon/gmon.c @@ -310,16 +310,29 @@ static void write_gmon (void) { struct gmon_hdr ghdr __attribute__ ((aligned (__alignof__ (int)))); - int fd; + int fd = -1; + char *env; - fd = __open ("gmon.out", O_CREAT|O_TRUNC|O_WRONLY, 0666); - if (fd < 0) + env = getenv ("GMON_OUT_PREFIX"); + if (env != NULL && !__libc_enable_secure) { - char buf[300]; - int errnum = errno; - fprintf (stderr, "_mcleanup: gmon.out: %s\n", - _strerror_internal (errnum, buf, sizeof buf)); - return; + size_t len = strlen (env); + char buf[len + 20]; + sprintf (buf, "%s.%u", env, __getpid ()); + fd = __open (buf, O_CREAT|O_TRUNC|O_WRONLY, 0666); + } + + if (fd == -1) + { + fd = __open ("gmon.out", O_CREAT|O_TRUNC|O_WRONLY, 0666); + if (fd < 0) + { + char buf[300]; + int errnum = errno; + fprintf (stderr, "_mcleanup: gmon.out: %s\n", + _strerror_internal (errnum, buf, sizeof buf)); + return; + } } /* write gmon.out header: */ diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog index eb866f0491..77aa4a2ea4 100644 --- a/linuxthreads/ChangeLog +++ b/linuxthreads/ChangeLog @@ -1,3 +1,7 @@ +1998-03-13 16:51 Ulrich Drepper <drepper@cygnus.com> + + * weaks.c: Define pthread_attr_init as GLIBC_2.0 and GLIBC_2.1. + 1998-03-13 00:46 Ulrich Drepper <drepper@cygnus.com> * attr.c: Implement pthread_attr_[gs]etguardsize, diff --git a/linuxthreads/weaks.c b/linuxthreads/weaks.c index da645c1aea..ac8e1167d3 100644 --- a/linuxthreads/weaks.c +++ b/linuxthreads/weaks.c @@ -1,5 +1,5 @@ /* The weak pthread functions for Linux. - Copyright (C) 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 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 @@ -26,7 +26,15 @@ extern int __pthread_return_1 __P ((void)); extern void __pthread_return_void __P ((void)); /* Those are pthread functions which return 0 if successful. */ +#if defined HAVE_ELF && defined PIC && defined DO_VERSIONING +weak_alias (__pthread_return_0, __libc_pthread_attr_init_2_0) +symbol_version (__libc_pthread_attr_init_2_0, pthread_attr_init, GLIBC_2.0); +weak_alias (__pthread_return_0, __libc_pthread_attr_init_2_1) +default_symbol_version (__libc_pthread_attr_init_2_1, pthread_attr_init, + GLIBC_2.1); +#else weak_alias (__pthread_return_0, pthread_attr_init) +#endif weak_alias (__pthread_return_0, pthread_attr_destroy) weak_alias (__pthread_return_0, pthread_attr_setdetachstate) weak_alias (__pthread_return_0, pthread_attr_getdetachstate) diff --git a/posix/Makefile b/posix/Makefile index a9b78aa606..0fc1787968 100644 --- a/posix/Makefile +++ b/posix/Makefile @@ -29,7 +29,7 @@ headers := sys/utsname.h sys/times.h sys/wait.h sys/types.h unistd.h \ bits/sched.h re_comp.h wait.h bits/environments.h cpio.h distribute := confstr.h TESTS TESTS2C.sed testcases.h \ - globtest.c globtest.sh + globtest.c globtest.sh wordexp-tst.sh routines := \ uname \ @@ -64,8 +64,9 @@ before-compile := testcases.h include ../Rules ifeq (no,$(cross-compiling)) -tests: $(objpfx)globtest +tests: $(objpfx)globtest $(objpfx)wordexp-test $(SHELL) -e globtest.sh $(common-objpfx) $(elf-objpfx) $(rtld-installed-name) + $(SHELL) -e wordexp-tst.sh $(common-objpfx) $(elf-objpfx) $(rtld-installed-name) endif CFLAGS-regex.c = -Wno-unused -Wno-strict-prototypes diff --git a/posix/wordexp-tst.sh b/posix/wordexp-tst.sh new file mode 100755 index 0000000000..e341e6435d --- /dev/null +++ b/posix/wordexp-tst.sh @@ -0,0 +1,71 @@ +#!/bin/sh + +# Some of these tests may look a little weird. +# The first parameter to wordexp-test is what it gives to wordexp. +# The others are just there to be parameters. + +common_objpfx=$1; shift +elf_objpfx=$1; shift +rtld_installed_name=$1; shift + +: ${TMPDIR=/tmp} +testout=$TMPDIR/wordexp-test-result + +failed=0 +export IFS=$(echo -e " \t\n") + +${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \ +${common_objpfx}posix/wordexp-test '$*' > ${testout}1 +cat <<"EOF" | cmp - ${testout}1 || failed=1 +wordexp returned 0 +we_wordv[0] = "$*" +EOF + +${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \ +${common_objpfx}posix/wordexp-test '${*}' unquoted > ${testout}2 +cat <<"EOF" | cmp - ${testout}2 || failed=1 +wordexp returned 0 +we_wordv[0] = "${*}" +we_wordv[1] = "unquoted" +EOF + +${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \ +${common_objpfx}posix/wordexp-test '$@' unquoted > $ |
