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=1d47cfc68d6871cadf2d8ccf543a2e8f3006a4a0;hb=036174b578f4c18fd2fefb9f5d87791ea2e01b5d;hpb=c7b5eb98e8eeafe63a079ee3c51e9670872437ae diff --git a/src/login/logind-inhibit.h b/src/login/logind-inhibit.h index 1d47cfc68..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,6 +56,7 @@ struct Inhibitor { InhibitWhat what; char *who; char *why; + InhibitMode mode; pid_t pid; uid_t uid; @@ -70,10 +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); -bool manager_is_inhibited(Manager *m, InhibitWhat w, dual_timestamp *since); +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);