1
LOCK FILE PROTOCOL (LFP)
6
This memo is a proposed specification for the Lock File Protocol (LPF).
7
Distribution of this memo is currently limited.
9
The following commands are currently in this edition of this specification.
11
LOCK (lock a resource), UNLOCK (unlock a resource), QUIT (disconnect)
16
The objectives of LPF are 1) to make administration of machines with a
17
large number of users easier 2) to encourage a common mechanism for
18
applications to share resources 3) to provide a platform neutral
19
interface for applications.
21
This specification tries to outline the minimal required features for
26
Lock files can be located in as many as 10 different directories depending
27
on the OS. Writing applications that handle all of the lock directories
28
is redundant and error prone.
30
By enabling three commands much of the redundant work can be eliminated and
31
a common locking scheme can be used. The end result is a consistant easy
36
Lock files have been used for a long time. For more information on
39
The File System Hierarchy Standard
40
http://www.pathname.com/fhs/
42
http://docs.freebsd.org/info/uucp/uucp.info.UUCP_Lock_Files.html
44
ftp://tsx-11.mit.edu/pub/linux/docs/linux-standards/fsstnd/
45
Proposed Changes to the File System Hierarchy Standard
46
ftp://scicom.alphacdc.com/pub/linux/devlock-0.X.tgz
47
"UNIX Network Programming", W. Richard Stevens,
48
Prentice-Hall, 1990, pages 96-101.
60
directory<----->Server<-----Client<---->User
67
4.1.1 ACCEESS CONTROL COMMANDS
69
QUIT The session is ended.
71
4.1.2 LOCK FILE CONTROL COMMANDS
73
LOCK If the device that is trying to be locked and the pid of the
74
requesting application are passed, an attempt will be made to
77
UNLOCK If the pid of the application requesting to unlock a device
78
is passed an attempt will be made to unlock the device.
80
Lock File Protocol January 2001
84
The following replies exist and try to follow the same format as FTP
85
reply commands (rfc 959)
88
202 Command not implemented
89
220 hostname Lock File Server (Version rxtx-1.5-9) ready
90
221 Thank you for using the Lock File service on hostname
92
500 'command': command not understood
93
550 : Permission denied.
95
5. DECLARATIVE SPECIFICATIONS
96
5.1 Minimum IMPLEMENTATION
98
The following commands must be in a minimum implementation
103
Currently on connections assisted by inetd are supported.
104
Though not official, LFP currently listens on port 50001.
105
Only connections from localhost should be allowed.
111
The following are the LFP COMMANDS
114
LOCK <SP> <device> <sp> <pid> <CRLF>
115
UNLOCK <SP> <device> <sp> <pid> <CRLF>
117
5.3.2 LFP COMMAND ARGUMENTS
119
<device> ::= <string>
120
<pid> ::= any decimal integer
122
5.4. SEQUENCING OF COMMANDS AND REPLIES
124
Connection Establisment
134
Here we present state diagrams for a very simple minded LFP
135
implementation. Only the first digit of the reply codes is used.
136
There is one state diagram for each group of LFP commands or command
139
The command groupings were determined by constructing a model for
140
each command then collecting together the commands with structurally
143
For each command or command sequence there are three possible
144
outcomes: success (S), failure (F), and error (E). In the state
145
diagrams below we use the symbol B for "begin", and the symbol W for
148
Lock File Protocol January 2001
150
We present the diagram that represents the largest group of LFP
157
+---+ cmd +---+ 2 +---+
158
| B |---------->| W |---------->| S |
165
This diagram models the commands:
170
7. TYPICAL LFP SCENARIO
172
$ telnet 127.0.0.1 50001
174
Connected to 127.0.0.1.
175
Escape character is '^]'.
178
unlock /dev/ttyS1 1234
181
221 Thank you for using the Lock File Service on servertrent.korpivaara.org.
182
Connection closed by foreign host.