1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
6 This file is part of systemd.
8 Copyright 2012 Lennart Poettering
10 systemd is free software; you can redistribute it and/or modify it
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
24 typedef struct Inhibitor Inhibitor;
29 typedef enum InhibitWhat {
33 INHIBIT_HANDLE_POWER_KEY = 8,
34 INHIBIT_HANDLE_SUSPEND_KEY = 16,
35 INHIBIT_HANDLE_HIBERNATE_KEY = 32,
36 INHIBIT_HANDLE_LID_SWITCH = 64,
37 _INHIBIT_WHAT_MAX = 128,
38 _INHIBIT_WHAT_INVALID = -1
41 typedef enum InhibitMode {
45 _INHIBIT_MODE_INVALID = -1
49 #include "logind-seat.h"
54 sd_event_source *event_source;
75 Inhibitor* inhibitor_new(Manager *m, const char *id);
76 void inhibitor_free(Inhibitor *i);
78 int inhibitor_save(Inhibitor *i);
79 int inhibitor_load(Inhibitor *i);
81 int inhibitor_start(Inhibitor *i);
82 int inhibitor_stop(Inhibitor *i);
84 int inhibitor_create_fifo(Inhibitor *i);
85 void inhibitor_remove_fifo(Inhibitor *i);
87 InhibitWhat manager_inhibit_what(Manager *m, InhibitMode mm);
88 bool manager_is_inhibited(Manager *m, InhibitWhat w, InhibitMode mm, dual_timestamp *since, bool ignore_inactive, bool ignore_uid, uid_t uid, Inhibitor **offending);
90 const char *inhibit_what_to_string(InhibitWhat k);
91 InhibitWhat inhibit_what_from_string(const char *s);
93 const char *inhibit_mode_to_string(InhibitMode k);
94 InhibitMode inhibit_mode_from_string(const char *s);