How to open a device for exclusive access?

Michael ODonnell michael.odonnell at comcast.net
Fri Jul 13 23:26:56 EDT 2007



One common method is for your servers to
attempt to open() an appropriately named file under
/var/lock/subsystem using O_EXCL|O_CREAT.  If that
fails you can assume another instance is already
running and has already claimed the corresponding /dev
entry.  Remember to delete your lock files on exit...
 


More information about the gnhlug-discuss mailing list