Where is sys/ioctl.h supposed to come from?

Ralf Corsepius ralf.corsepius at rtems.org
Tue Oct 11 13:04:12 UTC 2011


On 10/11/2011 02:21 PM, Peter Dufault wrote:
> I just noticed that this C code:
>
> #include<sys/ioctl.h>
> void foo(void){}
>
> fails with:
> [dufault at pico tmp]$ powerpc-rtems4.7.1-gcc -c foo.c
> foo.c:1:23: error: sys/ioctl.h: No such file or directory
> [dufault at pico tmp]$
>
> on ALL the rtems development environments I've got available going back to the above 4.7.1.
>
> There are sys/ioctl.h files in the BSP subdirectories but not in the usual include/sys directory.
Right.

It actually is in cpukit/libcsupport/include/sys/ioctl.h and being built 
per-cpukit and installed during "make install"

>  For example, for the 4.11 I've got:
 >
> [dufault at finny12 tmp]$ find /opt/rtems-4.11/ -name ioctl.h -print
> /opt/rtems-4.11/powerpc-rtems4.11/beatnik/lib/include/sys/ioctl.h
> /opt/rtems-4.11/powerpc-rtems4.11/phycore_mpc5554/lib/include/sys/ioctl.h
> [dufault at finny12 tmp]$
>
> What step have I been missing all these years?

sys/ioctl.h is a non-standardized file, portable source code must not 
rely upon (It actually is a BSD file).

If you are looking for ioctl(2), according to POSIX, <stropts.h> would 
be the place to provide it, but ... neither RTEMS provides this nor does 
any OS, I am aware about.

>  Here's a verbose trace, is it something to do with my nonexistent "sys-include" directory?
>
> [dufault at finny12 tmp]$ cat foo.c
> #include<sys/ioctl.h>
> void foo(void) {}
> [dufault at finny12 tmp]$ powerpc-rtems4.11-gcc -v -c foo.c
> Using built-in specs.
> COLLECT_GCC=powerpc-rtems4.11-gcc
> COLLECT_LTO_WRAPPER=/opt/rtems-4.11/libexec/gcc/powerpc-rtems4.11/4.6.1/lto-wrapper
> Target: powerpc-rtems4.11
> Configured with: ../gcc-4.6.1/configure --prefix=/opt/rtems-4.11 --bindir=/opt/rtems-4.11/bin --exec_prefix=/opt/rtems-4.11 --includedir=/opt/rtems-4.11/include --libdir=/opt/rtems-4.11/lib --libexecdir=/opt/rtems-4.11/libexec --mandir=/opt/rtems-4.11/share/man --infodir=/opt/rtems-4.11/share/info --datadir=/opt/rtems-4.11/share --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --target=powerpc-rtems4.11 --disable-libstdcxx-pch --with-gnu-as --with-gnu-ld --verbose --with-newlib --with-system-zlib --disable-nls --without-included-gettext --disable-win32-registry --enable-version-specific-runtime-libs --enable-threads --disable-lto --disable-plugin --enable-newlib-io-c99-formats --enable-newlib-iconv --enable-languages=c,c++
> Thread model: rtems
> gcc version 4.6.1 20110627 (RTEMS gcc-4.6.1-7.fc14/newlib-1.19.0-17.fc14) (GCC)
> COLLECT_GCC_OPTIONS='-v' '-c'
>   /opt/rtems-4.11/libexec/gcc/powerpc-rtems4.11/4.6.1/cc1 -quiet -v -Dmpc750 foo.c -quiet -dumpbase foo.c -auxbase foo -version -o /tmp/ccwiODAe.s
> GNU C (GCC) version 4.6.1 20110627 (RTEMS gcc-4.6.1-7.fc14/newlib-1.19.0-17.fc14) (powerpc-rtems4.11)
> 	compiled by GNU C version 4.5.1 20100924 (Red Hat 4.5.1-4), GMP version 4.3.1, MPFR version 2.4.2, MPC version 0.8.1
> GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
> ignoring nonexistent directory "/opt/rtems-4.11/lib/gcc/powerpc-rtems4.11/4.6.1/../../../../powerpc-rtems4.11/sys-include"
> #include "..." search starts here:
> #include<...>  search starts here:
>   /opt/rtems-4.11/lib/gcc/powerpc-rtems4.11/4.6.1/include
>   /opt/rtems-4.11/lib/gcc/powerpc-rtems4.11/4.6.1/include-fixed
>   /opt/rtems-4.11/lib/gcc/powerpc-rtems4.11/4.6.1/../../../../powerpc-rtems4.11/include
> End of search list.
> GNU C (GCC) version 4.6.1 20110627 (RTEMS gcc-4.6.1-7.fc14/newlib-1.19.0-17.fc14) (powerpc-rtems4.11)
> 	compiled by GNU C version 4.5.1 20100924 (Red Hat 4.5.1-4), GMP version 4.3.1, MPFR version 2.4.2, MPC version 0.8.1
> GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
> Compiler executable checksum: 418143d4d6b0120fd65a74d770b08579
> foo.c:1:23: fatal error: sys/ioctl.h: No such file or directory
> compilation terminated.
> [dufault at finny12 tmp]$

What I wrote above condenses to, "we treat sys/ioctrl.h as an RTEMS header"

=> you need to specify the "-qrtems ..." magic to pick-up this file 
_after_ having installed RTEMS. Inside of the build tree, this file 
should be available like any other RTEMS header.

Ralf




More information about the users mailing list