patches/uClibc/0.9.30.2/190-avr32-add-varargs-handling-of-prctl-syscall.patch
changeset 2040 c0162f201864
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/uClibc/0.9.30.2/190-avr32-add-varargs-handling-of-prctl-syscall.patch	Wed Jul 28 21:32:42 2010 +0200
     1.3 @@ -0,0 +1,74 @@
     1.4 +From 85bc04d5436ca6c8a30a1ad28862260a04b8b3d5 Mon Sep 17 00:00:00 2001
     1.5 +From: Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com>
     1.6 +Date: Wed, 16 Dec 2009 13:16:08 +0100
     1.7 +Subject: [PATCH 02/15] avr32: add varargs handling of prctl syscall
     1.8 +
     1.9 +prctl is defined to use varargs in the header file, hence it needs varargs
    1.10 +specific handling in the source. This patch properly handles the variodic
    1.11 +argument before the syscall is passed to the kernel for the AVR32 architecture.
    1.12 +
    1.13 +Signed-off-by: Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com>
    1.14 +---
    1.15 + libc/sysdeps/linux/avr32/Makefile.arch |    2 +-
    1.16 + libc/sysdeps/linux/avr32/prctl.c       |   36 ++++++++++++++++++++++++++++++++
    1.17 + 2 files changed, 37 insertions(+), 1 deletions(-)
    1.18 + create mode 100644 libc/sysdeps/linux/avr32/prctl.c
    1.19 +
    1.20 +diff --git a/libc/sysdeps/linux/avr32/Makefile.arch b/libc/sysdeps/linux/avr32/Makefile.arch
    1.21 +index bc5f625..98b85a7 100644
    1.22 +--- a/libc/sysdeps/linux/avr32/Makefile.arch
    1.23 ++++ b/libc/sysdeps/linux/avr32/Makefile.arch
    1.24 +@@ -5,7 +5,7 @@
    1.25 + # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
    1.26 + #
    1.27 + 
    1.28 +-CSRC	:= brk.c clone.c mmap.c sigaction.c
    1.29 ++CSRC	:= brk.c clone.c mmap.c prctl.c sigaction.c
    1.30 + 
    1.31 + SSRC	:= __longjmp.S setjmp.S bsd-setjmp.S bsd-_setjmp.S	\
    1.32 + 		sigrestorer.S syscall.S vfork.S
    1.33 +diff --git a/libc/sysdeps/linux/avr32/prctl.c b/libc/sysdeps/linux/avr32/prctl.c
    1.34 +new file mode 100644
    1.35 +index 0000000..4e146e3
    1.36 +--- /dev/null
    1.37 ++++ b/libc/sysdeps/linux/avr32/prctl.c
    1.38 +@@ -0,0 +1,36 @@
    1.39 ++/*
    1.40 ++ * prctl syscall for AVR32 Linux.
    1.41 ++ *
    1.42 ++ * Copyright (C) 2010 Atmel Corporation
    1.43 ++ *
    1.44 ++ * This file is subject to the terms and conditions of the GNU Lesser General
    1.45 ++ * Public License. See the file "COPYING.LIB" in the main directory of this
    1.46 ++ * archive for more details.
    1.47 ++ */
    1.48 ++#include <sys/syscall.h>
    1.49 ++#include <sys/prctl.h>
    1.50 ++#include <stdarg.h>
    1.51 ++
    1.52 ++#ifdef __NR_prctl
    1.53 ++#define __NR___syscall_prctl	__NR_prctl
    1.54 ++static inline _syscall5(int, __syscall_prctl, int, option, long, arg2,
    1.55 ++		long, arg3, long, arg4, long, arg5);
    1.56 ++
    1.57 ++int prctl(int __option, ...)
    1.58 ++{
    1.59 ++	long arg2;
    1.60 ++	long arg3;
    1.61 ++	long arg4;
    1.62 ++	long arg5;
    1.63 ++	va_list ap;
    1.64 ++
    1.65 ++	va_start(ap, __option);
    1.66 ++	arg2 = va_arg(ap, long);
    1.67 ++	arg3 = va_arg(ap, long);
    1.68 ++	arg4 = va_arg(ap, long);
    1.69 ++	arg5 = va_arg(ap, long);
    1.70 ++	va_end(ap);
    1.71 ++
    1.72 ++	return INLINE_SYSCALL(prctl, 5, __option, arg2, arg3, arg4, arg5);
    1.73 ++}
    1.74 ++#endif
    1.75 +-- 
    1.76 +1.6.6.1
    1.77 +