• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===-- Linux implementation of signal ------------------------------------===//
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 #include "src/signal/raise.h"
10 #include "src/signal/linux/signal.h"
11 
12 #include "src/__support/common.h"
13 
14 namespace __llvm_libc {
15 
LLVM_LIBC_ENTRYPOINT(raise)16 int LLVM_LIBC_ENTRYPOINT(raise)(int sig) {
17   __llvm_libc::Sigset sigset;
18   __llvm_libc::block_all_signals(sigset);
19   long pid = __llvm_libc::syscall(SYS_getpid);
20   long tid = __llvm_libc::syscall(SYS_gettid);
21   int ret = __llvm_libc::syscall(SYS_tgkill, pid, tid, sig);
22   __llvm_libc::restore_signals(sigset);
23   return ret;
24 }
25 
26 } // namespace __llvm_libc
27