linux/tools/testing/selftests/arm64/bti/signal.c
<<
>>
Prefs
   1// SPDX-License-Identifier: GPL-2.0
   2/*
   3 * Copyright (C) 2019  Arm Limited
   4 * Original author: Dave Martin <Dave.Martin@arm.com>
   5 */
   6
   7#include "system.h"
   8#include "signal.h"
   9
  10int sigemptyset(sigset_t *s)
  11{
  12        unsigned int i;
  13
  14        for (i = 0; i < _NSIG_WORDS; ++i)
  15                s->sig[i] = 0;
  16
  17        return 0;
  18}
  19
  20int sigaddset(sigset_t *s, int n)
  21{
  22        if (n < 1 || n > _NSIG)
  23                return -EINVAL;
  24
  25        s->sig[(n - 1) / _NSIG_BPW] |= 1UL << (n - 1) % _NSIG_BPW;
  26        return 0;
  27}
  28
  29int sigaction(int n, struct sigaction *sa, const struct sigaction *old)
  30{
  31        return syscall(__NR_rt_sigaction, n, sa, old, sizeof(sa->sa_mask));
  32}
  33
  34int sigprocmask(int how, const sigset_t *mask, sigset_t *old)
  35{
  36        return syscall(__NR_rt_sigprocmask, how, mask, old, sizeof(*mask));
  37}
  38