diff options
author | Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com> | 2009-12-16 13:16:08 +0100 |
---|---|---|
committer | Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com> | 2010-01-21 11:31:33 +0100 |
commit | 2b69e9906e5087a796b3a15e9aabcd102c705b19 (patch) | |
tree | 577d8bafad675828fb53b7a9fbe65bf26392ca6f /libc/sysdeps/linux/avr32/prctl.c | |
parent | 831ea78623556cbfae002477afc6256cacaaf2c6 (diff) |
avr32: add varargs handling of prctl syscall
prctl is defined to use varargs in the header file, hence it needs varargs
specific handling in the source. This patch properly handles the variodic
argument before the syscall is passed to the kernel for the AVR32 architecture.
Signed-off-by: Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com>
Diffstat (limited to 'libc/sysdeps/linux/avr32/prctl.c')
-rw-r--r-- | libc/sysdeps/linux/avr32/prctl.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/libc/sysdeps/linux/avr32/prctl.c b/libc/sysdeps/linux/avr32/prctl.c new file mode 100644 index 000000000..4e146e35e --- /dev/null +++ b/libc/sysdeps/linux/avr32/prctl.c @@ -0,0 +1,36 @@ +/* + * prctl syscall for AVR32 Linux. + * + * Copyright (C) 2010 Atmel Corporation + * + * This file is subject to the terms and conditions of the GNU Lesser General + * Public License. See the file "COPYING.LIB" in the main directory of this + * archive for more details. + */ +#include <sys/syscall.h> +#include <sys/prctl.h> +#include <stdarg.h> + +#ifdef __NR_prctl +#define __NR___syscall_prctl __NR_prctl +static inline _syscall5(int, __syscall_prctl, int, option, long, arg2, + long, arg3, long, arg4, long, arg5); + +int prctl(int __option, ...) +{ + long arg2; + long arg3; + long arg4; + long arg5; + va_list ap; + + va_start(ap, __option); + arg2 = va_arg(ap, long); + arg3 = va_arg(ap, long); + arg4 = va_arg(ap, long); + arg5 = va_arg(ap, long); + va_end(ap); + + return INLINE_SYSCALL(prctl, 5, __option, arg2, arg3, arg4, arg5); +} +#endif |