| 1 | From 2b69e9906e5087a796b3a15e9aabcd102c705b19 Mon Sep 17 00:00:00 2001 |
| 2 | From: Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com> |
| 3 | Date: Wed, 16 Dec 2009 12:16:08 +0000 |
| 4 | Subject: avr32: add varargs handling of prctl syscall |
| 5 | |
| 6 | prctl is defined to use varargs in the header file, hence it needs varargs |
| 7 | specific handling in the source. This patch properly handles the variodic |
| 8 | argument before the syscall is passed to the kernel for the AVR32 architecture. |
| 9 | |
| 10 | Signed-off-by: Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com> |
| 11 | --- |
| 12 | diff --git a/libc/sysdeps/linux/avr32/Makefile.arch b/libc/sysdeps/linux/avr32/Makefile.arch |
| 13 | index bc5f625..98b85a7 100644 |
| 14 | --- a/libc/sysdeps/linux/avr32/Makefile.arch |
| 15 | +++ b/libc/sysdeps/linux/avr32/Makefile.arch |
| 16 | @@ -5,7 +5,7 @@ |
| 17 | # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. |
| 18 | # |
| 19 | |
| 20 | -CSRC := brk.c clone.c mmap.c sigaction.c |
| 21 | +CSRC := brk.c clone.c mmap.c prctl.c sigaction.c |
| 22 | |
| 23 | SSRC := __longjmp.S setjmp.S bsd-setjmp.S bsd-_setjmp.S \ |
| 24 | sigrestorer.S syscall.S vfork.S |
| 25 | diff --git a/libc/sysdeps/linux/avr32/prctl.c b/libc/sysdeps/linux/avr32/prctl.c |
| 26 | new file mode 100644 |
| 27 | index 0000000..4e146e3 |
| 28 | --- a/dev/null |
| 29 | +++ b/libc/sysdeps/linux/avr32/prctl.c |
| 30 | @@ -0,0 +1,36 @@ |
| 31 | +/* |
| 32 | + * prctl syscall for AVR32 Linux. |
| 33 | + * |
| 34 | + * Copyright (C) 2010 Atmel Corporation |
| 35 | + * |
| 36 | + * This file is subject to the terms and conditions of the GNU Lesser General |
| 37 | + * Public License. See the file "COPYING.LIB" in the main directory of this |
| 38 | + * archive for more details. |
| 39 | + */ |
| 40 | +#include <sys/syscall.h> |
| 41 | +#include <sys/prctl.h> |
| 42 | +#include <stdarg.h> |
| 43 | + |
| 44 | +#ifdef __NR_prctl |
| 45 | +#define __NR___syscall_prctl __NR_prctl |
| 46 | +static inline _syscall5(int, __syscall_prctl, int, option, long, arg2, |
| 47 | + long, arg3, long, arg4, long, arg5); |
| 48 | + |
| 49 | +int prctl(int __option, ...) |
| 50 | +{ |
| 51 | + long arg2; |
| 52 | + long arg3; |
| 53 | + long arg4; |
| 54 | + long arg5; |
| 55 | + va_list ap; |
| 56 | + |
| 57 | + va_start(ap, __option); |
| 58 | + arg2 = va_arg(ap, long); |
| 59 | + arg3 = va_arg(ap, long); |
| 60 | + arg4 = va_arg(ap, long); |
| 61 | + arg5 = va_arg(ap, long); |
| 62 | + va_end(ap); |
| 63 | + |
| 64 | + return INLINE_SYSCALL(prctl, 5, __option, arg2, arg3, arg4, arg5); |
| 65 | +} |
| 66 | +#endif |
| 67 | -- |
| 68 | cgit v0.8.2.1 |
| 69 | |