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

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

Version: ~ [ linux-5.2-rc1 ] ~ [ linux-5.1.2 ] ~ [ linux-5.0.16 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.43 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.119 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.176 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.179 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.139 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.67 ] ~ [ 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.39.4 ] ~ [ linux-2.6.38.8 ] ~ [ linux-2.6.37.6 ] ~ [ linux-2.6.36.4 ] ~ [ linux-2.6.35.14 ] ~ [ linux-2.6.34.15 ] ~ [ linux-2.6.33.20 ] ~ [ 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/rbtree.h>
 17 #include <linux/spinlock_types.h>
 18 
 19 extern int max_lock_depth; /* for sysctl */
 20 
 21 /**
 22  * The rt_mutex structure
 23  *
 24  * @wait_lock:  spinlock to protect the structure
 25  * @waiters:    rbtree root to enqueue waiters in priority order
 26  * @waiters_leftmost: top waiter
 27  * @owner:      the mutex owner
 28  */
 29 struct rt_mutex {
 30         raw_spinlock_t          wait_lock;
 31         struct rb_root          waiters;
 32         struct rb_node          *waiters_leftmost;
 33         struct task_struct      *owner;
 34 #ifdef CONFIG_DEBUG_RT_MUTEXES
 35         int                     save_state;
 36         const char              *name, *file;
 37         int                     line;
 38         void                    *magic;
 39 #endif
 40 };
 41 
 42 struct rt_mutex_waiter;
 43 struct hrtimer_sleeper;
 44 
 45 #ifdef CONFIG_DEBUG_RT_MUTEXES
 46  extern int rt_mutex_debug_check_no_locks_freed(const void *from,
 47                                                 unsigned long len);
 48  extern void rt_mutex_debug_check_no_locks_held(struct task_struct *task);
 49 #else
 50  static inline int rt_mutex_debug_check_no_locks_freed(const void *from,
 51                                                        unsigned long len)
 52  {
 53         return 0;
 54  }
 55 # define rt_mutex_debug_check_no_locks_held(task)       do { } while (0)
 56 #endif
 57 
 58 #ifdef CONFIG_DEBUG_RT_MUTEXES
 59 # define __DEBUG_RT_MUTEX_INITIALIZER(mutexname) \
 60         , .name = #mutexname, .file = __FILE__, .line = __LINE__
 61 # define rt_mutex_init(mutex)                   __rt_mutex_init(mutex, __func__)
 62  extern void rt_mutex_debug_task_free(struct task_struct *tsk);
 63 #else
 64 # define __DEBUG_RT_MUTEX_INITIALIZER(mutexname)
 65 # define rt_mutex_init(mutex)                   __rt_mutex_init(mutex, NULL)
 66 # define rt_mutex_debug_task_free(t)                    do { } while (0)
 67 #endif
 68 
 69 #define __RT_MUTEX_INITIALIZER(mutexname) \
 70         { .wait_lock = __RAW_SPIN_LOCK_UNLOCKED(mutexname.wait_lock) \
 71         , .waiters = RB_ROOT \
 72         , .owner = NULL \
 73         __DEBUG_RT_MUTEX_INITIALIZER(mutexname)}
 74 
 75 #define DEFINE_RT_MUTEX(mutexname) \
 76         struct rt_mutex mutexname = __RT_MUTEX_INITIALIZER(mutexname)
 77 
 78 /**
 79  * rt_mutex_is_locked - is the mutex locked
 80  * @lock: the mutex to be queried
 81  *
 82  * Returns 1 if the mutex is locked, 0 if unlocked.
 83  */
 84 static inline int rt_mutex_is_locked(struct rt_mutex *lock)
 85 {
 86         return lock->owner != NULL;
 87 }
 88 
 89 extern void __rt_mutex_init(struct rt_mutex *lock, const char *name);
 90 extern void rt_mutex_destroy(struct rt_mutex *lock);
 91 
 92 extern void rt_mutex_lock(struct rt_mutex *lock);
 93 extern int rt_mutex_lock_interruptible(struct rt_mutex *lock);
 94 extern int rt_mutex_timed_lock(struct rt_mutex *lock,
 95                                struct hrtimer_sleeper *timeout);
 96 
 97 extern int rt_mutex_trylock(struct rt_mutex *lock);
 98 
 99 extern void rt_mutex_unlock(struct rt_mutex *lock);
100 
101 #endif
102 

~ [ 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