LCOV - code coverage report
Current view: top level - core - kill.c (source / functions) Hit Total Coverage
Test: systemd test coverage Lines: 15 16 93.8 %
Date: 2015-07-29 18:47:03 Functions: 6 6 100.0 %

          Line data    Source code
       1             : /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
       2             : 
       3             : /***
       4             :   This file is part of systemd.
       5             : 
       6             :   Copyright 2012 Lennart Poettering
       7             : 
       8             :   systemd is free software; you can redistribute it and/or modify it
       9             :   under the terms of the GNU Lesser General Public License as published by
      10             :   the Free Software Foundation; either version 2.1 of the License, or
      11             :   (at your option) any later version.
      12             : 
      13             :   systemd is distributed in the hope that it will be useful, but
      14             :   WITHOUT ANY WARRANTY; without even the implied warranty of
      15             :   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
      16             :   Lesser General Public License for more details.
      17             : 
      18             :   You should have received a copy of the GNU Lesser General Public License
      19             :   along with systemd; If not, see <http://www.gnu.org/licenses/>.
      20             : ***/
      21             : 
      22             : #include "util.h"
      23             : #include "signal-util.h"
      24             : #include "kill.h"
      25             : 
      26         115 : void kill_context_init(KillContext *c) {
      27         115 :         assert(c);
      28             : 
      29         115 :         c->kill_signal = SIGTERM;
      30         115 :         c->send_sigkill = true;
      31         115 :         c->send_sighup = false;
      32         115 : }
      33             : 
      34          57 : void kill_context_dump(KillContext *c, FILE *f, const char *prefix) {
      35          57 :         assert(c);
      36             : 
      37          57 :         if (!prefix)
      38           0 :                 prefix = "";
      39             : 
      40         114 :         fprintf(f,
      41             :                 "%sKillMode: %s\n"
      42             :                 "%sKillSignal: SIG%s\n"
      43             :                 "%sSendSIGKILL: %s\n"
      44             :                 "%sSendSIGHUP:  %s\n",
      45             :                 prefix, kill_mode_to_string(c->kill_mode),
      46             :                 prefix, signal_to_string(c->kill_signal),
      47          57 :                 prefix, yes_no(c->send_sigkill),
      48          57 :                 prefix, yes_no(c->send_sighup));
      49          57 : }
      50             : 
      51             : static const char* const kill_mode_table[_KILL_MODE_MAX] = {
      52             :         [KILL_CONTROL_GROUP] = "control-group",
      53             :         [KILL_PROCESS] = "process",
      54             :         [KILL_MIXED] = "mixed",
      55             :         [KILL_NONE] = "none"
      56             : };
      57             : 
      58          69 : DEFINE_STRING_TABLE_LOOKUP(kill_mode, KillMode);
      59             : 
      60             : static const char* const kill_who_table[_KILL_WHO_MAX] = {
      61             :         [KILL_MAIN] = "main",
      62             :         [KILL_CONTROL] = "control",
      63             :         [KILL_ALL] = "all"
      64             : };
      65             : 
      66          10 : DEFINE_STRING_TABLE_LOOKUP(kill_who, KillWho);

Generated by: LCOV version 1.11