On Wed, 16 Dec 2009 13:23:56 +0100 Hans-Christian Egtvedt <[email protected]> wrote:
Bump > prctl is defined to use varargs in the header file, hence might need varargs > specific handling in the source. This patch properly handles the variodic > argument before the syscall is passed to the kernel if the > __UCLIBC_VARARGS_REQUIRED__ symbol is defined. > > Since not all architectures need to handle varargs explicit, an uClibc > architecture feature was added to enable this feature. The config symbol is > named __UCLIBC_VARARGS_REQUIRED__ and is added as undefined to all > architectures except AVR32. > > Signed-off-by: Hans-Christian Egtvedt <[email protected]> > --- > .../linux/alpha/bits/uClibc_arch_features.h | 6 +++++ > libc/sysdeps/linux/arm/bits/uClibc_arch_features.h | 6 +++++ > .../linux/avr32/bits/uClibc_arch_features.h | 6 +++++ > .../sysdeps/linux/bfin/bits/uClibc_arch_features.h | 6 +++++ > .../linux/common/bits/uClibc_arch_features.h | 6 +++++ > libc/sysdeps/linux/common/prctl.c | 24 > ++++++++++++++++++++ > .../sysdeps/linux/cris/bits/uClibc_arch_features.h | 6 +++++ > libc/sysdeps/linux/e1/bits/uClibc_arch_features.h | 6 +++++ > libc/sysdeps/linux/frv/bits/uClibc_arch_features.h | 6 +++++ > .../linux/h8300/bits/uClibc_arch_features.h | 6 +++++ > .../sysdeps/linux/hppa/bits/uClibc_arch_features.h | 6 +++++ > .../sysdeps/linux/i386/bits/uClibc_arch_features.h | 6 +++++ > .../sysdeps/linux/i960/bits/uClibc_arch_features.h | 6 +++++ > .../sysdeps/linux/ia64/bits/uClibc_arch_features.h | 6 +++++ > .../sysdeps/linux/m68k/bits/uClibc_arch_features.h | 6 +++++ > .../linux/microblaze/bits/uClibc_arch_features.h | 6 +++++ > .../sysdeps/linux/mips/bits/uClibc_arch_features.h | 6 +++++ > .../sysdeps/linux/nios/bits/uClibc_arch_features.h | 6 +++++ > .../linux/nios2/bits/uClibc_arch_features.h | 6 +++++ > .../linux/powerpc/bits/uClibc_arch_features.h | 6 +++++ > libc/sysdeps/linux/sh/bits/uClibc_arch_features.h | 6 +++++ > .../sysdeps/linux/sh64/bits/uClibc_arch_features.h | 6 +++++ > .../linux/sparc/bits/uClibc_arch_features.h | 6 +++++ > .../sysdeps/linux/v850/bits/uClibc_arch_features.h | 6 +++++ > libc/sysdeps/linux/vax/bits/uClibc_arch_features.h | 6 +++++ > .../linux/x86_64/bits/uClibc_arch_features.h | 6 +++++ > .../linux/xtensa/bits/uClibc_arch_features.h | 6 +++++ > 27 files changed, 180 insertions(+), 0 deletions(-) > > diff --git a/libc/sysdeps/linux/alpha/bits/uClibc_arch_features.h > b/libc/sysdeps/linux/alpha/bits/uClibc_arch_features.h > index e106d12..cc44cb0 100644 > --- a/libc/sysdeps/linux/alpha/bits/uClibc_arch_features.h > +++ b/libc/sysdeps/linux/alpha/bits/uClibc_arch_features.h > @@ -44,4 +44,10 @@ > /* only weird assemblers generally need this */ > #undef __UCLIBC_ASM_LINE_SEP__ > > +/* > + * define if target requires to handle varargs explicit as stated in the GNU > + * documentation. > + */ > +#undef __UCLIBC_VARARGS_REQUIRED__ > + > #endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ > diff --git a/libc/sysdeps/linux/arm/bits/uClibc_arch_features.h > b/libc/sysdeps/linux/arm/bits/uClibc_arch_features.h > index 14621d9..e4d2370 100644 > --- a/libc/sysdeps/linux/arm/bits/uClibc_arch_features.h > +++ b/libc/sysdeps/linux/arm/bits/uClibc_arch_features.h > @@ -48,4 +48,10 @@ > /* only weird assemblers generally need this */ > #undef __UCLIBC_ASM_LINE_SEP__ > > +/* > + * define if target requires to handle varargs explicit as stated in the GNU > + * documentation. > + */ > +#undef __UCLIBC_VARARGS_REQUIRED__ > + > #endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ > diff --git a/libc/sysdeps/linux/avr32/bits/uClibc_arch_features.h > b/libc/sysdeps/linux/avr32/bits/uClibc_arch_features.h > index c306577..61ea6ca 100644 > --- a/libc/sysdeps/linux/avr32/bits/uClibc_arch_features.h > +++ b/libc/sysdeps/linux/avr32/bits/uClibc_arch_features.h > @@ -45,4 +45,10 @@ > /* only weird assemblers generally need this */ > #undef __UCLIBC_ASM_LINE_SEP__ > > +/* > + * define if target requires to handle varargs explicit as stated in the GNU > + * documentation. > + */ > +#define __UCLIBC_VARARGS_REQUIRED__ > + > #endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ > diff --git a/libc/sysdeps/linux/bfin/bits/uClibc_arch_features.h > b/libc/sysdeps/linux/bfin/bits/uClibc_arch_features.h > index 4bab547..30da91f 100644 > --- a/libc/sysdeps/linux/bfin/bits/uClibc_arch_features.h > +++ b/libc/sysdeps/linux/bfin/bits/uClibc_arch_features.h > @@ -45,4 +45,10 @@ > /* only weird assemblers generally need this */ > #undef __UCLIBC_ASM_LINE_SEP__ > > +/* > + * define if target requires to handle varargs explicit as stated in the GNU > + * documentation. > + */ > +#undef __UCLIBC_VARARGS_REQUIRED__ > + > #endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ > diff --git a/libc/sysdeps/linux/common/bits/uClibc_arch_features.h > b/libc/sysdeps/linux/common/bits/uClibc_arch_features.h > index 6cb6177..2019e7b 100644 > --- a/libc/sysdeps/linux/common/bits/uClibc_arch_features.h > +++ b/libc/sysdeps/linux/common/bits/uClibc_arch_features.h > @@ -47,4 +47,10 @@ > /* only weird assemblers generally need this */ > #undef __UCLIBC_ASM_LINE_SEP__ > > +/* > + * define if target requires to handle varargs explicit as stated in the GNU > + * documentation. > + */ > +#undef __UCLIBC_VARARGS_REQUIRED__ > + > #endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ > diff --git a/libc/sysdeps/linux/common/prctl.c > b/libc/sysdeps/linux/common/prctl.c > index a6764c5..4624fad 100644 > --- a/libc/sysdeps/linux/common/prctl.c > +++ b/libc/sysdeps/linux/common/prctl.c > @@ -12,6 +12,30 @@ > /* psm: including sys/prctl.h would depend on kernel headers */ > > #ifdef __NR_prctl > +#ifndef __UCLIBC_VARARGS_REQUIRED__ > extern int prctl (int, long, long, long, long); > _syscall5(int, prctl, int, option, long, arg2, long, arg3, long, arg4, long, > arg5) > +#else > +#include <sys/prctl.h> > + > +#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 > #endif > diff --git a/libc/sysdeps/linux/cris/bits/uClibc_arch_features.h > b/libc/sysdeps/linux/cris/bits/uClibc_arch_features.h > index fc14946..7c42e55 100644 > --- a/libc/sysdeps/linux/cris/bits/uClibc_arch_features.h > +++ b/libc/sysdeps/linux/cris/bits/uClibc_arch_features.h > @@ -45,4 +45,10 @@ > /* only weird assemblers generally need this */ > #define __UCLIBC_ASM_LINE_SEP__ @ > > +/* > + * define if target requires to handle varargs explicit as stated in the GNU > + * documentation. > + */ > +#undef __UCLIBC_VARARGS_REQUIRED__ > + > #endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ > diff --git a/libc/sysdeps/linux/e1/bits/uClibc_arch_features.h > b/libc/sysdeps/linux/e1/bits/uClibc_arch_features.h > index 2a9422e..969f7cb 100644 > --- a/libc/sysdeps/linux/e1/bits/uClibc_arch_features.h > +++ b/libc/sysdeps/linux/e1/bits/uClibc_arch_features.h > @@ -45,4 +45,10 @@ > /* only weird assemblers generally need this */ > #undef __UCLIBC_ASM_LINE_SEP__ > > +/* > + * define if target requires to handle varargs explicit as stated in the GNU > + * documentation. > + */ > +#undef __UCLIBC_VARARGS_REQUIRED__ > + > #endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ > diff --git a/libc/sysdeps/linux/frv/bits/uClibc_arch_features.h > b/libc/sysdeps/linux/frv/bits/uClibc_arch_features.h > index 2a9422e..969f7cb 100644 > --- a/libc/sysdeps/linux/frv/bits/uClibc_arch_features.h > +++ b/libc/sysdeps/linux/frv/bits/uClibc_arch_features.h > @@ -45,4 +45,10 @@ > /* only weird assemblers generally need this */ > #undef __UCLIBC_ASM_LINE_SEP__ > > +/* > + * define if target requires to handle varargs explicit as stated in the GNU > + * documentation. > + */ > +#undef __UCLIBC_VARARGS_REQUIRED__ > + > #endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ > diff --git a/libc/sysdeps/linux/h8300/bits/uClibc_arch_features.h > b/libc/sysdeps/linux/h8300/bits/uClibc_arch_features.h > index 4bab547..30da91f 100644 > --- a/libc/sysdeps/linux/h8300/bits/uClibc_arch_features.h > +++ b/libc/sysdeps/linux/h8300/bits/uClibc_arch_features.h > @@ -45,4 +45,10 @@ > /* only weird assemblers generally need this */ > #undef __UCLIBC_ASM_LINE_SEP__ > > +/* > + * define if target requires to handle varargs explicit as stated in the GNU > + * documentation. > + */ > +#undef __UCLIBC_VARARGS_REQUIRED__ > + > #endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ > diff --git a/libc/sysdeps/linux/hppa/bits/uClibc_arch_features.h > b/libc/sysdeps/linux/hppa/bits/uClibc_arch_features.h > index 722447d..cbb5fb0 100644 > --- a/libc/sysdeps/linux/hppa/bits/uClibc_arch_features.h > +++ b/libc/sysdeps/linux/hppa/bits/uClibc_arch_features.h > @@ -44,4 +44,10 @@ > /* the default ; is a comment on hppa */ > #define __UCLIBC_ASM_LINE_SEP__ ! > > +/* > + * define if target requires to handle varargs explicit as stated in the GNU > + * documentation. > + */ > +#undef __UCLIBC_VARARGS_REQUIRED__ > + > #endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ > diff --git a/libc/sysdeps/linux/i386/bits/uClibc_arch_features.h > b/libc/sysdeps/linux/i386/bits/uClibc_arch_features.h > index deeec03..c9e2242 100644 > --- a/libc/sysdeps/linux/i386/bits/uClibc_arch_features.h > +++ b/libc/sysdeps/linux/i386/bits/uClibc_arch_features.h > @@ -45,6 +45,12 @@ > /* only weird assemblers generally need this */ > #undef __UCLIBC_ASM_LINE_SEP__ > > +/* > + * define if target requires to handle varargs explicit as stated in the GNU > + * documentation. > + */ > +#undef __UCLIBC_VARARGS_REQUIRED__ > + > #if defined _LIBC > #define internal_function __attribute__ ((regparm (3), stdcall)) > #endif > diff --git a/libc/sysdeps/linux/i960/bits/uClibc_arch_features.h > b/libc/sysdeps/linux/i960/bits/uClibc_arch_features.h > index 0ddef34..19fadb9 100644 > --- a/libc/sysdeps/linux/i960/bits/uClibc_arch_features.h > +++ b/libc/sysdeps/linux/i960/bits/uClibc_arch_features.h > @@ -45,4 +45,10 @@ > /* only weird assemblers generally need this */ > #undef __UCLIBC_ASM_LINE_SEP__ > > +/* > + * define if target requires to handle varargs explicit as stated in the GNU > + * documentation. > + */ > +#undef __UCLIBC_VARARGS_REQUIRED__ > + > #endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ > diff --git a/libc/sysdeps/linux/ia64/bits/uClibc_arch_features.h > b/libc/sysdeps/linux/ia64/bits/uClibc_arch_features.h > index a3644ce..0bbf670 100644 > --- a/libc/sysdeps/linux/ia64/bits/uClibc_arch_features.h > +++ b/libc/sysdeps/linux/ia64/bits/uClibc_arch_features.h > @@ -44,4 +44,10 @@ > /* only weird assemblers generally need this */ > #undef __UCLIBC_ASM_LINE_SEP__ > > +/* > + * define if target requires to handle varargs explicit as stated in the GNU > + * documentation. > + */ > +#undef __UCLIBC_VARARGS_REQUIRED__ > + > #endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ > diff --git a/libc/sysdeps/linux/m68k/bits/uClibc_arch_features.h > b/libc/sysdeps/linux/m68k/bits/uClibc_arch_features.h > index 518fb39..69fa2c2 100644 > --- a/libc/sysdeps/linux/m68k/bits/uClibc_arch_features.h > +++ b/libc/sysdeps/linux/m68k/bits/uClibc_arch_features.h > @@ -48,4 +48,10 @@ > /* only weird assemblers generally need this */ > #undef __UCLIBC_ASM_LINE_SEP__ > > +/* > + * define if target requires to handle varargs explicit as stated in the GNU > + * documentation. > + */ > +#undef __UCLIBC_VARARGS_REQUIRED__ > + > #endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ > diff --git a/libc/sysdeps/linux/microblaze/bits/uClibc_arch_features.h > b/libc/sysdeps/linux/microblaze/bits/uClibc_arch_features.h > index 2a9422e..969f7cb 100644 > --- a/libc/sysdeps/linux/microblaze/bits/uClibc_arch_features.h > +++ b/libc/sysdeps/linux/microblaze/bits/uClibc_arch_features.h > @@ -45,4 +45,10 @@ > /* only weird assemblers generally need this */ > #undef __UCLIBC_ASM_LINE_SEP__ > > +/* > + * define if target requires to handle varargs explicit as stated in the GNU > + * documentation. > + */ > +#undef __UCLIBC_VARARGS_REQUIRED__ > + > #endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ > diff --git a/libc/sysdeps/linux/mips/bits/uClibc_arch_features.h > b/libc/sysdeps/linux/mips/bits/uClibc_arch_features.h > index 82f67bf..88ac2c6 100644 > --- a/libc/sysdeps/linux/mips/bits/uClibc_arch_features.h > +++ b/libc/sysdeps/linux/mips/bits/uClibc_arch_features.h > @@ -44,4 +44,10 @@ > /* only weird assemblers generally need this */ > #undef __UCLIBC_ASM_LINE_SEP__ > > +/* > + * define if target requires to handle varargs explicit as stated in the GNU > + * documentation. > + */ > +#undef __UCLIBC_VARARGS_REQUIRED__ > + > #endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ > diff --git a/libc/sysdeps/linux/nios/bits/uClibc_arch_features.h > b/libc/sysdeps/linux/nios/bits/uClibc_arch_features.h > index 2a9422e..969f7cb 100644 > --- a/libc/sysdeps/linux/nios/bits/uClibc_arch_features.h > +++ b/libc/sysdeps/linux/nios/bits/uClibc_arch_features.h > @@ -45,4 +45,10 @@ > /* only weird assemblers generally need this */ > #undef __UCLIBC_ASM_LINE_SEP__ > > +/* > + * define if target requires to handle varargs explicit as stated in the GNU > + * documentation. > + */ > +#undef __UCLIBC_VARARGS_REQUIRED__ > + > #endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ > diff --git a/libc/sysdeps/linux/nios2/bits/uClibc_arch_features.h > b/libc/sysdeps/linux/nios2/bits/uClibc_arch_features.h > index 2a9422e..969f7cb 100644 > --- a/libc/sysdeps/linux/nios2/bits/uClibc_arch_features.h > +++ b/libc/sysdeps/linux/nios2/bits/uClibc_arch_features.h > @@ -45,4 +45,10 @@ > /* only weird assemblers generally need this */ > #undef __UCLIBC_ASM_LINE_SEP__ > > +/* > + * define if target requires to handle varargs explicit as stated in the GNU > + * documentation. > + */ > +#undef __UCLIBC_VARARGS_REQUIRED__ > + > #endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ > diff --git a/libc/sysdeps/linux/powerpc/bits/uClibc_arch_features.h > b/libc/sysdeps/linux/powerpc/bits/uClibc_arch_features.h > index 6f1f396..f01a997 100644 > --- a/libc/sysdeps/linux/powerpc/bits/uClibc_arch_features.h > +++ b/libc/sysdeps/linux/powerpc/bits/uClibc_arch_features.h > @@ -44,4 +44,10 @@ > /* only weird assemblers generally need this */ > #undef __UCLIBC_ASM_LINE_SEP__ > > +/* > + * define if target requires to handle varargs explicit as stated in the GNU > + * documentation. > + */ > +#undef __UCLIBC_VARARGS_REQUIRED__ > + > #endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ > diff --git a/libc/sysdeps/linux/sh/bits/uClibc_arch_features.h > b/libc/sysdeps/linux/sh/bits/uClibc_arch_features.h > index 5e3528d..600874a 100644 > --- a/libc/sysdeps/linux/sh/bits/uClibc_arch_features.h > +++ b/libc/sysdeps/linux/sh/bits/uClibc_arch_features.h > @@ -48,4 +48,10 @@ > /* only weird assemblers generally need this */ > #undef __UCLIBC_ASM_LINE_SEP__ > > +/* > + * define if target requires to handle varargs explicit as stated in the GNU > + * documentation. > + */ > +#undef __UCLIBC_VARARGS_REQUIRED__ > + > #endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ > diff --git a/libc/sysdeps/linux/sh64/bits/uClibc_arch_features.h > b/libc/sysdeps/linux/sh64/bits/uClibc_arch_features.h > index 46bf23e..5cb5baf 100644 > --- a/libc/sysdeps/linux/sh64/bits/uClibc_arch_features.h > +++ b/libc/sysdeps/linux/sh64/bits/uClibc_arch_features.h > @@ -44,4 +44,10 @@ > /* only weird assemblers generally need this */ > #undef __UCLIBC_ASM_LINE_SEP__ > > +/* > + * define if target requires to handle varargs explicit as stated in the GNU > + * documentation. > + */ > +#undef __UCLIBC_VARARGS_REQUIRED__ > + > #endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ > diff --git a/libc/sysdeps/linux/sparc/bits/uClibc_arch_features.h > b/libc/sysdeps/linux/sparc/bits/uClibc_arch_features.h > index 1dbfa2b..6e3afac 100644 > --- a/libc/sysdeps/linux/sparc/bits/uClibc_arch_features.h > +++ b/libc/sysdeps/linux/sparc/bits/uClibc_arch_features.h > @@ -44,4 +44,10 @@ > /* only weird assemblers generally need this */ > #undef __UCLIBC_ASM_LINE_SEP__ > > +/* > + * define if target requires to handle varargs explicit as stated in the GNU > + * documentation. > + */ > +#undef __UCLIBC_VARARGS_REQUIRED__ > + > #endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ > diff --git a/libc/sysdeps/linux/v850/bits/uClibc_arch_features.h > b/libc/sysdeps/linux/v850/bits/uClibc_arch_features.h > index 2a9422e..969f7cb 100644 > --- a/libc/sysdeps/linux/v850/bits/uClibc_arch_features.h > +++ b/libc/sysdeps/linux/v850/bits/uClibc_arch_features.h > @@ -45,4 +45,10 @@ > /* only weird assemblers generally need this */ > #undef __UCLIBC_ASM_LINE_SEP__ > > +/* > + * define if target requires to handle varargs explicit as stated in the GNU > + * documentation. > + */ > +#undef __UCLIBC_VARARGS_REQUIRED__ > + > #endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ > diff --git a/libc/sysdeps/linux/vax/bits/uClibc_arch_features.h > b/libc/sysdeps/linux/vax/bits/uClibc_arch_features.h > index f9a7b39..383d60c 100644 > --- a/libc/sysdeps/linux/vax/bits/uClibc_arch_features.h > +++ b/libc/sysdeps/linux/vax/bits/uClibc_arch_features.h > @@ -44,4 +44,10 @@ > /* only weird assemblers generally need this */ > #undef __UCLIBC_ASM_LINE_SEP__ > > +/* > + * define if target requires to handle varargs explicit as stated in the GNU > + * documentation. > + */ > +#undef __UCLIBC_VARARGS_REQUIRED__ > + > #endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ > diff --git a/libc/sysdeps/linux/x86_64/bits/uClibc_arch_features.h > b/libc/sysdeps/linux/x86_64/bits/uClibc_arch_features.h > index 748e544..9f6532d 100644 > --- a/libc/sysdeps/linux/x86_64/bits/uClibc_arch_features.h > +++ b/libc/sysdeps/linux/x86_64/bits/uClibc_arch_features.h > @@ -44,4 +44,10 @@ > /* only weird assemblers generally need this */ > #undef __UCLIBC_ASM_LINE_SEP__ > > +/* > + * define if target requires to handle varargs explicit as stated in the GNU > + * documentation. > + */ > +#undef __UCLIBC_VARARGS_REQUIRED__ > + > #endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ > diff --git a/libc/sysdeps/linux/xtensa/bits/uClibc_arch_features.h > b/libc/sysdeps/linux/xtensa/bits/uClibc_arch_features.h > index fef1765..1598fc0 100644 > --- a/libc/sysdeps/linux/xtensa/bits/uClibc_arch_features.h > +++ b/libc/sysdeps/linux/xtensa/bits/uClibc_arch_features.h > @@ -44,4 +44,10 @@ > /* only weird assemblers generally need this */ > #undef __UCLIBC_ASM_LINE_SEP__ > > +/* > + * define if target requires to handle varargs explicit as stated in the GNU > + * documentation. > + */ > +#undef __UCLIBC_VARARGS_REQUIRED__ > + > #endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ -- Best regards, Hans-Christian Egtvedt _______________________________________________ uClibc mailing list [email protected] http://lists.busybox.net/mailman/listinfo/uclibc
