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