]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/login/logind-inhibit.h
remove unused includes
[thirdparty/systemd.git] / src / login / logind-inhibit.h
CommitLineData
f8e2fb7b
LP
1/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
05d3a176 3#pragma once
f8e2fb7b
LP
4
5/***
6 This file is part of systemd.
7
8 Copyright 2012 Lennart Poettering
9
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.
14
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.
19
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/>.
22***/
23
24typedef struct Inhibitor Inhibitor;
25
f8e2fb7b
LP
26
27typedef enum InhibitWhat {
28 INHIBIT_SHUTDOWN = 1,
4943c1c9 29 INHIBIT_SLEEP = 2,
f8e2fb7b 30 INHIBIT_IDLE = 4,
beaafb2e 31 INHIBIT_HANDLE_POWER_KEY = 8,
8e7fd6ad
LP
32 INHIBIT_HANDLE_SUSPEND_KEY = 16,
33 INHIBIT_HANDLE_HIBERNATE_KEY = 32,
34 INHIBIT_HANDLE_LID_SWITCH = 64,
35 _INHIBIT_WHAT_MAX = 128,
f8e2fb7b
LP
36 _INHIBIT_WHAT_INVALID = -1
37} InhibitWhat;
38
eecd1362
LP
39typedef enum InhibitMode {
40 INHIBIT_BLOCK,
41 INHIBIT_DELAY,
42 _INHIBIT_MODE_MAX,
43 _INHIBIT_MODE_INVALID = -1
44} InhibitMode;
45
d889a206 46#include "logind.h"
d889a206 47
f8e2fb7b
LP
48struct Inhibitor {
49 Manager *manager;
50
cc377381
LP
51 sd_event_source *event_source;
52
f8e2fb7b
LP
53 char *id;
54 char *state_file;
55
56 bool started;
57
58 InhibitWhat what;
59 char *who;
60 char *why;
eecd1362 61 InhibitMode mode;
f8e2fb7b
LP
62
63 pid_t pid;
64 uid_t uid;
65
c7b5eb98
LP
66 dual_timestamp since;
67
f8e2fb7b
LP
68 char *fifo_path;
69 int fifo_fd;
70};
71
72Inhibitor* inhibitor_new(Manager *m, const char *id);
73void inhibitor_free(Inhibitor *i);
74
75int inhibitor_save(Inhibitor *i);
76int inhibitor_load(Inhibitor *i);
77
78int inhibitor_start(Inhibitor *i);
79int inhibitor_stop(Inhibitor *i);
80
81int inhibitor_create_fifo(Inhibitor *i);
82void inhibitor_remove_fifo(Inhibitor *i);
83
eecd1362 84InhibitWhat manager_inhibit_what(Manager *m, InhibitMode mm);
85a428c6 85bool manager_is_inhibited(Manager *m, InhibitWhat w, InhibitMode mm, dual_timestamp *since, bool ignore_inactive, bool ignore_uid, uid_t uid, Inhibitor **offending);
f8e2fb7b
LP
86
87const char *inhibit_what_to_string(InhibitWhat k);
88InhibitWhat inhibit_what_from_string(const char *s);
89
eecd1362
LP
90const char *inhibit_mode_to_string(InhibitMode k);
91InhibitMode inhibit_mode_from_string(const char *s);