1*a499d680SAlex Brachet //===------------------- Linux Implementation of _Exit --------------------===//
2*a499d680SAlex Brachet //
3*a499d680SAlex Brachet // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*a499d680SAlex Brachet // See https://llvm.org/LICENSE.txt for license information.
5*a499d680SAlex Brachet // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*a499d680SAlex Brachet //
7*a499d680SAlex Brachet //===----------------------------------------------------------------------===//
8*a499d680SAlex Brachet 
9*a499d680SAlex Brachet #include "config/linux/syscall.h" // For internal syscall function.
10*a499d680SAlex Brachet #include "include/sys/syscall.h"  // For syscall numbers.
11*a499d680SAlex Brachet #include "src/__support/common.h"
12*a499d680SAlex Brachet 
13*a499d680SAlex Brachet #include "src/stdlib/_Exit.h"
14*a499d680SAlex Brachet 
15*a499d680SAlex Brachet namespace __llvm_libc {
16*a499d680SAlex Brachet 
17*a499d680SAlex Brachet void LLVM_LIBC_ENTRYPOINT(_Exit)(int status) {
18*a499d680SAlex Brachet   for (;;) {
19*a499d680SAlex Brachet     __llvm_libc::syscall(SYS_exit_group, status);
20*a499d680SAlex Brachet     __llvm_libc::syscall(SYS_exit, status);
21*a499d680SAlex Brachet   }
22*a499d680SAlex Brachet }
23*a499d680SAlex Brachet 
24*a499d680SAlex Brachet } // namespace __llvm_libc
25