1 /* 2 * exit syscall for uClibc 3 * 4 * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> 5 * 6 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. 7 */ 8 9 #include <unistd.h> 10 #include <stdlib.h> 11 #include <sys/syscall.h> 12 #include <bits/kernel-features.h> 13 14 #ifdef __UCLIBC_ABORT_INSTRUCTION__ 15 # define ABORT_INSTRUCTION __asm__(__UCLIBC_ABORT_INSTRUCTION__) 16 #else 17 # warning "no abort instruction defined for this arch" 18 #endif 19 20 /* have to check for kernel 2.5.35 too, since NR was earlier present */ 21 #if defined __NR_exit_group && __LINUX_KERNEL_VERSION >= 0x020600 \ 22 && defined __UCLIBC_HAS_THREADS__ 23 # undef __NR_exit 24 # define __NR_exit __NR_exit_group 25 #endif 26 _exit(int status)27void _exit(int status) 28 { 29 /* The loop is added only to keep gcc happy. */ 30 while(1) 31 { 32 INLINE_SYSCALL(exit, 1, status); 33 #ifdef ABORT_INSTRUCTION 34 ABORT_INSTRUCTION; 35 #endif 36 } 37 } 38 libc_hidden_def(_exit) 39 #ifdef __USE_ISOC99 40 weak_alias(_exit,_Exit) 41 #endif 42