1 /*
2 * Copyright (c) 2012-2021 The strace developers.
3 * All rights reserved.
4 *
5 * SPDX-License-Identifier: LGPL-2.1-or-later
6 */
7
8 #ifndef STRACE_KILL_SAVE_ERRNO_H
9 # define STRACE_KILL_SAVE_ERRNO_H
10
11 # include <sys/types.h>
12 # include <signal.h>
13 # include <errno.h>
14
15 static inline int
16 kill_save_errno(pid_t pid, int sig)
17 {
18 int saved_errno = errno;
19 int rc = kill(pid, sig);
20 errno = saved_errno;
21 return rc;
22 }
23
24 #endif /* !STRACE_KILL_SAVE_ERRNO_H */