From 66f8fa9bec0c6f0e62ccaad22f8ddd36267a5284 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 30 Jul 1999 06:32:48 +0000 Subject: Update. * malloc/malloc.c (ptmalloc_init): Also initialize __libc_pagesize if no threads are used. * libio/iofwrite.c: Add weak alias for _unlocked function if not _IO_MTSAFE_IO. * libio/iofread.c: Likewise. * libio/iofgets.c: Likewise. * libio/iofputs.c: Likewise. * sysdeps/generic/bits/libc-lock.h (__libc_cleanup_end): New definition. --- ChangeLog | 12 ++++++++++++ bits/libc-lock.h | 5 ++++- libio/iofgets.c | 6 +++++- libio/iofputs.c | 4 ++++ libio/iofread.c | 6 +++++- libio/iofwrite.c | 4 ++++ malloc/malloc.c | 4 +++- manual/startup.texi | 18 +++++++++++++----- sysdeps/generic/bits/libc-lock.h | 5 ++++- 9 files changed, 54 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 23923c5c84..4437c3b67b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,17 @@ 1999-07-29 H.J. Lu + * malloc/malloc.c (ptmalloc_init): Also initialize __libc_pagesize + if no threads are used. + + * libio/iofwrite.c: Add weak alias for _unlocked function if not + _IO_MTSAFE_IO. + * libio/iofread.c: Likewise. + * libio/iofgets.c: Likewise. + * libio/iofputs.c: Likewise. + + * sysdeps/generic/bits/libc-lock.h (__libc_cleanup_end): New + definition. + * stdlib/mbtowc.c: Include . * stdlib/wctomb.c: Likewise. * sysdeps/unix/sysv/linux/fstatfs64.c: Likewise. diff --git a/bits/libc-lock.h b/bits/libc-lock.h index c24dcd047a..84f9cd4653 100644 --- a/bits/libc-lock.h +++ b/bits/libc-lock.h @@ -1,5 +1,5 @@ /* libc-internal interface for mutex locks. Stub version. - Copyright (C) 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1999 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 @@ -90,6 +90,9 @@ /* End critical region with cleanup. */ #define __libc_cleanup_region_end(DOIT) +/* Sometimes we have to exit the block in the middle. */ +#define __libc_cleanup_end(DOIT) + /* We need portable names for some of the functions. */ #define __libc_mutex_unlock diff --git a/libio/iofgets.c b/libio/iofgets.c index 98e82782ce..63221dfbd7 100644 --- a/libio/iofgets.c +++ b/libio/iofgets.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. +/* Copyright (C) 1993, 95, 96, 97, 98, 99 Free Software Foundation, Inc. This file is part of the GNU IO Library. This library is free software; you can redistribute it and/or @@ -64,4 +64,8 @@ _IO_fgets (buf, n, fp) #ifdef weak_alias weak_alias (_IO_fgets, fgets) + +# ifndef _IO_MTSAFE_IO +weak_alias (_IO_fgets, fgets_unlocked) +# endif #endif diff --git a/libio/iofputs.c b/libio/iofputs.c index ed41d5a49c..32acf987a5 100644 --- a/libio/iofputs.c +++ b/libio/iofputs.c @@ -46,4 +46,8 @@ _IO_fputs (str, fp) #ifdef weak_alias weak_alias (_IO_fputs, fputs) + +# ifndef _IO_MTSAFE_IO +weak_alias (_IO_fputs, fputs_unlocked) +# endif #endif diff --git a/libio/iofread.c b/libio/iofread.c index c2d12d8693..a6bda98162 100644 --- a/libio/iofread.c +++ b/libio/iofread.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993, 1995, 1997, 1998 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1995, 1997, 1998, 1999 Free Software Foundation, Inc. This file is part of the GNU IO Library. This library is free software; you can redistribute it and/or @@ -47,4 +47,8 @@ _IO_fread (buf, size, count, fp) #ifdef weak_alias weak_alias (_IO_fread, fread) + +# ifndef _IO_MTSAFE_IO +weak_alias (_IO_fread, fread_unlocked) +# endif #endif diff --git a/libio/iofwrite.c b/libio/iofwrite.c index 886de7ae35..9be18bd8e0 100644 --- a/libio/iofwrite.c +++ b/libio/iofwrite.c @@ -53,4 +53,8 @@ _IO_fwrite (buf, size, count, fp) #ifdef weak_alias weak_alias (_IO_fwrite, fwrite) + +# ifndef _IO_MTSAFE_IO +weak_alias (_IO_fwrite, fwrite_unlocked) +# endif #endif diff --git a/malloc/malloc.c b/malloc/malloc.c index a2b80a9997..db12226828 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -1663,7 +1663,6 @@ ptmalloc_init __MALLOC_P((void)) /* Initialize the pthreads interface. */ if (__pthread_initialize != NULL) __pthread_initialize(); - __libc_pagesize = __getpagesize(); #endif mutex_init(&main_arena.mutex); mutex_init(&list_lock); @@ -1671,6 +1670,9 @@ ptmalloc_init __MALLOC_P((void)) tsd_setspecific(arena_key, (Void_t *)&main_arena); thread_atfork(ptmalloc_lock_all, ptmalloc_unlock_all, ptmalloc_init_all); #endif /* !defined NO_THREADS */ +#ifdef _LIBC + __libc_pagesize = __getpagesize(); +#endif #if defined _LIBC || defined MALLOC_HOOKS if((s = getenv("MALLOC_TRIM_THRESHOLD_"))) mALLOPt(M_TRIM_THRESHOLD, atoi(s)); diff --git a/manual/startup.texi b/manual/startup.texi index 1c75d3cabd..c8a525903b 100644 --- a/manual/startup.texi +++ b/manual/startup.texi @@ -317,6 +317,13 @@ definition is added to the environment. Otherwise, the @var{string} is interpreted as the name of an environment variable, and any definition for this variable in the environment is removed. +The difference to the @code{setenv} function is that the exact string +given as the parameter @var{string} is put into the environment. If the +user should change the string after the @code{putenv} call this will +reflect in automatically in the environment. This also requires that +@var{string} is no automatic variable which scope is left before the +variable is removed from the environment. + This function is part of the extended Unix interface. Since it was also available in old SVID libraries you should define either @var{_XOPEN_SOURCE} or @var{_SVID_SOURCE} before including any header. @@ -329,11 +336,12 @@ available in old SVID libraries you should define either The @code{setenv} function can be used to add a new definition to the environment. The entry with the name @var{name} is replaced by the value @samp{@var{name}=@var{value}}. Please note that this is also true -if @var{value} is the empty string. A null pointer for the @var{value} -parameter is illegal. If the environment already contains an entry with -key @var{name} the @var{replace} parameter controls the action. If -replace is zero, nothing happens. otherwise the old entry is replaced -by the new one. +if @var{value} is the empty string. To do this a new string is created +and the strings @var{name} and @var{value} are copied. A null pointer +for the @var{value} parameter is illegal. If the environment already +contains an entry with key @var{name} the @var{replace} parameter +controls the action. If replace is zero, nothing happens. Otherwise +the old entry is replaced by the new one. Please note that you cannot remove an entry completely using this function. diff --git a/sysdeps/generic/bits/libc-lock.h b/sysdeps/generic/bits/libc-lock.h index c24dcd047a..84f9cd4653 100644 --- a/sysdeps/generic/bits/libc-lock.h +++ b/sysdeps/generic/bits/libc-lock.h @@ -1,5 +1,5 @@ /* libc-internal interface for mutex locks. Stub version. - Copyright (C) 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1999 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 @@ -90,6 +90,9 @@ /* End critical region with cleanup. */ #define __libc_cleanup_region_end(DOIT) +/* Sometimes we have to exit the block in the middle. */ +#define __libc_cleanup_end(DOIT) + /* We need portable names for some of the functions. */ #define __libc_mutex_unlock -- cgit 1.4.1