cURL / Mailing Lists / curl-library / Single Mail


connect() select() poll() checking against -1 return values

From: <>
Date: Tue, 18 Nov 2008 15:10:12 -0800

just a small update, I figured out why my sys_net_errno() (the Cell OS
equivalent to GetLastError) was not functioning correctly.

On CellOS there are 2 types of "error" values.
Functions like connect() return

which is a negative number (not -1), while sys_net_errno() returns

which is something more sane like "36", so I was able to clean up my change
#ifdef SN_TARGET_PS3
  if( rc < 0 )
        rc = -1;

and change my code to make use of the values returned from sys_net_errno
using the setup_once.h change:
#define SOCKERRNO ((int)WSAGetLastError())
#define SET_SOCKERRNO(x) (WSASetLastError((int)(x)))
#elif defined SN_TARGET_PS3
#define SOCKERRNO (sys_net_errno)
#define SET_SOCKERRNO(x) (errno = (x))
#define SOCKERRNO (errno)
#define SET_SOCKERRNO(x) (errno = (x))

but sadly I've had to do this anywhere that socket functions were
explicitly checking against the value "-1", (connect, select, poll, etc..)

If libcurl had chosen to mask away the socket implementation calls such as
using _connect, _recv, _send, etc., I could have macro'd my changes away
easily in my config-ps3.h file. But this would force everyone who uses the
library to #define their complete implementations of socket functionality,
or at least libcurl would have to include a "base level" mapping for the
functionality which seems like too much work to support a single platform,
esp since it's such a small percentage of usage.

But the good news is, it works on PS3 with minimal changes, which is a
testament to this communities hard work. My next task is to look at the
memory manager overloading. :)

Thanks for all the replies!

--Jeff Curley
Sony Computer Entertainment America
Senior Programmer
(858) 824-5692

             Playstation To
             Sent by: libcurl development
             curl-library-boun <>
             11/18/2008 11:52 Re: ioctl includes missing #ifdefs
             Please respond to
Received on 2008-11-19