Dr Andrew Scott G7VAV

My photo
 
June 2025
Mo Tu We Th Fr Sa Su
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 1 2 3 4 5 6


klm_prot.x
001: /* @(#)klm_prot.x       2.1 88/08/01 4.0 RPCSRC */
002: 
003: /*
004:  * Kernel/lock manager protocol definition
005:  * Copyright (c) 2010, Oracle America, Inc.
006:  *
007:  * Redistribution and use in source and binary forms, with or without
008:  * modification, are permitted provided that the following conditions are
009:  * met:
010:  *
011:  *     * Redistributions of source code must retain the above copyright
012:  *       notice, this list of conditions and the following disclaimer.
013:  *     * Redistributions in binary form must reproduce the above
014:  *       copyright notice, this list of conditions and the following
015:  *       disclaimer in the documentation and/or other materials
016:  *       provided with the distribution.
017:  *     * Neither the name of the "Oracle America, Inc." nor the names of its
018:  *       contributors may be used to endorse or promote products derived
019:  *       from this software without specific prior written permission.
020:  *
021:  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
022:  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
023:  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
024:  *   FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
025:  *   COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
026:  *   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
027:  *   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
028:  *   GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
029:  *   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
030:  *   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
031:  *   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
032:  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
033:  *
034:  * protocol used between the UNIX kernel (the "client") and the
035:  * local lock manager.  The local lock manager is a deamon running
036:  * above the kernel.
037:  */
038: 
039: const   LM_MAXSTRLEN = 1024;
040: 
041: /*
042:  * lock manager status returns
043:  */
044: enum klm_stats {
045:         klm_granted = 0,        /* lock is granted */
046:         klm_denied = 1,         /* lock is denied */
047:         klm_denied_nolocks = 2, /* no lock entry available */
048:         klm_working = 3         /* lock is being processed */
049: };
050: 
051: /*
052:  * lock manager lock identifier
053:  */
054: struct klm_lock {
055:         string server_name<LM_MAXSTRLEN>;
056:         netobj fh;              /* a counted file handle */
057:         int pid;                /* holder of the lock */
058:         unsigned l_offset;      /* beginning offset of the lock */
059:         unsigned l_len;         /* byte length of the lock;
060:                                  * zero means through end of file */
061: };
062: 
063: /*
064:  * lock holder identifier
065:  */
066: struct klm_holder {
067:         bool exclusive;         /* FALSE if shared lock */
068:         int svid;               /* holder of the lock (pid) */
069:         unsigned l_offset;      /* beginning offset of the lock */
070:         unsigned l_len;         /* byte length of the lock;
071:                                  * zero means through end of file */
072: };
073: 
074: /*
075:  * reply to KLM_LOCK / KLM_UNLOCK / KLM_CANCEL
076:  */
077: struct klm_stat {
078:         klm_stats stat;
079: };
080: 
081: /*
082:  * reply to a KLM_TEST call
083:  */
084: union klm_testrply switch (klm_stats stat) {
085:         case klm_denied:
086:                 struct klm_holder holder;
087:         default: /* All other cases return no arguments */
088:                 void;
089: };
090: 
091: 
092: /*
093:  * arguments to KLM_LOCK
094:  */
095: struct klm_lockargs {
096:         bool block;
097:         bool exclusive;
098:         struct klm_lock alock;
099: };
100: 
101: /*
102:  * arguments to KLM_TEST
103:  */
104: struct klm_testargs {
105:         bool exclusive;
106:         struct klm_lock alock;
107: };
108: 
109: /*
110:  * arguments to KLM_UNLOCK
111:  */
112: struct klm_unlockargs {
113:         struct klm_lock alock;
114: };
115: 
116: program KLM_PROG {
117:         version KLM_VERS {
118: 
119:                 klm_testrply    KLM_TEST (struct klm_testargs) =        1;
120: 
121:                 klm_stat        KLM_LOCK (struct klm_lockargs) =        2;
122: 
123:                 klm_stat        KLM_CANCEL (struct klm_lockargs) =      3;
124:                 /* klm_granted=> the cancel request fails due to lock is already granted */
125:                 /* klm_denied=> the cancel request successfully aborts
126: lock request  */
127: 
128:                 klm_stat        KLM_UNLOCK (struct klm_unlockargs) =    4;
129:         } = 1;
130: } = 100020;
131: 


for client (none)
© Andrew Scott 2006 - 2025,
All Rights Reserved
http://www.andrew-scott.uk/
Andrew Scott
http://www.andrew-scott.co.uk/