You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by "Philippe M. Chiasson" <go...@apache.org> on 2010/04/19 20:21:15 UTC
Re: svn commit: r935519 - in /perl/modperl/trunk: t/response/TestAPR/socket.pm
xs/APR/Socket/APR__Socket.h xs/maps/apr_functions.map xs/tables/current/ModPerl/FunctionTable.pm
On 10-04-19 06:43 , torsten@apache.org wrote:
> Author: torsten
> Date: Mon Apr 19 10:43:15 2010
> New Revision: 935519
>
> URL: http://svn.apache.org/viewvc?rev=935519&view=rev
> Log:
> make the UNIX-level file descriptor of an APR::Socket available
I am wondering what the usage for this would/could be?
Also, this is introducing a non-portable API, something APR tries really
hard to avoid.
> Modified:
> perl/modperl/trunk/t/response/TestAPR/socket.pm
> perl/modperl/trunk/xs/APR/Socket/APR__Socket.h
> perl/modperl/trunk/xs/maps/apr_functions.map
> perl/modperl/trunk/xs/tables/current/ModPerl/FunctionTable.pm
>
> Modified: perl/modperl/trunk/t/response/TestAPR/socket.pm
> URL: http://svn.apache.org/viewvc/perl/modperl/trunk/t/response/TestAPR/socket.pm?rev=935519&r1=935518&r2=935519&view=diff
> ==============================================================================
> --- perl/modperl/trunk/t/response/TestAPR/socket.pm (original)
> +++ perl/modperl/trunk/t/response/TestAPR/socket.pm Mon Apr 19 10:43:15 2010
> @@ -18,7 +18,7 @@ use APR::Const -compile => 'EMISMATCH';
> sub handler {
> my $r = shift;
>
> - my $tests = 4;
> + my $tests = 5;
>
> plan $r, tests => $tests;
>
> @@ -40,6 +40,15 @@ sub handler {
> $socket->timeout_set($orig_val);
> ok t_cmp($socket->timeout_get(), $orig_val, "timeout_get()");
>
> + my $fd=$socket->sock_get;
> + t_debug "client socket fd=$fd";
> + if ($^O eq 'MSWin32') {
> + ok $fd==-1;
> + }
> + else {
> + ok $fd>=0;
> + }
> +
> Apache2::Const::OK;
> }
>
>
> Modified: perl/modperl/trunk/xs/APR/Socket/APR__Socket.h
> URL: http://svn.apache.org/viewvc/perl/modperl/trunk/xs/APR/Socket/APR__Socket.h?rev=935519&r1=935518&r2=935519&view=diff
> ==============================================================================
> --- perl/modperl/trunk/xs/APR/Socket/APR__Socket.h (original)
> +++ perl/modperl/trunk/xs/APR/Socket/APR__Socket.h Mon Apr 19 10:43:15 2010
> @@ -116,3 +116,14 @@ apr_status_t mpxs_APR__Socket_poll(apr_s
>
> return apr_poll(&fd, 1, &nsds, timeout);
> }
> +
> +static MP_INLINE int mpxs_APR__Socket_sock_get(pTHX_ apr_socket_t *sock)
> +{
> +#ifdef WIN32
> + return -1; /* not implemented */
> +#else
> + apr_os_sock_t s;
> + apr_os_sock_get(&s, sock);
> + return s;
> +#endif
> +}
Will this work on *all* non WIN32 platforms ?
--
Philippe M. Chiasson GPG: F9BFE0C2480E7680 1AE53631CB32A107 88C3A5A5
http://gozer.ectoplasm.org/ m/gozer\@(apache|cpan|ectoplasm)\.org/
Re: svn commit: r935519 - in /perl/modperl/trunk: t/response/TestAPR/socket.pm xs/APR/Socket/APR__Socket.h xs/maps/apr_functions.map xs/tables/current/ModPerl/FunctionTable.pm
Posted by Torsten Förtsch <to...@gmx.net>.
On Monday 19 April 2010 20:21:15 Philippe M. Chiasson wrote:
> > make the UNIX-level file descriptor of an APR::Socket available
>
> I am wondering what the usage for this would/could be?
Passing off the descriptor to another process to handle long running stuff
while freeing the apache worker.
See http://foertsch.name/ModPerl-Tricks/req-hand-over.shtml
> Also, this is introducing a non-portable API, something APR tries really
> hard to avoid.
>
But APR has these interfaces. Perhaps it should better be named fileno?
> > +
> > +static MP_INLINE int mpxs_APR__Socket_sock_get(pTHX_ apr_socket_t *sock)
> > +{
> > +#ifdef WIN32
> > + return -1; /* not implemented */
> > +#else
> > + apr_os_sock_t s;
> > + apr_os_sock_get(&s, sock);
> > + return s;
> > +#endif
> > +}
>
> Will this work on *all* non WIN32 platforms ?
>
This is apr shipped with httpd-2.2.14:
$ grep apr_os_sock_t apr_portable.h
typedef SOCKET apr_os_sock_t;
typedef int apr_os_sock_t;
typedef int apr_os_sock_t;
typedef int apr_os_sock_t;
typedef int apr_os_sock_t; /**< native dir */
The first result is windows. So, as long as no other systems are added it
should work.
Torsten Förtsch
--
Need professional modperl support? Hire me! (http://foertsch.name)
Like fantasy? http://kabatinte.net
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org