chiark / gitweb /
[PATCH] added klibc version 0.82 (cvs tree) to the udev tree.
[elogind.git] / klibc / klibc / exitc.c
1 /*
2  * exit.c
3  *
4  * Note: all programs need exit(), since it's invoked from
5  * crt0.o.  Therefore there is no point in breaking apart
6  * exit() and _exit().
7  */
8
9 #include <stdlib.h>
10 #include <unistd.h>
11 #include <sys/syscall.h>
12
13 /* We have an assembly version for i386 and x86-64 */
14
15 #if !defined(__i386__) && !defined(__x86_64__)
16
17 #define __NR___exit __NR_exit
18
19 /* Syscalls can't return void... */
20 static inline _syscall1(int,__exit,int,rv);
21
22 /* This allows atexit/on_exit to install a hook */
23 __noreturn (*__exit_handler)(int) = _exit;
24
25 __noreturn exit(int rv)
26 {
27   __exit_handler(rv);
28 }
29
30 __noreturn _exit(int rv)
31 {
32   __exit(rv);
33   for(;;);
34 }
35
36 #endif