[PATCH] avr32: add varargs handling of prctl syscall

Carmelo AMOROSO carmelo.amoroso at st.com
Wed Jan 20 16:58:42 UTC 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hans-Christian Egtvedt wrote:
> 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 at atmel.com>
> ---
> This is v2 of the previous attempt to add proper prctl handling for AVR32
> architecture. If everybody are fine with this approach I'll commit it to
> master, nptl and 0_9_30 branches.
> 
> 
>  libc/sysdeps/linux/avr32/Makefile.arch |    2 +-
>  libc/sysdeps/linux/avr32/prctl.c       |   36 ++++++++++++++++++++++++++++++++
>  2 files changed, 37 insertions(+), 1 deletions(-)
>  create mode 100644 libc/sysdeps/linux/avr32/prctl.c
> 
> diff --git a/libc/sysdeps/linux/avr32/Makefile.arch b/libc/sysdeps/linux/avr32/Makefile.arch
> index bc5f625..98b85a7 100644
> --- a/libc/sysdeps/linux/avr32/Makefile.arch
> +++ b/libc/sysdeps/linux/avr32/Makefile.arch
> @@ -5,7 +5,7 @@
>  # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
>  #
>  
> -CSRC	:= brk.c clone.c mmap.c sigaction.c
> +CSRC	:= brk.c clone.c mmap.c prctl.c sigaction.c
>  
>  SSRC	:= __longjmp.S setjmp.S bsd-setjmp.S bsd-_setjmp.S	\
>  		sigrestorer.S syscall.S vfork.S
> diff --git a/libc/sysdeps/linux/avr32/prctl.c b/libc/sysdeps/linux/avr32/prctl.c
> new file mode 100644
> index 0000000..4e146e3
> --- /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

Definitely the best way to cope with this ;)

Patch sounds good to me, please go ahead and commit.

Carmelo
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iEYEARECAAYFAktXNkEACgkQoRq/3BrK1s/MQQCff/doQLXZbef2uxbz/1w67iQw
/8AAnRmfNsA/lz0zLITrMhpvFyClbqUa
=wno9
-----END PGP SIGNATURE-----


More information about the uClibc mailing list