VirtualBox

source: vbox/trunk/src/VBox/Additions/linux/x11include/4.2/include/extensions/syncstr.h@ 1

Last change on this file since 1 was 1, checked in by vboxsync, 55 years ago

import

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 11.9 KB
Line 
1/* $Xorg: syncstr.h,v 1.4 2001/02/09 02:03:24 xorgcvs Exp $ */
2/*
3
4Copyright 1991, 1993, 1994, 1998 The Open Group
5
6Permission to use, copy, modify, distribute, and sell this software and its
7documentation for any purpose is hereby granted without fee, provided that
8the above copyright notice appear in all copies and that both that
9copyright notice and this permission notice appear in supporting
10documentation.
11
12The above copyright notice and this permission notice shall be included in
13all copies or substantial portions of the Software.
14
15THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
19AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22Except as contained in this notice, the name of The Open Group shall not be
23used in advertising or otherwise to promote the sale, use or other dealings
24in this Software without prior written authorization from The Open Group.
25
26*/
27
28/***********************************************************
29Copyright 1991,1993 by Digital Equipment Corporation, Maynard, Massachusetts,
30and Olivetti Research Limited, Cambridge, England.
31
32 All Rights Reserved
33
34Permission to use, copy, modify, and distribute this software and its
35documentation for any purpose and without fee is hereby granted,
36provided that the above copyright notice appear in all copies and that
37both that copyright notice and this permission notice appear in
38supporting documentation, and that the names of Digital or Olivetti
39not be used in advertising or publicity pertaining to distribution of the
40software without specific, written prior permission.
41
42DIGITAL AND OLIVETTI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
43SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
44FITNESS, IN NO EVENT SHALL THEY BE LIABLE FOR ANY SPECIAL, INDIRECT OR
45CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
46USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
47OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
48PERFORMANCE OF THIS SOFTWARE.
49
50******************************************************************/
51
52#include "sync.h"
53
54#ifndef _SYNC_OS
55
56/* cover up types from sync.h to make sure they're the right size for
57 * protocol packaging. These will be undef'ed after all the protocol
58 * structures are defined.
59 */
60#define XSyncCounter CARD32
61#define XSyncAlarm CARD32
62
63/*
64 * Initialize
65 */
66typedef struct _xSyncInitialize {
67 CARD8 reqType;
68 CARD8 syncReqType;
69 CARD16 length B16;
70 CARD8 majorVersion;
71 CARD8 minorVersion;
72 CARD16 pad B16;
73} xSyncInitializeReq;
74#define sz_xSyncInitializeReq 8
75
76typedef struct {
77 BYTE type;
78 CARD8 unused;
79 CARD16 sequenceNumber B16;
80 CARD32 length B32;
81 CARD8 majorVersion;
82 CARD8 minorVersion;
83 CARD16 pad B16;
84 CARD32 pad0 B32;
85 CARD32 pad1 B32;
86 CARD32 pad2 B32;
87 CARD32 pad3 B32;
88 CARD32 pad4 B32;
89} xSyncInitializeReply;
90#define sz_xSyncInitializeReply 32
91
92/*
93 * ListSystemCounters
94 */
95typedef struct _xSyncListSystemCounters
96{
97 CARD8 reqType;
98 CARD8 syncReqType;
99 CARD16 length B16;
100} xSyncListSystemCountersReq;
101#define sz_xSyncListSystemCountersReq 4
102
103typedef struct {
104 BYTE type;
105 CARD8 unused;
106 CARD16 sequenceNumber B16;
107 CARD32 length B32;
108 INT32 nCounters B32;
109 CARD32 pad0 B32;
110 CARD32 pad1 B32;
111 CARD32 pad2 B32;
112 CARD32 pad3 B32;
113 CARD32 pad4 B32;
114} xSyncListSystemCountersReply;
115#define sz_xSyncListSystemCountersReply 32
116
117typedef struct {
118 XSyncCounter counter B32;
119 INT32 resolution_hi B32;
120 CARD32 resolution_lo B32;
121 CARD16 name_length B16;
122} xSyncSystemCounter;
123#define sz_xSyncSystemCounter 14
124
125/*
126 * Create Counter
127 */
128typedef struct _xSyncCreateCounterReq {
129 CARD8 reqType;
130 CARD8 syncReqType;
131 CARD16 length B16;
132 XSyncCounter cid B32;
133 INT32 initial_value_hi B32;
134 CARD32 initial_value_lo B32;
135} xSyncCreateCounterReq;
136#define sz_xSyncCreateCounterReq 16
137
138/*
139 * Change Counter
140 */
141typedef struct _xSyncChangeCounterReq {
142 CARD8 reqType;
143 CARD8 syncReqType;
144 CARD16 length B16;
145 XSyncCounter cid B32;
146 INT32 value_hi B32;
147 CARD32 value_lo B32;
148} xSyncChangeCounterReq;
149#define sz_xSyncChangeCounterReq 16
150
151/*
152 * Set Counter
153 */
154typedef struct _xSyncSetCounterReq {
155 CARD8 reqType;
156 CARD8 syncReqType;
157 CARD16 length B16;
158 XSyncCounter cid B32;
159 INT32 value_hi B32;
160 CARD32 value_lo B32;
161} xSyncSetCounterReq;
162#define sz_xSyncSetCounterReq 16
163
164/*
165 * Destroy Counter
166 */
167typedef struct _xSyncDestroyCounterReq {
168 CARD8 reqType;
169 CARD8 syncReqType;
170 CARD16 length B16;
171 XSyncCounter counter B32;
172} xSyncDestroyCounterReq;
173#define sz_xSyncDestroyCounterReq 8
174
175/*
176 * Query Counter
177 */
178typedef struct _xSyncQueryCounterReq {
179 CARD8 reqType;
180 CARD8 syncReqType;
181 CARD16 length B16;
182 XSyncCounter counter B32;
183} xSyncQueryCounterReq;
184#define sz_xSyncQueryCounterReq 8
185
186
187typedef struct {
188 BYTE type;
189 CARD8 unused;
190 CARD16 sequenceNumber B16;
191 CARD32 length B32;
192 INT32 value_hi B32;
193 CARD32 value_lo B32;
194 CARD32 pad0 B32;
195 CARD32 pad1 B32;
196 CARD32 pad2 B32;
197 CARD32 pad3 B32;
198} xSyncQueryCounterReply;
199#define sz_xSyncQueryCounterReply 32
200
201/*
202 * Await
203 */
204typedef struct _xSyncAwaitReq {
205 CARD8 reqType;
206 CARD8 syncReqType;
207 CARD16 length B16;
208} xSyncAwaitReq;
209#define sz_xSyncAwaitReq 4
210
211typedef struct _xSyncWaitCondition {
212 XSyncCounter counter B32;
213 CARD32 value_type B32;
214 INT32 wait_value_hi B32;
215 CARD32 wait_value_lo B32;
216 CARD32 test_type B32;
217 INT32 event_threshold_hi B32;
218 CARD32 event_threshold_lo B32;
219} xSyncWaitCondition;
220#define sz_xSyncWaitCondition 28
221
222/*
223 * Create Alarm
224 */
225typedef struct _xSyncCreateAlarmReq {
226 CARD8 reqType;
227 CARD8 syncReqType;
228 CARD16 length B16;
229 XSyncAlarm id B32;
230 CARD32 valueMask B32;
231} xSyncCreateAlarmReq;
232#define sz_xSyncCreateAlarmReq 12
233
234/*
235 * Destroy Alarm
236 */
237typedef struct _xSyncDestroyAlarmReq {
238 CARD8 reqType;
239 CARD8 syncReqType;
240 CARD16 length B16;
241 XSyncAlarm alarm B32;
242} xSyncDestroyAlarmReq;
243#define sz_xSyncDestroyAlarmReq 8
244
245/*
246 * Query Alarm
247 */
248typedef struct _xSyncQueryAlarmReq {
249 CARD8 reqType;
250 CARD8 syncReqType;
251 CARD16 length B16;
252 XSyncAlarm alarm B32;
253} xSyncQueryAlarmReq;
254#define sz_xSyncQueryAlarmReq 8
255
256typedef struct {
257 BYTE type;
258 CARD8 unused;
259 CARD16 sequenceNumber B16;
260 CARD32 length B32;
261 XSyncCounter counter B32;
262 CARD32 value_type B32;
263 INT32 wait_value_hi B32;
264 CARD32 wait_value_lo B32;
265 CARD32 test_type B32;
266 INT32 delta_hi B32;
267 CARD32 delta_lo B32;
268 BOOL events;
269 BYTE state;
270 BYTE pad0;
271 BYTE pad1;
272} xSyncQueryAlarmReply;
273#define sz_xSyncQueryAlarmReply 40
274
275/*
276 * Change Alarm
277 */
278typedef struct _xSyncChangeAlarmReq {
279 CARD8 reqType;
280 CARD8 syncReqType;
281 CARD16 length B16;
282 XSyncAlarm alarm B32;
283 CARD32 valueMask B32;
284} xSyncChangeAlarmReq;
285#define sz_xSyncChangeAlarmReq 12
286
287/*
288 * SetPriority
289 */
290typedef struct _xSyncSetPriority{
291 CARD8 reqType;
292 CARD8 syncReqType;
293 CARD16 length B16;
294 CARD32 id B32;
295 INT32 priority B32;
296} xSyncSetPriorityReq;
297#define sz_xSyncSetPriorityReq 12
298
299/*
300 * Get Priority
301 */
302typedef struct _xSyncGetPriority{
303 CARD8 reqType;
304 CARD8 syncReqType;
305 CARD16 length B16;
306 CARD32 id B32; /*XXX XID? */
307} xSyncGetPriorityReq;
308#define sz_xSyncGetPriorityReq 8
309
310typedef struct {
311 BYTE type;
312 CARD8 unused;
313 CARD16 sequenceNumber B16;
314 CARD32 length B32;
315 INT32 priority B32;
316 CARD32 pad0 B32;
317 CARD32 pad1 B32;
318 CARD32 pad2 B32;
319 CARD32 pad3 B32;
320 CARD32 pad4 B32;
321} xSyncGetPriorityReply;
322#define sz_xSyncGetPriorityReply 32
323
324/*
325 * Events
326 */
327
328typedef struct _xSyncCounterNotifyEvent {
329 BYTE type;
330 BYTE kind;
331 CARD16 sequenceNumber B16;
332 XSyncCounter counter B32;
333 INT32 wait_value_hi B32;
334 CARD32 wait_value_lo B32;
335 INT32 counter_value_hi B32;
336 CARD32 counter_value_lo B32;
337 CARD32 time B32;
338 CARD16 count B16;
339 BOOL destroyed;
340 BYTE pad0;
341} xSyncCounterNotifyEvent;
342
343typedef struct _xSyncAlarmNotifyEvent {
344 BYTE type;
345 BYTE kind;
346 CARD16 sequenceNumber B16;
347 XSyncAlarm alarm B32;
348 INT32 counter_value_hi B32;
349 CARD32 counter_value_lo B32;
350 INT32 alarm_value_hi B32;
351 CARD32 alarm_value_lo B32;
352 CARD32 time B32;
353 CARD8 state;
354 BYTE pad0;
355 BYTE pad1;
356 BYTE pad2;
357} xSyncAlarmNotifyEvent;
358
359#undef XSyncCounter
360#undef XSyncAlarm
361
362#endif /* _SYNC_OS */
363
364#ifdef _SYNC_SERVER
365
366#define CARD64 XSyncValue /* XXX temporary! need real 64 bit values for Alpha */
367
368typedef struct _SyncCounter {
369 ClientPtr client; /* Owning client. 0 for system counters */
370 XSyncCounter id; /* resource ID */
371 CARD64 value; /* counter value */
372 struct _SyncTriggerList *pTriglist; /* list of triggers */
373 Bool beingDestroyed; /* in process of going away */
374 struct _SysCounterInfo *pSysCounterInfo; /* NULL if not a system counter */
375} SyncCounter;
376
377/*
378 * The System Counter interface
379 */
380
381typedef enum {
382 XSyncCounterNeverChanges,
383 XSyncCounterNeverIncreases,
384 XSyncCounterNeverDecreases,
385 XSyncCounterUnrestricted
386} SyncCounterType;
387
388typedef struct _SysCounterInfo {
389 char *name;
390 CARD64 resolution;
391 CARD64 bracket_greater;
392 CARD64 bracket_less;
393 SyncCounterType counterType; /* how can this counter change */
394 void (*QueryValue)(
395#if NeedNestedPrototypes
396 pointer /*pCounter*/,
397 CARD64 * /*freshvalue*/
398#endif
399);
400 void (*BracketValues)(
401#if NeedNestedPrototypes
402 pointer /*pCounter*/,
403 CARD64 * /*lessthan*/,
404 CARD64 * /*greaterthan*/
405#endif
406);
407} SysCounterInfo;
408
409
410
411typedef struct _SyncTrigger {
412 SyncCounter *pCounter;
413 CARD64 wait_value; /* wait value */
414 unsigned int value_type; /* Absolute or Relative */
415 unsigned int test_type; /* transition or Comparision type */
416 CARD64 test_value; /* trigger event threshold value */
417 Bool (*CheckTrigger)(
418#if NeedNestedPrototypes
419 struct _SyncTrigger * /*pTrigger*/,
420 CARD64 /*newval*/
421#endif
422 );
423 void (*TriggerFired)(
424#if NeedNestedPrototypes
425 struct _SyncTrigger * /*pTrigger*/
426#endif
427 );
428 void (*CounterDestroyed)(
429#if NeedNestedPrototypes
430 struct _SyncTrigger * /*pTrigger*/
431#endif
432 );
433} SyncTrigger;
434
435typedef struct _SyncTriggerList {
436 SyncTrigger *pTrigger;
437 struct _SyncTriggerList *next;
438} SyncTriggerList;
439
440typedef struct _SyncAlarmClientList {
441 ClientPtr client;
442 XID delete_id;
443 struct _SyncAlarmClientList *next;
444} SyncAlarmClientList;
445
446typedef struct _SyncAlarm {
447 SyncTrigger trigger;
448 ClientPtr client;
449 XSyncAlarm alarm_id;
450 CARD64 delta;
451 int events;
452 int state;
453 SyncAlarmClientList *pEventClients;
454} SyncAlarm;
455
456typedef struct {
457 ClientPtr client;
458 CARD32 delete_id;
459 int num_waitconditions;
460} SyncAwaitHeader;
461
462typedef struct {
463 SyncTrigger trigger;
464 CARD64 event_threshold;
465 SyncAwaitHeader *pHeader;
466} SyncAwait;
467
468typedef union {
469 SyncAwaitHeader header;
470 SyncAwait await;
471} SyncAwaitUnion;
472
473
474extern pointer SyncCreateSystemCounter(
475#if NeedFunctionPrototypes
476 char * /* name */,
477 CARD64 /* inital_value */,
478 CARD64 /* resolution */,
479 SyncCounterType /* change characterization */,
480 void (* /*QueryValue*/ ) (), /* XXX prototype */
481 void (* /*BracketValues*/) ()
482#endif
483);
484
485extern void SyncChangeCounter(
486#if NeedFunctionPrototypes
487 SyncCounter * /* pCounter*/,
488 CARD64 /* new_value */
489#endif
490);
491
492extern void SyncDestroySystemCounter(
493#if NeedFunctionPrototypes
494 pointer pCounter
495#endif
496);
497extern void InitServertime();
498
499#endif /* _SYNC_SERVER */
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette