Resource locking.
This header defines an interface to the locking features of the BBS. Locks are implemented with the aid of the lock daemon, which listens to commands on a socket.Lockd requests are strings sent to the daemon's socket. They look like this:
MAKE foo 42 bar Creates lock "foo" with info "bar" for PID 42 CHCK foo 42 Checks for the presence of lock "foo" (we're PID 42) KILL foo 42 Removes lock "foo" on behalf of process with PID 42Results are integers in decimal (matching the LKR_ constants below) followed by a string. A positive result code denotes the PID of a process holding the lock. In this case, the result code is followed by a string containing the info field of the lock. Negative result codes denote error conditions.
All this is slightly academic, though. The details of the transactions with the daemon are hidden from the user.
Original banner, legalese and change history follow.
***************************************************************************** ** ** ** FILE: lock.h ** ** AUTHORS: Alexios ** ** REVISION: A, August 94 ** ** PURPOSE: Interface to lock.c ** ** NOTES: ** ** LEGALESE: ** ** ** ** This program is free software; you can redistribute it and/or modify ** ** it under the terms of the GNU General Public License as published by ** ** the Free Software Foundation; either version 2 of the License, or (at ** ** your option) any later version. ** ** ** ** This program is distributed in the hope that it will be useful, but ** ** WITHOUT ANY WARRANTY; without even the implied warranty of ** ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** ** General Public License for more details. ** ** ** ** You should have received a copy of the GNU General Public License ** ** along with this program; if not, write to the Free Software ** ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ** ** ** ***************************************************************************** * * $Id: lock.h,v 1.3 2001/04/22 14:49:04 alexios Exp $ * * $Log: lock.h,v $ * Revision 1.3 2001/04/22 14:49:04 alexios * Merged in leftover 0.99.2 changes and additional bug fixes. * * Revision 0.3 1998/12/27 15:19:19 alexios * Rationalised locking to allow bbslockd to do all our * locking for us. * * Revision 0.2 1997/11/06 20:03:39 alexios * Added GPL legalese to the top of this file. * * Revision 0.1 1997/08/26 15:48:53 alexios * First registered revision. Adequate. * * *