1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00
* 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.
This commit is contained in:
Ulrich Drepper
1999-07-30 06:32:48 +00:00
parent 5330804225
commit 66f8fa9bec
9 changed files with 54 additions and 10 deletions

View File

@ -1,5 +1,17 @@
1999-07-29 H.J. Lu <hjl@gnu.org> 1999-07-29 H.J. Lu <hjl@gnu.org>
* 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 <string.h>. * stdlib/mbtowc.c: Include <string.h>.
* stdlib/wctomb.c: Likewise. * stdlib/wctomb.c: Likewise.
* sysdeps/unix/sysv/linux/fstatfs64.c: Likewise. * sysdeps/unix/sysv/linux/fstatfs64.c: Likewise.

View File

@ -1,5 +1,5 @@
/* libc-internal interface for mutex locks. Stub version. /* 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. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -90,6 +90,9 @@
/* End critical region with cleanup. */ /* End critical region with cleanup. */
#define __libc_cleanup_region_end(DOIT) #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. */ /* We need portable names for some of the functions. */
#define __libc_mutex_unlock #define __libc_mutex_unlock

View File

@ -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 file is part of the GNU IO Library.
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
@ -64,4 +64,8 @@ _IO_fgets (buf, n, fp)
#ifdef weak_alias #ifdef weak_alias
weak_alias (_IO_fgets, fgets) weak_alias (_IO_fgets, fgets)
# ifndef _IO_MTSAFE_IO
weak_alias (_IO_fgets, fgets_unlocked)
# endif
#endif #endif

View File

@ -46,4 +46,8 @@ _IO_fputs (str, fp)
#ifdef weak_alias #ifdef weak_alias
weak_alias (_IO_fputs, fputs) weak_alias (_IO_fputs, fputs)
# ifndef _IO_MTSAFE_IO
weak_alias (_IO_fputs, fputs_unlocked)
# endif
#endif #endif

View File

@ -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 file is part of the GNU IO Library.
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
@ -47,4 +47,8 @@ _IO_fread (buf, size, count, fp)
#ifdef weak_alias #ifdef weak_alias
weak_alias (_IO_fread, fread) weak_alias (_IO_fread, fread)
# ifndef _IO_MTSAFE_IO
weak_alias (_IO_fread, fread_unlocked)
# endif
#endif #endif

View File

@ -53,4 +53,8 @@ _IO_fwrite (buf, size, count, fp)
#ifdef weak_alias #ifdef weak_alias
weak_alias (_IO_fwrite, fwrite) weak_alias (_IO_fwrite, fwrite)
# ifndef _IO_MTSAFE_IO
weak_alias (_IO_fwrite, fwrite_unlocked)
# endif
#endif #endif

View File

@ -1663,7 +1663,6 @@ ptmalloc_init __MALLOC_P((void))
/* Initialize the pthreads interface. */ /* Initialize the pthreads interface. */
if (__pthread_initialize != NULL) if (__pthread_initialize != NULL)
__pthread_initialize(); __pthread_initialize();
__libc_pagesize = __getpagesize();
#endif #endif
mutex_init(&main_arena.mutex); mutex_init(&main_arena.mutex);
mutex_init(&list_lock); mutex_init(&list_lock);
@ -1671,6 +1670,9 @@ ptmalloc_init __MALLOC_P((void))
tsd_setspecific(arena_key, (Void_t *)&main_arena); tsd_setspecific(arena_key, (Void_t *)&main_arena);
thread_atfork(ptmalloc_lock_all, ptmalloc_unlock_all, ptmalloc_init_all); thread_atfork(ptmalloc_lock_all, ptmalloc_unlock_all, ptmalloc_init_all);
#endif /* !defined NO_THREADS */ #endif /* !defined NO_THREADS */
#ifdef _LIBC
__libc_pagesize = __getpagesize();
#endif
#if defined _LIBC || defined MALLOC_HOOKS #if defined _LIBC || defined MALLOC_HOOKS
if((s = getenv("MALLOC_TRIM_THRESHOLD_"))) if((s = getenv("MALLOC_TRIM_THRESHOLD_")))
mALLOPt(M_TRIM_THRESHOLD, atoi(s)); mALLOPt(M_TRIM_THRESHOLD, atoi(s));

View File

@ -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 interpreted as the name of an environment variable, and any definition
for this variable in the environment is removed. 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 This function is part of the extended Unix interface. Since it was also
available in old SVID libraries you should define either available in old SVID libraries you should define either
@var{_XOPEN_SOURCE} or @var{_SVID_SOURCE} before including any header. @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 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 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 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} if @var{value} is the empty string. To do this a new string is created
parameter is illegal. If the environment already contains an entry with and the strings @var{name} and @var{value} are copied. A null pointer
key @var{name} the @var{replace} parameter controls the action. If for the @var{value} parameter is illegal. If the environment already
replace is zero, nothing happens. otherwise the old entry is replaced contains an entry with key @var{name} the @var{replace} parameter
by the new one. 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. Please note that you cannot remove an entry completely using this function.

View File

@ -1,5 +1,5 @@
/* libc-internal interface for mutex locks. Stub version. /* 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. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -90,6 +90,9 @@
/* End critical region with cleanup. */ /* End critical region with cleanup. */
#define __libc_cleanup_region_end(DOIT) #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. */ /* We need portable names for some of the functions. */
#define __libc_mutex_unlock #define __libc_mutex_unlock