/* Attempts to acquire the semaphore. If no more tasks are allowed to acquire the semaphore, calling this function will put the task to sleep. If the sleep is interrupted by a fatal signal, this function will return -EINTR. If the semaphore is successfully acquired, this function returns 0.  */
int down_killable(struct semaphore *sem)
/* Attempts to acquire the semaphore. If no more tasks are allowed to acquire the semaphore, calling this function will put the task to sleep. If the sleep is interrupted by a fatal signal, this function will return -EINTR. If the semaphore is successfully acquired, this function returns 0.  */
int down_killable(struct semaphore *sem)
{
	unsigned long flags;
	int result = 0;
	spin_lock_irqsave(&sem->lock, flags);
	if (likely(sem->count > 0))
		sem->count--;
	else
		result = __down_killable(sem);
	spin_unlock_irqrestore(&sem->lock, flags);
	return result;
}