logind: use "sleep" as generic term for "suspend", "hibernate", and later on "hybrid suspend"

This commit is contained in:
Lennart Poettering 2012-05-05 00:46:31 +02:00
parent dd5f0a96f7
commit 4943c1c94b
7 changed files with 21 additions and 22 deletions

2
TODO
View File

@ -41,8 +41,6 @@ Features:
SessionIdleMode=(explicit|ignore|login) SessionIdleMode=(explicit|ignore|login)
ForceShutdown=(yes|no) ForceShutdown=(yes|no)
* logind: use "sleep" as generic term for "suspend", "hibernate", ...
* services which create their own subcgroups break cgroup-empty notification (needs to be fixed in the kernel) * services which create their own subcgroups break cgroup-empty notification (needs to be fixed in the kernel)
* don't delete /tmp/systemd-namespace-* before a process is gone down * don't delete /tmp/systemd-namespace-* before a process is gone down

View File

@ -151,11 +151,12 @@
<term><varname>InhibitDelayMaxSec=</varname></term> <term><varname>InhibitDelayMaxSec=</varname></term>
<listitem><para>Specifies the maximum <listitem><para>Specifies the maximum
time a suspend or reboot is delayed time a system shutdown or sleep
due to an inhibitor lock of type request is delayed due to an inhibitor
<literal>delay</literal> being taken lock of type <literal>delay</literal>
before it is ignored and the operation being taken before it is ignored and
executed anyway. Defaults to the operation executed
anyway. Defaults to
5s.</para></listitem> 5s.</para></listitem>
</varlistentry> </varlistentry>

View File

@ -60,14 +60,14 @@
<title>Description</title> <title>Description</title>
<para><command>systemd-inhibit</command> may be used <para><command>systemd-inhibit</command> may be used
to execute a program with a shutdown, suspend or idle to execute a program with a shutdown, sleep or idle
inhibitor lock taken. The lock will be acquired before inhibitor lock taken. The lock will be acquired before
the specified command line is executed and released the specified command line is executed and released
afterwards.</para> afterwards.</para>
<para>Inhibitor locks may be used to block or delay <para>Inhibitor locks may be used to block or delay
suspend and shutdown requests from the user, as well system sleep and shutdown requests from the user, as well
as automatic idle handling of the OS. This may be used as automatic idle handling of the OS. This is useful
to avoid system suspends while an optical disc is to avoid system suspends while an optical disc is
being recorded, or similar operations that should not being recorded, or similar operations that should not
be interrupted.</para> be interrupted.</para>
@ -101,7 +101,7 @@
separated list of one or more separated list of one or more
operations to inhibit: operations to inhibit:
<literal>shutdown</literal>, <literal>shutdown</literal>,
<literal>suspend</literal>, <literal>sleep</literal>,
<literal>idle</literal>, for <literal>idle</literal>, for
inhibiting reboot/power-off/halt/kexec, inhibiting reboot/power-off/halt/kexec,
suspending/hibernating, resp. the suspending/hibernating, resp. the

View File

