Mail Archives: cygwin-developers/2000/02/28/10:51:16
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_000_01BF8204.C0757E0E
Content-Type: text/plain;
charset="iso-8859-1"
With the Feb-27 I'm seeing a interrupted wait() not setting errno to EINTR.
This is an example:
#include <unistd.h>
#include <stdio.h>
#include <sys/wait.h>
#include <signal.h>
#include <errno.h>
int onalrm() { printf("onalrm\n"); }
main()
{
pid_t pid;
int status = 0;
if(fork() == 0) {
sleep(10);
exit(37);
}
signal(SIGALRM, onalrm);
alarm(3);
pid = wait(&status);
printf("pid=%d status=%d errno=%d\n", pid, status, errno);
}
A run shows:
% ./a.exe
onalrm
pid=-1 status=0 errno=10
errno should be 4 (EINTR), *not* 10 (ECHILD, No Children).
I've attached a fix that works, but I'm not certain it is correct.
Eric
------_=_NextPart_000_01BF8204.C0757E0E
Content-Type: application/octet-stream;
name="wait.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="wait.patch"
--- sigproc.cc- Mon Feb 28 12:23:28 2000=0A=
+++ sigproc.cc Mon Feb 28 15:48:56 2000=0A=
@@ -354,9 +354,10 @@ proc_subproc (DWORD what, DWORD val)=0A=
{=0A=
sip_printf ("waiting thread found no children");=0A=
HANDLE oldw =3D w->next->ev;=0A=
- w->next->ev =3D NULL;=0A=
if (clearing)=0A=
w->next->status =3D -1; /* flag that a signal was received */=0A=
+ else=0A=
+ w->next->ev =3D NULL;=0A=
if (!SetEvent (oldw))=0A=
system_printf ("couldn't wake up wait event %p, %E", oldw);=0A=
w->next =3D w->next->next;=0A=
------_=_NextPart_000_01BF8204.C0757E0E--
- Raw text -