[comp.unix.wizards] SVID and writev

ct@dde.dk (Claus Tondering) (08/20/90)

In the third edition of SVID (the edition that describes Release 4) the
following is said about the writev() system call (in write(BA_OS) in
volume 1):


  int writev(int fildes, const struct iovec *iov, int iovcnt);

  ... iovcnt is valid if greater than 0 and less than or equal
  to {IOV_MAX}.


A similar thing is said about readv().

I have not been able to find a specification of {IOV_MAX} anywhere. Unless
I have overlooked something, it is not defined or mentioned elsewhere
in the SVID. Is it supposed to be defined in an include-file, and if so,
which? And what should be its minimum value?

-- 
Claus Tondering                                       | The number of seconds
Dansk Data Elektronik A/S, Herlev, Denmark            | in a leap year is
E-mail: ct@dde.dk   or   ...!uunet!mcsun!dkuug!dde!ct | sqrt(1E15)

guy@auspex.auspex.com (Guy Harris) (08/21/90)

>I have not been able to find a specification of {IOV_MAX} anywhere. Unless
>I have overlooked something, it is not defined or mentioned elsewhere
>in the SVID.

{OPEN_MAX} isn't defined there either, because there's no official value
for it; it's implementation-dependent.  In that particular case, it's
specified by POSIX, and there's a way to query it with "sysconf()" (or
you can get it with "getrlimit()", but using "sysconf()" is more
portable).  There is, unfortunately, no "sysconf()" parameter in the
SVID to get it.

>Is it supposed to be defined in an include-file, and if so,
>which?

It's just a hardcoded 16 in 4.[23]BSD and 4.3-tahoe (quite literally
hardcoded - there's no #define, although there *is* an /* XXX */ on the
line containing the hardcoded 16), and the S5R4 documentation (as
opposed to the SVID) also says 16.  It may still be a hardcoded 16 in
S5R4, rather than a #defined constant.

>And what should be its minimum value?

I would not recommend building an implementation with a smaller value
than 16.  I don't know that there *is* some minimum value >1 that
somebody writing a program *using* "readv" or "writev", can count on,
but if you have to pick some such arbitrary value you should probably
pick 16.