aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/freezer.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/freezer.h')
-rw-r--r--include/linux/freezer.h26
1 files changed, 23 insertions, 3 deletions
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
index 1effc8b56b4e..a49b52934c55 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -49,6 +49,7 @@ extern int thaw_process(struct task_struct *p);
49 49
50extern void refrigerator(void); 50extern void refrigerator(void);
51extern int freeze_processes(void); 51extern int freeze_processes(void);
52extern int freeze_kernel_threads(void);
52extern void thaw_processes(void); 53extern void thaw_processes(void);
53 54
54static inline int try_to_freeze(void) 55static inline int try_to_freeze(void)
@@ -134,10 +135,25 @@ static inline void set_freezable_with_signal(void)
134} 135}
135 136
136/* 137/*
137 * Freezer-friendly wrappers around wait_event_interruptible() and 138 * Freezer-friendly wrappers around wait_event_interruptible(),
138 * wait_event_interruptible_timeout(), originally defined in <linux/wait.h> 139 * wait_event_killable() and wait_event_interruptible_timeout(), originally
140 * defined in <linux/wait.h>
139 */ 141 */
140 142
143#define wait_event_freezekillable(wq, condition) \
144({ \
145 int __retval; \
146 do { \
147 __retval = wait_event_killable(wq, \
148 (condition) || freezing(current)); \
149 if (__retval && !freezing(current)) \
150 break; \
151 else if (!(condition)) \
152 __retval = -ERESTARTSYS; \
153 } while (try_to_freeze()); \
154 __retval; \
155})
156
141#define wait_event_freezable(wq, condition) \ 157#define wait_event_freezable(wq, condition) \
142({ \ 158({ \
143 int __retval; \ 159 int __retval; \
@@ -171,7 +187,8 @@ static inline void clear_freeze_flag(struct task_struct *p) {}
171static inline int thaw_process(struct task_struct *p) { return 1; } 187static inline int thaw_process(struct task_struct *p) { return 1; }
172 188
173static inline void refrigerator(void) {} 189static inline void refrigerator(void) {}
174static inline int freeze_processes(void) { BUG(); return 0; } 190static inline int freeze_processes(void) { return -ENOSYS; }
191static inline int freeze_kernel_threads(void) { return -ENOSYS; }
175static inline void thaw_processes(void) {} 192static inline void thaw_processes(void) {}
176 193
177static inline int try_to_freeze(void) { return 0; } 194static inline int try_to_freeze(void) { return 0; }
@@ -188,6 +205,9 @@ static inline void set_freezable_with_signal(void) {}
188#define wait_event_freezable_timeout(wq, condition, timeout) \ 205#define wait_event_freezable_timeout(wq, condition, timeout) \
189 wait_event_interruptible_timeout(wq, condition, timeout) 206 wait_event_interruptible_timeout(wq, condition, timeout)
190 207
208#define wait_event_freezekillable(wq, condition) \
209 wait_event_killable(wq, condition)
210
191#endif /* !CONFIG_FREEZER */ 211#endif /* !CONFIG_FREEZER */
192 212
193#endif /* FREEZER_H_INCLUDED */ 213#endif /* FREEZER_H_INCLUDED */