Re: PROBLEM: using _syscall4 to call sys_futex with -fPIC won'tcompile

From: Andreas Schwab
Date: Mon Jul 05 2004 - 12:58:09 EST


Chris Friesen <cfriesen@xxxxxxxxxxxxxxxxxx> writes:

> The "_syscallx" macros are in the userspace versions of the kernel
> headers, and as such should be fair game.

They are known not to work with -fpic (on x86 anyway, other architectures
are less broken). Anyway, just because there is no #ifdef __KERNEL__
doesn't mean a kernel header is meant for user space use.

> Also, you need to get a list of syscall numbers somehow, and those
> numbers are generally defined in the same file that contains the
> "_syscallx" macros.

They are duplicated in <sys/syscall.h> (which is auto-generated from the
list in <asm/unistd.h>).

> syscall() doesn't work for all system calls. The man page explicitly
> warns that it doesn't work for pipe(2).

Only if pipe(2) uses the "two retvals" calling convention (Alpha and ia64,
but not x86 or m68k). But then, pipe is already available without
syscall(), and new syscalls normally use simple enough calling conventions
that are suitable for syscall().

Andreas.

--
Andreas Schwab, SuSE Labs, schwab@xxxxxxx
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/