strace/kill_save_errno.h
Dmitry V. Levin b93d52fe3d Change the license of strace to LGPL-2.1-or-later
strace is now provided under the terms of the GNU Lesser General
Public License version 2.1 or later, see COPYING for more details.

strace test suite is now provided under the terms of the GNU General
Public License version 2 or later, see tests/COPYING for more details.
2018-12-10 00:00:00 +00:00

25 lines
445 B
C

/*
* Copyright (c) 2012-2018 The strace developers.
* All rights reserved.
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
#ifndef STRACE_KILL_SAVE_ERRNO_H
#define STRACE_KILL_SAVE_ERRNO_H
#include <sys/types.h>
#include <signal.h>
#include <errno.h>
static inline int
kill_save_errno(pid_t pid, int sig)
{
int saved_errno = errno;
int rc = kill(pid, sig);
errno = saved_errno;
return rc;
}
#endif /* !STRACE_KILL_SAVE_ERRNO_H */