BSD 4_4 release
[unix-history] / usr / src / lib / librpc / rpcsvc / klm_prot.x
CommitLineData
ad787160
C
1/* @(#)klm_prot.x 2.1 88/08/01 4.0 RPCSRC */
2/* @(#)klm_prot.x 1.7 87/07/08 Copyr 1987 Sun Micro */
3
4/*
5 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
6 * unrestricted use provided that this legend is included on all tape
7 * media and as a part of the software program in whole or part. Users
8 * may copy or modify Sun RPC without charge, but are not authorized
9 * to license or distribute it to anyone else except as part of a product or
10 * program developed by the user.
11 *
12 * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
13 * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
14 * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
15 *
16 * Sun RPC is provided with no support and without any obligation on the
17 * part of Sun Microsystems, Inc. to assist in its use, correction,
18 * modification or enhancement.
19 *
20 * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
21 * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
22 * OR ANY PART THEREOF.
23 *
24 * In no event will Sun Microsystems, Inc. be liable for any lost revenue
25 * or profits or other special, indirect and consequential damages, even if
26 * Sun has been advised of the possibility of such damages.
27 *
28 * Sun Microsystems, Inc.
29 * 2550 Garcia Avenue
30 * Mountain View, California 94043
31 */
32
33/*
34 * Kernel/lock manager protocol definition
35 * Copyright (C) 1986 Sun Microsystems, Inc.
36 *
37 * protocol used between the UNIX kernel (the "client") and the
38 * local lock manager. The local lock manager is a deamon running
39 * above the kernel.
40 */
41program KLM_PROG {
42 version KLM_VERS {
43
44 klm_testrply KLM_TEST (struct klm_testargs) = 1;
45
46 klm_stat KLM_LOCK (struct klm_lockargs) = 2;
47
48 klm_stat KLM_CANCEL (struct klm_lockargs) = 3;
49 /* klm_granted=> the cancel request fails due to lock is already granted */
50 /* klm_denied=> the cancel request successfully aborts
51lock request */
52
53 klm_stat KLM_UNLOCK (struct klm_unlockargs) = 4;
54 } = 1;
55} = 100020;
56
57const LM_MAXSTRLEN = 1024;
58
59/*
60 * lock manager status returns
61 */
62enum klm_stats {
63 klm_granted = 0, /* lock is granted */
64 klm_denied = 1, /* lock is denied */
65 klm_denied_nolocks = 2, /* no lock entry available */
66 klm_working = 3 /* lock is being processed */
67};
68
69/*
70 * lock manager lock identifier
71 */
72struct klm_lock {
73 string server_name<LM_MAXSTRLEN>;
74 netobj fh; /* a counted file handle */
75 int pid; /* holder of the lock */
76 unsigned l_offset; /* beginning offset of the lock */
77 unsigned l_len; /* byte length of the lock;
78 * zero means through end of file */
79};
80
81/*
82 * lock holder identifier
83 */
84struct klm_holder {
85 bool exclusive; /* FALSE if shared lock */
86 int svid; /* holder of the lock (pid) */
87 unsigned l_offset; /* beginning offset of the lock */
88 unsigned l_len; /* byte length of the lock;
89 * zero means through end of file */
90};
91
92/*
93 * reply to KLM_LOCK / KLM_UNLOCK / KLM_CANCEL
94 */
95struct klm_stat {
96 klm_stats stat;
97};
98
99/*
100 * reply to a KLM_TEST call
101 */
102union klm_testrply switch (klm_stats stat) {
103 case klm_denied:
104 struct klm_holder holder;
105 default: /* All other cases return no arguments */
106 void;
107};
108
109
110/*
111 * arguments to KLM_LOCK
112 */
113struct klm_lockargs {
114 bool block;
115 bool exclusive;
116 struct klm_lock alock;
117};
118
119/*
120 * arguments to KLM_TEST
121 */
122struct klm_testargs {
123 bool exclusive;
124 struct klm_lock alock;
125};
126
127/*
128 * arguments to KLM_UNLOCK
129 */
130struct klm_unlockargs {
131 struct klm_lock alock;
132};