VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/xorg-server-1.17.1/os.h@ 77662

最後變更 在這個檔案從77662是 54163,由 vboxsync 提交於 10 年 前

Additions/x11/vboxvideo: support X.Org Server 1.17 (still untested).

  • 屬性 svn:eol-style 設為 native
檔案大小: 18.6 KB
 
1/***********************************************************
2
3Copyright 1987, 1998 The Open Group
4
5Permission to use, copy, modify, distribute, and sell this software and its
6documentation for any purpose is hereby granted without fee, provided that
7the above copyright notice appear in all copies and that both that
8copyright notice and this permission notice appear in supporting
9documentation.
10
11The above copyright notice and this permission notice shall be included in
12all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
21Except as contained in this notice, the name of The Open Group shall not be
22used in advertising or otherwise to promote the sale, use or other dealings
23in this Software without prior written authorization from The Open Group.
24
25Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
26
27 All Rights Reserved
28
29Permission to use, copy, modify, and distribute this software and its
30documentation for any purpose and without fee is hereby granted,
31provided that the above copyright notice appear in all copies and that
32both that copyright notice and this permission notice appear in
33supporting documentation, and that the name of Digital not be
34used in advertising or publicity pertaining to distribution of the
35software without specific, written prior permission.
36
37DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
38ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
39DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
40ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
41WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
42ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
43SOFTWARE.
44
45******************************************************************/
46
47#ifndef OS_H
48#define OS_H
49
50#include "misc.h"
51#include <stdarg.h>
52#include <stdint.h>
53#include <string.h>
54
55#define SCREEN_SAVER_ON 0
56#define SCREEN_SAVER_OFF 1
57#define SCREEN_SAVER_FORCER 2
58#define SCREEN_SAVER_CYCLE 3
59
60#ifndef MAX_REQUEST_SIZE
61#define MAX_REQUEST_SIZE 65535
62#endif
63#ifndef MAX_BIG_REQUEST_SIZE
64#define MAX_BIG_REQUEST_SIZE 4194303
65#endif
66
67typedef struct _FontPathRec *FontPathPtr;
68typedef struct _NewClientRec *NewClientPtr;
69
70#ifndef xnfalloc
71#define xnfalloc(size) XNFalloc((unsigned long)(size))
72#define xnfcalloc(_num, _size) XNFcalloc((unsigned long)(_num)*(unsigned long)(_size))
73#define xnfrealloc(ptr, size) XNFrealloc((void *)(ptr), (unsigned long)(size))
74
75#define xstrdup(s) Xstrdup(s)
76#define xnfstrdup(s) XNFstrdup(s)
77#endif
78
79#include <stdio.h>
80#include <stdarg.h>
81
82#ifdef DDXBEFORERESET
83extern void ddxBeforeReset(void);
84#endif
85
86#ifdef DDXOSVERRORF
87extern _X_EXPORT void (*OsVendorVErrorFProc) (const char *,
88 va_list args)
89_X_ATTRIBUTE_PRINTF(1, 0);
90#endif
91
92extern _X_EXPORT int WaitForSomething(int * /*pClientsReady */
93 );
94
95extern _X_EXPORT int ReadRequestFromClient(ClientPtr /*client */ );
96
97#if XTRANS_SEND_FDS
98extern _X_EXPORT int ReadFdFromClient(ClientPtr client);
99
100extern _X_EXPORT int WriteFdToClient(ClientPtr client, int fd, Bool do_close);
101#endif
102
103extern _X_EXPORT Bool InsertFakeRequest(ClientPtr /*client */ ,
104 char * /*data */ ,
105 int /*count */ );
106
107extern _X_EXPORT void ResetCurrentRequest(ClientPtr /*client */ );
108
109extern _X_EXPORT void FlushAllOutput(void);
110
111extern _X_EXPORT void FlushIfCriticalOutputPending(void);
112
113extern _X_EXPORT void SetCriticalOutputPending(void);
114
115extern _X_EXPORT int WriteToClient(ClientPtr /*who */ , int /*count */ ,
116 const void * /*buf */ );
117
118extern _X_EXPORT void ResetOsBuffers(void);
119
120extern _X_EXPORT void InitConnectionLimits(void);
121
122extern _X_EXPORT void NotifyParentProcess(void);
123
124extern _X_EXPORT void CreateWellKnownSockets(void);
125
126extern _X_EXPORT void ResetWellKnownSockets(void);
127
128extern _X_EXPORT void CloseWellKnownConnections(void);
129
130extern _X_EXPORT XID AuthorizationIDOfClient(ClientPtr /*client */ );
131
132extern _X_EXPORT const char *ClientAuthorized(ClientPtr /*client */ ,
133 unsigned int /*proto_n */ ,
134 char * /*auth_proto */ ,
135 unsigned int /*string_n */ ,
136 char * /*auth_string */ );
137
138extern _X_EXPORT Bool EstablishNewConnections(ClientPtr clientUnused,
139 void *closure);
140
141extern _X_EXPORT void CheckConnections(void);
142
143extern _X_EXPORT void CloseDownConnection(ClientPtr /*client */ );
144
145extern _X_EXPORT void AddGeneralSocket(int /*fd */ );
146
147extern _X_EXPORT void RemoveGeneralSocket(int /*fd */ );
148
149extern _X_EXPORT void AddEnabledDevice(int /*fd */ );
150
151extern _X_EXPORT void RemoveEnabledDevice(int /*fd */ );
152
153extern _X_EXPORT int OnlyListenToOneClient(ClientPtr /*client */ );
154
155extern _X_EXPORT void ListenToAllClients(void);
156
157extern _X_EXPORT void IgnoreClient(ClientPtr /*client */ );
158
159extern _X_EXPORT void AttendClient(ClientPtr /*client */ );
160
161extern _X_EXPORT void MakeClientGrabImpervious(ClientPtr /*client */ );
162
163extern _X_EXPORT void MakeClientGrabPervious(ClientPtr /*client */ );
164
165extern _X_EXPORT void ListenOnOpenFD(int /* fd */ , int /* noxauth */ );
166
167extern _X_EXPORT Bool AddClientOnOpenFD(int /* fd */ );
168
169extern _X_EXPORT CARD32 GetTimeInMillis(void);
170extern _X_EXPORT CARD64 GetTimeInMicros(void);
171
172extern _X_EXPORT void AdjustWaitForDelay(void *waitTime,
173 unsigned long newdelay);
174
175typedef struct _OsTimerRec *OsTimerPtr;
176
177typedef CARD32 (*OsTimerCallback) (OsTimerPtr timer,
178 CARD32 time,
179 void *arg);
180
181extern _X_EXPORT void TimerInit(void);
182
183extern _X_EXPORT Bool TimerForce(OsTimerPtr /* timer */ );
184
185#define TimerAbsolute (1<<0)
186#define TimerForceOld (1<<1)
187
188extern _X_EXPORT OsTimerPtr TimerSet(OsTimerPtr timer,
189 int flags,
190 CARD32 millis,
191 OsTimerCallback func,
192 void *arg);
193
194extern _X_EXPORT void TimerCheck(void);
195extern _X_EXPORT void TimerCancel(OsTimerPtr /* pTimer */ );
196extern _X_EXPORT void TimerFree(OsTimerPtr /* pTimer */ );
197
198extern _X_EXPORT void SetScreenSaverTimer(void);
199extern _X_EXPORT void FreeScreenSaverTimer(void);
200
201extern _X_EXPORT void AutoResetServer(int /*sig */ );
202
203extern _X_EXPORT void GiveUp(int /*sig */ );
204
205extern _X_EXPORT void UseMsg(void);
206
207extern _X_EXPORT void ProcessCommandLine(int /*argc */ , char * /*argv */ []);
208
209extern _X_EXPORT int set_font_authorizations(char **authorizations,
210 int *authlen,
211 void *client);
212
213/*
214 * This function malloc(3)s buffer, terminating the server if there is not
215 * enough memory.
216 */
217extern _X_EXPORT void *
218XNFalloc(unsigned long /*amount */ );
219
220/*
221 * This function calloc(3)s buffer, terminating the server if there is not
222 * enough memory.
223 */
224extern _X_EXPORT void *
225XNFcalloc(unsigned long /*amount */ );
226
227/*
228 * This function realloc(3)s passed buffer, terminating the server if there is
229 * not enough memory.
230 */
231extern _X_EXPORT void *
232XNFrealloc(void * /*ptr */ , unsigned long /*amount */ );
233
234/*
235 * This function strdup(3)s passed string. The only difference from the library
236 * function that it is safe to pass NULL, as NULL will be returned.
237 */
238extern _X_EXPORT char *
239Xstrdup(const char *s);
240
241/*
242 * This function strdup(3)s passed string, terminating the server if there is
243 * not enough memory. If NULL is passed to this function, NULL is returned.
244 */
245extern _X_EXPORT char *
246XNFstrdup(const char *s);
247
248/* Include new X*asprintf API */
249#include "Xprintf.h"
250
251/* Older api deprecated in favor of the asprintf versions */
252extern _X_EXPORT char *
253Xprintf(const char *fmt, ...)
254_X_ATTRIBUTE_PRINTF(1, 2)
255 _X_DEPRECATED;
256extern _X_EXPORT char *
257Xvprintf(const char *fmt, va_list va)
258_X_ATTRIBUTE_PRINTF(1, 0)
259 _X_DEPRECATED;
260extern _X_EXPORT char *
261XNFprintf(const char *fmt, ...)
262_X_ATTRIBUTE_PRINTF(1, 2)
263 _X_DEPRECATED;
264extern _X_EXPORT char *
265XNFvprintf(const char *fmt, va_list va)
266_X_ATTRIBUTE_PRINTF(1, 0)
267 _X_DEPRECATED;
268
269typedef void (*OsSigHandlerPtr) (int /* sig */ );
270typedef int (*OsSigWrapperPtr) (int /* sig */ );
271
272extern _X_EXPORT OsSigHandlerPtr
273OsSignal(int /* sig */ , OsSigHandlerPtr /* handler */ );
274extern _X_EXPORT OsSigWrapperPtr
275OsRegisterSigWrapper(OsSigWrapperPtr newWrap);
276
277extern _X_EXPORT int auditTrailLevel;
278
279extern _X_EXPORT void
280LockServer(void);
281extern _X_EXPORT void
282UnlockServer(void);
283
284extern _X_EXPORT int
285OsLookupColor(int /*screen */ ,
286 char * /*name */ ,
287 unsigned /*len */ ,
288 unsigned short * /*pred */ ,
289 unsigned short * /*pgreen */ ,
290 unsigned short * /*pblue */ );
291
292extern _X_EXPORT void
293OsInit(void);
294
295extern _X_EXPORT void
296OsCleanup(Bool);
297
298extern _X_EXPORT void
299OsVendorFatalError(const char *f, va_list args)
300_X_ATTRIBUTE_PRINTF(1, 0);
301
302extern _X_EXPORT void
303OsVendorInit(void);
304
305extern _X_EXPORT void
306OsBlockSignals(void);
307
308extern _X_EXPORT void
309OsReleaseSignals(void);
310
311extern _X_EXPORT int
312OsBlockSIGIO(void);
313
314extern _X_EXPORT void
315OsReleaseSIGIO(void);
316
317extern void
318OsResetSignals(void);
319
320extern _X_EXPORT void
321OsAbort(void)
322 _X_NORETURN;
323
324#if !defined(WIN32)
325extern _X_EXPORT int
326System(const char *);
327extern _X_EXPORT void *
328Popen(const char *, const char *);
329extern _X_EXPORT int
330Pclose(void *);
331extern _X_EXPORT void *
332Fopen(const char *, const char *);
333extern _X_EXPORT int
334Fclose(void *);
335#else
336
337extern const char *
338Win32TempDir(void);
339
340extern int
341System(const char *cmdline);
342
343#define Fopen(a,b) fopen(a,b)
344#define Fclose(a) fclose(a)
345#endif
346
347extern _X_EXPORT void
348CheckUserParameters(int argc, char **argv, char **envp);
349extern _X_EXPORT void
350CheckUserAuthorization(void);
351
352extern _X_EXPORT int
353AddHost(ClientPtr /*client */ ,
354 int /*family */ ,
355 unsigned /*length */ ,
356 const void * /*pAddr */ );
357
358extern _X_EXPORT Bool
359ForEachHostInFamily(int family,
360 Bool (*func)(
361 unsigned char *addr,
362 short len,
363 void *closure),
364 void *closure);
365
366extern _X_EXPORT int
367RemoveHost(ClientPtr client,
368 int family,
369 unsigned length,
370 void *pAddr);
371
372extern _X_EXPORT int
373GetHosts(void ** /*data */ ,
374 int * /*pnHosts */ ,
375 int * /*pLen */ ,
376 BOOL * /*pEnabled */ );
377
378typedef struct sockaddr *sockaddrPtr;
379
380extern _X_EXPORT int
381InvalidHost(sockaddrPtr /*saddr */ , int /*len */ , ClientPtr client);
382
383#define LCC_UID_SET (1 << 0)
384#define LCC_GID_SET (1 << 1)
385#define LCC_PID_SET (1 << 2)
386#define LCC_ZID_SET (1 << 3)
387
388typedef struct {
389 int fieldsSet; /* Bit mask of fields set */
390 int euid; /* Effective uid */
391 int egid; /* Primary effective group id */
392 int nSuppGids; /* Number of supplementary group ids */
393 int *pSuppGids; /* Array of supplementary group ids */
394 int pid; /* Process id */
395 int zoneid; /* Only set on Solaris 10 & later */
396} LocalClientCredRec;
397
398extern _X_EXPORT int
399GetLocalClientCreds(ClientPtr, LocalClientCredRec **);
400extern _X_EXPORT void
401FreeLocalClientCreds(LocalClientCredRec *);
402
403extern _X_EXPORT int
404ChangeAccessControl(ClientPtr /*client */ , int /*fEnabled */ );
405
406extern _X_EXPORT int
407GetAccessControl(void);
408
409extern _X_EXPORT void
410AddLocalHosts(void);
411
412extern _X_EXPORT void
413ResetHosts(const char *display);
414
415extern _X_EXPORT void
416EnableLocalHost(void);
417
418extern _X_EXPORT void
419DisableLocalHost(void);
420
421extern _X_EXPORT void
422AccessUsingXdmcp(void);
423
424extern _X_EXPORT void
425DefineSelf(int /*fd */ );
426
427#if XDMCP
428extern _X_EXPORT void
429AugmentSelf(void *from, int len);
430
431extern _X_EXPORT void
432RegisterAuthorizations(void);
433#endif
434
435extern _X_EXPORT void
436InitAuthorization(const char * /*filename */ );
437
438/* extern int LoadAuthorization(void); */
439
440extern _X_EXPORT int
441AuthorizationFromID(XID id,
442 unsigned short *name_lenp,
443 const char **namep,
444 unsigned short *data_lenp, char **datap);
445
446extern _X_EXPORT XID
447CheckAuthorization(unsigned int /*namelength */ ,
448 const char * /*name */ ,
449 unsigned int /*datalength */ ,
450 const char * /*data */ ,
451 ClientPtr /*client */ ,
452 const char ** /*reason */
453 );
454
455extern _X_EXPORT void
456ResetAuthorization(void);
457
458extern _X_EXPORT int
459RemoveAuthorization(unsigned short name_length,
460 const char *name,
461 unsigned short data_length, const char *data);
462
463extern _X_EXPORT int
464AddAuthorization(unsigned int /*name_length */ ,
465 const char * /*name */ ,
466 unsigned int /*data_length */ ,
467 char * /*data */ );
468
469#ifdef XCSECURITY
470extern _X_EXPORT XID
471GenerateAuthorization(unsigned int /* name_length */ ,
472 const char * /* name */ ,
473 unsigned int /* data_length */ ,
474 const char * /* data */ ,
475 unsigned int * /* data_length_return */ ,
476 char ** /* data_return */ );
477#endif
478
479extern _X_EXPORT int
480ddxProcessArgument(int /*argc */ , char * /*argv */ [], int /*i */ );
481
482extern _X_EXPORT void
483ddxUseMsg(void);
484
485/* stuff for ReplyCallback */
486extern _X_EXPORT CallbackListPtr ReplyCallback;
487typedef struct {
488 ClientPtr client;
489 const void *replyData;
490 unsigned long dataLenBytes; /* actual bytes from replyData + pad bytes */
491 unsigned long bytesRemaining;
492 Bool startOfReply;
493 unsigned long padBytes; /* pad bytes from zeroed array */
494} ReplyInfoRec;
495
496/* stuff for FlushCallback */
497extern _X_EXPORT CallbackListPtr FlushCallback;
498
499enum ExitCode {
500 EXIT_NO_ERROR = 0,
501 EXIT_ERR_ABORT = 1,
502 EXIT_ERR_CONFIGURE = 2,
503 EXIT_ERR_DRIVERS = 3,
504};
505
506extern _X_EXPORT void
507AbortDDX(enum ExitCode error);
508extern _X_EXPORT void
509ddxGiveUp(enum ExitCode error);
510extern _X_EXPORT int
511TimeSinceLastInputEvent(void);
512
513/* strcasecmp.c */
514#ifndef HAVE_STRCASECMP
515#define strcasecmp xstrcasecmp
516extern _X_EXPORT int
517xstrcasecmp(const char *s1, const char *s2);
518#endif
519
520#ifndef HAVE_STRNCASECMP
521#define strncasecmp xstrncasecmp
522extern _X_EXPORT int
523xstrncasecmp(const char *s1, const char *s2, size_t n);
524#endif
525
526#ifndef HAVE_STRCASESTR
527#define strcasestr xstrcasestr
528extern _X_EXPORT char *
529xstrcasestr(const char *s, const char *find);
530#endif
531
532#ifndef HAVE_STRLCPY
533extern _X_EXPORT size_t
534strlcpy(char *dst, const char *src, size_t siz);
535extern _X_EXPORT size_t
536strlcat(char *dst, const char *src, size_t siz);
537#endif
538
539#ifndef HAVE_STRNDUP
540extern _X_EXPORT char *
541strndup(const char *str, size_t n);
542#endif
543
544/* Logging. */
545typedef enum _LogParameter {
546 XLOG_FLUSH,
547 XLOG_SYNC,
548 XLOG_VERBOSITY,
549 XLOG_FILE_VERBOSITY
550} LogParameter;
551
552/* Flags for log messages. */
553typedef enum {
554 X_PROBED, /* Value was probed */
555 X_CONFIG, /* Value was given in the config file */
556 X_DEFAULT, /* Value is a default */
557 X_CMDLINE, /* Value was given on the command line */
558 X_NOTICE, /* Notice */
559 X_ERROR, /* Error message */
560 X_WARNING, /* Warning message */
561 X_INFO, /* Informational message */
562 X_NONE, /* No prefix */
563 X_NOT_IMPLEMENTED, /* Not implemented */
564 X_DEBUG, /* Debug message */
565 X_UNKNOWN = -1 /* unknown -- this must always be last */
566} MessageType;
567
568extern _X_EXPORT const char *
569LogInit(const char *fname, const char *backup);
570extern _X_EXPORT void
571LogClose(enum ExitCode error);
572extern _X_EXPORT Bool
573LogSetParameter(LogParameter param, int value);
574extern _X_EXPORT void
575LogVWrite(int verb, const char *f, va_list args)
576_X_ATTRIBUTE_PRINTF(2, 0);
577extern _X_EXPORT void
578LogWrite(int verb, const char *f, ...)
579_X_ATTRIBUTE_PRINTF(2, 3);
580extern _X_EXPORT void
581LogVMessageVerb(MessageType type, int verb, const char *format, va_list args)
582_X_ATTRIBUTE_PRINTF(3, 0);
583extern _X_EXPORT void
584LogMessageVerb(MessageType type, int verb, const char *format, ...)
585_X_ATTRIBUTE_PRINTF(3, 4);
586extern _X_EXPORT void
587LogMessage(MessageType type, const char *format, ...)
588_X_ATTRIBUTE_PRINTF(2, 3);
589extern _X_EXPORT void
590LogMessageVerbSigSafe(MessageType type, int verb, const char *format, ...)
591_X_ATTRIBUTE_PRINTF(3, 4);
592extern _X_EXPORT void
593LogVMessageVerbSigSafe(MessageType type, int verb, const char *format, va_list args)
594_X_ATTRIBUTE_PRINTF(3, 0);
595
596extern _X_EXPORT void
597LogVHdrMessageVerb(MessageType type, int verb,
598 const char *msg_format, va_list msg_args,
599 const char *hdr_format, va_list hdr_args)
600_X_ATTRIBUTE_PRINTF(3, 0)
601_X_ATTRIBUTE_PRINTF(5, 0);
602extern _X_EXPORT void
603LogHdrMessageVerb(MessageType type, int verb,
604 const char *msg_format, va_list msg_args,
605 const char *hdr_format, ...)
606_X_ATTRIBUTE_PRINTF(3, 0)
607_X_ATTRIBUTE_PRINTF(5, 6);
608extern _X_EXPORT void
609LogHdrMessage(MessageType type, const char *msg_format,
610 va_list msg_args, const char *hdr_format, ...)
611_X_ATTRIBUTE_PRINTF(2, 0)
612_X_ATTRIBUTE_PRINTF(4, 5);
613
614extern _X_EXPORT void
615FreeAuditTimer(void);
616extern _X_EXPORT void
617AuditF(const char *f, ...)
618_X_ATTRIBUTE_PRINTF(1, 2);
619extern _X_EXPORT void
620VAuditF(const char *f, va_list args)
621_X_ATTRIBUTE_PRINTF(1, 0);
622extern _X_EXPORT void
623FatalError(const char *f, ...)
624_X_ATTRIBUTE_PRINTF(1, 2)
625 _X_NORETURN;
626
627#ifdef DEBUG
628#define DebugF ErrorF
629#else
630#define DebugF(...) /* */
631#endif
632
633extern _X_EXPORT void
634VErrorF(const char *f, va_list args)
635_X_ATTRIBUTE_PRINTF(1, 0);
636extern _X_EXPORT void
637ErrorF(const char *f, ...)
638_X_ATTRIBUTE_PRINTF(1, 2);
639extern _X_EXPORT void
640VErrorFSigSafe(const char *f, va_list args)
641_X_ATTRIBUTE_PRINTF(1, 0);
642extern _X_EXPORT void
643ErrorFSigSafe(const char *f, ...)
644_X_ATTRIBUTE_PRINTF(1, 2);
645extern _X_EXPORT void
646LogPrintMarkers(void);
647
648extern _X_EXPORT void
649xorg_backtrace(void);
650
651extern _X_EXPORT int
652os_move_fd(int fd);
653
654#endif /* OS_H */
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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