cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: IRIX quirks?

From: Tor Arntsen <tor_at_spacetec.no>
Date: Fri, 6 Aug 2004 11:46:20 +0200

On Aug 5, 18:49, Daniel Stenberg wrote:
>On Tue, 3 Aug 2004, Tor Arntsen wrote:
>
>> #ifdef _XOPEN_SOURCE
>> ssize_t send(int s, const void *msg, size_t len, int flags);
>> ssize_t recv(int s, void *buf, size_t len, int flags);
>> #else
>> int send(int s, const void *msg, int len, int flags);
>> int recv(int s, void *buf, int len, int flags);
>> #endif
>
>This is next to insane. On the 64bit systems, these are quite big differences
>(ssize_t being 64 bits and int being 32) and I don't quite understand how they
>can make it a compile-time switch.
>
>Sigh.

/usr/include/sys/socket.h defines xpg4 and xpg5 versions of these
functions (xpg4 and xpg5 versions are the same for send/recv, but
differs for sendto etc.).

The actual 'send' and 'recv' are implemented as functions in
/usr/include/sys/socket.h, returning either the xpg4 or xpg5
version, depending on the existence/value of _XOPEN_SOURCE.
e.g.
recv(int _s, void *_buf, size_t _len, int _flags)
{
        return(__xpg4_recv(_s, _buf, _len, _flags));
}

(Obviously this will create trouble for programmers wishing to handle
the address of the functions, as each file including socket.h will
get its own function. The manpage describes how to program in this
case.)

-Tor
Received on 2004-08-06