Patch to remove segfault on the exiting of a service.
[openais.git] / include / ipc_lck.h
blob682bf1c9473b3ce6cc87bd7560b0de2ad191f31d
1 /*
2 * Copyright (c) 2002-2005 MontaVista Software, Inc.
3 * Copyright (c) 2006 Sun Microsystems, Inc.
5 * All rights reserved.
7 * Author: Steven Dake (sdake@mvista.com)
9 * This software licensed under BSD license, the text of which follows:
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions are met:
14 * - Redistributions of source code must retain the above copyright notice,
15 * this list of conditions and the following disclaimer.
16 * - Redistributions in binary form must reproduce the above copyright notice,
17 * this list of conditions and the following disclaimer in the documentation
18 * and/or other materials provided with the distribution.
19 * - Neither the name of the MontaVista Software, Inc. nor the names of its
20 * contributors may be used to endorse or promote products derived from this
21 * software without specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
33 * THE POSSIBILITY OF SUCH DAMAGE.
35 #ifndef IPC_LCK_H_DEFINED
36 #define IPC_LCK_H_DEFINED
38 #include "saAis.h"
39 #include "saLck.h"
40 #include "ipc_gen.h"
41 #include "swab.h"
43 enum req_lib_lck_resource_types {
44 MESSAGE_REQ_LCK_RESOURCEOPEN = 0,
45 MESSAGE_REQ_LCK_RESOURCEOPENASYNC = 1,
46 MESSAGE_REQ_LCK_RESOURCECLOSE = 2,
47 MESSAGE_REQ_LCK_RESOURCELOCK = 3,
48 MESSAGE_REQ_LCK_RESOURCELOCKASYNC = 4,
49 MESSAGE_REQ_LCK_RESOURCEUNLOCK = 5,
50 MESSAGE_REQ_LCK_RESOURCEUNLOCKASYNC = 6,
51 MESSAGE_REQ_LCK_LOCKPURGE = 7,
54 enum res_lib_lck_resource_types {
55 MESSAGE_RES_LCK_RESOURCEOPEN = 0,
56 MESSAGE_RES_LCK_RESOURCEOPENASYNC = 1,
57 MESSAGE_RES_LCK_RESOURCECLOSE = 2,
58 MESSAGE_RES_LCK_RESOURCELOCK = 3,
59 MESSAGE_RES_LCK_RESOURCELOCKASYNC = 4,
60 MESSAGE_RES_LCK_RESOURCEUNLOCK = 5,
61 MESSAGE_RES_LCK_RESOURCEUNLOCKASYNC = 6,
62 MESSAGE_RES_LCK_LOCKPURGE = 7,
63 MESSAGE_RES_LCK_LOCKWAITERCALLBACK = 8
66 struct req_lib_lck_resourceopen {
67 mar_req_header_t header;
68 SaInvocationT invocation;
69 mar_name_t lockResourceName;
70 SaLckResourceOpenFlagsT resourceOpenFlags;
71 SaLckResourceHandleT resourceHandle;
72 SaTimeT timeout;
73 int async_call;
76 struct res_lib_lck_resourceopen {
77 mar_res_header_t header;
78 SaLckResourceHandleT resourceHandle;
79 mar_message_source_t source;
82 struct res_lib_lck_resourceopenasync {
83 mar_res_header_t header;
84 SaInvocationT invocation;
85 SaLckResourceHandleT resourceHandle;
86 mar_message_source_t source;
89 struct req_lib_lck_resourceclose {
90 mar_req_header_t header;
91 mar_name_t lockResourceName;
92 SaLckResourceHandleT resourceHandle;
95 struct res_lib_lck_resourceclose {
96 mar_res_header_t header;
99 struct req_lib_lck_resourcelock {
100 mar_req_header_t header;
101 mar_name_t lockResourceName;
102 SaInvocationT invocation;
103 SaLckLockModeT lockMode;
104 SaLckLockFlagsT lockFlags;
105 SaLckWaiterSignalT waiterSignal;
106 SaTimeT timeout;
107 SaLckLockIdT lockId;
108 int async_call;
109 mar_message_source_t source;
110 SaLckResourceHandleT resourceHandle;
113 static inline void swab_req_lib_lck_resourcelock (
114 struct req_lib_lck_resourcelock *to_swab)
116 swab_mar_req_header_t (&to_swab->header);
117 swab_mar_name_t (&to_swab->lockResourceName);
118 to_swab->invocation = swab64 (to_swab->invocation);
119 to_swab->lockMode = swab64 (to_swab->lockMode);
120 to_swab->lockFlags = swab32 (to_swab->lockFlags);
121 to_swab->waiterSignal = swab64 (to_swab->waiterSignal);
122 to_swab->timeout = swab64 (to_swab->timeout);
123 to_swab->lockId = swab64 (to_swab->lockId);
124 to_swab->async_call = swab32 (to_swab->async_call);
125 swab_mar_message_source_t (&to_swab->source);
126 to_swab->resourceHandle = swab64 (to_swab->resourceHandle);
129 struct res_lib_lck_resourcelock {
130 mar_res_header_t header;
131 SaLckLockStatusT lockStatus;
132 void *resource_lock;
135 struct res_lib_lck_resourcelockasync {
136 mar_res_header_t header;
137 SaLckLockStatusT lockStatus;
138 SaLckLockIdT lockId;
139 void *resource_lock;
140 SaInvocationT invocation;
141 SaLckResourceHandleT resourceHandle;
144 struct req_lib_lck_resourceunlock {
145 mar_req_header_t header;
146 mar_name_t lockResourceName;
147 SaLckLockIdT lockId;
148 SaInvocationT invocation;
149 SaTimeT timeout;
150 int async_call;
151 void *resource_lock;
154 struct res_lib_lck_resourceunlock {
155 mar_res_header_t header;
158 struct res_lib_lck_resourceunlockasync {
159 mar_res_header_t header;
160 SaInvocationT invocation;
161 SaLckLockIdT lockId;
164 struct req_lib_lck_lockpurge {
165 mar_req_header_t header;
166 mar_name_t lockResourceName;
169 static inline void swab_req_lib_lck_lockpurge (
170 struct req_lib_lck_lockpurge *to_swab)
172 swab_mar_req_header_t (&to_swab->header);
173 swab_mar_name_t (&to_swab->lockResourceName);
176 struct res_lib_lck_lockpurge {
177 mar_res_header_t header;
180 struct res_lib_lck_lockwaitercallback {
181 mar_res_header_t header;
182 SaLckWaiterSignalT waiter_signal;
183 SaLckLockIdT lock_id;
184 SaLckLockModeT mode_held;
185 SaLckLockModeT mode_requested;
188 #endif /* IPC_LCK_H_DEFINED */