X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Flogin%2Flogind-inhibit.h;h=70de199c602a7495205f3d69eed61e56b2154a83;hp=0670a7f8cd5c2f1d16fb4e27d51fff9fa60b751a;hb=d49b80008fd8c0952da67bee0dc8a1314f29b8a7;hpb=f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6 diff --git a/src/login/logind-inhibit.h b/src/login/logind-inhibit.h index 0670a7f8c..70de199c6 100644 --- a/src/login/logind-inhibit.h +++ b/src/login/logind-inhibit.h @@ -1,7 +1,4 @@ -/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ - -#ifndef foologindinhibithfoo -#define foologindinhibithfoo +#pragma once /*** This file is part of systemd. @@ -24,22 +21,33 @@ typedef struct Inhibitor Inhibitor; -#include "list.h" -#include "util.h" -#include "logind.h" -#include "logind-seat.h" typedef enum InhibitWhat { INHIBIT_SHUTDOWN = 1, - INHIBIT_SUSPEND = 2, + INHIBIT_SLEEP = 2, INHIBIT_IDLE = 4, - _INHIBIT_WHAT_MAX = 8, + INHIBIT_HANDLE_POWER_KEY = 8, + INHIBIT_HANDLE_SUSPEND_KEY = 16, + INHIBIT_HANDLE_HIBERNATE_KEY = 32, + INHIBIT_HANDLE_LID_SWITCH = 64, + _INHIBIT_WHAT_MAX = 128, _INHIBIT_WHAT_INVALID = -1 } InhibitWhat; +typedef enum InhibitMode { + INHIBIT_BLOCK, + INHIBIT_DELAY, + _INHIBIT_MODE_MAX, + _INHIBIT_MODE_INVALID = -1 +} InhibitMode; + +#include "logind.h" + struct Inhibitor { Manager *manager; + sd_event_source *event_source; + char *id; char *state_file; @@ -48,10 +56,13 @@ struct Inhibitor { InhibitWhat what; char *who; char *why; + InhibitMode mode; pid_t pid; uid_t uid; + dual_timestamp since; + char *fifo_path; int fifo_fd; }; @@ -68,9 +79,11 @@ int inhibitor_stop(Inhibitor *i); int inhibitor_create_fifo(Inhibitor *i); void inhibitor_remove_fifo(Inhibitor *i); -InhibitWhat manager_inhibit_what(Manager *m); +InhibitWhat manager_inhibit_what(Manager *m, InhibitMode mm); +bool manager_is_inhibited(Manager *m, InhibitWhat w, InhibitMode mm, dual_timestamp *since, bool ignore_inactive, bool ignore_uid, uid_t uid, Inhibitor **offending); const char *inhibit_what_to_string(InhibitWhat k); InhibitWhat inhibit_what_from_string(const char *s); -#endif +const char *inhibit_mode_to_string(InhibitMode k); +InhibitMode inhibit_mode_from_string(const char *s);