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