3
* Copyright © 2013 Canonical Ltd.
4
* Author: James Hunt <james.hunt@canonical.com>
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License version 2, as
8
* published by the Free Software Foundation.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License along
16
* with this program; if not, write to the Free Software Foundation, Inc.,
17
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
#ifndef INIT_QUIESCE_H
21
#define INIT_QUIESCE_H
23
#include <nih/timer.h>
26
* QUIESCE_DEFAULT_JOB_RUNTIME:
28
* The default maximum length of time to wait after emitting the
29
* SESSION_END_EVENT event before stopping all jobs.
31
#define QUIESCE_DEFAULT_JOB_RUNTIME 5
36
* Reason for Session Init wishing to shutdown; either the Session Init
37
* has been notified the system is being shutdown, or the session has
38
* requested it be ended (for example due to a user logout request).
40
typedef enum quiesce_requester {
41
QUIESCE_REQUESTER_INVALID = -1,
42
QUIESCE_REQUESTER_SYSTEM = 0,
43
QUIESCE_REQUESTER_SESSION,
49
* Phase 0: No quiesce operation in progress.
51
* Phase 1: Wait: Period between SESSION_END_EVENT being emitted and
52
* QUIESCE_DEFAULT_JOB_RUNTIME being reached.
54
* Phase 2: Kill: Period between QUIESCE_DEFAULT_JOB_RUNTIME being
55
* reached and kill signal being sent to all jobs.
57
* Phase 3: Cleanup: Period between all jobs having ended
58
* (either naturally or by induction) and final exit.
60
typedef enum quiesce_phase {
61
QUIESCE_PHASE_NOT_QUIESCED,
64
QUIESCE_PHASE_CLEANUP,
69
void quiesce (QuiesceRequester requester);
70
void quiesce_wait_callback (void *data, NihTimer *timer);
71
void quiesce_show_slow_jobs (void);
72
void quiesce_finalise (void);
76
#endif /* INIT_QUIESCE_H */