@ -31,7 +31,7 @@
#include "build.h" #include "build.h"
#include "strv.h" #include "strv.h"
static const char* arg_what = "idle:suspend:shutdown"; static const char* arg_what = "idle:sleep:shutdown";
static const char* arg_who = NULL; static const char* arg_who = NULL;
static const char* arg_why = "Unknown reason"; static const char* arg_why = "Unknown reason";
static const char* arg_mode = "block"; static const char* arg_mode = "block";
@ -182,11 +182,11 @@ finish:
static int help(void) { static int help(void) {
printf("%s [OPTIONS...] {COMMAND} ...\n\n" printf("%s [OPTIONS...] {COMMAND} ...\n\n"
"Execute a process while inhibiting shutdown/suspend/idle.\n\n" "Execute a process while inhibiting shutdown/sleep/idle.\n\n"
" -h --help Show this help\n" " -h --help Show this help\n"
" --version Show package version\n" " --version Show package version\n"
" --what=WHAT Operations to inhibit, colon separated list of idle,\n" " --what=WHAT Operations to inhibit, colon separated list of idle,\n"
" suspend, shutdown\n" " sleep, shutdown\n"
" --who=STRING A descriptive string who is inhibiting\n" " --who=STRING A descriptive string who is inhibiting\n"
" --why=STRING A descriptive string why is being inhibited\n" " --why=STRING A descriptive string why is being inhibited\n"
" --mode=MODE One of block or delay\n" " --mode=MODE One of block or delay\n"

View File

@ -376,12 +376,12 @@ const char *inhibit_what_to_string(InhibitWhat w) {
static const char* const table[_INHIBIT_WHAT_MAX] = { static const char* const table[_INHIBIT_WHAT_MAX] = {
[0] = "", [0] = "",
[INHIBIT_SHUTDOWN] = "shutdown", [INHIBIT_SHUTDOWN] = "shutdown",
[INHIBIT_SUSPEND] = "suspend", [INHIBIT_SLEEP] = "sleep",
[INHIBIT_IDLE] = "idle", [INHIBIT_IDLE] = "idle",
[INHIBIT_SHUTDOWN|INHIBIT_SUSPEND] = "shutdown:suspend", [INHIBIT_SHUTDOWN|INHIBIT_SLEEP] = "shutdown:sleep",
[INHIBIT_SHUTDOWN|INHIBIT_IDLE] = "shutdown:idle", [INHIBIT_SHUTDOWN|INHIBIT_IDLE] = "shutdown:idle",
[INHIBIT_SHUTDOWN|INHIBIT_SUSPEND|INHIBIT_IDLE] = "shutdown:suspend:idle", [INHIBIT_SHUTDOWN|INHIBIT_SLEEP|INHIBIT_IDLE] = "shutdown:sleep:idle",
[INHIBIT_SUSPEND|INHIBIT_IDLE] = "suspend:idle" [INHIBIT_SLEEP|INHIBIT_IDLE] = "sleep:idle"
}; };
if (w < 0 || w >= _INHIBIT_WHAT_MAX) if (w < 0 || w >= _INHIBIT_WHAT_MAX)
@ -398,8 +398,8 @@ InhibitWhat inhibit_what_from_string(const char *s) {
FOREACH_WORD_SEPARATOR(w, l, s, ":", state) { FOREACH_WORD_SEPARATOR(w, l, s, ":", state) {
if (l == 8 && strncmp(w, "shutdown", l) == 0) if (l == 8 && strncmp(w, "shutdown", l) == 0)
what |= INHIBIT_SHUTDOWN; what |= INHIBIT_SHUTDOWN;
else if (l == 7 && strncmp(w, "suspend", l) == 0) else if (l == 5 && strncmp(w, "sleep", l) == 0)
what |= INHIBIT_SUSPEND; what |= INHIBIT_SLEEP;
else if (l == 4 && strncmp(w, "idle", l) == 0) else if (l == 4 && strncmp(w, "idle", l) == 0)
what |= INHIBIT_IDLE; what |= INHIBIT_IDLE;
else else

View File

@ -31,7 +31,7 @@ typedef struct Inhibitor Inhibitor;
typedef enum InhibitWhat { typedef enum InhibitWhat {
INHIBIT_SHUTDOWN = 1, INHIBIT_SHUTDOWN = 1,
INHIBIT_SUSPEND = 2, INHIBIT_SLEEP = 2,
INHIBIT_IDLE = 4, INHIBIT_IDLE = 4,
_INHIBIT_WHAT_MAX = 8, _INHIBIT_WHAT_MAX = 8,
_INHIBIT_WHAT_INVALID = -1 _INHIBIT_WHAT_INVALID = -1

View File

@ -119,7 +119,7 @@ int main(int argc, char*argv[]) {
print_inhibitors(bus); print_inhibitors(bus);
fd1 = inhibit(bus, "suspend"); fd1 = inhibit(bus, "sleep");
assert(fd1 >= 0); assert(fd1 >= 0);
print_inhibitors(bus); print_inhibitors(bus);