MCPcopy Create free account
hub / github.com/F-Stack/f-stack / lockinit

Function lockinit

freebsd/kern/kern_lock.c:430–464  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

428#endif
429
430void
431lockinit(struct lock *lk, int pri, const char *wmesg, int timo, int flags)
432{
433 int iflags;
434
435 MPASS((flags & ~LK_INIT_MASK) == 0);
436 ASSERT_ATOMIC_LOAD_PTR(lk->lk_lock,
437 ("%s: lockmgr not aligned for %s: %p", __func__, wmesg,
438 &lk->lk_lock));
439
440 iflags = LO_SLEEPABLE | LO_UPGRADABLE;
441 if (flags & LK_CANRECURSE)
442 iflags |= LO_RECURSABLE;
443 if ((flags & LK_NODUP) == 0)
444 iflags |= LO_DUPOK;
445 if (flags & LK_NOPROFILE)
446 iflags |= LO_NOPROFILE;
447 if ((flags & LK_NOWITNESS) == 0)
448 iflags |= LO_WITNESS;
449 if (flags & LK_QUIET)
450 iflags |= LO_QUIET;
451 if (flags & LK_IS_VNODE)
452 iflags |= LO_IS_VNODE;
453 if (flags & LK_NEW)
454 iflags |= LO_NEW;
455 iflags |= flags & LK_NOSHARE;
456
457 lock_init(&lk->lock_object, &lock_class_lockmgr, wmesg, NULL, iflags);
458 lk->lk_lock = LK_UNLOCKED;
459 lk->lk_recurse = 0;
460 lk->lk_exslpfail = 0;
461 lk->lk_timo = timo;
462 lk->lk_pri = pri;
463 STACK_ZERO(lk);
464}
465
466/*
467 * XXX: Gross hacks to manipulate external lock flags after

Callers 2

vnode_initFunction · 0.85
mount_initFunction · 0.85

Calls 1

lock_initFunction · 0.85

Tested by

no test coverage detected