curl-library
Re: ioctl includes missing #ifdefs
Date: Tue, 18 Nov 2008 11:52:39 -0800
I had to do another hand edit to the singleipconnect function.
the following code:
/* Connect TCP sockets, bind UDP */
if(conn->socktype == SOCK_STREAM)
rc = connect(sockfd, &addr.sa_addr, addr.addrlen);
else
rc = 0;
if(-1 == rc) {
error = SOCKERRNO;
switch (error) {
case EINPROGRESS:
case EWOULDBLOCK:
...
works fine as long as connect() returns -1 on errors. However for Cell OS
it returns the actual error code, and attempts to get the last error using
the Cell OS sys_net_errno does not result in the same error being returned,
at least in the case where the connection is in progress.
I had to make the following change:
/* Connect TCP sockets, bind UDP */
if(conn->socktype == SOCK_STREAM)
rc = connect(sockfd, &addr.sa_addr, addr.addrlen);
else
rc = 0;
#ifdef SN_TARGET_PS3
if( rc < 0 )
{
SET_SOCKERRNO(rc);
rc = -1;
}
#endif
if(-1 == rc) {
error = SOCKERRNO;
switch (error) {
case EINPROGRESS:
case EWOULDBLOCK:
...
and viola the connection now properly waits for connecting. By the way I
got the visual studio project converted to Visual Studio 2003, and included
some optional init and shutdown code for CellOS, and I now have the library
and source sample compiling and running on a PS3. All I've tested so far
was "--url" but I'm pretty confident in it at this point.
I have changes to 16 standard libcurl files (all very small including some
wraps around include files I posted about earlier), and have added a few
files (cellos.*, config-ps3.h, VS 2005 projects and solution).
If someone gets a chance I'd like to know if you'd like to have these
changes sent to you for "official" support. I added some basic CellOS init
and shutdown code so the Visual Studio project can build an executable that
can be ran on a PS3, but it's code that isn't meant to be used in any
product and I've ifdef'd it pretty well to illustrate as much.
--Jeff Curley
Sony Computer Entertainment America
Senior Programmer
(858) 824-5692
Jeff
Curley/SDPD/SCEA@
Playstation To
Sent by: libcurl development
curl-library-boun <curl-library_at_cool.haxx.se>
ces_at_cool.haxx.se cc
curl-library_at_cool.haxx.se
Subject
11/17/2008 11:23 Re: ioctl includes missing #ifdefs
AM
Please respond to
libcurl
development
<curl-library_at_coo
l.haxx.se>
Dan> What operating system? Obviously not Linux...
Actually it's for game development I'm not sure it's accurrate to say it's
running any operating system when the console is running a game. If it is
running something it's completely obfuscated away from the developer so I
just don't know the answer to that. :(
Dan> That's also going to fail in the same way if EAGAIN isn't defined.
I've
split the checks onto two lines which should work in all cases.
Well I tried that as well, and for the Cell SDK it still failed, I ended up
breaking it into this following:
#if !defined(SN_TARGET_PS3)
# if defined(EAGAIN) && EAGAIN != EWOULDBLOCK
/* On some platforms EAGAIN and EWOULDBLOCK are the
* same value, and on others they are different, hence
* the odd #if
*/
case EAGAIN:
# endif
#endif
Dan> That sounds like a Cell-specific case all right. Would something like
this:
I'll give this a try and see if it helps.
Thanks for the response! :)
--Jeff Curley
Sony Computer Entertainment America
Senior Programmer
(858) 824-5692
Dan Fandrich
<dan_at_coneharveste
rs.com> To
Sent by: curl-library_at_cool.haxx.se
curl-library-boun cc
ces_at_cool.haxx.se
Subject
Re: ioctl includes missing #ifdefs
11/14/2008 03:14
PM
Please respond to
libcurl
development
<curl-library_at_coo
l.haxx.se>
On Fri, Nov 14, 2008 at 12:02:33PM -0800, Jeff_Curley_at_playstation.sony.com
wrote:
> In porting over to Cell I noticed a few includes missing ifdef's around
What operating system? Obviously not Linux...
> them like the following:
>
> lib\dict.c
> lib\file.c
> lib\telnet.c
> lib\tftp.c
>
> are all missing checks around ioctl.h
> #include <sys/ioctl.h>
Good point. I've fixed those.
> In connect.c the function singleipconnect()
>
> has the following line:
> #if defined(EAGAIN) && EAGAIN != EWOULDBLOCK
>
> that's checking to see if EAGAIN and EWOULDBLOCK are different to see if
it
> can add the EAGAIN case.
That's also going to fail in the same way if EAGAIN isn't defined. I've
split the checks onto two lines which should work in all cases.
> Secondly, if you look closely at this code you will see that EAGAIN is
> defined to the value 0x80010001, but on Cell there is a
> SYS_NET_ERROR_EAGAIN that is used and indeed is the same value as
> EWOULDBLOCK. That is to say Cell defines EAGAIN as one value, and
> SYS_NET_ERROR_EAGAIN as another value. EAGAIN on Cell isn't a valid
return
> value for the connect function, in fact neither is SYS_NET_ERROR_EAGAIN.
So
> in other words on Cell we'll need to avoid adding the EAGAIN case for
> connect() calls.
That sounds like a Cell-specific case all right. Would something like this:
#ifdef SYS_NET_ERROR_EAGAIN
#undef EAGAIN
#define EAGAIN SYS_NET_ERROR_EAGAIN
#endif
in setup.h solve the problem?
>>> Dan
-- http://www.MoveAnnouncer.com The web change of address service Let webmasters know that your web site has movedReceived on 2008-11-18