| 1 | /* |
| 2 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | */ |
| 4 | |
| 5 | #include "config.h" |
| 6 | |
| 7 | #include <glib/gi18n-lib.h> |
| 8 | |
| 9 | #include <errno.h> |
| 10 | #include <signal.h> |
| 11 | #include <sys/types.h> |
| 12 | |
| 13 | #include "gsm-kill.h" |
| 14 | |
| 15 | |
| 16 | void |
| 17 | gsm_kill (pid_t pid, |
| 18 | int signal, |
| 19 | GError **error) |
| 20 | { |
| 21 | int err; |
| 22 | |
| 23 | if (kill (pid, signal) >= 0) { |
| 24 | return; |
| 25 | } |
| 26 | |
| 27 | err = errno; |
| 28 | |
| 29 | g_set_error (error, |
| 30 | G_FILE_ERROR, |
| 31 | g_file_error_from_errno (err), |
| 32 | _("Kill failed on %i: %s"), |
| 33 | pid, |
| 34 | g_strerror (err)); |
| 35 | } |