mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-22 19:00:07 +00:00
ca34d7a7c7
1997-08-14 03:14 Ulrich Drepper <drepper@cygnus.com> * elf/dl-minimal.c: Don't use relative #include paths. (malloc): Don't try to initialize _dl_pagesize, it already is. (__sigjmp_save, longjmp): Reformat. * sysdeps/generic/dl-sysdep.c: Implement _dl_show_auxv function to show content of auxiliary array. (_dl_sysdep_start): Remember start of auxiliary vector. * sysdeps/mach/hurd/dl-sysdep.c: (_dl_show_auxv): New dummy function. * elf/link.h: Add prototype for _dl_show_auxv. * elf/rtld.c (dl_main): Call _dl_show_auxv if LD_SHOW_AUXV envvar is present. * libio/iofdopen.c: Better prepare for use in libstdc++. * libio/iofflush.c: Likewise. * libio/iofgetpos.c: Likewise. * libio/iofgets.c: Likewise. * libio/iofopen.c: Likewise. * libio/iofputs.c: Likewise. * libio/iofread.c: Likewise. * libio/iofsetpos.c: Likewise. * libio/ioftell.c: Likewise. * libio/iofwrite.c: Likewise. * libio/iogetdelim.c: Likewise. * libio/iogets.c: Likewise. * libio/iopopen.c: Likewise. * libio/ioputs.c: Likewise. * libio/iosetbuffer.c: Likewise. * libio/iosetvbuf.c: Likewise. * libio/ioungetc.c: Likewise. * libio/iovsprintf.c: Likewise. * libio/iovsscanf.c: Likewise. * manual/creature.texi: Mention _XOPEN_SOURCE_EXTENDED in correct place. * manual/math.texi: Add comment to sincos decsription to say it's a GNU extension. Fix description of random function. * posix/fnmatch.h: Recognize Windog by _WINDOWS32 not WIN32. * posix/glob.c: Likewise. Handle stupid system headers on SunOS. Add casts for all __alloca calls. * posix/glob.h: Recognize Windog by _WINDOWS32 not WIN32. Declare additional GLOB_* constants also if _GNU_SOURCE is defined. Patches by Paul D. Smith <psmith@BayNetworks.COM>. * stdio-common/_itoa.c: Don't use relateive #include paths. * sysdeps/i386/fpu/bits/mathinline.h: Enable optimizations even for gcc 2.7. (atan): Loading 1.0 from memory does not pay off. (asinh): Fix typo. 1997-08-13 09:44 Philip Blundell <Philip.Blundell@pobox.com> * sysdeps/stub/accept.c: Use socklen_t where necessary. * sysdeps/stub/bind.c: Likewise. * sysdeps/stub/connect.c: Likewise. * sysdeps/stub/getsockname.c: Likewise. * sysdeps/stub/getsockopt.c: Likewise. * sysdeps/stub/recvfrom.c: Likewise. * sysdeps/stub/sendto.c: Likewise. * sysdeps/stub/setsockopt.c: Likewise. 1997-08-11 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * io/ftw.c (object_compare): Avoid memcmp when comparing scalar types. 1997-08-12 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * math/libm-test.c (cbrt_test): Add epsilon for long double to `cbrt (-0.001)'. 1997-08-11 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * sysdeps/stub/bits/string.h: Fix comment. 1997-08-01 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * elf/Makefile (routines): Remove dl-version. (dl-routines): Add it here instead. This removes dead code from libc.so. 1997-08-12 17:17 Wolfram Gloger <wmglo@dent.med.uni-muenchen.de> * malloc/thread-m.h (thread_atfork, thread_atfork_static): New macros to encapsulate pthread_atfork's functionality. * malloc/malloc.c (ptmalloc_lock_all, ptmalloc_unlock_all): New functions, registered via thread_atfork in the initialization routine or via thread_atfork_static in global scope. This ensures a consistent state of all locks across fork(). 1997-08-11 23:00:32 1997 Mark Kettenis <kettenis@phys.uva.nl> * login/programs/xtmp.c (compare_entry): Partially undo patch made by Klaus Espenlaub. There was no xtmp/utmp typo. Added comment to cclarify this. * login/programs/xtmp.h: Likewise. * posix/getopt.c: Recognize Windog by _WINDOWS32 not WIN32. Patch by Paul D. Smith <psmith@BayNetworks.COM>. 1997-08-12 13:51 Ulrich Drepper <drepper@cygnus.com> * login/getutid.c: Rename to __getutid and make getutid and getutxid weak aliases. Patch by ir. Mark M._Kettenis <kettenis@phys.uva.nl>. 1997-08-11 23:55 Ulrich Drepper <drepper@cygnus.com> * sysdeps/unix/sysv/linux/Makefile [subdir=misc] (sysdep_headers): Add bits/mman.h. 1997-08-11 08:51:21 1997 H.J. Lu <hjl@gnu.ai.mit.edu> * stdlib/fmtmsg.c (fmtmsg): Add static to __libc_once_define macro. * libc.map (__progname_full, __progname): Added. 1997-08-04 08:31 H.J. Lu <hjl@gnu.ai.mit.edu> * sysdeps/unix/sysv/linux/if_index.c (if_nametoindex): Return 0 if SIOGIFINDEX is not defined. (if_indextoname): Initialize "result" to NULL. (if_nametoindex, if_nameindex): Fix ENOSYS setting. 1997-08-11 11:58 Richard Henderson <rth@cygnus.com> Sparc ISO C 9x exception handling: * sysdeps/sparc/fpu/bits/mathdef.h: New file. * sysdeps/sparc/fpu/fclrexcpt.c: New file. * sysdeps/sparc/fpu/fegetenv.c: New file. * sysdeps/sparc/fpu/fegetround.c: New file. * sysdeps/sparc/fpu/feholdexcpt.c: New file. * sysdeps/sparc/fpu/fesetenv.c: New file. * sysdeps/sparc/fpu/fesetround.c: New file. * sysdeps/sparc/fpu/feupdateenv.c: New file. * sysdeps/sparc/fpu/fgetexcptflg.c: New file. * sysdeps/sparc/fpu/fraiseexcpt.c: New file. * sysdeps/sparc/fpu/fsetexcptflg.c: New file. * sysdeps/sparc/fpu/ftestexcept.c: New file. * sysdeps/sparc/sparc32/fpu/bits/fenv.h: New file. * sysdeps/sparc/sparc64/fpu/bits/fenv.h: New file. 1997-08-11 11:58 Richard Henderson <rth@cygnus.com> Sparc64 merge: * configure.in: Change up subdirectories, rename sparc8->sparcv8. * csu/Makefile: Nuke need-nopic-initfini bits. The problem was that sparc64 ld did not recognize pic relocs at all. * elf/dl-deps.c: Include <string.h>. * elf/do-rel.h (elf_dynamic_do_rel): Take reloc address and size directly instead of the DT names to get them from. * elf/dynamic-link.h (_ELF_DYNAMIC_DO_RELOC): New macro distilled from ELF_DYNAMIC_DO_REL{,A}. Define a second version that accounts for the possibility that DT_RELA and DT_JMPPLT overlap, as such is the case on the Sparc. * elf/elf.h: Stub out Elf64_Ver*, and make them the same as the Elf32_Ver* bits. The linker does not even know to differentiate between the word sizes. Someone should examine this and figure out what the proper sizes of things should be for 64-bit hosts before the sparc64 libraries are distributed. * shlib-versions: Rename sparc64 ld.so to not conflict with sparc32 on the same machine. Move old sysdeps/sparc contents to sysdeps/sparc/sparc32, rename sparc8 subdir to sparcv8, move sysdeps/sparc64 content to sysdeps/sparc/sparc64. Same for sysdeps/unix/sysv/linux/sparc. * sysdeps/sparc/Implies: Do ieee754 here. * sysdeps/sparc/configure.in: Move from sparc32/. * sysdeps/sparc/sparc32/Implies: Do wordsize here. * sysdeps/sparc/sparc64/Implies: Likewise. * sysdeps/sparc/sparc32/dl-machine.h (elf_machine_load_address): Use uninitialized .got to find load address instead of AT_BASE, as the later does not exist when running ld.so directly. * sysdeps/sparc/sparc32/fpu/fpu_control.h: Move from ../. * sysdeps/sparc/sparc64/fpu/fpu_control.h: Likewise. * sysdeps/sparc/sparc32/udiv_qrnnd.S: Clean up PIC support. * sysdeps/sparc/sparc64/Makefile (sysdep_routines): Add s_finitel and s_signbitl for stdio. * sysdeps/sparc/sparc64/configure.in: Remove, we no longer need nopic_initfini. * sysdeps/sparc/sparc64/bsd-_setjmp.S: Remove. * sysdeps/sparc/sparc64/bsd-setjmp.S: Remove. * sysdeps/unix/sysv/linux/sparc/sparc64/bsd-_setjmp.S: New empty file. * sysdeps/unix/sysv/linux/sparc/sparc64/bsd-setjmp.S: New empty file. * sysdeps/unix/sysv/linux/sparc/sparc64/longjmp.S: Add __longjmp alias. * sysdeps/unix/sysv/linux/sparc/sparc64/setjmp.S: Add weak _setjmp and setjmp entry points. * sysdeps/sparc/sparc64/dl-machine.h: Finish real implementation. * sysdeps/sparc/sparc64/elf/crtbegin.S: Add copyright, fix PIC. * sysdeps/sparc/sparc64/elf/crtend.S: Likewise. * sysdeps/unix/sysv/linux/sparc/bits/sigaction.h (struct sigaction): Fix sa_flags size for sparc64; add sa_restorer for kernel. * sysdeps/unix/sysv/linux/sparc/sparc64/brk.S: Fix PIC. * sysdeps/unix/sysv/linux/sparc/sparc64/clone.S: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/init-first.h: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/syscall.S: New file. 1997-08-10 18:29:08 1997 Mark Kettenis <kettenis@phys.uva.nl> * login/login.c (login): Check for correct return value of utmpname. 1997-08-11 16:49 Ulrich Drepper <drepper@cygnus.com> * time/tzset.c (__tzset_internal): Correctly handle TZ strings following incorrect old POSIX specs. Patch by Paul Eggert <eggert@twinsun.com>. * sysdeps/generic/bits/sigaction.h: Correct comment for SA_RESTART. * sysdeps/unix/bsd/osf/bits/sigaction.h: Likewise. * sysdeps/unix/sysv/linux/alpha/bits/sigaction.h: Likewise. * sysdeps/unix/sysv/linux/bits/sigaction.h: Likewise. * sysdeps/unix/sysv/linux/mips/bits/sigaction.h: Likewise. * sysdeps/unix/sysv/linux/sparc/bits/sigaction.h: Likewise. * sysdeps/unix/sysv/minix/bits/sigaction.h: Likewise. * sysdeps/unix/sysv/sysv4/bits/sigaction.h: Likewise. Reported by NIIBE Yutaka <gniibe@mri.co.jp>. 1997-08-09 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * manual/math.texi: Define the macros @mul and @infinity and use them to format the multiplication and infinity signs. (FP Comparison Functions): Use @code, not @math, for C code examples. * elf/dl-profile.c: Add descriptions and implement reading of
362 lines
8.8 KiB
C
362 lines
8.8 KiB
C
/* Copyright (C) 1997 Free Software Foundation, Inc.
|
|
This file is part of the GNU C Library.
|
|
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
|
|
|
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 <fmtmsg.h>
|
|
#include <bits/libc-lock.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <sys/syslog.h>
|
|
|
|
|
|
/* We have global data, protect the modification. */
|
|
__libc_lock_define_initialized (static, lock)
|
|
|
|
|
|
enum
|
|
{
|
|
label_mask = 0x01,
|
|
severity_mask = 0x02,
|
|
text_mask = 0x04,
|
|
action_mask = 0x08,
|
|
tag_mask = 0x10,
|
|
all_mask = label_mask | severity_mask | text_mask | action_mask | tag_mask
|
|
};
|
|
|
|
static struct
|
|
{
|
|
const char *name;
|
|
size_t len;
|
|
} keywords[] =
|
|
{
|
|
{ "label", 5 },
|
|
{ "severity", 8 },
|
|
{ "text", 4 },
|
|
{ "action", 6},
|
|
{ "tag", 3 }
|
|
};
|
|
#define NKEYWORDS (sizeof( keywords) / sizeof (keywords[0]))
|
|
|
|
|
|
struct severity_info
|
|
{
|
|
int severity;
|
|
const char *string;
|
|
struct severity_info *next;
|
|
};
|
|
|
|
|
|
/* List of known severities. */
|
|
static const struct severity_info nosev =
|
|
{
|
|
MM_NOSEV, "", NULL
|
|
};
|
|
static const struct severity_info haltsev =
|
|
{
|
|
MM_HALT, "HALT", (struct severity_info *) &nosev
|
|
};
|
|
static const struct severity_info errorsev =
|
|
{
|
|
MM_ERROR, "ERROR", (struct severity_info *) &haltsev
|
|
};
|
|
static const struct severity_info warningsev =
|
|
{
|
|
MM_WARNING, "WARNING", (struct severity_info *) &errorsev
|
|
};
|
|
static const struct severity_info infosev =
|
|
{
|
|
MM_INFO, "INFO", (struct severity_info *) &warningsev
|
|
};
|
|
|
|
/* Start of the list. */
|
|
static struct severity_info *severity_list = (struct severity_info *) &infosev;
|
|
|
|
/* Mask of values we will print. */
|
|
static int print;
|
|
|
|
/* Prototypes for local functions. */
|
|
static void init (void);
|
|
static int internal_addseverity (int severity, const char *string);
|
|
|
|
|
|
int
|
|
fmtmsg (long int classification, const char *label, int severity,
|
|
const char *text, const char *action, const char *tag)
|
|
{
|
|
__libc_once_define (static, once);
|
|
int result = MM_OK;
|
|
struct severity_info *severity_rec;
|
|
|
|
/* make sure everything is initialized. */
|
|
__libc_once (once, init);
|
|
|
|
/* Start the real work. First check whether the input is ok. */
|
|
if (label != MM_NULLLBL)
|
|
{
|
|
/* Must be two fields, separated by a colon. */
|
|
const char *cp = strchr (label, ':');
|
|
if (cp == NULL)
|
|
return MM_NOTOK;
|
|
|
|
/* The first field must not contain more then 10 bytes. */
|
|
if (cp - label > 10
|
|
/* The second field must not have more then 14 bytes. */
|
|
|| strlen (cp + 1) > 14)
|
|
return MM_NOTOK;
|
|
}
|
|
|
|
for (severity_rec = severity_list; severity_rec != NULL;
|
|
severity_rec = severity_rec->next)
|
|
if (severity == severity_rec->severity)
|
|
/* Bingo. */
|
|
break;
|
|
|
|
/* If we don't know anything about the severity level return an error. */
|
|
if (severity_rec == NULL)
|
|
return MM_NOTOK;
|
|
|
|
|
|
/* Now we can print. */
|
|
if (classification & MM_PRINT)
|
|
{
|
|
int do_label = (print & label_mask) && label != MM_NULLLBL;
|
|
int do_severity = (print & severity_mask) && severity != MM_NULLSEV;
|
|
int do_text = (print & text_mask) && text != MM_NULLTXT;
|
|
int do_action = (print & action_mask) && action != MM_NULLACT;
|
|
int do_tag = (print & tag_mask) && tag != MM_NULLTAG;
|
|
|
|
if (fprintf (stderr, "%s%s%s%s%s%s%s%s%s%s\n",
|
|
do_label ? label : "",
|
|
do_label && (do_severity | do_text) ? ": " : "",
|
|
do_severity ? severity_rec->string : "",
|
|
do_severity && do_text ? ": " : "",
|
|
do_text ? text : "",
|
|
(do_label | do_severity | do_text) && (do_action | do_tag)
|
|
? "\n" : "",
|
|
do_action ? "TO FIX: " : "",
|
|
do_action ? action : "",
|
|
do_action && do_tag ? " " : "",
|
|
do_tag ? tag : "") == EOF)
|
|
/* Oh, oh. An error occured during the output. */
|
|
result = MM_NOMSG;
|
|
}
|
|
|
|
if (classification & MM_CONSOLE)
|
|
{
|
|
int do_label = label != MM_NULLLBL;
|
|
int do_severity = severity != MM_NULLSEV;
|
|
int do_text = text != MM_NULLTXT;
|
|
int do_action = action != MM_NULLACT;
|
|
int do_tag = tag != MM_NULLTAG;
|
|
|
|
syslog (LOG_ERR, "%s%s%s%s%s%s%s%s%s%s\n",
|
|
do_label ? label : "",
|
|
do_label && (do_severity | do_text) ? ": " : "",
|
|
do_severity ? severity_rec->string : "",
|
|
do_severity && do_text ? ": " : "",
|
|
do_text ? text : "",
|
|
(do_label | do_severity | do_text) && (do_action | do_tag)
|
|
? "\n" : "",
|
|
do_action ? "TO FIX: " : "",
|
|
do_action ? action : "",
|
|
do_action && do_tag ? " " : "",
|
|
do_tag ? tag : "");
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
|
|
/* Initialize from environment variable content. */
|
|
static void
|
|
init (void)
|
|
{
|
|
const char *msgverb_var = getenv ("MSGVERB");
|
|
const char *sevlevel_var = getenv ("SEV_LEVEL");
|
|
|
|
if (msgverb_var != NULL && msgverb_var[0] != '\0')
|
|
{
|
|
/* Using this extra variable allows us to work without locking. */
|
|
do
|
|
{
|
|
size_t cnt;
|
|
|
|
for (cnt = 0; cnt < NKEYWORDS; ++cnt)
|
|
if (memcmp (msgverb_var,
|
|
keywords[cnt].name, keywords[cnt].len) == 0
|
|
&& (msgverb_var[keywords[cnt].len] == ':'
|
|
|| msgverb_var[keywords[cnt].len] == '\0'))
|
|
break;
|
|
|
|
if (cnt < NKEYWORDS)
|
|
{
|
|
print |= 1 << cnt;
|
|
|
|
msgverb_var += keywords[cnt].len;
|
|
if (msgverb_var[0] == ':')
|
|
++msgverb_var;
|
|
}
|
|
else
|
|
{
|
|
/* We found an illegal keyword in the environment
|
|
variable. The specifications say that we print all
|
|
fields. */
|
|
print = all_mask;
|
|
break;
|
|
}
|
|
}
|
|
while (msgverb_var[0] != '\0');
|
|
}
|
|
else
|
|
print = all_mask;
|
|
|
|
|
|
if (sevlevel_var != NULL)
|
|
{
|
|
__libc_lock_lock (lock);
|
|
|
|
while (sevlevel_var[0] != '\0')
|
|
{
|
|
const char *end = strchr (sevlevel_var, ':');
|
|
int level;
|
|
|
|
if (end == NULL)
|
|
end = strchr (sevlevel_var, '\0');
|
|
|
|
/* First field: keyword. This is not used here but it must be
|
|
present. */
|
|
while (sevlevel_var < end)
|
|
if (*sevlevel_var++ == ',')
|
|
break;
|
|
|
|
if (sevlevel_var < end)
|
|
{
|
|
/* Second field: severity level, a number. */
|
|
char *cp;
|
|
|
|
level = strtol (sevlevel_var, &cp, 0);
|
|
if (cp != sevlevel_var && cp < end && *cp++ == ','
|
|
&& level > MM_INFO)
|
|
{
|
|
const char *new_string;
|
|
|
|
new_string = __strndup (cp, end - cp);
|
|
|
|
if (new_string != NULL
|
|
&& (internal_addseverity (level, new_string)
|
|
!= MM_OK))
|
|
free ((char *) new_string);
|
|
}
|
|
}
|
|
|
|
sevlevel_var = end + (*end == ':' ? 1 : 0);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/* Add the new entry to the list. */
|
|
static int
|
|
internal_addseverity (int severity, const char *string)
|
|
{
|
|
struct severity_info *runp, *lastp;
|
|
int result = MM_OK;
|
|
|
|
/* First see if there is already a record for the severity level. */
|
|
for (runp = severity_list, lastp = NULL; runp != NULL; runp = runp-> next)
|
|
if (runp->severity == severity)
|
|
break;
|
|
else
|
|
lastp = runp;
|
|
|
|
if (runp != NULL)
|
|
{
|
|
/* Release old string. */
|
|
free ((char *) runp->string);
|
|
|
|
if (string != NULL)
|
|
/* Change the string. */
|
|
runp->string = string;
|
|
else
|
|
{
|
|
/* Remove the severity class. */
|
|
if (lastp == NULL)
|
|
severity_list = runp->next;
|
|
else
|
|
lastp->next = runp->next;
|
|
|
|
free (runp);
|
|
}
|
|
}
|
|
else if (string != NULL)
|
|
{
|
|
runp = malloc (sizeof (*runp));
|
|
if (runp == NULL)
|
|
result = MM_NOTOK;
|
|
else
|
|
{
|
|
runp->severity = severity;
|
|
runp->next = severity_list;
|
|
runp->string = string;
|
|
severity_list = runp;
|
|
}
|
|
}
|
|
else
|
|
/* We tried to remove a non-existing severity class. */
|
|
result = MM_NOTOK;
|
|
|
|
return result;
|
|
}
|
|
|
|
|
|
/* Add new severity level or remove old one. */
|
|
int
|
|
addseverity (int severity, const char *string)
|
|
{
|
|
int result;
|
|
const char *new_string;
|
|
|
|
if (string == NULL)
|
|
/* We want to remove the severity class. */
|
|
new_string = NULL;
|
|
else
|
|
{
|
|
new_string = __strdup (string);
|
|
|
|
if (new_string == NULL || severity <= MM_INFO)
|
|
/* Allocation failed or illegal value. */
|
|
return MM_NOTOK;
|
|
}
|
|
|
|
/* Protect the global data. */
|
|
__libc_lock_lock (lock);
|
|
|
|
/* Do the real work. */
|
|
result = internal_addseverity (severity, string);
|
|
|
|
if (result != MM_OK)
|
|
/* Free the allocated string. */
|
|
free ((char *) new_string);
|
|
|
|
/* Release the lock. */
|
|
__libc_lock_unlock (lock);
|
|
|
|
return result;
|
|
}
|