mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 11:31:16 +00:00
util: Introduce virProcessGroupKill
Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
5998497d5f
commit
fc180c741f
@ -3070,6 +3070,7 @@ virProcessGetMaxMemLock;
|
||||
virProcessGetNamespaces;
|
||||
virProcessGetPids;
|
||||
virProcessGetStartTime;
|
||||
virProcessGroupKill;
|
||||
virProcessKill;
|
||||
virProcessKillPainfully;
|
||||
virProcessKillPainfullyDelay;
|
||||
|
@ -361,6 +361,23 @@ int virProcessKill(pid_t pid, int sig)
|
||||
}
|
||||
|
||||
|
||||
/* send signal to a process group */
|
||||
int virProcessGroupKill(pid_t pid, int sig G_GNUC_UNUSED)
|
||||
{
|
||||
if (pid <= 1) {
|
||||
errno = ESRCH;
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
#else
|
||||
return killpg(pid, sig);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Try to kill the process and verify it has exited
|
||||
*
|
||||
|
@ -52,6 +52,7 @@ virProcessWait(pid_t pid, int *exitstatus, bool raw)
|
||||
G_GNUC_WARN_UNUSED_RESULT;
|
||||
|
||||
int virProcessKill(pid_t pid, int sig);
|
||||
int virProcessGroupKill(pid_t pid, int sig);
|
||||
|
||||
int virProcessKillPainfully(pid_t pid, bool force);
|
||||
int virProcessKillPainfullyDelay(pid_t pid,
|
||||
|
Loading…
Reference in New Issue
Block a user