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 */ 41 42 const LM_MAXSTRLEN = 1024; 43 44 /* 45 * lock manager status returns 46 */ 47 enum klm_stats { 48 klm_granted = 0, /* lock is granted */ 49 klm_denied = 1, /* lock is denied */ 50 klm_denied_nolocks = 2, /* no lock entry available */ 51 klm_working = 3 /* lock is being processed */ 52 }; 53 54 /* 55 * lock manager lock identifier 56 */ 57 struct klm_lock { 58 string server_name<LM_MAXSTRLEN>; 59 netobj fh; /* a counted file handle */ 60 int pid; /* holder of the lock */ 61 unsigned l_offset; /* beginning offset of the lock */ 62 unsigned l_len; /* byte length of the lock; 63 * zero means through end of file */ 64 }; 65 66 /* 67 * lock holder identifier 68 */ 69 struct klm_holder { 70 bool exclusive; /* FALSE if shared lock */ 71 int svid; /* holder of the lock (pid) */ 72 unsigned l_offset; /* beginning offset of the lock */ 73 unsigned l_len; /* byte length of the lock; 74 * zero means through end of file */ 75 }; 76 77 /* 78 * reply to KLM_LOCK / KLM_UNLOCK / KLM_CANCEL 79 */ 80 struct klm_stat { 81 klm_stats stat; 82 }; 83 84 /* 85 * reply to a KLM_TEST call 86 */ 87 union klm_testrply switch (klm_stats stat) { 88 case klm_denied: 89 struct klm_holder holder; 90 default: /* All other cases return no arguments */ 91 void; 92 }; 93 94 95 /* 96 * arguments to KLM_LOCK 97 */ 98 struct klm_lockargs { 99 bool block; 100 bool exclusive; 101 struct klm_lock alock; 102 }; 103 104 /* 105 * arguments to KLM_TEST 106 */ 107 struct klm_testargs { 108 bool exclusive; 109 struct klm_lock alock; 110 }; 111 112 /* 113 * arguments to KLM_UNLOCK 114 */ 115 struct klm_unlockargs { 116 struct klm_lock alock; 117 }; 118 119 program KLM_PROG { 120 version KLM_VERS { 121 122 klm_testrply KLM_TEST (struct klm_testargs) = 1; 123 124 klm_stat KLM_LOCK (struct klm_lockargs) = 2; 125 126 klm_stat KLM_CANCEL (struct klm_lockargs) = 3; 127 /* klm_granted=> the cancel request fails due to lock is already granted */ 128 /* klm_denied=> the cancel request successfully aborts 129 lock request */ 130 131 klm_stat KLM_UNLOCK (struct klm_unlockargs) = 4; 132 } = 1; 133 } = 100020; 134 135