commit bash-20070920 snapshot

This commit is contained in:
Chet Ramey
2011-12-07 09:13:02 -05:00
parent 53ac45a3eb
commit 79e6c7dcc8
7 changed files with 42 additions and 21 deletions
+7
View File
@@ -14893,3 +14893,10 @@ builtins/common.c
- if DONT_REPORT_BROKEN_PIPE_WRITE_ERRORS is defined, don't print an - if DONT_REPORT_BROKEN_PIPE_WRITE_ERRORS is defined, don't print an
error message from sh_wrerror if errno == EPIPE. Suggestion from error message from sh_wrerror if errno == EPIPE. Suggestion from
Petr Sumbera <petr.sumbera@sun.com> Petr Sumbera <petr.sumbera@sun.com>
9/19
----
{jobs,nojobs}.c,jobs.h
- add code to retry fork() after EAGAIN, with a progressively longer
sleep between attempts, up to FORKSLEEP_MAX (16) seconds. Suggested
by Martin Koeppe <mkoeppe@gmx.de>
+1 -1
View File
@@ -290,7 +290,7 @@ fc_builtin (list)
line was actually added (HISTIGNORE may have caused it to not be), line was actually added (HISTIGNORE may have caused it to not be),
so we check hist_last_line_added. */ so we check hist_last_line_added. */
/* "When not listing, he fc command that caused the editing shall not be /* "When not listing, the fc command that caused the editing shall not be
entered into the history list." */ entered into the history list." */
if (listing == 0 && hist_last_line_added) if (listing == 0 && hist_last_line_added)
delete_last_history (); delete_last_history ();
+3 -2
View File
@@ -8595,8 +8595,9 @@ none are found.
Provides control over the resources available to the shell and to Provides control over the resources available to the shell and to
processes started by it, on systems that allow such control. processes started by it, on systems that allow such control.
The \fB\-H\fP and \fB\-S\fP options specify that the hard or soft limit is The \fB\-H\fP and \fB\-S\fP options specify that the hard or soft limit is
set for the given resource. A hard limit cannot be increased once it set for the given resource.
is set; a soft limit may be increased up to the value of the hard limit. A hard limit cannot be increased by a non-root user once it is set;
a soft limit may be increased up to the value of the hard limit.
If neither \fB\-H\fP nor \fB\-S\fP is specified, both the soft and hard If neither \fB\-H\fP nor \fB\-S\fP is specified, both the soft and hard
limits are set. limits are set.
The value of The value of
+2
View File
@@ -3655,6 +3655,8 @@ If @var{limit} is given, it is the new value of the specified resource;
the special @var{limit} values @code{hard}, @code{soft}, and the special @var{limit} values @code{hard}, @code{soft}, and
@code{unlimited} stand for the current hard limit, the current soft limit, @code{unlimited} stand for the current hard limit, the current soft limit,
and no limit, respectively. and no limit, respectively.
A hard limit cannot be increased by a non-root user once it is set;
a soft limit may be increased up to the value of the hard limit.
Otherwise, the current value of the soft limit for the specified resource Otherwise, the current value of the soft limit for the specified resource
is printed, unless the @option{-H} option is supplied. is printed, unless the @option{-H} option is supplied.
When setting new limits, if neither @option{-H} nor @option{-S} is supplied, When setting new limits, if neither @option{-H} nor @option{-S} is supplied,
+11 -2
View File
@@ -1674,6 +1674,7 @@ make_child (command, async_p)
char *command; char *command;
int async_p; int async_p;
{ {
int forksleep;
sigset_t set, oset; sigset_t set, oset;
pid_t pid; pid_t pid;
@@ -1695,8 +1696,16 @@ make_child (command, async_p)
sync_buffered_stream (default_buffered_input); sync_buffered_stream (default_buffered_input);
#endif /* BUFFERED_INPUT */ #endif /* BUFFERED_INPUT */
/* Create the child, handle severe errors. */ /* Create the child, handle severe errors. Retry on EAGAIN. */
if ((pid = fork ()) < 0) while ((pid = fork ()) < 0 && errno == EAGAIN && forksleep < FORKSLEEP_MAX)
{
sys_error ("fork: retry");
if (sleep (forksleep) != 0)
break;
forksleep <<= 1;
}
if (pid < 0)
{ {
sys_error ("fork"); sys_error ("fork");
+3
View File
@@ -38,6 +38,9 @@
/* I looked it up. For pretty_print_job (). The real answer is 24. */ /* I looked it up. For pretty_print_job (). The real answer is 24. */
#define LONGEST_SIGNAL_DESC 24 #define LONGEST_SIGNAL_DESC 24
/* The max time to sleep while retrying fork() on EAGAIN failure */
#define FORKSLEEP_MAX 16
/* We keep an array of jobs. Each entry in the array is a linked list /* We keep an array of jobs. Each entry in the array is a linked list
of processes that are piped together. The first process encountered is of processes that are piped together. The first process encountered is
the group leader. */ the group leader. */
+15 -16
View File
@@ -465,9 +465,7 @@ make_child (command, async_p)
int async_p; int async_p;
{ {
pid_t pid; pid_t pid;
#if defined (HAVE_WAITPID) int forksleep;
int retry = 1;
#endif /* HAVE_WAITPID */
/* Discard saved memory. */ /* Discard saved memory. */
if (command) if (command)
@@ -484,26 +482,27 @@ make_child (command, async_p)
sync_buffered_stream (default_buffered_input); sync_buffered_stream (default_buffered_input);
#endif /* BUFFERED_INPUT */ #endif /* BUFFERED_INPUT */
/* Create the child, handle severe errors. */ /* Create the child, handle severe errors. Retry on EAGAIN. */
#if defined (HAVE_WAITPID) forksleep = 1;
retry_fork: while ((pid = fork ()) < 0 && errno == EAGAIN && forksleep < FORKSLEEP_MAX)
#endif /* HAVE_WAITPID */
if ((pid = fork ()) < 0)
{ {
sys_error ("fork: retry");
#if defined (HAVE_WAITPID) #if defined (HAVE_WAITPID)
/* Posix systems with a non-blocking waitpid () system call available /* Posix systems with a non-blocking waitpid () system call available
get another chance after zombies are reaped. */ get another chance after zombies are reaped. */
if (errno == EAGAIN && retry) reap_zombie_children ();
{ if (forksleep > 1 && sleep (forksleep) != 0)
reap_zombie_children (); break;
retry = 0; #else
goto retry_fork; if (sleep (forksleep) != 0)
} break;
#endif /* HAVE_WAITPID */ #endif /* HAVE_WAITPID */
forksleep <<= 1;
}
if (pid < 0)
{
sys_error ("fork"); sys_error ("fork");
throw_to_top_level (); throw_to_top_level ();
} }