/freebsd-src/sys/dev/drm2/ttm/ |
H A D | ttm_lock.c | 48 void ttm_lock_init(struct ttm_lock *lock) in ttm_lock_init() argument 50 mtx_init(&lock->lock, "ttmlk", NULL, MTX_DEF); in ttm_lock_init() 51 lock->rw = 0; in ttm_lock_init() 52 lock->flags = 0; in ttm_lock_init() 53 lock->kill_takers = false; in ttm_lock_init() 54 lock->signal = SIGKILL; in ttm_lock_init() 68 void ttm_read_unlock(struct ttm_lock *lock) in ttm_read_unlock() argument 70 mtx_lock(&lock->lock); in ttm_read_unlock() 71 if (--lock->rw == 0) in ttm_read_unlock() 72 wakeup(lock); in ttm_read_unlock() [all …]
|
H A D | ttm_lock.h | 33 * of the DRM heavyweight hardware lock. 34 * The lock is a read-write lock. Taking it in read mode and write mode 39 * It's allowed to leave kernel space with the vt lock held. 40 * If a user-space process dies while having the vt-lock, 41 * it will be released during the file descriptor release. The vt lock 42 * excludes write lock and read lock. 44 * The suspend mode is used to lock out all TTM users when preparing for 59 * @base: ttm base object used solely to release the lock if the client 60 * holding the lock dies. 61 * @queue: Queue for processes waiting for lock change-of-status. [all …]
|
/freebsd-src/share/man/man9/ |
H A D | lock.9 | 53 .Fn lockinit "struct lock *lkp" "int prio" "const char *wmesg" "int timo" "int flags" 55 .Fn lockdestroy "struct lock *lkp" 57 .Fn lockmgr "struct lock *lkp" "u_int flags" "struct mtx *ilk" 59 .Fn lockmgr_args "struct lock *lkp" "u_int flags" "struct mtx *ilk" "const char *wmesg" "int prio" … 61 .Fn lockmgr_args_rw "struct lock *lkp" "u_int flags" "struct rwlock *ilk" "const char *wmesg" "int … 63 .Fn lockmgr_disown "struct lock *lkp" 65 .Fn lockmgr_disowned "const struct lock *lkp" 67 .Fn lockmgr_lock_flags "struct lock *lkp" "u_int flags" "struct lock_object *ilk" "const char *file… 69 .Fn lockmgr_printinfo "const struct lock *lkp" 71 .Fn lockmgr_recursed "const struct lock *lkp" [all …]
|
H A D | sx.9 | 52 .Nd kernel shared/exclusive lock 117 shared/exclusive lock. 131 to ignore this lock. 133 Do not profile this lock. 138 Do not log any operations for this lock via 153 The lock 157 Threads acquire and release a shared lock by calling 166 Threads acquire and release an exclusive lock by calling 175 A thread can attempt to upgrade a currently held shared lock to an exclusive 176 lock by calling [all …]
|
H A D | rmlock.9 | 51 .Nd kernel reader/writer lock optimized for read-mostly access patterns 109 Acquiring an exclusive lock after the lock has been locked for shared access 114 locks and follow the same lock ordering rules as 127 Readers can recurse if the lock is initialized with the 136 It changes lock ordering rules to the same as for 148 lock ordering. 152 Initialize the read-mostly lock 158 on the lock. 162 initialize the read-mostly lock 172 to ignore this lock. [all …]
|
H A D | rwlock.9 | 48 .Nd kernel reader/writer lock 127 as reader/writer lock, described by name 131 on the lock. 133 Initialize the rw lock just like the 146 Do not profile this lock. 150 to ignore this lock. 152 Do not log any operations for this lock via 168 Lock 171 If any thread holds this lock exclusively, the current thread blocks, 179 .Dq "recursing on a lock" . [all …]
|
/freebsd-src/contrib/unbound/util/ |
H A D | locks.h | 49 * o lock_rw: lock that has many readers and one writer (to a data entry). 51 * This lock is meant for non performance sensitive uses. 52 * o lock_quick: speed lock. For performance sensitive locking of critical 86 #define lock_protect(lock, area, size) /* nop */ argument 87 #define lock_unprotect(lock, area) /* nop */ argument 88 #define lock_get_mem(lock) (0) /* nothing */ argument 98 /** use pthread mutex for basic lock */ 101 #define lock_basic_init(lock) LOCKRET(pthread_mutex_init(lock, NULL)) argument 102 #define lock_basic_destroy(lock) LOCKRE argument 100 lock_basic_init(lock) global() argument 103 lock_basic_unlock(lock) global() argument 108 lock_rw_init(lock) global() argument 109 lock_rw_destroy(lock) global() argument 110 lock_rw_rdlock(lock) global() argument 111 lock_rw_wrlock(lock) global() argument 112 lock_rw_unlock(lock) global() argument 117 lock_rw_init(lock) global() argument 118 lock_rw_destroy(lock) global() argument 119 lock_rw_rdlock(lock) global() argument 120 lock_rw_wrlock(lock) global() argument 121 lock_rw_unlock(lock) global() argument 128 lock_quick_init(lock) global() argument 129 lock_quick_destroy(lock) global() argument 130 lock_quick_lock(lock) global() argument 131 lock_quick_unlock(lock) global() argument 143 lock_quick_init(lock) global() argument 144 lock_quick_destroy(lock) global() argument 145 lock_quick_lock(lock) global() argument 146 lock_quick_unlock(lock) global() argument 188 lock_rw_init(lock) global() argument 189 lock_rw_destroy(lock) global() argument 190 lock_rw_rdlock(lock) global() argument 191 lock_rw_wrlock(lock) global() argument 192 lock_rw_unlock(lock) global() argument 196 lock_basic_init(lock) global() argument 197 lock_basic_destroy(lock) global() argument 198 lock_basic_lock(lock) global() argument 199 lock_basic_unlock(lock) global() argument 203 lock_quick_init(lock) global() argument 204 lock_quick_destroy(lock) global() argument 205 lock_quick_lock(lock) global() argument 206 lock_quick_unlock(lock) global() argument 226 lock_rw_init(lock) global() argument 227 lock_rw_destroy(lock) global() argument 228 lock_rw_rdlock(lock) global() argument 229 lock_rw_wrlock(lock) global() argument 230 lock_rw_unlock(lock) global() argument 241 lock_quick_init(lock) global() argument 242 lock_quick_destroy(lock) global() argument 243 lock_quick_lock(lock) global() argument 244 lock_quick_unlock(lock) global() argument 262 lock_rw_init(lock) global() argument 263 lock_rw_destroy(lock) global() argument 264 lock_rw_rdlock(lock) global() argument 265 lock_rw_wrlock(lock) global() argument 266 lock_rw_unlock(lock) global() argument 270 lock_basic_init(lock) global() argument 271 lock_basic_destroy(lock) global() argument 272 lock_basic_lock(lock) global() argument 273 lock_basic_unlock(lock) global() argument 277 lock_quick_init(lock) global() argument 278 lock_quick_destroy(lock) global() argument 279 lock_quick_lock(lock) global() argument 280 lock_quick_unlock(lock) global() argument [all...] |
/freebsd-src/sys/dev/drm2/ |
H A D | drm_lock.c | 46 * Lock ioctl. 54 * Add the current task to the lock wait queue, and attempt to take to lock. 58 struct drm_lock *lock = data; in drm_lock() local 64 if (lock->context == DRM_KERNEL_CONTEXT) { in drm_lock() 66 DRM_CURRENTPID, lock->context); in drm_lock() 70 DRM_DEBUG("%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n", in drm_lock() 71 lock->context, DRM_CURRENTPID, in drm_lock() 72 master->lock.hw_lock->lock, lock->flags); in drm_lock() 74 mtx_lock(&master->lock.spinlock); in drm_lock() 75 master->lock.user_waiters++; in drm_lock() [all …]
|
/freebsd-src/contrib/ntp/sntp/libevent/ |
H A D | evthread.c | 107 event_warnx("Trying to disable lock functions after " in evthread_set_lock_callbacks() 118 target->lock == cbs->lock && in evthread_set_lock_callbacks() 123 event_warnx("Can't change lock callbacks once they have been " in evthread_set_lock_callbacks() 127 if (cbs->alloc && cbs->free && cbs->lock && cbs->unlock) { in evthread_set_lock_callbacks() 189 * lock to protect count. */ 191 void *lock; member 201 if (!(result->lock = original_lock_fns_.alloc( in debug_lock_alloc() 207 result->lock = NULL; in debug_lock_alloc() 219 struct debug_lock *lock = lock_; in debug_lock_free() local 220 EVUTIL_ASSERT(lock->count == 0); in debug_lock_free() [all …]
|
H A D | evthread-internal.h | 50 /* Global function pointers to lock-related functions. NULL if locking isn't 65 * running a given event_base's loop. Requires lock. */ 72 * thread. Requires lock. */ 78 /** Allocate a new lock, and store it in lockvar, a void*. Sets lockvar to 84 /** Free a given lock, if it is present and locking is enabled. */ 92 /** Acquire a lock. */ 96 evthread_lock_fns_.lock(mode, lockvar); \ 99 /** Release a lock */ 116 /** Lock an event_base, if it is set up for locking. Acquires the lock 127 /** If lock debugging is enabled, and lock is non-null, assert that 'lock' is [all …]
|
/freebsd-src/contrib/libevent/ |
H A D | evthread.c | 107 event_warnx("Trying to disable lock functions after " in evthread_set_lock_callbacks() 118 target->lock == cbs->lock && in evthread_set_lock_callbacks() 123 event_warnx("Can't change lock callbacks once they have been " in evthread_set_lock_callbacks() 127 if (cbs->alloc && cbs->free && cbs->lock && cbs->unlock) { in evthread_set_lock_callbacks() 189 * lock to protect count. */ 191 void *lock; member 201 if (!(result->lock = original_lock_fns_.alloc( in debug_lock_alloc() 207 result->lock = NULL; in debug_lock_alloc() 219 struct debug_lock *lock = lock_; in debug_lock_free() local 220 EVUTIL_ASSERT(lock->count == 0); in debug_lock_free() [all …]
|
H A D | evthread-internal.h | 50 /* Global function pointers to lock-related functions. NULL if locking isn't 65 * running a given event_base's loop. Requires lock. */ 72 * thread. Requires lock. */ 78 /** Allocate a new lock, and store it in lockvar, a void*. Sets lockvar to 84 /** Free a given lock, if it is present and locking is enabled. */ 92 /** Acquire a lock. */ 96 evthread_lock_fns_.lock(mode, lockvar); \ 99 /** Release a lock */ 116 /** Lock an event_base, if it is set up for locking. Acquires the lock 127 /** If lock debugging is enabled, and lock is non-null, assert that 'lock' is [all …]
|
/freebsd-src/sys/sys/ |
H A D | lock.h | 44 * Lock classes. Each lock has a class which describes characteristics 48 * an error to perform any type of context switch while holding a spin lock. 49 * Also, for an individual lock to be recursable, its class must allow 50 * recursion and the lock itself must explicitly allow recursion. 53 * data for the 'show lock' DDB command. The 'lc_lock' and 55 * to lock and unlock locks while blocking on a sleep queue. The 63 void (*lc_assert)(const struct lock_object *lock, int what); 64 void (*lc_ddb_show)(const struct lock_object *lock); 65 void (*lc_lock)(struct lock_object *lock, uintptr_ 96 LO_CLASSINDEX(lock) global() argument 97 LOCK_CLASS(lock) global() argument 257 WITNESS_INIT(lock,type) global() argument 260 WITNESS_DESTROY(lock) global() argument 263 WITNESS_CHECKORDER(lock,flags,file,line,interlock) global() argument 270 WITNESS_LOCK(lock,flags,file,line) global() argument 273 WITNESS_UPGRADE(lock,flags,file,line) global() argument 276 WITNESS_DOWNGRADE(lock,flags,file,line) global() argument 279 WITNESS_UNLOCK(lock,flags,file,line) global() argument 282 WITNESS_CHECK(flags,lock,fmt,...) global() argument 285 WITNESS_WARN(flags,lock,fmt,...) global() argument 292 WITNESS_SAVE(lock,n) global() argument 295 WITNESS_RESTORE(lock,n) global() argument 298 WITNESS_NORELEASE(lock) global() argument 301 WITNESS_RELEASEOK(lock) global() argument 304 WITNESS_FILE(lock) global() argument 307 WITNESS_LINE(lock) global() argument 311 WITNESS_INIT(lock,type) global() argument 312 WITNESS_DESTROY(lock) global() argument 314 WITNESS_CHECKORDER(lock,flags,file,line,interlock) global() argument 315 WITNESS_LOCK(lock,flags,file,line) global() argument 316 WITNESS_UPGRADE(lock,flags,file,line) global() argument 317 WITNESS_DOWNGRADE(lock,flags,file,line) global() argument 318 WITNESS_UNLOCK(lock,flags,file,line) global() argument 319 WITNESS_CHECK(flags,lock,fmt,...) global() argument 320 WITNESS_WARN(flags,lock,fmt,...) global() argument 322 WITNESS_SAVE(lock,n) global() argument 323 WITNESS_RESTORE(lock,n) global() argument 324 WITNESS_NORELEASE(lock) global() argument 325 WITNESS_RELEASEOK(lock) global() argument 326 WITNESS_FILE(lock) global() argument 327 WITNESS_LINE(lock) global() argument [all...] |
/freebsd-src/crypto/heimdal/lib/hx509/ |
H A D | lock.c | 60 hx509_lock_init(hx509_context context, hx509_lock *lock) in hx509_lock_init() argument 65 *lock = NULL; in hx509_lock_init() 81 *lock = l; in hx509_lock_init() 87 hx509_lock_add_password(hx509_lock lock, const char *password) in hx509_lock_add_password() argument 96 d = realloc(lock->password.val, in hx509_lock_add_password() 97 (lock->password.len + 1) * sizeof(lock->password.val[0])); in hx509_lock_add_password() 102 lock->password.val = d; in hx509_lock_add_password() 103 lock->password.val[lock->password.len] = s; in hx509_lock_add_password() 104 lock->password.len++; in hx509_lock_add_password() 110 _hx509_lock_get_passwords(hx509_lock lock) in _hx509_lock_get_passwords() argument [all …]
|
/freebsd-src/sys/cddl/compat/opensolaris/sys/ |
H A D | rwlock.h | 32 #include <sys/lock.h> 59 #define rw_init(lock, desc, type, arg) do { \ argument 62 KASSERT(((lock)->lock_object.lo_flags & LO_ALLMASK) != \ 63 LO_EXPECTED, ("lock %s already initialized", #lock)); \ 64 bzero((lock), sizeof(struct sx)); \ 65 for (_name = #lock; *_name != '\0'; _name++) { \ 70 _name = #lock; \ 71 sx_init_flags((lock), _name, RW_FLAGS); \ 73 #define rw_destroy(lock) sx_destroy(lock) argument 74 #define rw_enter(lock, how) do { \ argument [all …]
|
/freebsd-src/sys/kern/ |
H A D | kern_lockf.c | 70 #include <sys/lock.h> 172 * This structure is used to keep track of both local and remote lock 174 * the lock owner structure. Each possible lock owner (local proc for 179 * If a lock owner has a lock that blocks some other lock or a lock 180 * that is waiting for some other lock, it also has a vertex in the 196 pid_t lo_pid; /* (c) Process Id of the lock owner */ 197 int lo_sysid; /* (c) System Id of the lock owner */ 198 int lo_hash; /* (c) Used to lock the appropriate chain */ 205 struct sx lock; member 220 * lock that prevents the lock from being granted and also to each [all …]
|
H A D | kern_rangelock.c | 36 #include <sys/lock.h> 64 * Lock is in cheat mode when RL_CHEAT_CHEATING bit is set in the in rlqentry_free() 65 * lock->head. Special cookies are returned in this mode, and in rlqentry_free() 86 rangelock_cheat_drain(struct rangelock *lock) 92 v = atomic_load_ptr(&lock->head); in ranges_overlap() 95 sleepq_add(&lock->head, NULL, "ranged1", 0, 0); in ranges_overlap() 96 sleepq_wait(&lock->head, PRI_USER); in ranges_overlap() 97 sleepq_lock(&lock->head); in ranges_overlap() 99 sleepq_release(&lock->head); 104 rangelock_cheat_lock(struct rangelock *lock, in in rangelock_calc_block() 71 rangelock_init(struct rangelock * lock) rangelock_init() argument 79 rangelock_destroy(struct rangelock * lock) rangelock_destroy() argument 103 rangelock_calc_block(struct rangelock * lock) rangelock_calc_block() argument 140 rangelock_unlock_locked(struct rangelock * lock,struct rl_q_entry * entry,struct mtx * ilk,bool do_calc_block) rangelock_unlock_locked() argument 176 rangelock_unlock(struct rangelock * lock,void * cookie,struct mtx * ilk) rangelock_unlock() argument 189 rangelock_unlock_range(struct rangelock * lock,void * cookie,off_t start,off_t end,struct mtx * ilk) rangelock_unlock_range() argument 217 rangelock_enqueue(struct rangelock * lock,off_t start,off_t end,int mode,struct mtx * ilk,bool trylock) rangelock_enqueue() argument 271 rangelock_rlock(struct rangelock * lock,off_t start,off_t end,struct mtx * ilk) rangelock_rlock() argument 278 rangelock_tryrlock(struct rangelock * lock,off_t start,off_t end,struct mtx * ilk) rangelock_tryrlock() argument 286 rangelock_wlock(struct rangelock * lock,off_t start,off_t end,struct mtx * ilk) rangelock_wlock() argument 293 rangelock_trywlock(struct rangelock * lock,off_t start,off_t end,struct mtx * ilk) rangelock_trywlock() argument [all...] |
/freebsd-src/sbin/hastd/ |
H A D | synch.h | 48 mtx_init(pthread_mutex_t *lock) __requires_unlocked(*lock) 52 error = pthread_mutex_init(lock, NULL); in mtx_init() 56 mtx_destroy(pthread_mutex_t *lock) __requires_unlocked(*lock) 60 error = pthread_mutex_destroy(lock); in mtx_destroy() 64 mtx_lock(pthread_mutex_t *lock) __locks_exclusive(*lock) 68 error = pthread_mutex_lock(lock); in mtx_lock() 72 mtx_trylock(pthread_mutex_t *lock) __trylocks_exclusiv in mtx_lock() 49 mtx_init(pthread_mutex_t * lock) mtx_init() argument 57 mtx_destroy(pthread_mutex_t * lock) mtx_destroy() argument 65 mtx_lock(pthread_mutex_t * lock) mtx_lock() argument 73 mtx_trylock(pthread_mutex_t * lock) mtx_trylock() argument 82 mtx_unlock(pthread_mutex_t * lock) mtx_unlock() argument 90 mtx_owned(pthread_mutex_t * lock) mtx_owned() argument 97 rw_init(pthread_rwlock_t * lock) rw_init() argument 105 rw_destroy(pthread_rwlock_t * lock) rw_destroy() argument 113 rw_rlock(pthread_rwlock_t * lock) rw_rlock() argument 121 rw_wlock(pthread_rwlock_t * lock) rw_wlock() argument 129 rw_unlock(pthread_rwlock_t * lock) rw_unlock() argument 153 cv_wait(pthread_cond_t * cv,pthread_mutex_t * lock) cv_wait() argument 161 cv_timedwait(pthread_cond_t * cv,pthread_mutex_t * lock,int timeout) cv_timedwait() argument [all...] |
/freebsd-src/share/man/man4/ |
H A D | dtrace_lockstat.4 | 51 .Fn lockstat:::lockmgr-acquire "struct lock *" "int" 52 .Fn lockstat:::lockmgr-release "struct lock *" "int" 53 .Fn lockstat:::lockmgr-disown "struct lock *" "int" 54 .Fn lockstat:::lockmgr-block "struct lock *" "uint64_t" "int" "int" "int" 55 .Fn lockstat:::lockmgr-upgrade "struct lock *" 56 .Fn lockstat:::lockmgr-downgrade "struct lock *" 66 provider contains DTrace probes for inspecting kernel lock 74 lock types. 80 Each type of lock has 84 probes which expose the lock structure being operated upon, [all …]
|
/freebsd-src/crypto/openssl/crypto/ |
H A D | threads_win.c | 35 SRWLOCK lock; member 42 CRYPTO_RWLOCK *lock; in CRYPTO_THREAD_lock_new() local 46 if ((lock = OPENSSL_zalloc(sizeof(CRYPTO_win_rwlock))) == NULL) in CRYPTO_THREAD_lock_new() 48 rwlock = lock; in CRYPTO_THREAD_lock_new() 49 InitializeSRWLock(&rwlock->lock); in CRYPTO_THREAD_lock_new() 52 if ((lock = OPENSSL_zalloc(sizeof(CRITICAL_SECTION))) == NULL) { in CRYPTO_THREAD_lock_new() 59 if (!InitializeCriticalSectionAndSpinCount(lock, 0x400)) { in CRYPTO_THREAD_lock_new() 60 OPENSSL_free(lock); in CRYPTO_THREAD_lock_new() 64 InitializeCriticalSection(lock); in CRYPTO_THREAD_lock_new() 68 return lock; in CRYPTO_THREAD_lock_new() [all …]
|
/freebsd-src/sys/contrib/openzfs/include/os/freebsd/spl/sys/ |
H A D | rwlock.h | 34 #include <sys/lock.h> 60 #define rw_init(lock, desc, type, arg) do { \ argument 63 for (_name = #lock; *_name != '\0'; _name++) { \ 68 _name = #lock; \ 69 sx_init_flags((lock), _name, RW_FLAGS); \ 71 #define rw_destroy(lock) sx_destroy(lock) argument 72 #define rw_enter(lock, how) do { \ argument 74 sx_slock(lock); \ 76 sx_xlock(lock); \ 79 #define rw_tryenter(lock, how) \ argument [all …]
|
/freebsd-src/usr.bin/lockf/ |
H A D | lockf.1 | 30 .Nd execute a command while holding a file lock 45 utility acquires an exclusive lock on a 51 While holding the lock, it executes a 59 releases the lock, and removes the 69 is not considered to constitute a lock. 90 This can be used to lock inside a shell script. 98 This will guarantee lock ordering, as well as implement 104 option is not used, then no guarantees around lock ordering can be made. 109 Causes the lock file to be kept (not removed) after the command 115 Failure to acquire the lock is indicated only in the exit status. [all …]
|
/freebsd-src/contrib/ofed/opensm/include/complib/ |
H A D | cl_passivelock.h | 38 * This file contains the passive lock, which synchronizes passive threads. 39 * The passive lock allows multiple readers to access a resource 58 /****h* Component Library/Passive Lock 60 * Passive Lock 63 * The Passive Lock provides synchronization between multiple threads that 64 * are sharing the lock with a single thread holding the lock exclusively. 66 * Passive lock works exclusively between threads and cannot be used in 69 * The passive lock functions operate a cl_plock_t structure which should 83 /****s* Component Library: Passive Lock/cl_plock_t 88 * Passive Lock structure. [all …]
|
/freebsd-src/contrib/llvm-project/openmp/runtime/src/ |
H A D | kmp_lock.h | 2 * kmp_lock.h -- lock header file 49 // intel archs. It allocates at least 8 bytes for nested lock (more on 67 // lock flags 72 // When a lock table is used, the indices are of kmp_lock_index_t 75 // When memory allocated for locks are on the lock pool (free list), 87 // There are 5 lock implementations: 95 // and 3 lock purposes: 104 // Lock implementations. 108 // Non-nested test and set locks differ from the other lock kinds (except 109 // futex) in that we use the memory allocated by the compiler for the lock, [all …]
|
/freebsd-src/sys/contrib/ck/include/ |
H A D | ck_elide.h | 45 * _busy: Lock was busy 138 * L_P - Lock predicate, returns false if resource is available. 145 ck_elide_##N##_lock_adaptive(T *lock, \ 161 if (L_P(lock) == true) \ 173 if (L_P(lock) == false) \ 187 L(lock); \ 191 ck_elide_##N##_unlock_adaptive(struct ck_elide_stat *st, T *lock) \ 194 if (U_P(lock) == false) { \ 199 U(lock); \ 205 ck_elide_##N##_lock(T *lock) \ [all …]
|