Lines Matching defs:ksem
71 #include <sys/ksem.h>
91 MODULE(MODULE_CLASS_MISC, ksem, NULL);
98 static LIST_HEAD(,ksem) ksem_head __cacheline_aligned;
103 static LIST_HEAD(, ksem) *ksem_pshared_hashtab __cacheline_aligned;
322 ksem_remove_pshared(ksem_t *ksem)
325 LIST_REMOVE(ksem, ks_entry);
333 ksem_t *ksem = NULL;
337 LIST_FOREACH(ksem, &ksem_pshared_hashtab[bucket], ks_entry) {
338 if (ksem->ks_pshared_id == id) {
339 mutex_enter(&ksem->ks_lock);
340 if (ksem->ks_pshared_proc == NULL) {
345 mutex_exit(&ksem->ks_lock);
348 ksem->ks_ref++;
349 KASSERT(ksem->ks_ref != 0);
350 return ksem;
361 ksem_t *ksem = ksem_lookup_pshared_locked(id);
363 return ksem;
367 ksem_alloc_pshared_id(ksem_t *ksem)
372 KASSERT(ksem->ks_pshared_proc != NULL);
385 ksem->ks_pshared_id = try;
386 u_long bucket = KSEM_PSHARED_HASH(ksem->ks_pshared_id);
387 LIST_INSERT_HEAD(&ksem_pshared_hashtab[bucket], ksem, ks_entry);
517 ksem_release(ksem_t *ksem, int fd)
521 KASSERT(mutex_owned(&ksem->ks_lock));
523 KASSERT(ksem->ks_ref > 0);
524 if (--ksem->ks_ref == 0) {
529 destroy = (ksem->ks_flags & KS_UNLINKED) ||
530 (ksem->ks_name == NULL);
532 mutex_exit(&ksem->ks_lock);
535 ksem_free(ksem);