_syscallN() Macros on IA64

The _syscallN() macros (i.e. _syscall0 .. _syscall6) are not supported on IA64 (and a range of other architectures). The most portable way to make a system call is to use the glibc builtin syscall() macro.

Example Error

sfithreads.c:105: error: parse error before "gettid"
sfithreads.c:105: warning: type defaults to `int' in declaration of `_syscall0'
sfithreads.c: In function `thread_get_tid':
sfithreads.c:115: warning: implicit declaration of function `gettid'
sfithreads.c: At top level:
sfithreads.c:105: warning: `_syscall0' declared `static' but never defined

Discussions

David Mosberger's position on this (from a post to LKML)

Why not just disallow user-level use of the _syscall() macros.
syscall() is a much more portable and easier to implement alternative
which has been around "forever" (even SunOS supported it, IIRC). I
suppose there is a slight performance loss (function-call vs. inline)
but we're talking about system calls here...

Also, the _syscall() macros have never been supported at the
user-level on ia64 linux and most packages already know to use
syscall(). Unfortunately, some "clever" maintainers use syscall()
only inside #ifdef __ia64, but that would be easy to fix if _syscall()
gets discouraged on all linux platforms.

IA64wiki: syscallMacro (last edited 2009-12-10 03:13:40 by localhost)

Gelato@UNSW is sponsored by
the University of New South Wales National ICT Australia The Gelato Federation Hewlett-Packard Company Australian Research Council
Please contact us with any questions or comments.