VirtualBox

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

Last change on this file since 62489 was 49174, checked in by vboxsync, 11 years ago

Additions/x11: replace header files for X.Org Server 1.6.0 with those for version 1.6.5 due to an ABI bump in-between.

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

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