diff options
author | Peter S. Mazinger <ps.m@gmx.net> | 2011-04-12 22:36:24 +0200 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2012-06-15 14:00:36 +0200 |
commit | 11430a8e3c521e2bd8a2d0821a60c3b0d554e6ff (patch) | |
tree | dc0b724fa9efc3a3fb059b8bd30062d58cba86a7 /libc/sysdeps | |
parent | c311492873eaff4ca86db511ae971abc8d688221 (diff) |
_exit.c: add ABORT_INSTRUCTION
Warn if the arch has no __UCLIBC_ABORT_INSTRUCTION__.
Run only one syscall, exit_group is not an exclusivity, use it if THREADS are enabled.
Guard according header.
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Diffstat (limited to 'libc/sysdeps')
-rw-r--r-- | libc/sysdeps/linux/common/_exit.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/libc/sysdeps/linux/common/_exit.c b/libc/sysdeps/linux/common/_exit.c index 2196a98fe..c9e73c546 100644 --- a/libc/sysdeps/linux/common/_exit.c +++ b/libc/sysdeps/linux/common/_exit.c @@ -10,17 +10,33 @@ #include <unistd.h> #include <stdlib.h> #include <sys/syscall.h> +#include <bits/kernel-features.h> + +#ifdef __UCLIBC_ABORT_INSTRUCTION__ +# define ABORT_INSTRUCTION __asm__(__UCLIBC_ABORT_INSTRUCTION__) +#else +# warning "no abort instruction defined for this arch" +#endif + +/* have to check for kernel 2.5.35 too, since NR was earlier present */ +#if defined __NR_exit_group && __LINUX_KERNEL_VERSION >= 0x020600 \ + && defined __UCLIBC_HAS_THREADS__ +# undef __NR_exit +# define __NR_exit __NR_exit_group +#endif void _exit(int status) { /* The loop is added only to keep gcc happy. */ while(1) { -#if defined __NR_exit_group && defined __UCLIBC_HAS_THREADS_NATIVE__ - INLINE_SYSCALL(exit_group, 1, status); -#endif INLINE_SYSCALL(exit, 1, status); +#ifdef ABORT_INSTRUCTION + ABORT_INSTRUCTION; +#endif } } libc_hidden_def(_exit) +#ifdef __USE_ISOC99 weak_alias(_exit,_Exit) +#endif |