File locking in Linux

Table of contents Introduction Advisory locking Common features Differing features File descriptors and i-nodes BSD locks (flock) POSIX record locks (fcntl) lockf function Open file description locks (fcntl) Emulating Open file description locks Test program Command-line tools Mandatory locking Example usage Introduction File …

Reusing UNIX domain socket (SO_REUSEADDR for AF_UNIX)

Unix domain sockets are a networkless version of Internet sockets. They have several advantages: Unix domain sockets are files, so file-system permissions may be used for them when one end is closed (e.g. process exits), SIGPIPE is delivered to another end performance may be up to 2x better See details here. Lack of SO_REUSEADDR …