X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Flogin%2Flogind-inhibit.h;fp=src%2Flogin%2Flogind-inhibit.h;h=0670a7f8cd5c2f1d16fb4e27d51fff9fa60b751a;hp=0000000000000000000000000000000000000000;hb=f8e2fb7b14e53f5a4bcfd66d26910af1dee185c6;hpb=9156e799a258658cf3f51434708cdb194c13eaa4 diff --git a/src/login/logind-inhibit.h b/src/login/logind-inhibit.h new file mode 100644 index 000000000..0670a7f8c --- /dev/null +++ b/src/login/logind-inhibit.h @@ -0,0 +1,76 @@ +/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ + +#ifndef foologindinhibithfoo +#define foologindinhibithfoo + +/*** + This file is part of systemd. + + Copyright 2012 Lennart Poettering + + systemd is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + + systemd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with systemd; If not, see . +***/ + +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_IDLE = 4, + _INHIBIT_WHAT_MAX = 8, + _INHIBIT_WHAT_INVALID = -1 +} InhibitWhat; + +struct Inhibitor { + Manager *manager; + + char *id; + char *state_file; + + bool started; + + InhibitWhat what; + char *who; + char *why; + + pid_t pid; + uid_t uid; + + char *fifo_path; + int fifo_fd; +}; + +Inhibitor* inhibitor_new(Manager *m, const char *id); +void inhibitor_free(Inhibitor *i); + +int inhibitor_save(Inhibitor *i); +int inhibitor_load(Inhibitor *i); + +int inhibitor_start(Inhibitor *i); +int inhibitor_stop(Inhibitor *i); + +int inhibitor_create_fifo(Inhibitor *i); +void inhibitor_remove_fifo(Inhibitor *i); + +InhibitWhat manager_inhibit_what(Manager *m); + +const char *inhibit_what_to_string(InhibitWhat k); +InhibitWhat inhibit_what_from_string(const char *s); + +#endif