Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--winsup/cygwin/ChangeLog5
-rw-r--r--winsup/cygwin/wait.cc31
2 files changed, 22 insertions, 14 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 3dc3f3402..c7c6d4a47 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,8 @@
+Mon Jan 15 21:07:00 2001 Christopher Faylor <cgf@cygnus.com>
+
+ * wait.cc (wait4): Rename variable for consistency. Allow restartable
+ signal behavior.
+
Mon Jan 15 23:15:00 2001 Corinna Vinschen <corinna@vinschen.de>
* mmap.cc (mmap): Add more parameter checking. Change error output
diff --git a/winsup/cygwin/wait.cc b/winsup/cygwin/wait.cc
index 2f5c1ba4e..852c7f453 100644
--- a/winsup/cygwin/wait.cc
+++ b/winsup/cygwin/wait.cc
@@ -47,11 +47,12 @@ wait3 (int *status, int options, struct rusage *r)
pid_t
wait4 (int intpid, int *status, int options, struct rusage *r)
{
- int rc;
+ int res;
waitq *w;
HANDLE waitfor;
sigframe thisframe (mainthread);
+beg:
if (options & ~(WNOHANG | WUNTRACED))
{
set_errno (EINVAL);
@@ -71,48 +72,50 @@ wait4 (int intpid, int *status, int options, struct rusage *r)
w->pid, w->options);
if (!proc_subproc(PROC_WAIT, (DWORD)w))
{
- set_errno(ENOSYS);
+ set_errno (ENOSYS);
paranoid_printf ("proc_subproc returned 0");
- rc = -1;
+ res = -1;
goto done;
}
if ((waitfor = w->ev) == NULL)
goto nochildren;
- rc = WaitForSingleObject (waitfor, INFINITE);
+ res = WaitForSingleObject (waitfor, INFINITE);
- sigproc_printf ("%d = WaitForSingleObject (...)", rc);
+ sigproc_printf ("%d = WaitForSingleObject (...)", res);
if (w->ev == NULL)
{
nochildren:
/* found no children */
set_errno (ECHILD);
- rc = -1;
+ res = -1;
goto done;
}
if (w->status == -1)
{
set_sig_errno (EINTR);
- rc = -1;
+ res = -1;
}
- else if (rc != WAIT_OBJECT_0)
+ else if (res != WAIT_OBJECT_0)
{
/* We shouldn't set errno to any random value if we can help it.
See the Posix manual for a list of valid values for `errno'. */
set_errno (EINVAL);
- rc = -1;
+ res = -1;
}
- else if ((rc = w->pid) != 0 && status)
+ else if ((res = w->pid) != 0 && status)
*status = w->status;
done:
- sigproc_printf ("intpid %d, status %p, w->status %d, options %d, rc %d",
- intpid, status, w->status, options, rc);
+ if (res < 0 && get_errno () == EINTR && call_signal_handler ())
+ goto beg;
+ sigproc_printf ("intpid %d, status %p, w->status %d, options %d, res %d",
+ intpid, status, w->status, options, res);
w->status = -1;
- if (rc < 0)
+ if (res < 0)
sigproc_printf("*** errno = %d", get_errno());
- return rc;
+ return res;
}