cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: IRIX quirks?

From: Tor Arntsen <tor_at_spacetec.no>
Date: Tue, 3 Aug 2004 19:45:15 +0200

Hi Daniel,

On Jul 31, 22:37, Daniel Stenberg wrote:
>Hi
>
>I'm puzzled by a few warnings caused by the MIPRPro compiler on 64bit IRIX
>6.5.22 as provided by Tor Arntsen.
>
>I found some IRIX 5.3 man pages online that indicated that the prototypes IRIX
>provides for the following functions don't match the ones that Linux provides:
>
>* writev()
>* send()
>* recv()
>
>It would be interesting to know if this is still the case for more recent
>versions of IRIX, as that would explains a few warnings.
>
>I compared the protos with "The Single UNIX Specification, Version 2", and it
>made this TSUSV2-compliant table:
>
>function Linux IRIX
>-------- ----- ----
> writev no yes
> send yes no
> recv yes no
>
>(The differences are all usage of ssize_t instead of int and vice versa.)

The prototypes for writev, send and recv on IRIX 6.5.22 (and it shouldn't
change in future irix 6.5 versions I believe) are now:

For writev:
 #include <sys/uio.h>
  ssize_t writev(int, const struct iovec *, int);

For send: The first one is the _XOPEN_SOURCE version, and the second
is what they call the "normal type when _XOPEN_SOURCE is not defined".
(Actually they have one XPG4 and one XPG5 version, the latter is if
_XOPEN_SOURCE >= 500, but the prototypes for send(2) is the same. It's
different for e.g. sendto(2))

For recv: The same situation. I have included both below:

 #include <sys/types.h>
 #include <sys/socket.h>

 #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

The man pages says that the above applies to irix 6.5.19 and
newer, and the _XOPEN_SOURCE version is not documented for
earlier releases, but it does in fact also apply for these
older 6.5 versions (no xpg5 though, but that doesn't make
any difference for send(2) and recv(2)).

For IRIX 6.2 you'll only find the non-_XOPEN_SOURCE versions,
i.e. writev is the same as for 6.5 and send and recv are the
versions returning int.

Comparing this to the Linux prototypes it seems we should
get the same definition if we define _XOPEN_SOURCE on IRIX,
we could probably even set it to 500 (in fact that's what
I find myself doing when trying to get stuff to compile
without warnings on IRIX, AIX and Linux withouth having
to add ifdefs everywhere).

One interesting thing though is that even though the
manpage on my Linux box says
int writev(int filedes, const struct iovec *vector,
                 size_t count);

the actual sys/uio.h header file says different:
>grep writev /usr/include/sys/uio.h
extern ssize_t writev (int __fd, __const struct iovec *__vector, int __count);

In other words, the header file agrees with the _XOPEN_SOURCE
version on IRIX, but not with its own manpage. This is on
Debian SID, glibc 2.3.2

I can set up some small test program to compile here and
there if it turns out that we're not getting rid of these
warnings easily.

-Tor
Received on 2004-08-03