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