No empty .Rs/.Re
[netbsd-mini2440.git] / gnu / dist / gdb6 / gdb / osf-share / cma_attr.h
blob389fd6fd207c6a27f20a8313d4ff9effd66ad3f4
1 /*
2 * (c) Copyright 1990-1996 OPEN SOFTWARE FOUNDATION, INC.
3 * (c) Copyright 1990-1996 HEWLETT-PACKARD COMPANY
4 * (c) Copyright 1990-1996 DIGITAL EQUIPMENT CORPORATION
5 * (c) Copyright 1991, 1992 Siemens-Nixdorf Information Systems
6 * To anyone who acknowledges that this file is provided "AS IS" without
7 * any express or implied warranty: permission to use, copy, modify, and
8 * distribute this file for any purpose is hereby granted without fee,
9 * provided that the above copyright notices and this notice appears in
10 * all source code copies, and that none of the names listed above be used
11 * in advertising or publicity pertaining to distribution of the software
12 * without specific, written prior permission. None of these organizations
13 * makes any representations about the suitability of this software for
14 * any purpose.
17 * Header file for attributes object
20 #ifndef CMA_ATTR
21 #define CMA_ATTR
24 * INCLUDE FILES
27 #include <cma_defs.h>
28 #include <cma_queue.h>
29 #ifdef __hpux
30 # include <sys/param.h>
31 #endif
32 #if _CMA_UNIX_TYPE == _CMA__SVR4
33 #include <sys/unistd.h>
34 #endif
36 * CONSTANTS AND MACROS
41 * FUNCTIONAL DESCRIPTION:
43 * cma__int_attr_get_priority - Performs the work of cma_attr_get_priority
45 * FORMAL PARAMETERS:
47 * cma_t_attr *_att_ - Attribute object to get from
48 * cma_t_priority *_setting_ - Current setting
50 * IMPLICIT INPUTS:
52 * none
54 * IMPLICIT OUTPUTS:
56 * priority
58 * FUNCTION VALUE:
60 * none
62 * SIDE EFFECTS:
64 * none
66 #define cma__int_attr_get_priority(_att_,_setting_) { \
67 cma__t_int_attr *_int_att_; \
68 (_int_att_) = cma__validate_default_attr (_att_); \
69 cma__int_lock ((_int_att_)->mutex); \
70 (*(_setting_)) = (_int_att_)->priority; \
71 cma__int_unlock ((_int_att_)->mutex); \
76 * FUNCTIONAL DESCRIPTION:
78 * cma__int_attr_get_sched - Performs work of cma_attr_get_sched
80 * FORMAL PARAMETERS:
82 * cma_t_attr *_att_ _ Attributes object used
83 * cma_t_sched_policy *_setting_ - Current setting
85 * IMPLICIT INPUTS:
87 * none
89 * IMPLICIT OUTPUTS:
91 * scheduling policy
93 * FUNCTION VALUE:
95 * none
97 * SIDE EFFECTS:
99 * none
101 #define cma__int_attr_get_sched(_att_,_setting_) { \
102 cma__t_int_attr *_int_att_; \
103 (_int_att_) = cma__validate_default_attr (_att_); \
104 cma__int_lock ((_int_att_)->mutex); \
105 (*(_setting_)) = (_int_att_)->policy; \
106 cma__int_unlock ((_int_att_)->mutex); \
111 * FUNCTIONAL DESCRIPTION:
113 * cma__int_attr_get_inherit_sched - Performs work of
114 * cma_attr_get_inherit_sched
116 * FORMAL PARAMETERS:
118 * cma_t_attr *_att_ - Attributes object to use
119 * cma_t_sched_inherit *_setting_ - Current setting
121 * IMPLICIT INPUTS:
123 * none
125 * IMPLICIT OUTPUTS:
127 * Inheritable scheduling policy
129 * FUNCTION VALUE:
131 * none
133 * SIDE EFFECTS:
135 * none
137 #define cma__int_attr_get_inherit_sched(_att_,_setting_) { \
138 cma__t_int_attr *_int_att_; \
139 (_int_att_) = cma__validate_default_attr (_att_); \
140 cma__int_lock ((_int_att_)->mutex); \
141 (*(_setting_)) \
142 = ((_int_att_)->inherit_sched ? cma_c_sched_inherit : cma_c_sched_use_default); \
143 cma__int_unlock ((_int_att_)->mutex); \
147 * FUNCTIONAL DESCRIPTION:
149 * cma__int_attr_set_stacksize - Performs work for cma_attr_set_stacksize
151 * FORMAL PARAMETERS:
153 * cma_t_attr *_att_ - Attributes object to use
154 * cma_t_natural _setting_ - Setting
156 * IMPLICIT INPUTS:
158 * none
160 * IMPLICIT OUTPUTS:
162 * none
164 * FUNCTION VALUE:
166 * none
168 * SIDE EFFECTS:
170 * Change attribute objects stack size setting
172 #define cma__int_attr_set_stacksize(_att_,_setting_) { \
173 cma__t_int_attr *_int_att_; \
174 if ((_setting_) <= 0) \
175 cma__error (cma_s_badparam); \
176 _int_att_ = cma__validate_attr (_att_); \
177 cma__int_lock ((_int_att_)->mutex); \
178 _int_att_->stack_size = cma__roundup_chunksize(_setting_); \
179 cma__free_cache (_int_att_, cma__c_obj_tcb); \
180 _int_att_->cache[cma__c_obj_tcb].revision++; \
181 _int_att_->cache[cma__c_obj_stack].revision++; \
182 cma__int_unlock (_int_att_->mutex); \
186 * FUNCTIONAL DESCRIPTION:
188 * cma__int_attr_get_stacksize - Performs work of cma_attr_get_stacksize
190 * FORMAL PARAMETERS:
192 * cma_t_attr *_att_ - Attributes object to use
193 * cma_t_natural *_setting_ - Current setting
195 * IMPLICIT INPUTS:
197 * none
199 * IMPLICIT OUTPUTS:
201 * Attribute objects stack size setting
203 * FUNCTION VALUE:
205 * none
207 * SIDE EFFECTS:
209 * none
211 #define cma__int_attr_get_stacksize(_att_,_setting_) { \
212 cma__t_int_attr *_int_att_; \
213 (_int_att_) = cma__validate_default_attr (_att_); \
214 cma__int_lock ((_int_att_)->mutex); \
215 (*(_setting_)) = (_int_att_)->stack_size; \
216 cma__int_unlock ((_int_att_)->mutex); \
221 * FUNCTIONAL DESCRIPTION:
223 * cma__int_attr_set_guardsize - Performs work for cma_attr_set_guardsize
225 * FORMAL PARAMETERS:
227 * cma_t_attr *_att_ - Attributes object to use
228 * cma_t_natural _setting_ - Setting
230 * IMPLICIT INPUTS:
232 * none
234 * IMPLICIT OUTPUTS:
236 * none
238 * FUNCTION VALUE:
240 * none
242 * SIDE EFFECTS:
244 * Change attribute objects guard size setting
246 #define cma__int_attr_set_guardsize(_att_,_setting_) { \
247 cma__t_int_attr *_int_att_; \
248 _int_att_ = cma__validate_attr (_att_); \
249 cma__int_lock ((_int_att_)->mutex); \
250 _int_att_->guard_size = cma__roundup_chunksize(_setting_); \
251 cma__free_cache (_int_att_, cma__c_obj_tcb); \
252 _int_att_->cache[cma__c_obj_tcb].revision++; \
253 _int_att_->cache[cma__c_obj_stack].revision++; \
254 cma__int_unlock (_int_att_->mutex); \
258 * FUNCTIONAL DESCRIPTION:
260 * cma__int_attr_get_guardsize - Performs work of cma_attr_get_guardsize
262 * FORMAL PARAMETERS:
264 * cma_t_attr *_att_ - Attributes object to use
265 * cma_t_natural *_setting_ - Current setting
267 * IMPLICIT INPUTS:
269 * none
271 * IMPLICIT OUTPUTS:
273 * Attribute objects guard size setting
275 * FUNCTION VALUE:
277 * none
279 * SIDE EFFECTS:
281 * none
283 #define cma__int_attr_get_guardsize(_att_,_setting_) { \
284 cma__t_int_attr *_int_att_; \
285 (_int_att_) = cma__validate_default_attr (_att_); \
286 cma__int_lock ((_int_att_)->mutex); \
287 (*(_setting_)) = (_int_att_)->guard_size; \
288 cma__int_unlock ((_int_att_)->mutex); \
292 * TYPEDEFS
294 #ifndef __STDC__
295 struct CMA__T_INT_MUTEX; /* Avoid circular dependency */
296 #endif
298 typedef struct CMA__T_CACHE {
299 cma_t_natural revision; /* Revisions */
300 cma_t_natural count;
301 cma__t_queue queue; /* Cache headers */
302 } cma__t_cache;
304 typedef struct CMA__T_INT_ATTR {
305 cma__t_object header; /* Common header */
306 struct CMA__T_INT_ATTR *attributes; /* Point to controlling attr */
307 struct CMA__T_INT_MUTEX *mutex; /* Serialize access to object */
308 cma_t_priority priority; /* Priority of new thread */
309 cma_t_sched_policy policy; /* Sched policy of thread */
310 cma_t_boolean inherit_sched; /* Is scheduling inherited? */
311 cma_t_natural stack_size; /* Size of stack (bytes) */
312 cma_t_natural guard_size; /* Size of guard (bytes) */
313 cma_t_mutex_kind mutex_kind; /* Mutex kind */
314 cma__t_cache cache[cma__c_obj_num]; /* Cache information */
315 cma_t_boolean delete_pending; /* attr. obj. is deleted */
316 cma_t_natural refcnt; /* Number of objects using attr. obj */
317 } cma__t_int_attr;
320 * GLOBAL DATA
323 extern cma__t_int_attr cma__g_def_attr;
326 * INTERNAL INTERFACES
329 extern void cma__destroy_attributes (cma__t_int_attr *);
331 extern void cma__free_attributes (cma__t_int_attr *);
333 extern void cma__free_cache (cma__t_int_attr *,cma_t_natural );
335 extern cma__t_int_attr *cma__get_attributes (cma__t_int_attr *);
337 extern void cma__init_attr (void);
339 extern void cma__reinit_attr (cma_t_integer);
341 #endif