On Mon, Dec 08, 2008 at 04:55:39PM +0100, Hans-Christian Egtvedt wrote: >Hi all, > >I'd like some feedback on the attached patch. The one I've attached now >will individually handle the prctl calls which uses arg2 and those who >do not. Checked up against Linux v2.6.27. > >The solution is bad since it is locked against those prctl calls >available for a given kernel version. But there is (AFAIK) no way >of detecting the number of arguments given to prctl. > >The way uClibc does it today is wrong, and does not work on AVR32 >architecture. > >For the record, prctl uses only arg2 at most, and there are some calls >which does not use arguments (see list in patch). > >-- >Best regards, >Hans-Christian Egtvedt >--- a/libc/sysdeps/linux/common/prctl.c >+++ b/libc/sysdeps/linux/common/prctl.c >@@ -8,10 +8,29 @@ > */ > > #include <sys/syscall.h> >+#include <sys/prctl.h> > #include <stdarg.h> >-/* psm: including sys/prctl.h would depend on kernel headers */ > > #ifdef __NR_prctl >-extern int prctl (int, long, long, long, long); >-_syscall5(int, prctl, int, option, long, arg2, long, arg3, long, arg4, long, >arg5) >+#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 = 0; >+ va_list ap;
NAK. For a start we don't support varargs yet. _______________________________________________ uClibc mailing list uClibc@uclibc.org http://busybox.net/cgi-bin/mailman/listinfo/uclibc