diff options
Diffstat (limited to 'include/linux/freezer.h')
-rw-r--r-- | include/linux/freezer.h | 26 |
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 | ||
50 | extern void refrigerator(void); | 50 | extern void refrigerator(void); |
51 | extern int freeze_processes(void); | 51 | extern int freeze_processes(void); |
52 | extern int freeze_kernel_threads(void); | ||
52 | extern void thaw_processes(void); | 53 | extern void thaw_processes(void); |
53 | 54 | ||
54 | static inline int try_to_freeze(void) | 55 | static 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) {} | |||
171 | static inline int thaw_process(struct task_struct *p) { return 1; } | 187 | static inline int thaw_process(struct task_struct *p) { return 1; } |
172 | 188 | ||
173 | static inline void refrigerator(void) {} | 189 | static inline void refrigerator(void) {} |
174 | static inline int freeze_processes(void) { BUG(); return 0; } | 190 | static inline int freeze_processes(void) { return -ENOSYS; } |
191 | static inline int freeze_kernel_threads(void) { return -ENOSYS; } | ||
175 | static inline void thaw_processes(void) {} | 192 | static inline void thaw_processes(void) {} |
176 | 193 | ||
177 | static inline int try_to_freeze(void) { return 0; } | 194 | static 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 */ |