Home
last modified time | relevance | path

Searched refs:lock (Results 1 – 25 of 1763) sorted by relevance

12345678910>>...71

/src/sys/dev/drm2/ttm/
H A Dttm_lock.c48 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 …]
/src/contrib/unbound/util/
H A Dlocks.h86 #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 …]
/src/crypto/openssl/crypto/
H A Dthreads_win.c41 SRWLOCK lock; member
59 CRYPTO_RCU_LOCK *lock; member
126 static struct rcu_qp *allocate_new_qp_group(struct rcu_lock_st *lock, in allocate_new_qp_group() argument
131 lock->group_count = count; in allocate_new_qp_group()
183 void ossl_rcu_lock_free(CRYPTO_RCU_LOCK *lock) in ossl_rcu_lock_free() argument
185 CRYPTO_THREAD_lock_free(lock->rw_lock); in ossl_rcu_lock_free()
186 OPENSSL_free(lock->qp_group); in ossl_rcu_lock_free()
187 ossl_crypto_condvar_free(&lock->alloc_signal); in ossl_rcu_lock_free()
188 ossl_crypto_condvar_free(&lock->prior_signal); in ossl_rcu_lock_free()
189 ossl_crypto_mutex_free(&lock->alloc_lock); in ossl_rcu_lock_free()
[all …]
H A Dthreads_pthread.c197 CRYPTO_RCU_LOCK *lock; member
262 static struct rcu_qp *get_hold_current_qp(struct rcu_lock_st *lock) in get_hold_current_qp() argument
268 qp_idx = ATOMIC_LOAD_N(uint32_t, &lock->reader_idx, __ATOMIC_RELAXED); in get_hold_current_qp()
281 ATOMIC_ADD_FETCH(&lock->qp_group[qp_idx].users, (uint64_t)1, in get_hold_current_qp()
285 if (qp_idx == ATOMIC_LOAD_N(uint32_t, &lock->reader_idx, __ATOMIC_ACQUIRE)) in get_hold_current_qp()
288 ATOMIC_SUB_FETCH(&lock->qp_group[qp_idx].users, (uint64_t)1, in get_hold_current_qp()
292 return &lock->qp_group[qp_idx]; in get_hold_current_qp()
305 void ossl_rcu_read_lock(CRYPTO_RCU_LOCK *lock) in ossl_rcu_read_lock() argument
309 CRYPTO_THREAD_LOCAL *lkey = ossl_lib_ctx_get_rcukey(lock->ctx); in ossl_rcu_read_lock()
321 ossl_init_thread_start(NULL, lock->ctx, ossl_rcu_free_local_data); in ossl_rcu_read_lock()
[all …]
H A Dthreads_none.c30 struct rcu_lock_st *lock; in ossl_rcu_lock_new() local
32 lock = OPENSSL_zalloc(sizeof(*lock)); in ossl_rcu_lock_new()
33 return lock; in ossl_rcu_lock_new()
36 void ossl_rcu_lock_free(CRYPTO_RCU_LOCK *lock) in ossl_rcu_lock_free() argument
38 OPENSSL_free(lock); in ossl_rcu_lock_free()
41 void ossl_rcu_read_lock(CRYPTO_RCU_LOCK *lock) in ossl_rcu_read_lock() argument
46 void ossl_rcu_write_lock(CRYPTO_RCU_LOCK *lock) in ossl_rcu_write_lock() argument
51 void ossl_rcu_write_unlock(CRYPTO_RCU_LOCK *lock) in ossl_rcu_write_unlock() argument
56 void ossl_rcu_read_unlock(CRYPTO_RCU_LOCK *lock) in ossl_rcu_read_unlock() argument
61 void ossl_synchronize_rcu(CRYPTO_RCU_LOCK *lock) in ossl_synchronize_rcu() argument
[all …]
/src/contrib/unbound/testcode/
H A Dchecklocks.c91 static void lock_error(struct checked_lock* lock, const char* func,
95 static void lock_error(struct checked_lock* lock, in lock_error() argument
99 log_err("Created at %s %s:%d", lock->create_func, in lock_error()
100 lock->create_file, lock->create_line); in lock_error()
101 if(lock->holder_func && lock->holder_file) in lock_error()
102 log_err("Previously %s %s:%d", lock->holder_func, in lock_error()
103 lock->holder_file, lock->holder_line); in lock_error()
106 (lock->type==check_lock_mutex)?"mutex": ( in lock_error()
107 (lock->type==check_lock_spinlock)?"spinlock": ( in lock_error()
108 (lock->type==check_lock_rwlock)?"rwlock": "badtype")), err); in lock_error()
[all …]
/src/contrib/libevent/
H A Devthread.c118 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 Devthread-internal.h96 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 …]
/src/contrib/ntp/sntp/libevent/
H A Devthread.c118 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 Devthread-internal.h96 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 …]
/src/crypto/heimdal/lib/hx509/
H A Dlock.c60 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 …]
/src/sys/cddl/compat/opensolaris/sys/
H A Drwlock.h59 #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 …]
/src/sys/dev/drm2/
H A Ddrm_lock.c58 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 …]
/src/sys/contrib/openzfs/include/os/freebsd/spl/sys/
H A Drwlock.h61 #define rw_init(lock, desc, type, arg) do { \ argument
64 for (_name = #lock; *_name != '\0'; _name++) { \
69 _name = #lock; \
70 sx_init_flags((lock), _name, RW_FLAGS); \
72 #define rw_destroy(lock) sx_destroy(lock) argument
73 #define rw_enter(lock, how) do { \ argument
75 sx_slock(lock); \
77 sx_xlock(lock); \
80 #define rw_tryenter(lock, how) \ argument
81 ((how) == RW_READER ? sx_try_slock(lock) : sx_try_xlock(lock))
[all …]
H A Dmutex.h55 #define mutex_init(lock, desc, type, arg) do { \ argument
58 for (_name = #lock; *_name != '\0'; _name++) { \
63 _name = #lock; \
64 sx_init_flags((lock), _name, MUTEX_FLAGS); \
66 #define mutex_destroy(lock) sx_destroy(lock) argument
67 #define mutex_enter(lock) sx_xlock(lock) argument
68 #define mutex_enter_interruptible(lock) sx_xlock_sig(lock) argument
69 #define mutex_enter_nested(lock, type) sx_xlock(lock) argument
70 #define mutex_tryenter(lock) sx_try_xlock(lock) argument
71 #define mutex_exit(lock) sx_xunlock(lock) argument
[all …]
/src/sbin/hastd/
H A Dsynch.h48 mtx_init(pthread_mutex_t *lock) __requires_unlocked(*lock) in mtx_init() argument
52 error = pthread_mutex_init(lock, NULL); in mtx_init()
56 mtx_destroy(pthread_mutex_t *lock) __requires_unlocked(*lock) in mtx_destroy() argument
60 error = pthread_mutex_destroy(lock); in mtx_destroy()
64 mtx_lock(pthread_mutex_t *lock) __locks_exclusive(*lock) in mtx_lock() argument
68 error = pthread_mutex_lock(lock); in mtx_lock()
72 mtx_trylock(pthread_mutex_t *lock) __trylocks_exclusive(true, *lock) in mtx_trylock() argument
76 error = pthread_mutex_trylock(lock); in mtx_trylock()
81 mtx_unlock(pthread_mutex_t *lock) __unlocks(*lock) in mtx_unlock() argument
85 error = pthread_mutex_unlock(lock); in mtx_unlock()
[all …]
/src/sys/kern/
H A Dkern_rangelock.c86 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 Dkern_condvar.c65 #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, cvp->cv_description, SLEEPQ_CONDVAR, 0); in _cv_wait()
145 if (lock != &Giant.lock_object) { in _cv_wait()
148 WITNESS_SAVE(lock, lock_witness); in _cv_wait()
[all …]
H A Dkern_lockf.c205 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 …]
/src/sys/sys/
H A Dlock.h63 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 …]
/src/lib/libthr/thread/
H A Dthr_pspinlock.c53 _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 …]
/src/sys/contrib/ck/include/spinlock/
H A Danderson.h58 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 …]
/src/contrib/openbsm/bin/auditdistd/
H A Dsynch.h49 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 …]
/src/sys/contrib/openzfs/cmd/zed/
H A Dzed_file.c35 struct flock lock; in zed_file_lock() local
41 lock.l_type = F_WRLCK; in zed_file_lock()
42 lock.l_whence = SEEK_SET; in zed_file_lock()
43 lock.l_start = 0; in zed_file_lock()
44 lock.l_len = 0; in zed_file_lock()
46 if (fcntl(fd, F_SETLK, &lock) < 0) { in zed_file_lock()
62 struct flock lock; in zed_file_unlock() local
68 lock.l_type = F_UNLCK; in zed_file_unlock()
69 lock.l_whence = SEEK_SET; in zed_file_unlock()
70 lock.l_start = 0; in zed_file_unlock()
[all …]
/src/sys/compat/linuxkpi/common/include/linux/
H A Drwlock.h43 #define read_lock_irq(lock) read_lock((lock)) argument
44 #define read_unlock_irq(lock) read_unlock((lock)) argument
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, flags) \ argument
48 do {(flags) = 0; read_lock(lock); } while (0)
49 #define write_lock_irqsave(lock, flags) \ argument
50 do {(flags) = 0; write_lock(lock); } while (0)
51 #define read_unlock_irqrestore(lock, flags) \ argument
52 do { read_unlock(lock); } while (0)
[all …]

12345678910>>...71