VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/7.0/xorg/os.h@ 37801

最後變更 在這個檔案從37801是 17236,由 vboxsync 提交於 16 年 前

Additions/x11/x11include: blast! Reverted r43555 and r43556

  • 屬性 svn:eol-style 設為 native
檔案大小: 15.3 KB
 
1/* $XFree86: xc/programs/Xserver/include/os.h,v 3.54 2003/10/30 21:21:06 herrb Exp $ */
2/***********************************************************
3
4Copyright 1987, 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
27Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
28
29 All Rights Reserved
30
31Permission to use, copy, modify, and distribute this software and its
32documentation for any purpose and without fee is hereby granted,
33provided that the above copyright notice appear in all copies and that
34both that copyright notice and this permission notice appear in
35supporting documentation, and that the name of Digital not be
36used in advertising or publicity pertaining to distribution of the
37software without specific, written prior permission.
38
39DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
40ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
41DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
42ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
43WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
44ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
45SOFTWARE.
46
47******************************************************************/
48
49/* $Xorg: os.h,v 1.4 2001/02/09 02:05:15 xorgcvs Exp $ */
50
51#ifndef OS_H
52#define OS_H
53
54#include "misc.h"
55#define ALLOCATE_LOCAL_FALLBACK(_size) Xalloc((unsigned long)(_size))
56#define DEALLOCATE_LOCAL_FALLBACK(_ptr) Xfree((pointer)(_ptr))
57#include <X11/Xalloca.h>
58#ifndef IN_MODULE
59#include <stdarg.h>
60#else
61#include "xf86_ansic.h"
62#endif
63
64#define NullFID ((FID) 0)
65
66#define SCREEN_SAVER_ON 0
67#define SCREEN_SAVER_OFF 1
68#define SCREEN_SAVER_FORCER 2
69#define SCREEN_SAVER_CYCLE 3
70
71#ifndef MAX_REQUEST_SIZE
72#define MAX_REQUEST_SIZE 65535
73#endif
74#ifndef MAX_BIG_REQUEST_SIZE
75#define MAX_BIG_REQUEST_SIZE 4194303
76#endif
77
78typedef pointer FID;
79typedef struct _FontPathRec *FontPathPtr;
80typedef struct _NewClientRec *NewClientPtr;
81
82#ifndef xalloc
83#define xnfalloc(size) XNFalloc((unsigned long)(size))
84#define xnfcalloc(_num, _size) XNFcalloc((unsigned long)(_num)*(unsigned long)(_size))
85#define xnfrealloc(ptr, size) XNFrealloc((pointer)(ptr), (unsigned long)(size))
86
87#define xalloc(size) Xalloc((unsigned long)(size))
88#define xcalloc(_num, _size) Xcalloc((unsigned long)(_num)*(unsigned long)(_size))
89#define xrealloc(ptr, size) Xrealloc((pointer)(ptr), (unsigned long)(size))
90#define xfree(ptr) Xfree((pointer)(ptr))
91#define xstrdup(s) Xstrdup(s)
92#define xnfstrdup(s) XNFstrdup(s)
93#endif
94
95#ifndef IN_MODULE
96#ifdef __SCO__
97#include <stdio.h>
98#endif
99#include <string.h>
100#endif
101
102/* have to put $(SIGNAL_DEFINES) in DEFINES in Imakefile to get this right */
103#ifdef SIGNALRETURNSINT
104#define SIGVAL int
105#else
106#define SIGVAL void
107#endif
108
109extern Bool OsDelayInitColors;
110extern void (*OsVendorVErrorFProc)(const char *, va_list args);
111
112extern int WaitForSomething(
113 int* /*pClientsReady*/
114);
115
116#ifdef LBX
117#define ReadRequestFromClient(client) ((client)->readRequest(client))
118extern int StandardReadRequestFromClient(ClientPtr /*client*/);
119
120extern int ClientConnectionNumber(ClientPtr /*client*/);
121#else
122extern int ReadRequestFromClient(ClientPtr /*client*/);
123#endif /* LBX */
124
125extern Bool InsertFakeRequest(
126 ClientPtr /*client*/,
127 char* /*data*/,
128 int /*count*/);
129
130extern void ResetCurrentRequest(ClientPtr /*client*/);
131
132extern void FlushAllOutput(void);
133
134extern void FlushIfCriticalOutputPending(void);
135
136extern void SetCriticalOutputPending(void);
137
138extern int WriteToClient(ClientPtr /*who*/, int /*count*/, char* /*buf*/);
139
140extern void ResetOsBuffers(void);
141
142extern void InitConnectionLimits(void);
143
144extern void CreateWellKnownSockets(void);
145
146extern void ResetWellKnownSockets(void);
147
148extern void CloseWellKnownConnections(void);
149
150extern XID AuthorizationIDOfClient(ClientPtr /*client*/);
151
152extern char *ClientAuthorized(
153 ClientPtr /*client*/,
154 unsigned int /*proto_n*/,
155 char* /*auth_proto*/,
156 unsigned int /*string_n*/,
157 char* /*auth_string*/);
158
159extern Bool EstablishNewConnections(
160 ClientPtr /*clientUnused*/,
161 pointer /*closure*/);
162
163extern void CheckConnections(void);
164
165extern void CloseDownConnection(ClientPtr /*client*/);
166
167extern void AddEnabledDevice(int /*fd*/);
168
169extern void RemoveEnabledDevice(int /*fd*/);
170
171extern void OnlyListenToOneClient(ClientPtr /*client*/);
172
173extern void ListenToAllClients(void);
174
175extern void IgnoreClient(ClientPtr /*client*/);
176
177extern void AttendClient(ClientPtr /*client*/);
178
179extern void MakeClientGrabImpervious(ClientPtr /*client*/);
180
181extern void MakeClientGrabPervious(ClientPtr /*client*/);
182
183#ifdef LBX
184extern void CloseDownFileDescriptor(ClientPtr /* client */);
185#endif
186
187extern void AvailableClientInput(ClientPtr /* client */);
188
189extern CARD32 GetTimeInMillis(void);
190
191extern void AdjustWaitForDelay(
192 pointer /*waitTime*/,
193 unsigned long /*newdelay*/);
194
195typedef struct _OsTimerRec *OsTimerPtr;
196
197typedef CARD32 (*OsTimerCallback)(
198 OsTimerPtr /* timer */,
199 CARD32 /* time */,
200 pointer /* arg */);
201
202extern void TimerInit(void);
203
204extern Bool TimerForce(OsTimerPtr /* timer */);
205
206#define TimerAbsolute (1<<0)
207#define TimerForceOld (1<<1)
208
209extern OsTimerPtr TimerSet(
210 OsTimerPtr /* timer */,
211 int /* flags */,
212 CARD32 /* millis */,
213 OsTimerCallback /* func */,
214 pointer /* arg */);
215
216extern void TimerCheck(void);
217extern void TimerCancel(OsTimerPtr /* pTimer */);
218extern void TimerFree(OsTimerPtr /* pTimer */);
219
220extern void SetScreenSaverTimer(void);
221extern void FreeScreenSaverTimer(void);
222
223#ifdef DPMSExtension
224extern void SetDPMSTimers(void);
225extern void FreeDPMSTimers(void);
226#endif
227
228extern SIGVAL AutoResetServer(int /*sig*/);
229
230extern SIGVAL GiveUp(int /*sig*/);
231
232extern void UseMsg(void);
233
234extern void InitGlobals(void);
235
236extern void ProcessCommandLine(int /*argc*/, char* /*argv*/[]);
237
238extern int set_font_authorizations(
239 char ** /* authorizations */,
240 int * /*authlen */,
241 pointer /* client */);
242
243#ifndef _HAVE_XALLOC_DECLS
244#define _HAVE_XALLOC_DECLS
245extern pointer Xalloc(unsigned long /*amount*/);
246extern pointer Xcalloc(unsigned long /*amount*/);
247extern pointer Xrealloc(pointer /*ptr*/, unsigned long /*amount*/);
248extern void Xfree(pointer /*ptr*/);
249#endif
250
251extern pointer XNFalloc(unsigned long /*amount*/);
252extern pointer XNFcalloc(unsigned long /*amount*/);
253extern pointer XNFrealloc(pointer /*ptr*/, unsigned long /*amount*/);
254
255extern void OsInitAllocator(void);
256
257extern char *Xstrdup(const char *s);
258extern char *XNFstrdup(const char *s);
259extern char *Xprintf(const char *fmt, ...);
260extern char *Xvprintf(const char *fmt, va_list va);
261extern char *XNFprintf(const char *fmt, ...);
262extern char *XNFvprintf(const char *fmt, va_list va);
263
264typedef SIGVAL (*OsSigHandlerPtr)(int /* sig */);
265
266extern OsSigHandlerPtr OsSignal(int /* sig */, OsSigHandlerPtr /* handler */);
267
268extern int auditTrailLevel;
269
270#ifdef SERVER_LOCK
271extern void LockServer(void);
272extern void UnlockServer(void);
273#endif
274
275extern int OsLookupColor(
276 int /*screen*/,
277 char * /*name*/,
278 unsigned /*len*/,
279 unsigned short * /*pred*/,
280 unsigned short * /*pgreen*/,
281 unsigned short * /*pblue*/);
282
283extern void OsInit(void);
284
285extern void OsCleanup(Bool);
286
287extern void OsVendorFatalError(void);
288
289extern void OsVendorInit(void);
290
291extern int OsInitColors(void);
292
293void OsBlockSignals (void);
294
295void OsReleaseSignals (void);
296
297#if !defined(WIN32) && !defined(__UNIXOS2__)
298extern int System(char *);
299extern pointer Popen(char *, char *);
300extern int Pclose(pointer);
301extern pointer Fopen(char *, char *);
302extern int Fclose(pointer);
303#else
304#define System(a) system(a)
305#define Popen(a,b) popen(a,b)
306#define Pclose(a) pclose(a)
307#define Fopen(a,b) fopen(a,b)
308#define Fclose(a) fclose(a)
309#endif
310
311extern void CheckUserParameters(int argc, char **argv, char **envp);
312extern void CheckUserAuthorization(void);
313
314extern int AddHost(
315 ClientPtr /*client*/,
316 int /*family*/,
317 unsigned /*length*/,
318 pointer /*pAddr*/);
319
320extern Bool ForEachHostInFamily (
321 int /*family*/,
322 Bool (* /*func*/ )(
323 unsigned char * /* addr */,
324 short /* len */,
325 pointer /* closure */),
326 pointer /*closure*/);
327
328extern int RemoveHost(
329 ClientPtr /*client*/,
330 int /*family*/,
331 unsigned /*length*/,
332 pointer /*pAddr*/);
333
334extern int GetHosts(
335 pointer * /*data*/,
336 int * /*pnHosts*/,
337 int * /*pLen*/,
338 BOOL * /*pEnabled*/);
339
340typedef struct sockaddr * sockaddrPtr;
341
342extern int InvalidHost(sockaddrPtr /*saddr*/, int /*len*/, ClientPtr client);
343
344extern int LocalClient(ClientPtr /* client */);
345
346extern int LocalClientCred(ClientPtr, int *, int *);
347
348extern int ChangeAccessControl(ClientPtr /*client*/, int /*fEnabled*/);
349
350extern int GetAccessControl(void);
351
352
353extern void AddLocalHosts(void);
354
355extern void ResetHosts(char *display);
356
357extern void EnableLocalHost(void);
358
359extern void DisableLocalHost(void);
360
361extern void AccessUsingXdmcp(void);
362
363extern void DefineSelf(int /*fd*/);
364
365extern void AugmentSelf(pointer /*from*/, int /*len*/);
366
367extern void InitAuthorization(char * /*filename*/);
368
369/* extern int LoadAuthorization(void); */
370
371extern void RegisterAuthorizations(void);
372
373extern XID AuthorizationToID (
374 unsigned short name_length,
375 char *name,
376 unsigned short data_length,
377 char *data);
378
379extern int AuthorizationFromID (
380 XID id,
381 unsigned short *name_lenp,
382 char **namep,
383 unsigned short *data_lenp,
384 char **datap);
385
386extern XID CheckAuthorization(
387 unsigned int /*namelength*/,
388 char * /*name*/,
389 unsigned int /*datalength*/,
390 char * /*data*/,
391 ClientPtr /*client*/,
392 char ** /*reason*/
393);
394
395extern void ResetAuthorization(void);
396
397extern int RemoveAuthorization (
398 unsigned short name_length,
399 char *name,
400 unsigned short data_length,
401 char *data);
402
403extern int AddAuthorization(
404 unsigned int /*name_length*/,
405 char * /*name*/,
406 unsigned int /*data_length*/,
407 char * /*data*/);
408
409extern XID GenerateAuthorization(
410 unsigned int /* name_length */,
411 char * /* name */,
412 unsigned int /* data_length */,
413 char * /* data */,
414 unsigned int * /* data_length_return */,
415 char ** /* data_return */);
416
417#ifdef COMMANDLINE_CHALLENGED_OPERATING_SYSTEMS
418extern void ExpandCommandLine(int * /*pargc*/, char *** /*pargv*/);
419#endif
420
421extern void ddxInitGlobals(void);
422
423extern int ddxProcessArgument(int /*argc*/, char * /*argv*/ [], int /*i*/);
424
425extern void ddxUseMsg(void);
426
427/*
428 * idiom processing stuff
429 */
430
431extern xReqPtr PeekNextRequest(xReqPtr req, ClientPtr client, Bool readmore);
432
433extern void SkipRequests(xReqPtr req, ClientPtr client, int numskipped);
434
435/* int ReqLen(xReq *req, ClientPtr client)
436 * Given a pointer to a *complete* request, return its length in bytes.
437 * Note that if the request is a big request (as defined in the Big
438 * Requests extension), the macro lies by returning 4 less than the
439 * length that it actually occupies in the request buffer. This is so you
440 * can blindly compare the length with the various sz_<request> constants
441 * in Xproto.h without having to know/care about big requests.
442 */
443#define ReqLen(_pxReq, _client) \
444 ((_pxReq->length ? \
445 (_client->swapped ? lswaps(_pxReq->length) : _pxReq->length) \
446 : ((_client->swapped ? \
447 lswapl(((CARD32*)_pxReq)[1]) : ((CARD32*)_pxReq)[1])-1) \
448 ) << 2)
449
450/* otherReqTypePtr CastxReq(xReq *req, otherReqTypePtr)
451 * Cast the given request to one of type otherReqTypePtr to access
452 * fields beyond the length field.
453 */
454#define CastxReq(_pxReq, otherReqTypePtr) \
455 (_pxReq->length ? (otherReqTypePtr)_pxReq \
456 : (otherReqTypePtr)(((CARD32*)_pxReq)+1))
457
458/* stuff for SkippedRequestsCallback */
459extern CallbackListPtr SkippedRequestsCallback;
460typedef struct {
461 xReqPtr req;
462 ClientPtr client;
463 int numskipped;
464} SkippedRequestInfoRec;
465
466/* stuff for ReplyCallback */
467extern CallbackListPtr ReplyCallback;
468typedef struct {
469 ClientPtr client;
470 pointer replyData;
471 unsigned long dataLenBytes;
472 unsigned long bytesRemaining;
473 Bool startOfReply;
474} ReplyInfoRec;
475
476/* stuff for FlushCallback */
477extern CallbackListPtr FlushCallback;
478
479extern void AbortDDX(void);
480extern void ddxGiveUp(void);
481extern int TimeSinceLastInputEvent(void);
482
483/* Logging. */
484typedef enum _LogParameter {
485 XLOG_FLUSH,
486 XLOG_SYNC,
487 XLOG_VERBOSITY,
488 XLOG_FILE_VERBOSITY
489} LogParameter;
490
491/* Flags for log messages. */
492typedef enum {
493 X_PROBED, /* Value was probed */
494 X_CONFIG, /* Value was given in the config file */
495 X_DEFAULT, /* Value is a default */
496 X_CMDLINE, /* Value was given on the command line */
497 X_NOTICE, /* Notice */
498 X_ERROR, /* Error message */
499 X_WARNING, /* Warning message */
500 X_INFO, /* Informational message */
501 X_NONE, /* No prefix */
502 X_NOT_IMPLEMENTED, /* Not implemented */
503 X_UNKNOWN = -1 /* unknown -- this must always be last */
504} MessageType;
505
506/* XXX Need to check which GCC versions have the format(printf) attribute. */
507#if defined(__GNUC__) && \
508 ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ > 4)))
509#define _printf_attribute(a,b) __attribute((format(__printf__,a,b)))
510#else
511#define _printf_attribute(a,b) /**/
512#endif
513
514extern const char *LogInit(const char *fname, const char *backup);
515extern void LogClose(void);
516extern Bool LogSetParameter(LogParameter param, int value);
517extern void LogVWrite(int verb, const char *f, va_list args);
518extern void LogWrite(int verb, const char *f, ...) _printf_attribute(2,3);
519extern void LogVMessageVerb(MessageType type, int verb, const char *format,
520 va_list args);
521extern void LogMessageVerb(MessageType type, int verb, const char *format,
522 ...) _printf_attribute(3,4);
523extern void LogMessage(MessageType type, const char *format, ...)
524 _printf_attribute(2,3);
525extern void FreeAuditTimer(void);
526extern void AuditF(const char *f, ...) _printf_attribute(1,2);
527extern void VAuditF(const char *f, va_list args);
528extern void FatalError(const char *f, ...) _printf_attribute(1,2)
529#if defined(__GNUC__) && \
530 ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ > 4)))
531__attribute((noreturn))
532#endif
533;
534
535extern void VErrorF(const char *f, va_list args);
536extern void ErrorF(const char *f, ...) _printf_attribute(1,2);
537extern void Error(char *str);
538extern void LogPrintMarkers(void);
539
540#if defined(NEED_SNPRINTF) && !defined(IN_MODULE)
541extern int snprintf(char *str, size_t size, const char *format, ...)
542 _printf_attribute(3,4);
543extern int vsnprintf(char *str, size_t size, const char *format, va_list ap);
544#endif
545
546#endif /* OS_H */
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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