/freebsd/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 | 71 struct mtx lock; member 86 extern void ttm_lock_init(struct ttm_lock *lock); 95 extern void ttm_read_unlock(struct ttm_lock *lock); 107 extern int ttm_read_lock(struct ttm_lock *lock, bool interruptible); 124 extern int ttm_read_trylock(struct ttm_lock *lock, bool interruptible); 133 extern void ttm_lock_downgrade(struct ttm_lock *lock); 142 extern void ttm_suspend_lock(struct ttm_lock *lock); 151 extern void ttm_suspend_unlock(struct ttm_lock *lock); 165 extern int ttm_vt_lock(struct ttm_lock *lock, bool interruptible, 177 extern int ttm_vt_unlock(struct ttm_lock *lock); [all …]
|
/freebsd/contrib/unbound/util/ |
H A D | locks.h | 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 101 #define lock_basic_init(lock) LOCKRET(pthread_mutex_init(lock, NULL)) argument 102 #define lock_basic_destroy(lock) LOCKRET(pthread_mutex_destroy(lock)) argument 103 #define lock_basic_lock(lock) LOCKRET(pthread_mutex_lock(lock)) argument 104 #define lock_basic_unlock(lock) LOCKRET(pthread_mutex_unlock(lock)) argument 109 #define lock_rw_init(lock) LOCKRET(pthread_mutex_init(lock, NULL)) argument 110 #define lock_rw_destroy(lock) LOCKRET(pthread_mutex_destroy(lock)) argument 111 #define lock_rw_rdlock(lock) LOCKRET(pthread_mutex_lock(lock)) argument [all …]
|
/freebsd/contrib/ntp/sntp/libevent/ |
H A D | evthread.c | 118 target->lock == cbs->lock && in evthread_set_lock_callbacks() 127 if (cbs->alloc && cbs->free && cbs->lock && cbs->unlock) { in evthread_set_lock_callbacks() 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() 221 EVUTIL_ASSERT(locktype == lock->locktype); in debug_lock_free() 222 EVUTIL_ASSERT(DEBUG_LOCK_SIG == lock->signature); in debug_lock_free() 224 original_lock_fns_.free(lock->lock, in debug_lock_free() [all …]
|
H A D | evthread-internal.h | 96 evthread_lock_fns_.lock(mode, lockvar); \ 129 #define EVLOCK_ASSERT_LOCKED(lock) \ argument 131 if ((lock) && evthread_lock_debugging_enabled_) { \ 132 EVUTIL_ASSERT(evthread_is_debug_lock_held_(lock)); \ 138 static inline int EVLOCK_TRY_LOCK_(void *lock); 140 EVLOCK_TRY_LOCK_(void *lock) in EVLOCK_TRY_LOCK_() argument 142 if (lock && evthread_lock_fns_.lock) { in EVLOCK_TRY_LOCK_() 143 int r = evthread_lock_fns_.lock(EVTHREAD_TRY, lock); in EVLOCK_TRY_LOCK_() 174 #define EVTHREAD_COND_WAIT(cond, lock) \ argument 175 ( (cond) ? evthread_cond_fns_.wait_condition((cond), (lock), NULL) : 0 ) [all …]
|
H A D | evthread_win32.c | 53 CRITICAL_SECTION *lock = mm_malloc(sizeof(CRITICAL_SECTION)); in evthread_win32_lock_create() local 54 if (!lock) in evthread_win32_lock_create() 56 if (InitializeCriticalSectionAndSpinCount(lock, SPIN_COUNT) == 0) { in evthread_win32_lock_create() 57 mm_free(lock); in evthread_win32_lock_create() 60 return lock; in evthread_win32_lock_create() 66 CRITICAL_SECTION *lock = lock_; in evthread_win32_lock_free() local 67 DeleteCriticalSection(lock); in evthread_win32_lock_free() 68 mm_free(lock); in evthread_win32_lock_free() 74 CRITICAL_SECTION *lock = lock_; in evthread_win32_lock() local 76 return ! TryEnterCriticalSection(lock); in evthread_win32_lock() [all …]
|
/freebsd/contrib/libevent/ |
H A D | evthread.c | 118 target->lock == cbs->lock && in evthread_set_lock_callbacks() 127 if (cbs->alloc && cbs->free && cbs->lock && cbs->unlock) { in evthread_set_lock_callbacks() 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() 221 EVUTIL_ASSERT(locktype == lock->locktype); in debug_lock_free() 222 EVUTIL_ASSERT(DEBUG_LOCK_SIG == lock->signature); in debug_lock_free() 224 original_lock_fns_.free(lock->lock, in debug_lock_free() [all …]
|
H A D | evthread-internal.h | 96 evthread_lock_fns_.lock(mode, lockvar); \ 129 #define EVLOCK_ASSERT_LOCKED(lock) \ argument 131 if ((lock) && evthread_lock_debugging_enabled_) { \ 132 EVUTIL_ASSERT(evthread_is_debug_lock_held_(lock)); \ 138 static inline int EVLOCK_TRY_LOCK_(void *lock); 140 EVLOCK_TRY_LOCK_(void *lock) in EVLOCK_TRY_LOCK_() argument 142 if (lock && evthread_lock_fns_.lock) { in EVLOCK_TRY_LOCK_() 143 int r = evthread_lock_fns_.lock(EVTHREAD_TRY, lock); in EVLOCK_TRY_LOCK_() 174 #define EVTHREAD_COND_WAIT(cond, lock) \ argument 175 ( (cond) ? evthread_cond_fns_.wait_condition((cond), (lock), NULL) : 0 ) [all …]
|
/freebsd/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/sys/cddl/compat/opensolaris/sys/ |
H A D | rwlock.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 76 sx_slock(lock); \ [all …]
|
/freebsd/sys/dev/drm2/ |
H A D | drm_lock.c | 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() 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() 76 mtx_unlock(&master->lock.spinlock); in drm_lock() 80 if (!master->lock.hw_lock) { in drm_lock() 87 if (drm_lock_take(&master->lock, lock->context)) { in drm_lock() [all …]
|
/freebsd/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 …]
|
H A D | threads_pthread.c | 48 CRYPTO_RWLOCK *lock; in CRYPTO_THREAD_lock_new() local 50 if ((lock = OPENSSL_zalloc(sizeof(pthread_rwlock_t))) == NULL) { in CRYPTO_THREAD_lock_new() 55 if (pthread_rwlock_init(lock, NULL) != 0) { in CRYPTO_THREAD_lock_new() 56 OPENSSL_free(lock); in CRYPTO_THREAD_lock_new() 61 CRYPTO_RWLOCK *lock; in CRYPTO_THREAD_lock_new() 63 if ((lock = OPENSSL_zalloc(sizeof(pthread_mutex_t))) == NULL) { in CRYPTO_THREAD_lock_new() 80 if (pthread_mutex_init(lock, &attr) != 0) { in CRYPTO_THREAD_lock_new() 82 OPENSSL_free(lock); in CRYPTO_THREAD_lock_new() 89 return lock; in CRYPTO_THREAD_lock_new() 92 __owur int CRYPTO_THREAD_read_lock(CRYPTO_RWLOCK *lock) in CRYPTO_THREAD_read_lock() argument [all …]
|
/freebsd/sys/kern/ |
H A D | kern_rangelock.c | 86 rangelock_cheat_drain(struct rangelock *lock) in rangelock_cheat_drain() argument 92 v = atomic_load_ptr(&lock->head); in rangelock_cheat_drain() 95 sleepq_add(&lock->head, NULL, "ranged1", 0, 0); in rangelock_cheat_drain() 96 sleepq_wait(&lock->head, PRI_USER); in rangelock_cheat_drain() 97 sleepq_lock(&lock->head); in rangelock_cheat_drain() 99 sleepq_release(&lock->head); in rangelock_cheat_drain() 104 rangelock_cheat_lock(struct rangelock *lock, int locktype, bool trylock, in rangelock_cheat_lock() argument 109 v = atomic_load_ptr(&lock->head); in rangelock_cheat_lock() 118 sleepq_lock(&lock->head); in rangelock_cheat_lock() 120 rangelock_cheat_drain(lock); in rangelock_cheat_lock() [all …]
|
H A D | kern_condvar.c | 35 #include <sys/lock.h> 65 #define CV_ASSERT(cvp, lock, td) do { \ argument 69 KASSERT((lock) != NULL, ("%s: lock NULL", __func__)); \ 108 _cv_wait(struct cv *cvp, struct lock_object *lock) in _cv_wait() argument 119 CV_ASSERT(cvp, lock, td); in _cv_wait() 120 WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, lock, in _cv_wait() 135 class = LOCK_CLASS(lock); in _cv_wait() 140 if (lock == &Giant.lock_object) in _cv_wait() 144 sleepq_add(cvp, lock, cv in _cv_wait() 171 _cv_wait_unlock(struct cv * cvp,struct lock_object * lock) _cv_wait_unlock() argument 228 _cv_wait_sig(struct cv * cvp,struct lock_object * lock) _cv_wait_sig() argument 296 _cv_timedwait_sbt(struct cv * cvp,struct lock_object * lock,sbintime_t sbt,sbintime_t pr,int flags) _cv_timedwait_sbt() argument 366 _cv_timedwait_sig_sbt(struct cv * cvp,struct lock_object * lock,sbintime_t sbt,sbintime_t pr,int flags) _cv_timedwait_sig_sbt() argument [all...] |
H A D | kern_lockf.c | 205 struct sx lock; member 286 sx_init(&lf_lock_owners[i].lock, "lock owners lock"); in lf_init() 343 sx_xlock(&lf_lock_owners[lo->lo_hash].lock); in lf_alloc_lock() 345 sx_xunlock(&lf_lock_owners[lo->lo_hash].lock); in lf_alloc_lock() 353 lf_free_lock(struct lockf_entry *lock) in lf_free_lock() argument 357 KASSERT(lock->lf_refs > 0, ("lockf_entry negative ref count %p", lock)); in lf_free_lock() 358 if (--lock->lf_refs > 0) in lf_free_lock() 365 struct lock_owner *lo = lock->lf_owner; in lf_free_lock() 367 KASSERT(LIST_EMPTY(&lock->lf_outedges), in lf_free_lock() 369 KASSERT(LIST_EMPTY(&lock->lf_inedges), in lf_free_lock() [all …]
|
/freebsd/sys/contrib/openzfs/include/os/freebsd/spl/sys/ |
H A D | rwlock.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 80 ((how) == RW_READER ? sx_try_slock(lock) : sx_try_xlock(lock)) [all …]
|
H A D | mutex.h | 54 #define mutex_init(lock, desc, type, arg) do { \ argument 57 for (_name = #lock; *_name != '\0'; _name++) { \ 62 _name = #lock; \ 63 sx_init_flags((lock), _name, MUTEX_FLAGS); \ 65 #define mutex_destroy(lock) sx_destroy(lock) argument 66 #define mutex_enter(lock) sx_xlock(lock) argument 67 #define mutex_enter_interruptible(lock) sx_xlock_sig(lock) argument 68 #define mutex_enter_nested(lock, type) sx_xlock(lock) argument 69 #define mutex_tryenter(lock) sx_try_xlock(lock) argument 70 #define mutex_exit(lock) sx_xunlock(lock) argument [all …]
|
/freebsd/sys/sys/ |
H A D | lock.h | 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_t how); 66 int (*lc_owner)(const struct lock_object *lock, 68 uintptr_t (*lc_unlock)(struct lock_object *lock); 69 int (*lc_trylock)(struct lock_object *lock, uintptr_t how); 97 #define LO_CLASSINDEX(lock) ((((lock)->lo_flags) & LO_CLASSMASK) >> LO_CLASSSHIFT) argument 98 #define LOCK_CLASS(lock) (lock_classes[LO_CLASSINDEX((lock))]) argument 240 int witness_is_owned(const struct lock_object *lock); 258 #define WITNESS_INIT(lock, type) \ argument [all …]
|
H A D | condvar.h | 51 void _cv_wait(struct cv *cvp, struct lock_object *lock); 52 void _cv_wait_unlock(struct cv *cvp, struct lock_object *lock); 53 int _cv_wait_sig(struct cv *cvp, struct lock_object *lock); 54 int _cv_timedwait_sbt(struct cv *cvp, struct lock_object *lock, 56 int _cv_timedwait_sig_sbt(struct cv *cvp, struct lock_object *lock, 62 #define cv_wait(cvp, lock) \ argument 63 _cv_wait((cvp), &(lock)->lock_object) 64 #define cv_wait_unlock(cvp, lock) \ argument 65 _cv_wait_unlock((cvp), &(lock)->lock_object) 66 #define cv_wait_sig(cvp, lock) \ argument [all …]
|
/freebsd/lib/libthr/thread/ |
H A D | thr_pspinlock.c | 53 _pthread_spin_init(pthread_spinlock_t *lock, int pshared) in _pthread_spin_init() argument 57 if (lock == NULL) in _pthread_spin_init() 64 *lock = lck; in _pthread_spin_init() 66 lck = __thr_pshared_offpage(lock, 1); in _pthread_spin_init() 69 *lock = THR_PSHARED_PTR; in _pthread_spin_init() 78 _pthread_spin_destroy(pthread_spinlock_t *lock) in _pthread_spin_destroy() argument 83 if (lock == NULL || *lock == NULL) { in _pthread_spin_destroy() 85 } else if (*lock == THR_PSHARED_PTR) { in _pthread_spin_destroy() 86 l = __thr_pshared_offpage(lock, 0); in _pthread_spin_destroy() 91 free(*lock); in _pthread_spin_destroy() [all …]
|
/freebsd/sys/contrib/ck/include/spinlock/ |
H A D | anderson.h | 58 ck_spinlock_anderson_init(struct ck_spinlock_anderson *lock, in ck_spinlock_anderson_init() argument 71 lock->slots = slots; in ck_spinlock_anderson_init() 72 lock->count = count; in ck_spinlock_anderson_init() 73 lock->mask = count - 1; in ck_spinlock_anderson_init() 74 lock->next = 0; in ck_spinlock_anderson_init() 82 lock->wrap = (UINT_MAX % count) + 1; in ck_spinlock_anderson_init() 84 lock->wrap = 0; in ck_spinlock_anderson_init() 91 ck_spinlock_anderson_locked(struct ck_spinlock_anderson *lock) in ck_spinlock_anderson_locked() argument 96 position = ck_pr_load_uint(&lock->next) & lock->mask; in ck_spinlock_anderson_locked() 97 r = ck_pr_load_uint(&lock->slots[position].locked); in ck_spinlock_anderson_locked() [all …]
|
/freebsd/sys/compat/linuxkpi/common/include/linux/ |
H A D | rwlock.h | 33 #include <sys/lock.h> 43 #define read_lock_irq(lock) read_lock((lock)) 44 #define read_unlock_irq(lock) read_unlock((lock)) 45 #define write_lock_irq(lock) write_lock((lock)) argument 46 #define write_unlock_irq(lock) write_unlock((lock)) argument 47 #define read_lock_irqsave(lock, flag argument 48 write_unlock_irq(lock) global() argument 49 read_lock_irqsave(lock,flags) global() argument 51 write_lock_irqsave(lock,flags) global() argument 53 read_unlock_irqrestore(lock,flags) global() argument 55 write_unlock_irqrestore(lock,flags) global() argument 59 rwlock_init(rwlock_t * lock) rwlock_init() argument [all...] |
/freebsd/contrib/openbsm/bin/auditdistd/ |
H A D | synch.h | 49 mtx_init(pthread_mutex_t *lock) in mtx_init() argument 53 error = pthread_mutex_init(lock, NULL); in mtx_init() 57 mtx_destroy(pthread_mutex_t *lock) in mtx_destroy() argument 61 error = pthread_mutex_destroy(lock); in mtx_destroy() 65 mtx_lock(pthread_mutex_t *lock) in mtx_lock() argument 69 error = pthread_mutex_lock(lock); in mtx_lock() 73 mtx_trylock(pthread_mutex_t *lock) in mtx_trylock() argument 77 error = pthread_mutex_trylock(lock); in mtx_trylock() 82 mtx_unlock(pthread_mutex_t *lock) in mtx_unlock() argument 86 error = pthread_mutex_unlock(lock); in mtx_unlock() [all …]
|
/freebsd/sys/contrib/openzfs/cmd/zed/ |
H A D | zed_file.c | 34 struct flock lock; in zed_file_lock() local 40 lock.l_type = F_WRLCK; in zed_file_lock() 41 lock.l_whence = SEEK_SET; in zed_file_lock() 42 lock.l_start = 0; in zed_file_lock() 43 lock.l_len = 0; in zed_file_lock() 45 if (fcntl(fd, F_SETLK, &lock) < 0) { in zed_file_lock() 61 struct flock lock; in zed_file_unlock() local 67 lock.l_type = F_UNLCK; in zed_file_unlock() 68 lock.l_whence = SEEK_SET; in zed_file_unlock() 69 lock.l_start = 0; in zed_file_unlock() [all …]
|