I started to use syscalls in Perl scripts a long time ago. One of the main issues I face every time I install a script on a new machine is creating Perl header files from the C headers.

It is supposed to be done very easy:

# cd /usr/include
# h2ph *.h
# h2ph */*.h

With this we should have our Perl headers generated… However I found that on many distributions, the system headers asm/unisd.h have their includes like this:

# ifdef __i386__
# include "unistd_32.h"
# else
# include "unistd_64.h"
# endif

This is a big problem as h2ph skips lines with quotes and it expects that the header files should be something like this:


# ifdef __i386__
# include <unistd_32.h>
# else
# include <unistd_64.h>
# endif

So I have to manually fix this stupid bug in order to use the syscalls I need.

What I mainly use from the syscalls are:

__NR_getpriority - used for renice
__NR_setpriority - used for renice
__NR_ioprio_get - used for ionice
__NR_ioprio_set - used for ionice


Comments are closed.

Posted by HackMan
Dated: 24th February 2009
Filled Under: Linux General, Technology