LCOV - code coverage report
Current view: top level - core - kill.c (source / functions) Hit Total Coverage
Test: systemd_full.info Lines: 17 17 100.0 %
Date: 2019-08-23 13:36:53 Functions: 6 6 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 10 12 83.3 %

           Branch data     Line data    Source code
       1                 :            : /* SPDX-License-Identifier: LGPL-2.1+ */
       2                 :            : 
       3                 :            : #include "kill.h"
       4                 :            : #include "signal-util.h"
       5                 :            : #include "string-table.h"
       6                 :            : #include "util.h"
       7                 :            : 
       8                 :       2280 : void kill_context_init(KillContext *c) {
       9         [ -  + ]:       2280 :         assert(c);
      10                 :            : 
      11                 :       2280 :         c->kill_signal = SIGTERM;
      12                 :       2280 :         c->final_kill_signal = SIGKILL;
      13                 :       2280 :         c->send_sigkill = true;
      14                 :       2280 :         c->send_sighup = false;
      15                 :       2280 :         c->watchdog_signal = SIGABRT;
      16                 :       2280 : }
      17                 :            : 
      18                 :        704 : void kill_context_dump(KillContext *c, FILE *f, const char *prefix) {
      19         [ -  + ]:        704 :         assert(c);
      20                 :            : 
      21                 :        704 :         prefix = strempty(prefix);
      22                 :            : 
      23                 :        704 :         fprintf(f,
      24                 :            :                 "%sKillMode: %s\n"
      25                 :            :                 "%sKillSignal: SIG%s\n"
      26                 :            :                 "%sFinalKillSignal: SIG%s\n"
      27                 :            :                 "%sSendSIGKILL: %s\n"
      28                 :            :                 "%sSendSIGHUP:  %s\n",
      29                 :            :                 prefix, kill_mode_to_string(c->kill_mode),
      30                 :            :                 prefix, signal_to_string(c->kill_signal),
      31                 :            :                 prefix, signal_to_string(c->final_kill_signal),
      32                 :        704 :                 prefix, yes_no(c->send_sigkill),
      33                 :        704 :                 prefix, yes_no(c->send_sighup));
      34                 :        704 : }
      35                 :            : 
      36                 :            : static const char* const kill_mode_table[_KILL_MODE_MAX] = {
      37                 :            :         [KILL_CONTROL_GROUP] = "control-group",
      38                 :            :         [KILL_PROCESS] = "process",
      39                 :            :         [KILL_MIXED] = "mixed",
      40                 :            :         [KILL_NONE] = "none"
      41                 :            : };
      42                 :            : 
      43   [ +  +  +  + ]:        752 : DEFINE_STRING_TABLE_LOOKUP(kill_mode, KillMode);
      44                 :            : 
      45                 :            : static const char* const kill_who_table[_KILL_WHO_MAX] = {
      46                 :            :         [KILL_MAIN] = "main",
      47                 :            :         [KILL_CONTROL] = "control",
      48                 :            :         [KILL_ALL] = "all",
      49                 :            :         [KILL_MAIN_FAIL] = "main-fail",
      50                 :            :         [KILL_CONTROL_FAIL] = "control-fail",
      51                 :            :         [KILL_ALL_FAIL] = "all-fail"
      52                 :            : };
      53                 :            : 
      54   [ +  +  +  + ]:         64 : DEFINE_STRING_TABLE_LOOKUP(kill_who, KillWho);

Generated by: LCOV version 1.14