diff options
Diffstat (limited to 'kernel/locking/mutex.c')
-rw-r--r-- | kernel/locking/mutex.c | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c index 858a07590e39..2048359f33d2 100644 --- a/kernel/locking/mutex.c +++ b/kernel/locking/mutex.c | |||
@@ -1082,15 +1082,16 @@ static noinline int __sched | |||
1082 | __mutex_lock_interruptible_slowpath(struct mutex *lock); | 1082 | __mutex_lock_interruptible_slowpath(struct mutex *lock); |
1083 | 1083 | ||
1084 | /** | 1084 | /** |
1085 | * mutex_lock_interruptible - acquire the mutex, interruptible | 1085 | * mutex_lock_interruptible() - Acquire the mutex, interruptible by signals. |
1086 | * @lock: the mutex to be acquired | 1086 | * @lock: The mutex to be acquired. |
1087 | * | 1087 | * |
1088 | * Lock the mutex like mutex_lock(), and return 0 if the mutex has | 1088 | * Lock the mutex like mutex_lock(). If a signal is delivered while the |
1089 | * been acquired or sleep until the mutex becomes available. If a | 1089 | * process is sleeping, this function will return without acquiring the |
1090 | * signal arrives while waiting for the lock then this function | 1090 | * mutex. |
1091 | * returns -EINTR. | ||
1092 | * | 1091 | * |
1093 | * This function is similar to (but not equivalent to) down_interruptible(). | 1092 | * Context: Process context. |
1093 | * Return: 0 if the lock was successfully acquired or %-EINTR if a | ||
1094 | * signal arrived. | ||
1094 | */ | 1095 | */ |
1095 | int __sched mutex_lock_interruptible(struct mutex *lock) | 1096 | int __sched mutex_lock_interruptible(struct mutex *lock) |
1096 | { | 1097 | { |
@@ -1104,6 +1105,18 @@ int __sched mutex_lock_interruptible(struct mutex *lock) | |||
1104 | 1105 | ||
1105 | EXPORT_SYMBOL(mutex_lock_interruptible); | 1106 | EXPORT_SYMBOL(mutex_lock_interruptible); |
1106 | 1107 | ||
1108 | /** | ||
1109 | * mutex_lock_killable() - Acquire the mutex, interruptible by fatal signals. | ||
1110 | * @lock: The mutex to be acquired. | ||
1111 | * | ||
1112 | * Lock the mutex like mutex_lock(). If a signal which will be fatal to | ||
1113 | * the current process is delivered while the process is sleeping, this | ||
1114 | * function will return without acquiring the mutex. | ||
1115 | * | ||
1116 | * Context: Process context. | ||
1117 | * Return: 0 if the lock was successfully acquired or %-EINTR if a | ||
1118 | * fatal signal arrived. | ||
1119 | */ | ||
1107 | int __sched mutex_lock_killable(struct mutex *lock) | 1120 | int __sched mutex_lock_killable(struct mutex *lock) |
1108 | { | 1121 | { |
1109 | might_sleep(); | 1122 | might_sleep(); |
@@ -1115,6 +1128,16 @@ int __sched mutex_lock_killable(struct mutex *lock) | |||
1115 | } | 1128 | } |
1116 | EXPORT_SYMBOL(mutex_lock_killable); | 1129 | EXPORT_SYMBOL(mutex_lock_killable); |
1117 | 1130 | ||
1131 | /** | ||
1132 | * mutex_lock_io() - Acquire the mutex and mark the process as waiting for I/O | ||
1133 | * @lock: The mutex to be acquired. | ||
1134 | * | ||
1135 | * Lock the mutex like mutex_lock(). While the task is waiting for this | ||
1136 | * mutex, it will be accounted as being in the IO wait state by the | ||
1137 | * scheduler. | ||
1138 | * | ||
1139 | * Context: Process context. | ||
1140 | */ | ||
1118 | void __sched mutex_lock_io(struct mutex *lock) | 1141 | void __sched mutex_lock_io(struct mutex *lock) |
1119 | { | 1142 | { |
1120 | int token; | 1143 | int token; |