1 /* SPDX-License-Identifier: LGPL-2.1+ */
4 typedef struct Inhibitor Inhibitor
;
6 typedef enum InhibitWhat
{
7 INHIBIT_SHUTDOWN
= 1 << 0,
8 INHIBIT_SLEEP
= 1 << 1,
10 INHIBIT_HANDLE_POWER_KEY
= 1 << 3,
11 INHIBIT_HANDLE_SUSPEND_KEY
= 1 << 4,
12 INHIBIT_HANDLE_HIBERNATE_KEY
= 1 << 5,
13 INHIBIT_HANDLE_LID_SWITCH
= 1 << 6,
14 _INHIBIT_WHAT_MAX
= 1 << 7,
15 _INHIBIT_WHAT_INVALID
= -1
18 typedef enum InhibitMode
{
22 _INHIBIT_MODE_INVALID
= -1
30 sd_event_source
*event_source
;
51 int inhibitor_new(Inhibitor
**ret
, Manager
*m
, const char* id
);
52 Inhibitor
* inhibitor_free(Inhibitor
*i
);
54 DEFINE_TRIVIAL_CLEANUP_FUNC(Inhibitor
*, inhibitor_free
);
56 int inhibitor_load(Inhibitor
*i
);
58 int inhibitor_start(Inhibitor
*i
);
59 void inhibitor_stop(Inhibitor
*i
);
61 int inhibitor_create_fifo(Inhibitor
*i
);
63 bool inhibitor_is_orphan(Inhibitor
*i
);
65 InhibitWhat
manager_inhibit_what(Manager
*m
, InhibitMode mm
);
66 bool manager_is_inhibited(Manager
*m
, InhibitWhat w
, InhibitMode mm
, dual_timestamp
*since
, bool ignore_inactive
, bool ignore_uid
, uid_t uid
, Inhibitor
**offending
);
68 const char *inhibit_what_to_string(InhibitWhat k
);
69 InhibitWhat
inhibit_what_from_string(const char *s
);
71 const char *inhibit_mode_to_string(InhibitMode k
);
72 InhibitMode
inhibit_mode_from_string(const char *s
);