~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/rtmutex.h

Version: ~ [ linux-5.4-rc3 ] ~ [ linux-5.3.6 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.79 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.149 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.196 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.196 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.75 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * RT Mutexes: blocking mutual exclusion locks with PI support
  3  *
  4  * started by Ingo Molnar and Thomas Gleixner:
  5  *
  6  *  Copyright (C) 2004-2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>
  7  *  Copyright (C) 2006, Timesys Corp., Thomas Gleixner <tglx@timesys.com>
  8  *
  9  * This file contains the public data structure and API definitions.
 10  */
 11 
 12 #ifndef __LINUX_RT_MUTEX_H
 13 #define __LINUX_RT_MUTEX_H
 14 
 15 #include <linux/linkage.h>
 16 #include <linux/plist.h>
 17 #include <linux/spinlock_types.h>
 18 
 19 /**
 20  * The rt_mutex structure
 21  *
 22  * @wait_lock:  spinlock to protect the structure
 23  * @wait_list:  pilist head to enqueue waiters in priority order
 24  * @owner:      the mutex owner
 25  */
 26 struct rt_mutex {
 27         spinlock_t              wait_lock;
 28         struct plist_head       wait_list;
 29         struct task_struct      *owner;
 30 #ifdef CONFIG_DEBUG_RT_MUTEXES
 31         int                     save_state;
 32         const char              *name, *file;
 33         int                     line;
 34         void                    *magic;
 35 #endif
 36 };
 37 
 38 struct rt_mutex_waiter;
 39 struct hrtimer_sleeper;
 40 
 41 #ifdef CONFIG_DEBUG_RT_MUTEXES
 42  extern int rt_mutex_debug_check_no_locks_freed(const void *from,
 43                                                 unsigned long len);
 44  extern void rt_mutex_debug_check_no_locks_held(struct task_struct *task);
 45 #else
 46  static inline int rt_mutex_debug_check_no_locks_freed(const void *from,
 47                                                        unsigned long len)
 48  {
 49         return 0;
 50  }
 51 # define rt_mutex_debug_check_no_locks_held(task)       do { } while (0)
 52 #endif
 53 
 54 #ifdef CONFIG_DEBUG_RT_MUTEXES
 55 # define __DEBUG_RT_MUTEX_INITIALIZER(mutexname) \
 56         , .name = #mutexname, .file = __FILE__, .line = __LINE__
 57 # define rt_mutex_init(mutex)                   __rt_mutex_init(mutex, __func__)
 58  extern void rt_mutex_debug_task_free(struct task_struct *tsk);
 59 #else
 60 # define __DEBUG_RT_MUTEX_INITIALIZER(mutexname)
 61 # define rt_mutex_init(mutex)                   __rt_mutex_init(mutex, NULL)
 62 # define rt_mutex_debug_task_free(t)                    do { } while (0)
 63 #endif
 64 
 65 #define __RT_MUTEX_INITIALIZER(mutexname) \
 66         { .wait_lock = __SPIN_LOCK_UNLOCKED(mutexname.wait_lock) \
 67         , .wait_list = PLIST_HEAD_INIT(mutexname.wait_list, mutexname.wait_lock) \
 68         , .owner = NULL \
 69         __DEBUG_RT_MUTEX_INITIALIZER(mutexname)}
 70 
 71 #define DEFINE_RT_MUTEX(mutexname) \
 72         struct rt_mutex mutexname = __RT_MUTEX_INITIALIZER(mutexname)
 73 
 74 /**
 75  * rt_mutex_is_locked - is the mutex locked
 76  * @lock: the mutex to be queried
 77  *
 78  * Returns 1 if the mutex is locked, 0 if unlocked.
 79  */
 80 static inline int rt_mutex_is_locked(struct rt_mutex *lock)
 81 {
 82         return lock->owner != NULL;
 83 }
 84 
 85 extern void __rt_mutex_init(struct rt_mutex *lock, const char *name);
 86 extern void rt_mutex_destroy(struct rt_mutex *lock);
 87 
 88 extern void rt_mutex_lock(struct rt_mutex *lock);
 89 extern int rt_mutex_lock_interruptible(struct rt_mutex *lock,
 90                                                 int detect_deadlock);
 91 extern int rt_mutex_timed_lock(struct rt_mutex *lock,
 92                                         struct hrtimer_sleeper *timeout,
 93                                         int detect_deadlock);
 94 
 95 extern int rt_mutex_trylock(struct rt_mutex *lock);
 96 
 97 extern void rt_mutex_unlock(struct rt_mutex *lock);
 98 
 99 #ifdef CONFIG_RT_MUTEXES
100 # define INIT_RT_MUTEXES(tsk)                                           \
101         .pi_waiters     = PLIST_HEAD_INIT(tsk.pi_waiters, tsk.pi_lock), \
102         INIT_RT_MUTEX_DEBUG(tsk)
103 #else
104 # define INIT_RT_MUTEXES(tsk)
105 #endif
106 
107 #endif
108 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp