bug-hurd
[Top][All Lists]
Advanced

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

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


From: Svante Signell
Subject: Re: 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 08:00:26 +0100

On Fri, 2012-11-23 at 01:55 +0100, Samuel Thibault wrote:
> 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.

Of course, will change that.

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

Yes please.

> 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)

Yes, the error I check for is EPIPE. 

> In the poll case, we are indeed supposed to catch errors and set POLLERR
> in that case, which we apparently never do.  

Or rather POLLHUP.

> 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,

The mail subject should be as you proposed, sorry. I'm not yet fluent in
the terminology and how to write things properly the GNU Hurd way.

>  while in the select() case you
> simply mark the fd as readable (since that's the expected select
> behavior)?

Yes, no errors in the select case only for poll (according to POSIX).
The remaining thing to check is if the proposed change affects the
select case in the current hurdselect (until a new one is installed).
For poll it doesn't, I've checked.




reply via email to

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