cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: HAVE_SYS_SELECT_H, HAVE_STRDUP, and port to an RTOS

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Tue, 24 Jun 2008 13:34:23 -0700

On Tue, Jun 24, 2008 at 04:59:59PM +0200, Rolland Dudemaine wrote:
> I have successfully ported curl and libcurl to the INTEGRITY RTOS in a
> few hours. curl seems to work well, and the port was straightforward.

Good stuff!

> Here are 3 patches that were necessary to make this work.
> The first 2 are actually legit improvements to the code I think, the
> last one doesn't hurt :
> - curl-7.18.2_sys_select.diff : autoconf has a macro to define whether
> sys/select.h is available, which is HAVE_SYS_SELECT_H. Adding it to the
> list helps, and should not harm existing systems.

> diff -ur curl-7.18.2/include/curl/curl.h curl-7.18.2-new/include/curl/curl.h
> --- curl-7.18.2/include/curl/curl.h 2008-06-04 17:36:10.000000000 +0200
> +++ curl-7.18.2-new/include/curl/curl.h 2008-06-24 14:22:16.000000000 +0200
> @@ -64,7 +64,7 @@
> libc5-based Linux systems. Only include it on system that are known to
> require it! */
> #if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || \
> - defined(__minix) || defined(__SYMBIAN32__)
> + defined(__minix) || defined(__SYMBIAN32__) || HAVE_SYS_SELECT_H
> #include <sys/select.h>
> #endif

The comment above this patch implies that sys/select.h shouldn't be included
on all systems (presumably, because it's either not needed or causes
problems). Also, HAVE_* macros aren't available in curl.h so it couldn't
even be done if it made sense. It's probably best to just add a macro
specific to INTEGRITY there instead.

> - curl-7.18.2_strdup.diff : src/setup.h already optionally include the
> local strdup.h when strdup() is not available globally in the system.
> The same include should be added in lib/setup.h
>
> diff -ur curl-7.18.2/lib/setup.h curl-7.18.2-new/lib/setup.h
> --- curl-7.18.2/lib/setup.h 2008-04-23 22:07:52.000000000 +0200
> +++ curl-7.18.2-new/lib/setup.h 2008-06-24 15:06:38.000000000 +0200
> @@ -366,6 +366,11 @@
> #define CURL_CA_BUNDLE getenv("CURL_CA_BUNDLE")
> #endif
>
> +#ifndef HAVE_STRDUP
> +#include "strdup.h"
> +#define strdup(ptr) curlx_strdup(ptr)
> +#endif
> +
> /*
> * Include macros and defines that should only be processed once.
> */

strdup should already be taken care of. It's defined as a macro in both
memory.h and memdebug.h, depending on the debugging mode, and always points
to a definition that exists. Line 193 of easy.c points to curlx_strdup.
Where does this fail you?

> - curl-7.18.2_createconnection.diff : INTEGRITY native's API has
> Connection Objects, and a native call is CreateConnection(). The
> attached page renames the static function CreateConnection() to
> CreateCURLConnection() so that there is no conflict anymore.

This sound pretty straightforward to me.

>>> Dan

-- 
http://www.MoveAnnouncer.com              The web change of address service
          Let webmasters know that your web site has moved
-------------------------------------------------------------------
List admin: http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-users
FAQ:        http://curl.haxx.se/docs/faq.html
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2008-06-24