From Bugzilla Helper: User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040430 Description of problem: This little program compiles on OpenBSD, but not on RedHat (Linux 9 and NOEL 4): #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); } [afarber@borcx079] > gcc -v Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/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.3 20030502 (Red Hat Linux 3.2.3-47) [afarber@borcx079] > cat /etc/redhat-release Red Hat Enterprise Linux AS release 3 (Taroon Update 4) [afarber@borcx079] > gcc -o iovmax iovmax.c 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.) Adding #include <bits/uio.h> or -D__USE_XOPEN=1 doesn't help. Regards Alex Version-Release number of selected component (if applicable): gcc-3.2.3-47 How reproducible: Always Steps to Reproduce: 1.gcc -o iovmax iovmax.c 2. 3. Actual Results: s. above Expected Results: Some value between 16 and 1024 (which should be atomic for writev/readv) Additional info:
Created attachment 117567 [details] The test program iovmax.c
Please see info libc --index-search="Feature Test Macros" Without any feature set macros IOV_MAX is intentionally not defined to avoid namespace pollution, as it is a XPG only macro. You can use one of -D_XOPEN_SOURCE -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE=600 -D_GNU_SOURCE to select it. Don't include bits/uio.h though, that's a glibc private header that should never be included directly.