Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Which header defines IOV_MAX on Linux?

3,364 views
Skip to first unread message

Alexander Farber

unread,
Aug 9, 2005, 3:27:22 AM8/9/05
to
Hi,

this little programm compiles on OpenBSD 3.7 (with gcc 3.3.5)
but fails on RedHat Linux 9 (with gcc 3.2.2):

bolinux72:afarber {516} cat iovmax.c
#include <stdio.h>
#include <limits.h>
#include <sys/uio.h>

int
main(int argc, char *argv[])
{
struct iovec iov[IOV_MAX];
printf("IOV_MAX = %d\n", IOV_MAX);

exit(0);
}

bolinux72:afarber {515} gcc -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --with-system-zlib --enable-__cxa_atexit
--host=i386-redhat-linux
Thread model: posix
gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)

bolinux72:afarber {514} gcc -o iovmax iovmax.c
iovmax.c: In function `main':
iovmax.c:8: `IOV_MAX' undeclared (first use in this function)
iovmax.c:8: (Each undeclared identifier is reported only once
iovmax.c:8: for each function it appears in.)

bolinux72:afarber {517} gcc -o iovmax -D__USE_XOPEN=1 iovmax.c
iovmax.c: In function `main':
iovmax.c:8: `IOV_MAX' undeclared (first use in this function)
iovmax.c:8: (Each undeclared identifier is reported only once
iovmax.c:8: for each function it appears in.)

Does anybody please know, how to get it compiled on Linux?

Regards
Alex

Parahat Melayev

unread,
Aug 9, 2005, 3:50:29 AM8/9/05
to
<bits/uio.h>
at line 38 there is something like
#define UIO_MAXIOV 1024

Alexander Farber

unread,
Aug 9, 2005, 3:52:57 AM8/9/05
to
Unfortunately, this doesn't help:

bolinux72:/home/afarber> cat iovmax.c


#include <stdio.h>
#include <limits.h>
#include <sys/uio.h>

#include <bits/uio.h>

int
main(int argc, char *argv[])
{
struct iovec iov[IOV_MAX];
printf("IOV_MAX = %d\n", IOV_MAX);

exit(0);
}


bolinux72:/home/afarber> gcc -o iovmax iovmax.c
In file included from iovmax.c:4:
/usr/include/bits/uio.h:43: redefinition of `struct iovec'
iovmax.c: In function `main':
iovmax.c:9: `IOV_MAX' undeclared (first use in this function)
iovmax.c:9: (Each undeclared identifier is reported only once
iovmax.c:9: for each function it appears in.)

Roman Mashak

unread,
Aug 9, 2005, 4:40:35 AM8/9/05
to
Hello, Alexander!
You wrote on 9 Aug 2005 00:52:57 -0700:

AF> bolinux72:/home/afarber> cat iovmax.c
AF> #include <stdio.h>
AF> #include <limits.h>
AF> #include <sys/uio.h>
AF> #include <bits/uio.h>

AF> int
AF> main(int argc, char *argv[])
AF> {
AF> struct iovec iov[IOV_MAX];
AF> printf("IOV_MAX = %d\n", IOV_MAX);

AF> exit(0);
AF> }
Hm.. it's strange, as IOV_MAX is defined in /usr/include/bits/stdio_lim.h,
which is included by stdio.h

With best regards, Roman Mashak. E-mail: m...@tusur.ru


Parahat Melayev

unread,
Aug 9, 2005, 5:03:04 AM8/9/05
to
from <bits/uio.h>
#ifndef _SYS_UIO_H
# error "Never include <bits/uio.h> directly; use <sys/uio.h> instead."
#endif


#ifdef UIO_MAXIOV
#define IOV_MAX UIO_MAXIOV
printf("UIO_MAXIOV is defined and its value is %d\n", UIO_MAXIOV);
printf("IOV_MAX = UIO_MAXIOV so IOV_MAX will be: %d\n", IOV_MAX)
#else
printf("UIO_MAXIOV is not defined\n");
#endif


I don't know if UIO_MAXIOV is same with IOV_MAX... But I think so...

A. Melinte

unread,
Aug 9, 2005, 1:29:25 PM8/9/05
to
find / -name '*.h' | xargs grep IOV_MAX


"Alexander Farber" <Alexande...@gmail.com> wrote in message
news:1123573977....@g43g2000cwa.googlegroups.com...

0 new messages