FAQ 8.21 Where do I get the include files to do ioctl() or syscall()?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

This is an excerpt from the latest version perlfaq8.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .


8.21: Where do I get the include files to do ioctl() or syscall()?

    Historically, these would be generated by the h2ph tool, part of the
    standard perl distribution. This program converts cpp(1) directives in C
    header files to files containing subroutine definitions, like
    &SYS_getitimer, which you can use as arguments to your functions. It
    doesn't work perfectly, but it usually gets most of the job done. Simple
    files like errno.h, syscall.h, and socket.h were fine, but the hard ones
    like ioctl.h nearly always need to hand-edited. Here's how to install
    the *.ph files:

            1.  become super-user
            2.  cd /usr/include
            3.  h2ph *.h */*.h

    If your system supports dynamic loading, for reasons of portability and
    sanity you probably ought to use h2xs (also part of the standard perl
    distribution). This tool converts C header files to Perl extensions. See
    perlxstut for how to get started with h2xs.

    If your system doesn't support dynamic loading, you still probably ought
    to use h2xs. See perlxstut and ExtUtils::MakeMaker for more information
    (in brief, just use make perl instead of a plain make to rebuild perl
    with a new static extension).


The perlfaq-workers, a group of volunteers, maintain the perlfaq. They
are not necessarily experts in every domain where Perl might show up,
so please include as much information as possible and relevant in any
corrections. The perlfaq-workers also don't have access to every
operating system or platform, so please include relevant details for
corrections to examples that do not work on particular platforms.
Working code is greatly appreciated.

If you'd like to help maintain the perlfaq, see the details in

Site Timeline