OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [osf-share/] [cma_attr.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 106 markom
/*
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.
15
 */
16
/*
17
 *      Header file for attributes object
18
 */
19
 
20
#ifndef CMA_ATTR
21
#define CMA_ATTR
22
 
23
/*
24
 *  INCLUDE FILES
25
 */
26
 
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
35
/*
36
 * CONSTANTS AND MACROS
37
 */
38
 
39
 
40
/*
41
 *  FUNCTIONAL DESCRIPTION:
42
 *
43
 *      cma__int_attr_get_priority -  Performs the work of cma_attr_get_priority
44
 *
45
 *  FORMAL PARAMETERS:
46
 *
47
 *      cma_t_attr          *_att_      - Attribute object to get from
48
 *      cma_t_priority      *_setting_  - Current setting
49
 *
50
 *  IMPLICIT INPUTS:
51
 *
52
 *      none
53
 *
54
 *  IMPLICIT OUTPUTS:
55
 *
56
 *      priority
57
 *
58
 *  FUNCTION VALUE:
59
 *
60
 *      none
61
 *
62
 *  SIDE EFFECTS:
63
 *
64
 *      none
65
 */
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); \
72
    }
73
 
74
 
75
/*
76
 *  FUNCTIONAL DESCRIPTION:
77
 *
78
 *      cma__int_attr_get_sched - Performs work of cma_attr_get_sched
79
 *
80
 *  FORMAL PARAMETERS:
81
 *
82
 *      cma_t_attr          *_att_      _ Attributes object used
83
 *      cma_t_sched_policy  *_setting_  - Current setting
84
 *
85
 *  IMPLICIT INPUTS:
86
 *
87
 *      none
88
 *
89
 *  IMPLICIT OUTPUTS:
90
 *
91
 *      scheduling policy
92
 *
93
 *  FUNCTION VALUE:
94
 *
95
 *      none
96
 *
97
 *  SIDE EFFECTS:
98
 *
99
 *      none
100
 */
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); \
107
    }
108
 
109
 
110
/*
111
 *  FUNCTIONAL DESCRIPTION:
112
 *
113
 *      cma__int_attr_get_inherit_sched - Performs work of
114
 *      cma_attr_get_inherit_sched
115
 *
116
 *  FORMAL PARAMETERS:
117
 *
118
 *      cma_t_attr          *_att_      - Attributes object to use
119
 *      cma_t_sched_inherit *_setting_  - Current setting
120
 *
121
 *  IMPLICIT INPUTS:
122
 *
123
 *      none
124
 *
125
 *  IMPLICIT OUTPUTS:
126
 *
127
 *      Inheritable scheduling policy
128
 *
129
 *  FUNCTION VALUE:
130
 *
131
 *      none
132
 *
133
 *  SIDE EFFECTS:
134
 *
135
 *      none
136
 */
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); \
144
    }
145
 
146
/*
147
 *  FUNCTIONAL DESCRIPTION:
148
 *
149
 *      cma__int_attr_set_stacksize - Performs work for cma_attr_set_stacksize
150
 *
151
 *  FORMAL PARAMETERS:
152
 *
153
 *      cma_t_attr          *_att_      - Attributes object to use
154
 *      cma_t_natural       _setting_   - Setting
155
 *
156
 *  IMPLICIT INPUTS:
157
 *
158
 *      none
159
 *
160
 *  IMPLICIT OUTPUTS:
161
 *
162
 *      none
163
 *
164
 *  FUNCTION VALUE:
165
 *
166
 *      none
167
 *
168
 *  SIDE EFFECTS:
169
 *
170
 *      Change attribute objects stack size setting
171
 */
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); \
183
    }
184
 
185
/*
186
 *  FUNCTIONAL DESCRIPTION:
187
 *
188
 *      cma__int_attr_get_stacksize - Performs work of cma_attr_get_stacksize
189
 *
190
 *  FORMAL PARAMETERS:
191
 *
192
 *      cma_t_attr          *_att_      - Attributes object to use
193
 *      cma_t_natural       *_setting_  - Current setting
194
 *
195
 *  IMPLICIT INPUTS:
196
 *
197
 *      none
198
 *
199
 *  IMPLICIT OUTPUTS:
200
 *
201
 *      Attribute objects stack size setting
202
 *
203
 *  FUNCTION VALUE:
204
 *
205
 *      none
206
 *
207
 *  SIDE EFFECTS:
208
 *
209
 *      none
210
 */
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); \
217
    }
218
 
219
 
220
/*
221
 *  FUNCTIONAL DESCRIPTION:
222
 *
223
 *      cma__int_attr_set_guardsize - Performs work for cma_attr_set_guardsize
224
 *
225
 *  FORMAL PARAMETERS:
226
 *
227
 *      cma_t_attr          *_att_      - Attributes object to use
228
 *      cma_t_natural       _setting_   - Setting
229
 *
230
 *  IMPLICIT INPUTS:
231
 *
232
 *      none
233
 *
234
 *  IMPLICIT OUTPUTS:
235
 *
236
 *      none
237
 *
238
 *  FUNCTION VALUE:
239
 *
240
 *      none
241
 *
242
 *  SIDE EFFECTS:
243
 *
244
 *      Change attribute objects guard size setting
245
 */
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); \
255
    }
256
 
257
/*
258
 *  FUNCTIONAL DESCRIPTION:
259
 *
260
 *      cma__int_attr_get_guardsize - Performs work of cma_attr_get_guardsize
261
 *
262
 *  FORMAL PARAMETERS:
263
 *
264
 *      cma_t_attr          *_att_      - Attributes object to use
265
 *      cma_t_natural       *_setting_  - Current setting
266
 *
267
 *  IMPLICIT INPUTS:
268
 *
269
 *      none
270
 *
271
 *  IMPLICIT OUTPUTS:
272
 *
273
 *      Attribute objects guard size setting
274
 *
275
 *  FUNCTION VALUE:
276
 *
277
 *      none
278
 *
279
 *  SIDE EFFECTS:
280
 *
281
 *      none
282
 */
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); \
289
    }
290
 
291
/*
292
 * TYPEDEFS
293
 */
294
#ifndef __STDC__
295
struct CMA__T_INT_MUTEX;                /* Avoid circular dependency */
296
#endif
297
 
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;
303
 
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;
318
 
319
/*
320
 *  GLOBAL DATA
321
 */
322
 
323
extern cma__t_int_attr  cma__g_def_attr;
324
 
325
/*
326
 * INTERNAL INTERFACES
327
 */
328
 
329
extern void cma__destroy_attributes  (cma__t_int_attr *);
330
 
331
extern void cma__free_attributes  (cma__t_int_attr      *);
332
 
333
extern void cma__free_cache  (cma__t_int_attr *,cma_t_natural );
334
 
335
extern cma__t_int_attr *cma__get_attributes  (cma__t_int_attr   *);
336
 
337
extern void cma__init_attr  (void);
338
 
339
extern void cma__reinit_attr  (cma_t_integer);
340
 
341
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.