MCPcopy Create free account
hub / github.com/apache/mesos / kill

Function kill

src/linux/cgroups.cpp:828–852  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

826
827
828Try<Nothing> kill(
829 const string& hierarchy,
830 const string& cgroup,
831 int signal)
832{
833 Try<set<pid_t>> pids = processes(hierarchy, cgroup);
834 if (pids.isError()) {
835 return Error("Failed to get processes of cgroup: " + pids.error());
836 }
837
838 foreach (pid_t pid, pids.get()) {
839 if (::kill(pid, signal) == -1) {
840 // If errno is set to ESRCH, it means that either a) this process already
841 // terminated, or b) it's in a 'zombie' state and we can't signal it
842 // anyway. In either case, ignore the error.
843 if (errno != ESRCH) {
844 return ErrnoError(
845 "Failed to send " + string(strsignal(signal)) +
846 " to process " + stringify(pid));
847 }
848 }
849 }
850
851 return Nothing();
852}
853
854
855Try<string> read(

Callers 15

finalizeMethod · 0.70
foreachFunction · 0.70
killMethod · 0.70
cloneFunction · 0.70
commandDiscardedFunction · 0.50
receivedMethod · 0.50
taskHealthUpdatedMethod · 0.50
killMethod · 0.50
shutdownMethod · 0.50
escalatedMethod · 0.50
taskCompletionTimeoutMethod · 0.50
foreachMethod · 0.50

Calls 5

NothingClass · 0.85
processesFunction · 0.70
errorMethod · 0.65
ErrorFunction · 0.50
isErrorMethod · 0.45

Tested by 15

foreachFunction · 0.40
TEST_PFunction · 0.40
TYPED_TESTFunction · 0.40
TEST_PFunction · 0.40
setupMethod · 0.40
TEST_PFunction · 0.40
eventsMethod · 0.40
TEST_FFunction · 0.40
cleanupMethod · 0.40
TESTFunction · 0.40
TEST_FFunction · 0.40
TESTFunction · 0.40