patches/uClibc/0.9.30.2/190-avr32-add-varargs-handling-of-prctl-syscall.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Jul 17 17:54:21 2011 +0200 (2011-07-17)
changeset 2888 dd71df95903a
permissions -rw-r--r--
cc/gcc: pass the companion libs prefix to cc_core

In case of canadian-cross, the companion libraries are not the same for
the core cc (they run on 'build') as they are for the final cc (they run
on 'host').

Prepare for this differentiation (coming later), while retaining the
current behavior (to use the same compblibs).

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
     1 From 85bc04d5436ca6c8a30a1ad28862260a04b8b3d5 Mon Sep 17 00:00:00 2001
     2 From: Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com>
     3 Date: Wed, 16 Dec 2009 13:16:08 +0100
     4 Subject: [PATCH 02/15] 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  libc/sysdeps/linux/avr32/Makefile.arch |    2 +-
    13  libc/sysdeps/linux/avr32/prctl.c       |   36 ++++++++++++++++++++++++++++++++
    14  2 files changed, 37 insertions(+), 1 deletions(-)
    15  create mode 100644 libc/sysdeps/linux/avr32/prctl.c
    16 
    17 diff --git a/libc/sysdeps/linux/avr32/Makefile.arch b/libc/sysdeps/linux/avr32/Makefile.arch
    18 index bc5f625..98b85a7 100644
    19 --- a/libc/sysdeps/linux/avr32/Makefile.arch
    20 +++ b/libc/sysdeps/linux/avr32/Makefile.arch
    21 @@ -5,7 +5,7 @@
    22  # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
    23  #
    24  
    25 -CSRC	:= brk.c clone.c mmap.c sigaction.c
    26 +CSRC	:= brk.c clone.c mmap.c prctl.c sigaction.c
    27  
    28  SSRC	:= __longjmp.S setjmp.S bsd-setjmp.S bsd-_setjmp.S	\
    29  		sigrestorer.S syscall.S vfork.S
    30 diff --git a/libc/sysdeps/linux/avr32/prctl.c b/libc/sysdeps/linux/avr32/prctl.c
    31 new file mode 100644
    32 index 0000000..4e146e3
    33 --- /dev/null
    34 +++ b/libc/sysdeps/linux/avr32/prctl.c
    35 @@ -0,0 +1,36 @@
    36 +/*
    37 + * prctl syscall for AVR32 Linux.
    38 + *
    39 + * Copyright (C) 2010 Atmel Corporation
    40 + *
    41 + * This file is subject to the terms and conditions of the GNU Lesser General
    42 + * Public License. See the file "COPYING.LIB" in the main directory of this
    43 + * archive for more details.
    44 + */
    45 +#include <sys/syscall.h>
    46 +#include <sys/prctl.h>
    47 +#include <stdarg.h>
    48 +
    49 +#ifdef __NR_prctl
    50 +#define __NR___syscall_prctl	__NR_prctl
    51 +static inline _syscall5(int, __syscall_prctl, int, option, long, arg2,
    52 +		long, arg3, long, arg4, long, arg5);
    53 +
    54 +int prctl(int __option, ...)
    55 +{
    56 +	long arg2;
    57 +	long arg3;
    58 +	long arg4;
    59 +	long arg5;
    60 +	va_list ap;
    61 +
    62 +	va_start(ap, __option);
    63 +	arg2 = va_arg(ap, long);
    64 +	arg3 = va_arg(ap, long);
    65 +	arg4 = va_arg(ap, long);
    66 +	arg5 = va_arg(ap, long);
    67 +	va_end(ap);
    68 +
    69 +	return INLINE_SYSCALL(prctl, 5, __option, arg2, arg3, arg4, arg5);
    70 +}
    71 +#endif
    72 -- 
    73 1.6.6.1
    74