1 //===---------- Linux implementation of a quick exit function ---*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_LIBC_SRC_SUPPORT_OSUTIL_LINUX_QUICK_EXIT_H
10 #define LLVM_LIBC_SRC_SUPPORT_OSUTIL_LINUX_QUICK_EXIT_H
11 
12 #include "syscall.h"             // For internal syscall function.
13 
14 #include <sys/syscall.h> // For syscall numbers.
15 
16 namespace __llvm_libc {
17 
quick_exit(int status)18 static inline void quick_exit(int status) {
19   for (;;) {
20     __llvm_libc::syscall(SYS_exit_group, status);
21     __llvm_libc::syscall(SYS_exit, status);
22   }
23 }
24 
25 } // namespace __llvm_libc
26 
27 #endif // LLVM_LIBC_SRC_SUPPORT_OSUTIL_LINUX_QUICK_EXIT_H
28