cURL / Mailing Lists / curl-library / Single Mail


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

From: <>
Date: Wed, 19 Nov 2008 12:28:04 -0800

yeah I considered doing exactly that yesterday but I ran into issues with
having a macro named "connect" and pulling in the CellOS function header
for "connect" I wasn't being careful though to keep the includes separated,
so I think you are totally right and I'll give it another shot today.

Thanks Dan :)

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

             Daniel Stenberg
             Sent by: To
             curl-library-boun libcurl development
             11/19/2008 05:34 Subject
             AM Re: connect() select() poll()
                                       checking against -1 return values
             Please respond to

On Tue, 18 Nov 2008, wrote:

> If libcurl had chosen to mask away the socket implementation calls such
> using _connect, _recv, _send, etc., I could have macro'd my changes away
> easily in my config-ps3.h file.

Right, but libcurl has taken the opposite approach and thus _you_ can do
masking away of your system's internals! We've deliberately assumed a
POSIX-like API and that implies -1 for errors.

You should be able to do something similar to this:

/* in a header libcurl uses: */
#define connect(x,y,z) my_connect(x,y,z)

/* in source code that libcurl links with: */
int my_connect(int socket, const struct sockaddr *address,
                socklen_t address_len)
   int rc = (connect)(socket, address, address_len);
   if(rc < 0) {
      errno = rc;
      rc = -1;

   return rc;

> But the good news is, it works on PS3 with minimal changes, which is a
> testament to this communities hard work.

Cool news, thanks for letting us know!

Received on 2008-11-19