You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Jeff Trawick <tr...@gmail.com> on 2013/11/18 15:24:13 UTC

Re: svn commit: r1543033 - /apr/apr/trunk/network_io/unix/socket_util.c

On Mon, Nov 18, 2013 at 9:10 AM, <ji...@apache.org> wrote:

> Author: jim
> Date: Mon Nov 18 14:10:58 2013
> New Revision: 1543033
>
> URL: http://svn.apache.org/r1543033
> Log:
> OSX (Darwin) returns APR_POLLHUP|APR_POLLIN, so the
> test for equality fails. Instead, just check for the bit.
>
> Modified:
>     apr/apr/trunk/network_io/unix/socket_util.c
>
> Modified: apr/apr/trunk/network_io/unix/socket_util.c
> URL:
> http://svn.apache.org/viewvc/apr/apr/trunk/network_io/unix/socket_util.c?rev=1543033&r1=1543032&r2=1543033&view=diff
>
> ==============================================================================
> --- apr/apr/trunk/network_io/unix/socket_util.c (original)
> +++ apr/apr/trunk/network_io/unix/socket_util.c Mon Nov 18 14:10:58 2013
> @@ -46,7 +46,12 @@ APR_DECLARE(apr_status_t) apr_socket_atr
>          /* Some other error -> unexpected error. */
>          return rv;
>      }
> +#if defined(DARWIN)
> +    /* OSX returns APR_POLLHUP|APR_POLLIN */
> +    else if (nfds == 1 && (pfds[0].rtnevents & APR_POLLIN)  ==
> APR_POLLIN) {
> +#else
>      else if (nfds == 1 && pfds[0].rtnevents == APR_POLLIN) {
> +#endif
>

Trying to read if APR_POLLIN, independent of other flags, seems valid for
all platforms...

BTW, is the testsock testcase failing on OS X, or is this something not
caught by testsock?



>          apr_sockaddr_t unused;
>          apr_size_t len = 1;
>          char buf;
>
>
>


-- 
Born in Roswell... married an alien...
http://emptyhammock.com/

Re: svn commit: r1543033 - /apr/apr/trunk/network_io/unix/socket_util.c

Posted by Jeff Trawick <tr...@gmail.com>.
On Mon, Nov 18, 2013 at 9:47 AM, Jim Jagielski <ji...@jagunet.com> wrote:

>
> On Nov 18, 2013, at 9:36 AM, Jeff Trawick <tr...@gmail.com> wrote:
> > and since we have a useful testcase then maybe it is worth abandoning
> the #else path...  but YMMV :)
>
> +1 from me :)


okay, it will be on me :)

-- 
Born in Roswell... married an alien...
http://emptyhammock.com/

Re: svn commit: r1543033 - /apr/apr/trunk/network_io/unix/socket_util.c

Posted by Jim Jagielski <ji...@jaguNET.com>.
On Nov 18, 2013, at 9:36 AM, Jeff Trawick <tr...@gmail.com> wrote:
> and since we have a useful testcase then maybe it is worth abandoning the #else path...  but YMMV :)

+1 from me :)

Re: svn commit: r1543033 - /apr/apr/trunk/network_io/unix/socket_util.c

Posted by Jim Jagielski <ji...@jaguNET.com>.
On Nov 18, 2013, at 9:36 AM, Jeff Trawick <tr...@gmail.com> wrote:
>  
> 
> This is a long standing OSX issue...
> 
> I interpret that as "yes, the testcase failed"...
> 

Yeppers


Re: svn commit: r1543033 - /apr/apr/trunk/network_io/unix/socket_util.c

Posted by Jeff Trawick <tr...@gmail.com>.
On Mon, Nov 18, 2013 at 9:30 AM, Jim Jagielski <ji...@jagunet.com> wrote:

> The #else part is what's originally in there... afaik, the
> test only fails for OSX because of this issue (rtnevents
> contains both the POLLIN and POLLHUP bits).
>

understood; the original code looks fragile...


>
> This is a long standing OSX issue...


I interpret that as "yes, the testcase failed"...

and since we have a useful testcase then maybe it is worth abandoning the
#else path...  but YMMV :)



