Take an exclusive flock(2) on fd without blocking. True when this process now holds it,
false when another open file description does.
The kernel owns the lock's lifetime: it is released when the last descriptor referring to it
closes, which every way of dying includes. So a holder killed with SIGKILL, or one the OOM
killer takes, leaves no lock behind, and the next acquirer learns the holder is gone from the
kernel rather than inferring it from a recorded pid.
Take an exclusive
flock(2)onfdwithout blocking. True when this process now holds it, false when another open file description does.The kernel owns the lock's lifetime: it is released when the last descriptor referring to it closes, which every way of dying includes. So a holder killed with SIGKILL, or one the OOM killer takes, leaves no lock behind, and the next acquirer learns the holder is gone from the kernel rather than inferring it from a recorded pid.