Bash-4.3 distribution sources and documentation

This commit is contained in:
Chet Ramey 2014-02-26 09:36:43 -05:00
commit ac50fbac37
497 changed files with 129395 additions and 87598 deletions

View file

@ -32,7 +32,7 @@
#endif
#if !defined (getpagesize)
# ifndef _MINIX
# if defined (HAVE_SYS_PARAM_H)
# include <sys/param.h>
# endif
# if defined (PAGESIZE)

View file

@ -45,11 +45,11 @@
# define NULL 0
#endif
#if !defined (__STRING)
#if !defined (CPP_STRING)
# if defined (HAVE_STRINGIZE)
# define __STRING(x) #x
# define CPP_STRING(x) #x
# else
# define __STRING(x) "x"
# define CPP_STRING(x) "x"
# endif /* !HAVE_STRINGIZE */
#endif /* !__STRING */
@ -165,4 +165,9 @@ do { \
# define _(x) x
#endif
#include <signal.h>
extern void _malloc_block_signals __P((sigset_t *, sigset_t *));
extern void _malloc_unblock_signals __P((sigset_t *, sigset_t *));
#endif /* _IMALLOC_H */

View file

@ -172,7 +172,7 @@ typedef union _malloc_guard {
#define ASSERT(p) \
do \
{ \
if (!(p)) xbotch((PTR_T)0, ERR_ASSERT_FAILED, __STRING(p), file, line); \
if (!(p)) xbotch((PTR_T)0, ERR_ASSERT_FAILED, CPP_STRING(p), file, line); \
} \
while (0)
@ -265,7 +265,7 @@ extern char *sbrk ();
#endif /* !HAVE_DECL_SBRK */
#ifdef SHELL
extern int interrupt_immediately;
extern int interrupt_immediately, running_trap;
extern int signal_is_trapped __P((int));
#endif
@ -498,8 +498,8 @@ xsplit (mp, nu)
busy[nbuck] = 0;
}
static void
block_signals (setp, osetp)
void
_malloc_block_signals (setp, osetp)
sigset_t *setp, *osetp;
{
#ifdef HAVE_POSIX_SIGNALS
@ -513,8 +513,8 @@ block_signals (setp, osetp)
#endif
}
static void
unblock_signals (setp, osetp)
void
_malloc_unblock_signals (setp, osetp)
sigset_t *setp, *osetp;
{
#ifdef HAVE_POSIX_SIGNALS
@ -562,10 +562,14 @@ morecore (nu)
/* Block all signals in case we are executed from a signal handler. */
blocked_sigs = 0;
#ifdef SHELL
if (interrupt_immediately || signal_is_trapped (SIGINT) || signal_is_trapped (SIGCHLD))
# if defined (SIGCHLD)
if (interrupt_immediately || running_trap || signal_is_trapped (SIGINT) || signal_is_trapped (SIGCHLD))
# else
if (interrupt_immediately || running_trap || signal_is_trapped (SIGINT))
# endif
#endif
{
block_signals (&set, &oset);
_malloc_block_signals (&set, &oset);
blocked_sigs = 1;
}
@ -652,7 +656,7 @@ morecore (nu)
morecore_done:
if (blocked_sigs)
unblock_signals (&set, &oset);
_malloc_unblock_signals (&set, &oset);
}
static void
@ -901,10 +905,10 @@ internal_free (mem, file, line, flags)
if (mg.i != p->mh_nbytes)
xbotch (mem, ERR_ASSERT_FAILED, _("free: start and end chunk sizes differ"), file, line);
#if 1
if (nunits >= LESSCORE_MIN && ((char *)p + binsize(nunits) == memtop))
#if GLIBC21
if (nunits >= LESSCORE_MIN && ((char *)p + binsize(nunits) == sbrk (0)))
#else
if (((char *)p + binsize(nunits) == memtop) && nunits >= LESSCORE_MIN)
if (nunits >= LESSCORE_MIN && ((char *)p + binsize(nunits) == memtop))
#endif
{
/* If above LESSCORE_FRC, give back unconditionally. This should be set

View file

@ -28,6 +28,11 @@
#include "imalloc.h"
#include "table.h"
#ifdef SHELL
extern int interrupt_immediately, running_trap;
extern int signal_is_trapped __P((int));
#endif
extern int malloc_register;
#ifdef MALLOC_REGISTER
@ -168,6 +173,18 @@ mregister_alloc (tag, mem, size, file, line)
int line;
{
mr_table_t *tentry;
sigset_t set, oset;
int blocked_sigs;
/* Block all signals in case we are executed from a signal handler. */
blocked_sigs = 0;
#ifdef SHELL
if (interrupt_immediately || running_trap || signal_is_trapped (SIGINT) || signal_is_trapped (SIGCHLD))
#endif
{
_malloc_block_signals (&set, &oset);
blocked_sigs = 1;
}
tentry = find_entry (mem, FIND_ALLOC);
@ -175,6 +192,8 @@ mregister_alloc (tag, mem, size, file, line)
{
/* oops. table is full. punt. */
fprintf (stderr, _("register_alloc: alloc table is full with FIND_ALLOC?\n"));
if (blocked_sigs)
_malloc_unblock_signals (&set, &oset);
return;
}
@ -194,6 +213,9 @@ mregister_alloc (tag, mem, size, file, line)
if (tentry != &mem_overflow)
table_allocated++;
if (blocked_sigs)
_malloc_unblock_signals (&set, &oset);
}
void
@ -204,6 +226,18 @@ mregister_free (mem, size, file, line)
int line;
{
mr_table_t *tentry;
sigset_t set, oset;
int blocked_sigs;
/* Block all signals in case we are executed from a signal handler. */
blocked_sigs = 0;
#ifdef SHELL
if (interrupt_immediately || running_trap || signal_is_trapped (SIGINT) || signal_is_trapped (SIGCHLD))
#endif
{
_malloc_block_signals (&set, &oset);
blocked_sigs = 1;
}
tentry = find_entry (mem, FIND_EXIST);
if (tentry == 0)
@ -212,6 +246,8 @@ mregister_free (mem, size, file, line)
#if 0
fprintf (stderr, "register_free: %p not in allocation table?\n", mem);
#endif
if (blocked_sigs)
_malloc_unblock_signals (&set, &oset);
return;
}
if (tentry->flags & MT_FREE)
@ -228,6 +264,9 @@ mregister_free (mem, size, file, line)
if (tentry != &mem_overflow)
table_allocated--;
if (blocked_sigs)
_malloc_unblock_signals (&set, &oset);
}
/* If we ever add more flags, this will require changes. */