bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

io_select EPIPE error case? [Was: [PATCH] Prepare pflocal/io.c for a rev


From: Samuel Thibault
Subject: io_select EPIPE error case? [Was: [PATCH] Prepare pflocal/io.c for a revised hurdselect.c: Pipe case (for review)]
Date: Fri, 23 Nov 2012 01:55:19 +0100
User-agent: Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30)

Svante Signell, le Thu 22 Nov 2012 20:29:32 +0100, a écrit :
> @@ -231,15 +232,21 @@ S_io_select (struct sock_user *user,
>        if (valid & SELECT_READ)
>       {
>         pipe_acquire_reader (read_pipe);
> -       if (pipe_wait_readable (read_pipe, 1, 1) != EWOULDBLOCK)
> +       err = pipe_wait_readable (read_pipe, 1, 1);
> +       if (err != EWOULDBLOCK)
>           ready |= SELECT_READ; /* Data immediately readable (or error). */
> +       if ((err != 0) && (err != EWOULDBLOCK))
> +         return err;
>         mutex_unlock (&read_pipe->lock);

That can not be correct, you have to release the lock before returning.


About the behavior change, I'd tend to agree, but I'd rather get others'
opinion too.

I guess what you actually want to fix is the error case on poll()?
(actually here the only error that can happen is EPIPE)
(that would have saved a mail roundtrip if you had simply said so in
your mail)

In the poll case, we are indeed supposed to catch errors and set POLLERR
in that case, which we apparently never do.  I guess (again, you should
have written it to save guesswork) that what you want to do is that when
io_select returns an error, in the poll() case you record something so
that POLLERR will eventually be set, while in the select() case you
simply mark the fd as readable (since that's the expected select
behavior)?

Samuel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]