> will look to see
> if theres anything in BUGZ
> On Nov 18, 2013, at 9:24 AM, Jeff Trawick <tr...@gmail.com> wrote:
>
> > On Mon, Nov 18, 2013 at 9:10 AM, <ji...@apache.org> wrote:
> > Author: jim
> > Date: Mon Nov 18 14:10:58 2013
> > New Revision: 1543033
> >
> > URL: http://svn.apache.org/r1543033
> > Log:
> > OSX (Darwin) returns APR_POLLHUP|APR_POLLIN, so the
> > test for equality fails. Instead, just check for the bit.
> >
> > Modified:
> >     apr/apr/trunk/network_io/unix/socket_util.c
> >
> > Modified: apr/apr/trunk/network_io/unix/socket_util.c
> > URL:
> http://svn.apache.org/viewvc/apr/apr/trunk/network_io/unix/socket_util.c?rev=1543033&r1=1543032&r2=1543033&view=diff
> >
> ==============================================================================
> > --- apr/apr/trunk/network_io/unix/socket_util.c (original)
> > +++ apr/apr/trunk/network_io/unix/socket_util.c Mon Nov 18 14:10:58 2013
> > @@ -46,7 +46,12 @@ APR_DECLARE(apr_status_t) apr_socket_atr
> >          /* Some other error -> unexpected error. */
> >          return rv;
> >      }
> > +#if defined(DARWIN)
> > +    /* OSX returns APR_POLLHUP|APR_POLLIN */
> > +    else if (nfds == 1 && (pfds[0].rtnevents & APR_POLLIN)  ==
> APR_POLLIN) {
> > +#else
> >      else if (nfds == 1 && pfds[0].rtnevents == APR_POLLIN) {
> > +#endif
> >
> > Trying to read if APR_POLLIN, independent of other flags, seems valid
> for all platforms...
> >
> > BTW, is the testsock testcase failing on OS X, or is this something not
> caught by testsock?
> >
> >
> >          apr_sockaddr_t unused;
> >          apr_size_t len = 1;
> >          char buf;
> >
> >
> >
> >
> >
> > --
> > Born in Roswell... married an alien...
> > http://emptyhammock.com/
>
>


-- 
Born in Roswell... married an alien...
http://emptyhammock.com/

Re: svn commit: r1543033 - /apr/apr/trunk/network_io/unix/socket_util.c

Posted by Jim Jagielski <ji...@jaguNET.com>.
The #else part is what's originally in there... afaik, the
test only fails for OSX because of this issue (rtnevents
contains both the POLLIN and POLLHUP bits).

This is a long standing OSX issue... will look to see
if theres anything in BUGZ
On Nov 18, 2013, at 9:24 AM, Jeff Trawick <tr...@gmail.com> wrote:

> On Mon, Nov 18, 2013 at 9:10 AM, <ji...@apache.org> wrote:
> Author: jim
> Date: Mon Nov 18 14:10:58 2013
> New Revision: 1543033
> 
> URL: http://svn.apache.org/r1543033
> Log:
> OSX (Darwin) returns APR_POLLHUP|APR_POLLIN, so the
> test for equality fails. Instead, just check for the bit.
> 
> Modified:
>     apr/apr/trunk/network_io/unix/socket_util.c
> 
> Modified: apr/apr/trunk/network_io/unix/socket_util.c
> URL: http://svn.apache.org/viewvc/apr/apr/trunk/network_io/unix/socket_util.c?rev=1543033&r1=1543032&r2=1543033&view=diff
> ==============================================================================
> --- apr/apr/trunk/network_io/unix/socket_util.c (original)
> +++ apr/apr/trunk/network_io/unix/socket_util.c Mon Nov 18 14:10:58 2013
> @@ -46,7 +46,12 @@ APR_DECLARE(apr_status_t) apr_socket_atr
>          /* Some other error -> unexpected error. */
>          return rv;
>      }
> +#if defined(DARWIN)
> +    /* OSX returns APR_POLLHUP|APR_POLLIN */
> +    else if (nfds == 1 && (pfds[0].rtnevents & APR_POLLIN)  == APR_POLLIN) {
> +#else
>      else if (nfds == 1 && pfds[0].rtnevents == APR_POLLIN) {
> +#endif
> 
> Trying to read if APR_POLLIN, independent of other flags, seems valid for all platforms...
> 
> BTW, is the testsock testcase failing on OS X, or is this something not caught by testsock?
> 
>  
>          apr_sockaddr_t unused;
>          apr_size_t len = 1;
>          char buf;
> 
> 
> 
> 
> 
> -- 
> Born in Roswell... married an alien...
> http://emptyhammock.com/