cURL / Mailing Lists / curl-library / Single Mail


Re: HP-UX socklen_t issue

From: Yang Tse <>
Date: Mon, 20 Apr 2009 13:54:01 +0200

2009/4/19, Daniel Stenberg wrote:

> [...] I agree that figuring out
> the actual data type to use for one of the functions that normally use
> socklen_t seems like a clever approach.

In the last sentence of my previous post I stated that I did not
foresee any need to expose 'curl_socklen_t' in the external API. But
this statement has been bouncing back and forth in my head since then,
and I now think that I was wrong and that most probably the
curl_socklen_t definition should be done in curlbuild.h and checked in

Additionally to what I've already exposed in previous post there is a
third part involved in the HP-UX socklen_t issue...

On HP-UX system socket related functions can be provided by libc or by
libxnet. The c library provides a 32-Bit ABI only to these functions
and the X/Open xnet library is capable of providing the 64-Bit ABI and
the 32-Bit one.

Socket related functions provided by libc can be safely used when
using the ILP32 data model no matter if _XOPEN_SOURCE_EXTENDED is
defined or not. In this two cases 'addrlen' and 'optlen' have a 32-Bit
size. But in order to achieve full 'visibility' of the X/Open
interface when _XOPEN_SOURCE_EXTENDED is defined the xnet library is
required for linking.

When using the LP64 data model without _XOPEN_SOURCE_EXTENDED defined
it is also safe to use the libc provided socket functions. In this
case 'addrlen' and 'optlen' also have a 32-Bit size.

When using the LP64 data model with _XOPEN_SOURCE_EXTENDED defined it
becomes mandatory to use the xnet library in order to link to socket
functions expecting 64-Bit 'addrlen' and 'optlen'.

So what do all these convolutions imply for us on HP-UX?

_XOPEN_SOURCE_EXTENDED might be defined or not by whoever builds
libcurl, requiring or not to link against libxnet.

Additionally curl_socklen_t might have a 32 or 64-Bit size depending
on the data model and _XOPEN_SOURCE_EXTENDED being defined or not at

All of the above make ne now think that curl_socklen_t should probably
be defined in curlbuild.h and checked in curlrules.h to avoid nasty

Thoughts, besides 'what a pain'?

Received on 2009-04-20